MCPcopy Create free account
hub / github.com/argotorg/solidity / addVariable

Method addVariable

libsolidity/codegen/CompilerContext.cpp:212–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void CompilerContext::addVariable(
213 VariableDeclaration const& _declaration,
214 unsigned _offsetToCurrent
215)
216{
217 solAssert(m_asm->deposit() >= 0 && unsigned(m_asm->deposit()) >= _offsetToCurrent, "");
218 unsigned sizeOnStack = _declaration.annotation().type->sizeOnStack();
219 // Variables should not have stack size other than [1, 2],
220 // but that might change when new types are introduced.
221 solAssert(sizeOnStack == 1 || sizeOnStack == 2, "");
222 m_localVariables[&_declaration].push_back(unsigned(m_asm->deposit()) - _offsetToCurrent);
223}
224
225void CompilerContext::removeVariable(Declaration const& _declaration)
226{

Callers 4

compileFirstExpressionFunction · 0.80
visitMethod · 0.80

Calls 2

depositMethod · 0.45
sizeOnStackMethod · 0.45

Tested by

no test coverage detected