| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // IrNodes are kept in a separate library to have precise control over their | 5 // IrNodes are kept in a separate library to have precise control over their |
| 6 // dependencies on other parts of the system. | 6 // dependencies on other parts of the system. |
| 7 library dart2js.ir_nodes; | 7 library dart2js.ir_nodes; |
| 8 | 8 |
| 9 import '../dart2jslib.dart' as dart2js show Constant; | 9 import '../dart2jslib.dart' as dart2js show Constant; |
| 10 import '../elements/elements.dart' show FunctionElement, LibraryElement; | 10 import '../elements/elements.dart' show FunctionElement, LibraryElement; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 /// The base class of things that variables can refer to: primitives, | 26 /// The base class of things that variables can refer to: primitives, |
| 27 /// continuations, function and continuation parameters, etc. | 27 /// continuations, function and continuation parameters, etc. |
| 28 abstract class Definition extends Node { | 28 abstract class Definition extends Node { |
| 29 // The head of a linked-list of occurrences, in no particular order. | 29 // The head of a linked-list of occurrences, in no particular order. |
| 30 Reference firstRef = null; | 30 Reference firstRef = null; |
| 31 | 31 |
| 32 bool get hasAtMostOneUse => firstRef == null || firstRef.nextRef == null; | 32 bool get hasAtMostOneUse => firstRef == null || firstRef.nextRef == null; |
| 33 bool get hasExactlyOneUse => firstRef != null && firstRef.nextRef == null; | 33 bool get hasExactlyOneUse => firstRef != null && firstRef.nextRef == null; |
| 34 bool get hasAtLeastOneUse => firstRef != null; |
| 34 } | 35 } |
| 35 | 36 |
| 36 abstract class Primitive extends Definition { | 37 abstract class Primitive extends Definition { |
| 37 } | 38 } |
| 38 | 39 |
| 39 /// Operands to invocations and primitives are always variables. They point to | 40 /// Operands to invocations and primitives are always variables. They point to |
| 40 /// their definition and are linked into a list of occurrences. | 41 /// their definition and are linked into a list of occurrences. |
| 41 class Reference { | 42 class Reference { |
| 42 Definition definition; | 43 Definition definition; |
| 43 Reference nextRef = null; | 44 Reference nextRef = null; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 String visitParameter(Parameter triv) { | 248 String visitParameter(Parameter triv) { |
| 248 // Parameters are visited directly in visitLetCont. | 249 // Parameters are visited directly in visitLetCont. |
| 249 return '(Unexpected Parameter)'; | 250 return '(Unexpected Parameter)'; |
| 250 } | 251 } |
| 251 | 252 |
| 252 String visitContinuation(Continuation triv) { | 253 String visitContinuation(Continuation triv) { |
| 253 // Continuations are visited directly in visitLetCont. | 254 // Continuations are visited directly in visitLetCont. |
| 254 return '(Unexpected Continuation)'; | 255 return '(Unexpected Continuation)'; |
| 255 } | 256 } |
| 256 } | 257 } |
| OLD | NEW |