public override bool Define(VariableSymbol sym) { if (ResolveLocalVariable(sym.Name) != null) { return false; } return base.Define(sym); }
public new virtual bool Define(VariableSymbol sym) { return base.Define(sym); }
internal static VariableSymbol CreateAndDefineVariable(string name, IType type, IVariableScope scope) { var sym = new VariableSymbol(name, type, scope); scope.Define(sym); return sym; }
// Detects possible duplicate declaration of a variable identifier. public override void Visit(VariableDeclaration node) { Debug.Assert(CurrentScope is IVariableScope); node.Type = CheckDeclaredType(node); var variableSymbol = new VariableSymbol(node.Name, node.Type, CurrentScope); if ((CurrentScope as IVariableScope).Define(variableSymbol)) { variableSymbol.Declaration = node; node.Scope = CurrentScope; } else { ReportSymbolDefinitionError(node); } }