aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerUtils.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-09 05:18:19 +0800
committerChristian <c@ethdev.com>2014-12-09 05:26:22 +0800
commit35d5b28faeee5e19d0dbbeb3c75454249d636abd (patch)
tree227b04a23f5d66e442fc824e4cfcbba802989ccd /CompilerUtils.h
parentb7d856ed5fee1f0f918e30218e3a95fd8fc20dd3 (diff)
downloaddexon-solidity-35d5b28faeee5e19d0dbbeb3c75454249d636abd.tar.gz
dexon-solidity-35d5b28faeee5e19d0dbbeb3c75454249d636abd.tar.zst
dexon-solidity-35d5b28faeee5e19d0dbbeb3c75454249d636abd.zip
Variable-size stack elements for expression compiler.
Diffstat (limited to 'CompilerUtils.h')
-rw-r--r--CompilerUtils.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/CompilerUtils.h b/CompilerUtils.h
index 3b6f13e9..2aac7e4e 100644
--- a/CompilerUtils.h
+++ b/CompilerUtils.h
@@ -39,9 +39,23 @@ public:
void moveToStackVariable(VariableDeclaration const& _variable);
/// Removes the current value from the top of the stack.
void popStackElement(Type const& _type);
+
+ template <class T>
+ static unsigned getSizeOnStack(std::vector<T> const& _variables);
+ static unsigned getSizeOnStack(std::vector<std::shared_ptr<Type const>> const& _variableTypes);
+
private:
CompilerContext& m_context;
};
+template <class T>
+unsigned CompilerUtils::getSizeOnStack(std::vector<T> const& _variables)
+{
+ unsigned size = 0;
+ for (T const& variable: _variables)
+ size += variable->getType()->getSizeOnStack();
+ return size;
+}
+
}
}