From 2ddb7cb1f45cf9aeef90ec5c8000a2d279f0302b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 18 May 2017 14:47:27 -0700 Subject: Address review feedback for #1014 (#1016) * address review feedback for #1014 --- src/ast/manipulation.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/ast/manipulation.h') diff --git a/src/ast/manipulation.h b/src/ast/manipulation.h index 9e01e4c74..29b6a346d 100644 --- a/src/ast/manipulation.h +++ b/src/ast/manipulation.h @@ -21,10 +21,10 @@ namespace wasm { -struct ExpressionManipulator { +namespace ExpressionManipulator { // Re-use a node's memory. This helps avoid allocation when optimizing. template - static OutputType* convert(InputType *input) { + inline OutputType* convert(InputType *input) { static_assert(sizeof(OutputType) <= sizeof(InputType), "Can only convert to a smaller size Expression node"); input->~InputType(); // arena-allocaed, so no destructor, but avoid UB. @@ -35,13 +35,13 @@ struct ExpressionManipulator { // Convenience method for nop, which is a common conversion template - static Nop* nop(InputType* target) { + inline Nop* nop(InputType* target) { return convert(target); } // Convert a node that allocates template - static OutputType* convert(InputType *input, MixedArena& allocator) { + inline OutputType* convert(InputType *input, MixedArena& allocator) { assert(sizeof(OutputType) <= sizeof(InputType)); input->~InputType(); // arena-allocaed, so no destructor, but avoid UB. OutputType* output = (OutputType*)(input); @@ -50,9 +50,9 @@ struct ExpressionManipulator { } using CustomCopier = std::function; - static Expression* flexibleCopy(Expression* original, Module& wasm, CustomCopier custom); + Expression* flexibleCopy(Expression* original, Module& wasm, CustomCopier custom); - static Expression* copy(Expression* original, Module& wasm) { + inline Expression* copy(Expression* original, Module& wasm) { auto copy = [](Expression* curr) { return nullptr; }; @@ -60,8 +60,8 @@ struct ExpressionManipulator { } // Splice an item into the middle of a block's list - static void spliceIntoBlock(Block* block, Index index, Expression* add); -}; + void spliceIntoBlock(Block* block, Index index, Expression* add); +} } // wasm -- cgit v1.2.3