| OLD | NEW |
| 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/values.dart' as values; | 7 import '../constants/values.dart' as values; |
| 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../io/source_information.dart' show SourceInformation; | 10 import '../io/source_information.dart' show SourceInformation; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 /// Number of places where this variable occurs in a [VariableUse]. | 112 /// Number of places where this variable occurs in a [VariableUse]. |
| 113 int readCount = 0; | 113 int readCount = 0; |
| 114 | 114 |
| 115 /// Number of places where this variable occurs as: | 115 /// Number of places where this variable occurs as: |
| 116 /// - left-hand of an [Assign] | 116 /// - left-hand of an [Assign] |
| 117 /// - left-hand of a [FunctionDeclaration] | 117 /// - left-hand of a [FunctionDeclaration] |
| 118 /// - parameter in a [FunctionDefinition] | 118 /// - parameter in a [FunctionDefinition] |
| 119 /// - catch parameter in a [Try] | 119 /// - catch parameter in a [Try] |
| 120 int writeCount = 0; | 120 int writeCount = 0; |
| 121 | 121 |
| 122 /// True if a nested function reads or writes this variable. | 122 /// True if an inner JS function might access this variable through a |
| 123 /// | 123 /// [ForeignCode] node. |
| 124 /// Always false in JS-mode because closure conversion eliminated nested | |
| 125 /// functions. | |
| 126 bool isCaptured = false; | 124 bool isCaptured = false; |
| 127 | 125 |
| 128 Variable(this.host, this.element) { | 126 Variable(this.host, this.element) { |
| 129 assert(host != null); | 127 assert(host != null); |
| 130 } | 128 } |
| 131 | 129 |
| 132 String toString() => element == null ? 'Variable' : element.toString(); | 130 String toString() => element == null ? 'Variable' : element.toString(); |
| 133 } | 131 } |
| 134 | 132 |
| 135 /// Read the value of a variable. | 133 /// Read the value of a variable. |
| (...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 | 1596 |
| 1599 /// Number of uses of the current fallthrough target. | 1597 /// Number of uses of the current fallthrough target. |
| 1600 int get useCount => _stack.last.useCount; | 1598 int get useCount => _stack.last.useCount; |
| 1601 | 1599 |
| 1602 /// Indicate that a statement will fall through to the current fallthrough | 1600 /// Indicate that a statement will fall through to the current fallthrough |
| 1603 /// target. | 1601 /// target. |
| 1604 void use() { | 1602 void use() { |
| 1605 ++_stack.last.useCount; | 1603 ++_stack.last.useCount; |
| 1606 } | 1604 } |
| 1607 } | 1605 } |
| OLD | NEW |