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

Function rootConstVariableDeclaration

libsolidity/ast/ASTUtils.cpp:72–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72VariableDeclaration const* rootConstVariableDeclaration(VariableDeclaration const& _varDecl)
73{
74 solAssert(_varDecl.isConstant(), "Constant variable expected");
75 solAssert(!isConstantVariableRecursive(_varDecl), "Recursive declaration");
76
77 VariableDeclaration const* rootDecl = &_varDecl;
78 Identifier const* identifier;
79 while ((identifier = dynamic_cast<Identifier const*>(rootDecl->value().get())))
80 {
81 auto referencedVarDecl = dynamic_cast<VariableDeclaration const*>(identifier->annotation().referencedDeclaration);
82 if (!referencedVarDecl || !referencedVarDecl->isConstant())
83 return nullptr;
84 rootDecl = referencedVarDecl;
85 }
86 return rootDecl;
87}
88
89Expression const* resolveOuterUnaryTuples(Expression const* _expr)
90{

Callers 3

visitMethod · 0.85
visitMethod · 0.85
translateReferenceMethod · 0.85

Calls 4

isConstantMethod · 0.45
getMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected