| 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; | 5 part of js; |
| 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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 | 857 |
| 858 int get precedenceLevel => PRIMARY; | 858 int get precedenceLevel => PRIMARY; |
| 859 } | 859 } |
| 860 | 860 |
| 861 Prefix typeOf(Expression argument) => new Prefix('typeof', argument); | 861 Prefix typeOf(Expression argument) => new Prefix('typeof', argument); |
| 862 | 862 |
| 863 Binary equals(Expression left, Expression right) { | 863 Binary equals(Expression left, Expression right) { |
| 864 return new Binary('==', left, right); | 864 return new Binary('==', left, right); |
| 865 } | 865 } |
| 866 | 866 |
| 867 LiteralString string(String value) => new LiteralString("'$value'"); | 867 LiteralString string(String value) => new LiteralString('"$value"'); |
| 868 | 868 |
| 869 If if_(Expression condition, Node then, [Node otherwise]) { | 869 If if_(Expression condition, Node then, [Node otherwise]) { |
| 870 return (otherwise == null) | 870 return (otherwise == null) |
| 871 ? new If.noElse(condition, then) | 871 ? new If.noElse(condition, then) |
| 872 : new If(condition, then, otherwise); | 872 : new If(condition, then, otherwise); |
| 873 } | 873 } |
| 874 | 874 |
| 875 Return return_([Expression value]) => new Return(value); | 875 Return return_([Expression value]) => new Return(value); |
| 876 | 876 |
| 877 VariableUse use(String name) => new VariableUse(name); | 877 VariableUse use(String name) => new VariableUse(name); |
| 878 | 878 |
| 879 PropertyAccess fieldAccess(Expression receiver, String fieldName) { | 879 PropertyAccess fieldAccess(Expression receiver, String fieldName) { |
| 880 return new PropertyAccess.field(receiver, fieldName); | 880 return new PropertyAccess.field(receiver, fieldName); |
| 881 } | 881 } |
| 882 | 882 |
| 883 Block emptyBlock() => new Block.empty(); | 883 Block emptyBlock() => new Block.empty(); |
| 884 | 884 |
| 885 Block block1(Statement statement) => new Block(<Statement>[statement]); |
| 886 |
| 887 Block block2(Statement s1, Statement s2) => new Block(<Statement>[s1, s2]); |
| 888 |
| 885 Call call(Expression target, List<Expression> arguments) { | 889 Call call(Expression target, List<Expression> arguments) { |
| 886 return new Call(target, arguments); | 890 return new Call(target, arguments); |
| 887 } | 891 } |
| 888 | 892 |
| 889 Fun fun(List<String> parameterNames, Block body) { | 893 Fun fun(List<String> parameterNames, Block body) { |
| 890 return new Fun(parameterNames.map((n) => new Parameter(n)), body); | 894 return new Fun(parameterNames.map((n) => new Parameter(n)), body); |
| 891 } | 895 } |
| 892 | 896 |
| 893 Assignment assign(Expression leftHandSide, Expression value) { | 897 Assignment assign(Expression leftHandSide, Expression value) { |
| 894 return new Assignment(leftHandSide, value); | 898 return new Assignment(leftHandSide, value); |
| 895 } | 899 } |
| 896 | 900 |
| 897 Expression undefined() => new Prefix('void', new LiteralNumber('0')); | 901 Expression undefined() => new Prefix('void', new LiteralNumber('0')); |
| OLD | NEW |