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

Method addImmutable

libsolidity/codegen/CompilerContext.cpp:73–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void CompilerContext::addImmutable(VariableDeclaration const& _variable)
74{
75 solAssert(_variable.immutable(), "Attempted to register a non-immutable variable as immutable.");
76 solUnimplementedAssert(_variable.annotation().type->isValueType(), "Only immutable variables of value type are supported.");
77 solAssert(m_runtimeContext, "Attempted to register an immutable variable for runtime code generation.");
78 m_immutableVariables[&_variable] = CompilerUtils::generalPurposeMemoryStart + *m_reservedMemory;
79 solAssert(_variable.annotation().type->memoryHeadSize() == 32, "Memory writes might overlap.");
80 *m_reservedMemory += _variable.annotation().type->memoryHeadSize();
81}
82
83size_t CompilerContext::immutableMemoryOffset(VariableDeclaration const& _variable) const
84{

Callers 1

Calls 3

immutableMethod · 0.80
isValueTypeMethod · 0.45
memoryHeadSizeMethod · 0.45

Tested by

no test coverage detected