MCPcopy Create free account
hub / github.com/csyonghe/Spire / VisitVarExpression

Method VisitVarExpression

Source/SpireCore/CodeGenerator.cpp:1343–1362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1341 return true;
1342 }
1343 virtual RefPtr<ExpressionSyntaxNode> VisitVarExpression(VarExpressionSyntaxNode* expr) override
1344 {
1345 RefPtr<Object> refObj;
1346 if (expr->Tags.TryGetValue("ComponentReference", refObj))
1347 {
1348 if (auto refComp = refObj.As<StringObject>())
1349 {
1350 ILOperand * op;
1351 if (variables.TryGetValue(refComp->Content, op))
1352 PushStack(op);
1353 else
1354 throw InvalidProgramException(String("referencing undefined component/variable '") + refComp->Content + "'. probable cause: unchecked circular reference.");
1355 }
1356 }
1357 else if (!GenerateVarRef(expr->Variable, expr->Access))
1358 {
1359 throw InvalidProgramException("identifier is neither a variable nor a recognized component.");
1360 }
1361 return expr;
1362 }
1363 private:
1364 CodeGenerator & operator = (const CodeGenerator & other) = delete;
1365 public:

Callers

nothing calls this directly

Calls 3

StringClass · 0.85
TryGetValueMethod · 0.45

Tested by

no test coverage detected