示例#1
0
文件: Resolver.cs 项目: leddt/cslox
        public Void Visit(Expr.Assign expr)
        {
            Resolve(expr.Value);
            ResolveLocal(expr, expr.Name);

            return(Void.Instance);
        }
示例#2
0
        object Expr.IVisitor <object> .VisitAssignExpr(Expr.Assign expr)
        {
            object value = Evaluate(expr.value);

            environment.Assign(expr.name, value);
            return(value);
        }
示例#3
0
        public object VisitAssignExpr(Expr.Assign expr)
        {
            object value = Evaluate(expr.Value);

            if (locals.ContainsKey(expr))
            {
                environment.AssignAt(locals[expr], expr.name, value);
            }
            else
            {
                environment.Assign(expr.name, value);
            }
            return(value);
        }
示例#4
0
        public object VisitAssign(Expr.Assign expr)
        {
            var value = Evaluate(expr.Value);

            int distance;

            if (_locals.TryGetValue(expr, out distance))
            {
                _environment.AssignAt(distance, expr.Name, value);
            }
            else
            {
                _globals.Assign(expr.Name, value);
            }

            return(value);
        }
示例#5
0
 public string VisitAssign(Expr.Assign expr)
 {
     return(Parenthesize("set", expr.Name.Lexeme, expr.Value));
 }
示例#6
0
 public object VisitAssignExpr(Expr.Assign expr)
 {
     Resolve(expr.Value);
     ResolveLocal(expr, expr.name);
     return(null);
 }
示例#7
0
 public string VisitAssignExpr(Expr.Assign expr)
 {
     return(parenthesize(expr.name.Lexeme, expr.Value));
 }
示例#8
0
 public Unit VisitAssign(Expr.Assign expr)
 {
     Resolve(expr.Value);
     ResolveLocal(expr, expr.Name);
     return(Unit.Default);
 }
示例#9
0
 object Expr.IVisitor <object> .VisitAssignExpr(Expr.Assign expr)
 {
     Resolve(expr.value);
     ResolveLocal(expr, expr.name);
     return(null);
 }