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

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

Issue 2980113002: fix #27320, better DDC temp generation (Closed)
Patch Set: rebase Created 3 years, 5 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
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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 for (var node in exprs) { 702 for (var node in exprs) {
703 comma = (comma == null) ? node : new Binary(op, comma, node); 703 comma = (comma == null) ? node : new Binary(op, comma, node);
704 } 704 }
705 return comma; 705 return comma;
706 } 706 }
707 707
708 int get precedenceLevel; 708 int get precedenceLevel;
709 709
710 Statement toStatement() => new ExpressionStatement(toVoidExpression()); 710 Statement toStatement() => new ExpressionStatement(toVoidExpression());
711 Statement toReturn() => new Return(this); 711 Statement toReturn() => new Return(this);
712
713 // TODO(jmesserly): make this return a Yield?
712 Statement toYieldStatement({bool star: false}) => 714 Statement toYieldStatement({bool star: false}) =>
713 new ExpressionStatement(new Yield(this, star: star)); 715 new ExpressionStatement(new Yield(this, star: star));
714 716
715 Expression toVoidExpression() => this; 717 Expression toVoidExpression() => this;
716 Expression toAssignExpression(Expression left) => new Assignment(left, this); 718 Expression toAssignExpression(Expression left, [String op]) =>
719 new Assignment.compound(left, op, this);
720
721 // TODO(jmesserly): make this work for more cases?
717 Statement toVariableDeclaration(Identifier name) => 722 Statement toVariableDeclaration(Identifier name) =>
718 new VariableDeclarationList( 723 new VariableDeclarationList(
719 'let', [new VariableInitialization(name, this)]).toStatement(); 724 'let', [new VariableInitialization(name, this)]).toStatement();
720 } 725 }
721 726
722 class LiteralExpression extends Expression { 727 class LiteralExpression extends Expression {
723 final String template; 728 final String template;
724 final List<Expression> inputs; 729 final List<Expression> inputs;
725 730
726 LiteralExpression(this.template) : inputs = const []; 731 LiteralExpression(this.template) : inputs = const [];
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 final List<ModuleItem> body; 1908 final List<ModuleItem> body;
1904 Module(this.body, {this.name}); 1909 Module(this.body, {this.name});
1905 1910
1906 accept(NodeVisitor visitor) => visitor.visitModule(this); 1911 accept(NodeVisitor visitor) => visitor.visitModule(this);
1907 void visitChildren(NodeVisitor visitor) { 1912 void visitChildren(NodeVisitor visitor) {
1908 for (ModuleItem item in body) item.accept(visitor); 1913 for (ModuleItem item in body) item.accept(visitor);
1909 } 1914 }
1910 1915
1911 Module _clone() => new Module(body); 1916 Module _clone() => new Module(body);
1912 } 1917 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/js_metalet.dart ('k') | pkg/dev_compiler/lib/src/js_ast/template.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698