コード例 #1
0
 public override bool Define(VariableSymbol sym)
 {
     if (ResolveLocalVariable(sym.Name) != null)
     {
         return false;
     }
     return base.Define(sym);
 }
コード例 #2
0
 public new virtual bool Define(VariableSymbol sym)
 {
     return base.Define(sym);
 }
コード例 #3
0
 internal static VariableSymbol CreateAndDefineVariable(string name, IType type, IVariableScope scope)
 {
     var sym = new VariableSymbol(name, type, scope);
     scope.Define(sym);
     return sym;
 }
コード例 #4
0
        // 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);
            }
        }