Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(451)

Side by Side Diff: lib/src/js_ast/nodes.dart

Issue 2016483002: Enable strong mode in DDC, fix all warnings/errors (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/js_ast/builder.dart ('k') | lib/src/js_ast/printer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> implements TypeRefVisitor<T> { 7 abstract class NodeVisitor<T> implements TypeRefVisitor<T> {
8 T visitProgram(Program node); 8 T visitProgram(Program node);
9 9
10 T visitBlock(Block node); 10 T visitBlock(Block node);
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 BindingPattern(this.variables); 838 BindingPattern(this.variables);
839 839
840 void visitChildren(NodeVisitor visitor) { 840 void visitChildren(NodeVisitor visitor) {
841 for (DestructuredVariable v in variables) v.accept(visitor); 841 for (DestructuredVariable v in variables) v.accept(visitor);
842 } 842 }
843 } 843 }
844 844
845 class SimpleBindingPattern extends BindingPattern { 845 class SimpleBindingPattern extends BindingPattern {
846 final Identifier name; 846 final Identifier name;
847 SimpleBindingPattern(Identifier name) 847 SimpleBindingPattern(Identifier name)
848 : super([new DestructuredVariable(name: name)]), this.name = name; 848 : name = name,
849 super([new DestructuredVariable(name: name)]);
850
849 accept(NodeVisitor visitor) => visitor.visitSimpleBindingPattern(this); 851 accept(NodeVisitor visitor) => visitor.visitSimpleBindingPattern(this);
850 852
851 /// Avoid parenthesis when pretty-printing. 853 /// Avoid parenthesis when pretty-printing.
852 @override int get precedenceLevel => PRIMARY; 854 @override int get precedenceLevel => PRIMARY;
853 @override Node _clone() => new SimpleBindingPattern(name); 855 @override Node _clone() => new SimpleBindingPattern(name);
854 } 856 }
855 857
856 class ObjectBindingPattern extends BindingPattern { 858 class ObjectBindingPattern extends BindingPattern {
857 ObjectBindingPattern(List<DestructuredVariable> variables) 859 ObjectBindingPattern(List<DestructuredVariable> variables)
858 : super(variables); 860 : super(variables);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 return new Block([left.toStatement(), right.toReturn()]); 959 return new Block([left.toStatement(), right.toReturn()]);
958 } 960 }
959 961
960 Statement toYieldStatement({bool star: false}) { 962 Statement toYieldStatement({bool star: false}) {
961 if (!isCommaOperator) return super.toYieldStatement(star: star); 963 if (!isCommaOperator) return super.toYieldStatement(star: star);
962 return new Block([left.toStatement(), right.toYieldStatement(star: star)]); 964 return new Block([left.toStatement(), right.toYieldStatement(star: star)]);
963 } 965 }
964 966
965 List<Expression> commaToExpressionList() { 967 List<Expression> commaToExpressionList() {
966 if (!isCommaOperator) throw new StateError('not a comma expression'); 968 if (!isCommaOperator) throw new StateError('not a comma expression');
967 var exprs = []; 969 var exprs = <Expression>[];
968 _flattenComma(exprs, left); 970 _flattenComma(exprs, left);
969 _flattenComma(exprs, right); 971 _flattenComma(exprs, right);
970 return exprs; 972 return exprs;
971 } 973 }
972 974
973 static void _flattenComma(List<Expression> exprs, Expression node) { 975 static void _flattenComma(List<Expression> exprs, Expression node) {
974 if (node is Binary && node.isCommaOperator) { 976 if (node is Binary && node.isCommaOperator) {
975 _flattenComma(exprs, node.left); 977 _flattenComma(exprs, node.left);
976 _flattenComma(exprs, node.right); 978 _flattenComma(exprs, node.right);
977 } else { 979 } else {
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 1864
1863 final List<ModuleItem> body; 1865 final List<ModuleItem> body;
1864 Module(this.body, {this.name}); 1866 Module(this.body, {this.name});
1865 1867
1866 accept(NodeVisitor visitor) => visitor.visitModule(this); 1868 accept(NodeVisitor visitor) => visitor.visitModule(this);
1867 void visitChildren(NodeVisitor visitor) { 1869 void visitChildren(NodeVisitor visitor) {
1868 for (ModuleItem item in body) item.accept(visitor); 1870 for (ModuleItem item in body) item.accept(visitor);
1869 } 1871 }
1870 Module _clone() => new Module(body); 1872 Module _clone() => new Module(body);
1871 } 1873 }
OLDNEW
« no previous file with comments | « lib/src/js_ast/builder.dart ('k') | lib/src/js_ast/printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698