aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerContext.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-11-22 02:14:56 +0800
committerChristian <c@ethdev.com>2014-11-24 04:28:45 +0800
commit583a315d3d282ab9fd871bb2ea3beded367be6d0 (patch)
tree8471241f34041fe5aadd7fc0a574fef8c80e2aa8 /CompilerContext.h
parentc50cd646ce3b8b6c20da747efee89f9420526cae (diff)
downloaddexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.tar.gz
dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.tar.zst
dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.zip
Magic variables.
Diffstat (limited to 'CompilerContext.h')
-rw-r--r--CompilerContext.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/CompilerContext.h b/CompilerContext.h
index e624222d..6a48e148 100644
--- a/CompilerContext.h
+++ b/CompilerContext.h
@@ -40,6 +40,7 @@ class CompilerContext
public:
CompilerContext(): m_stateVariablesSize(0) {}
+ void addMagicGlobal(MagicVariableDeclaration const& _declaration);
void addStateVariable(VariableDeclaration const& _declaration);
void startNewFunction() { m_localVariables.clear(); m_asm.setDeposit(0); }
void initializeLocalVariables(unsigned _numVariables);
@@ -48,6 +49,7 @@ public:
void adjustStackOffset(int _adjustment) { m_asm.adjustDeposit(_adjustment); }
+ bool isMagicGlobal(Declaration const* _declaration) const { return m_magicGlobals.count(_declaration); }
bool isFunctionDefinition(Declaration const* _declaration) const { return m_functionEntryLabels.count(_declaration); }
bool isLocalVariable(Declaration const* _declaration) const;
bool isStateVariable(Declaration const* _declaration) const { return m_stateVariables.count(_declaration); }
@@ -90,6 +92,8 @@ public:
private:
eth::Assembly m_asm;
+ /// Magic global variables like msg, tx or this, distinguished by type.
+ std::set<Declaration const*> m_magicGlobals;
/// Size of the state variables, offset of next variable to be added.
u256 m_stateVariablesSize;
/// Storage offsets of state variables