| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of js_ast; | 5 part of js_ast; |
| 6 | 6 |
| 7 abstract class NodeVisitor<T> { | 7 abstract class NodeVisitor<T> { |
| 8 T visitProgram(Program node); | 8 T visitProgram(Program node); |
| 9 | 9 |
| 10 T visitBlock(Block node); | 10 T visitBlock(Block node); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 NamedFunction(this.name, this.function); | 897 NamedFunction(this.name, this.function); |
| 898 | 898 |
| 899 accept(NodeVisitor visitor) => visitor.visitNamedFunction(this); | 899 accept(NodeVisitor visitor) => visitor.visitNamedFunction(this); |
| 900 | 900 |
| 901 void visitChildren(NodeVisitor visitor) { | 901 void visitChildren(NodeVisitor visitor) { |
| 902 name.accept(visitor); | 902 name.accept(visitor); |
| 903 function.accept(visitor); | 903 function.accept(visitor); |
| 904 } | 904 } |
| 905 NamedFunction _clone() => new NamedFunction(name, function); | 905 NamedFunction _clone() => new NamedFunction(name, function); |
| 906 | 906 |
| 907 int get precedenceLevel => CALL; | 907 int get precedenceLevel => LEFT_HAND_SIDE; |
| 908 } | 908 } |
| 909 | 909 |
| 910 class Fun extends Expression { | 910 class Fun extends Expression { |
| 911 final List<Parameter> params; | 911 final List<Parameter> params; |
| 912 final Block body; | 912 final Block body; |
| 913 final AsyncModifier asyncModifier; | 913 final AsyncModifier asyncModifier; |
| 914 | 914 |
| 915 Fun(this.params, this.body, {this.asyncModifier: const AsyncModifier.sync()}); | 915 Fun(this.params, this.body, {this.asyncModifier: const AsyncModifier.sync()}); |
| 916 | 916 |
| 917 accept(NodeVisitor visitor) => visitor.visitFun(this); | 917 accept(NodeVisitor visitor) => visitor.visitFun(this); |
| 918 | 918 |
| 919 void visitChildren(NodeVisitor visitor) { | 919 void visitChildren(NodeVisitor visitor) { |
| 920 for (Parameter param in params) param.accept(visitor); | 920 for (Parameter param in params) param.accept(visitor); |
| 921 body.accept(visitor); | 921 body.accept(visitor); |
| 922 } | 922 } |
| 923 | 923 |
| 924 Fun _clone() => new Fun(params, body, asyncModifier: asyncModifier); | 924 Fun _clone() => new Fun(params, body, asyncModifier: asyncModifier); |
| 925 | 925 |
| 926 int get precedenceLevel => CALL; | 926 int get precedenceLevel => LEFT_HAND_SIDE; |
| 927 } | 927 } |
| 928 | 928 |
| 929 class AsyncModifier { | 929 class AsyncModifier { |
| 930 final bool isAsync; | 930 final bool isAsync; |
| 931 final bool isYielding; | 931 final bool isYielding; |
| 932 final String description; | 932 final String description; |
| 933 | 933 |
| 934 const AsyncModifier.sync() | 934 const AsyncModifier.sync() |
| 935 : isAsync = false, | 935 : isAsync = false, |
| 936 isYielding = false, | 936 isYielding = false, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 962 | 962 |
| 963 accept(NodeVisitor visitor) => visitor.visitAccess(this); | 963 accept(NodeVisitor visitor) => visitor.visitAccess(this); |
| 964 | 964 |
| 965 void visitChildren(NodeVisitor visitor) { | 965 void visitChildren(NodeVisitor visitor) { |
| 966 receiver.accept(visitor); | 966 receiver.accept(visitor); |
| 967 selector.accept(visitor); | 967 selector.accept(visitor); |
| 968 } | 968 } |
| 969 | 969 |
| 970 PropertyAccess _clone() => new PropertyAccess(receiver, selector); | 970 PropertyAccess _clone() => new PropertyAccess(receiver, selector); |
| 971 | 971 |
| 972 int get precedenceLevel => CALL; | 972 int get precedenceLevel => LEFT_HAND_SIDE; |
| 973 } | 973 } |
| 974 | 974 |
| 975 /// A [DeferredToken] is a placeholder for some [Expression] that is not known | 975 /// A [DeferredToken] is a placeholder for some [Expression] that is not known |
| 976 /// at construction time of an ast. Unlike [InterpolatedExpression], | 976 /// at construction time of an ast. Unlike [InterpolatedExpression], |
| 977 /// [DeferredToken] is not limited to templates but may also occur in | 977 /// [DeferredToken] is not limited to templates but may also occur in |
| 978 /// fully instantiated asts. | 978 /// fully instantiated asts. |
| 979 abstract class DeferredToken extends Expression { | 979 abstract class DeferredToken extends Expression { |
| 980 void visitChildren(NodeVisitor visitor) {} | 980 void visitChildren(NodeVisitor visitor) {} |
| 981 | 981 |
| 982 DeferredToken _clone() => this; | 982 DeferredToken _clone() => this; |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 class Comment extends Statement { | 1289 class Comment extends Statement { |
| 1290 final String comment; | 1290 final String comment; |
| 1291 | 1291 |
| 1292 Comment(this.comment); | 1292 Comment(this.comment); |
| 1293 | 1293 |
| 1294 accept(NodeVisitor visitor) => visitor.visitComment(this); | 1294 accept(NodeVisitor visitor) => visitor.visitComment(this); |
| 1295 Comment _clone() => new Comment(comment); | 1295 Comment _clone() => new Comment(comment); |
| 1296 | 1296 |
| 1297 void visitChildren(NodeVisitor visitor) {} | 1297 void visitChildren(NodeVisitor visitor) {} |
| 1298 } | 1298 } |
| OLD | NEW |