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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart

Issue 898463002: Rename ClosureVariable, use separate IR forms for declaration and assignment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library tree_ir_nodes; 5 library tree_ir_nodes;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../constants/values.dart' as values; 8 import '../constants/values.dart' as values;
9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir;
10 import '../dart_types.dart' show DartType, GenericType; 10 import '../dart_types.dart' show DartType, GenericType;
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 * An assignments of an [Expression] to a [Variable]. 485 * An assignments of an [Expression] to a [Variable].
486 * 486 *
487 * In contrast to the CPS-based IR, non-primitive expressions can be assigned 487 * In contrast to the CPS-based IR, non-primitive expressions can be assigned
488 * to variables. 488 * to variables.
489 */ 489 */
490 class Assign extends Statement { 490 class Assign extends Statement {
491 Statement next; 491 Statement next;
492 Variable variable; 492 Variable variable;
493 Expression definition; 493 Expression definition;
494 494
495 /// If true, this declares a new copy of the closure variable. 495 /// If true, this assignes to a fresh variable scoped to the [next]
496 /// The consequences are similar to [cps_ir.SetClosureVariable]. 496 /// statement.
497 /// All uses of the variable must be nested inside the [next] statement. 497 ///
498 /// Variable declarations themselves are hoisted to function level.
498 bool isDeclaration; 499 bool isDeclaration;
499 500
500 Assign(this.variable, this.definition, this.next, 501 Assign(this.variable, this.definition, this.next,
501 { this.isDeclaration: false }) { 502 { this.isDeclaration: false }) {
502 variable.writeCount++; 503 variable.writeCount++;
503 } 504 }
504 505
505 bool get hasExactlyOneUse => variable.readCount == 1; 506 bool get hasExactlyOneUse => variable.readCount == 1;
506 507
507 accept(StatementVisitor visitor) => visitor.visitAssign(this); 508 accept(StatementVisitor visitor) => visitor.visitAssign(this);
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 visitStatement(node.next); 920 visitStatement(node.next);
920 } 921 }
921 922
922 visitCreateBox(CreateBox node) { 923 visitCreateBox(CreateBox node) {
923 } 924 }
924 925
925 visitCreateInstance(CreateInstance node) { 926 visitCreateInstance(CreateInstance node) {
926 node.arguments.forEach(visitExpression); 927 node.arguments.forEach(visitExpression);
927 } 928 }
928 } 929 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | tests/compiler/dart2js/backend_dart/sexpr_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698