getValue method
dynamic
getValue(
- Name node
Implementation
dynamic getValue(Name node) {
// 1) Try the node's own scope first (captures nested function declarations).
if (node.scope != null) {
final Context scopedCtx = getContextForScope(node.scope!);
final dynamic fromScoped = scopedCtx.getContextById(node.value);
if (fromScoped != null) return fromScoped;
}
// 2) Scan all known contexts (newest first) as a safety net.
for (final Scope s in contexts.keys.toList().reversed) {
final dynamic v = contexts[s]!.getContextById(node.value);
if (v != null) return v;
}
// 3) Fallback to the resolved scope via environment tracking.
Scope scope = findScope(node);
Context ctx = getContextForScope(scope);
return ctx.getContextById(node.value);
}