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

Method registerImmutableVariable

libsolidity/codegen/ir/IRGenerationContext.cpp:88–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void IRGenerationContext::registerImmutableVariable(VariableDeclaration const& _variable)
89{
90 solAssert(m_executionContext != ExecutionContext::Deployed);
91 solAssert(_variable.immutable(), "Attempted to register a non-immutable variable as immutable.");
92 solUnimplementedAssert(
93 _variable.annotation().type->isValueType(),
94 "Only immutable variables of value type are supported."
95 );
96 solAssert(m_reservedMemory.has_value(), "Reserved memory has already been reset.");
97 m_immutableVariables[&_variable] = CompilerUtils::generalPurposeMemoryStart + *m_reservedMemory;
98 solAssert(_variable.annotation().type->memoryHeadSize() == 32, "Memory writes might overlap.");
99 *m_reservedMemory += _variable.annotation().type->memoryHeadSize();
100}
101
102size_t IRGenerationContext::immutableMemoryOffset(VariableDeclaration const& _variable) const
103{

Callers 1

generateMethod · 0.80

Calls 3

immutableMethod · 0.80
isValueTypeMethod · 0.45
memoryHeadSizeMethod · 0.45

Tested by

no test coverage detected