diff options
author | Christian <c@ethdev.com> | 2014-11-22 02:14:56 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-24 04:28:45 +0800 |
commit | 583a315d3d282ab9fd871bb2ea3beded367be6d0 (patch) | |
tree | 8471241f34041fe5aadd7fc0a574fef8c80e2aa8 /Compiler.cpp | |
parent | c50cd646ce3b8b6c20da747efee89f9420526cae (diff) | |
download | dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.tar.gz dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.tar.zst dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.zip |
Magic variables.
Diffstat (limited to 'Compiler.cpp')
-rw-r--r-- | Compiler.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Compiler.cpp b/Compiler.cpp index a3865bc3..a82ecd95 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -32,17 +32,13 @@ using namespace std; namespace dev { namespace solidity { -bytes Compiler::compile(ContractDefinition& _contract, bool _optimize) -{ - Compiler compiler; - compiler.compileContract(_contract); - return compiler.m_context.getAssembledBytecode(_optimize); -} - -void Compiler::compileContract(ContractDefinition& _contract) +void Compiler::compileContract(ContractDefinition& _contract, vector<MagicVariableDeclaration const*> const& _magicGlobals) { m_context = CompilerContext(); // clear it just in case + for (MagicVariableDeclaration const* variable: _magicGlobals) + m_context.addMagicGlobal(*variable); + for (ASTPointer<FunctionDefinition> const& function: _contract.getDefinedFunctions()) if (function->getName() != _contract.getName()) // don't add the constructor here m_context.addFunction(*function); @@ -328,7 +324,8 @@ bool Compiler::visit(ExpressionStatement& _expressionStatement) { Expression& expression = _expressionStatement.getExpression(); ExpressionCompiler::compileExpression(m_context, expression); - if (expression.getType()->getCategory() != Type::Category::VOID) + Type::Category category = expression.getType()->getCategory(); + if (category != Type::Category::VOID && category != Type::Category::MAGIC) m_context << eth::Instruction::POP; return false; } |