| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// ----------------------------------------------------------------------- | 5 /// ----------------------------------------------------------------------- |
| 6 /// ERROR HANDLING | 6 /// ERROR HANDLING |
| 7 /// ----------------------------------------------------------------------- | 7 /// ----------------------------------------------------------------------- |
| 8 /// | 8 /// |
| 9 /// As a rule of thumb, errors that can be detected statically are handled by | 9 /// As a rule of thumb, errors that can be detected statically are handled by |
| 10 /// the frontend, typically by translating the erroneous code into a 'throw' or | 10 /// the frontend, typically by translating the erroneous code into a 'throw' or |
| (...skipping 3568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3579 | 3579 |
| 3580 /// For named parameters, this is the name of the parameter. No two named | 3580 /// For named parameters, this is the name of the parameter. No two named |
| 3581 /// parameters (in the same parameter list) can have the same name. | 3581 /// parameters (in the same parameter list) can have the same name. |
| 3582 /// | 3582 /// |
| 3583 /// In all other cases, the name is cosmetic, may be empty or null, | 3583 /// In all other cases, the name is cosmetic, may be empty or null, |
| 3584 /// and is not necessarily unique. | 3584 /// and is not necessarily unique. |
| 3585 String name; | 3585 String name; |
| 3586 int flags = 0; | 3586 int flags = 0; |
| 3587 DartType type; // Not null, defaults to dynamic. | 3587 DartType type; // Not null, defaults to dynamic. |
| 3588 | 3588 |
| 3589 /// Offset of the declaration, set and used when writing the binary. |
| 3590 int binaryOffset = -1; |
| 3591 |
| 3589 /// For locals, this is the initial value. | 3592 /// For locals, this is the initial value. |
| 3590 /// For parameters, this is the default value. | 3593 /// For parameters, this is the default value. |
| 3591 /// | 3594 /// |
| 3592 /// Should be null in other cases. | 3595 /// Should be null in other cases. |
| 3593 Expression initializer; // May be null. | 3596 Expression initializer; // May be null. |
| 3594 | 3597 |
| 3595 VariableDeclaration(this.name, | 3598 VariableDeclaration(this.name, |
| 3596 {this.initializer, | 3599 {this.initializer, |
| 3597 this.type: const DynamicType(), | 3600 this.type: const DynamicType(), |
| 3598 bool isFinal: false, | 3601 bool isFinal: false, |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4130 /// different [FunctionType] objects. | 4133 /// different [FunctionType] objects. |
| 4131 class TypeParameter extends TreeNode { | 4134 class TypeParameter extends TreeNode { |
| 4132 String name; // Cosmetic name. | 4135 String name; // Cosmetic name. |
| 4133 | 4136 |
| 4134 /// The bound on the type variable. | 4137 /// The bound on the type variable. |
| 4135 /// | 4138 /// |
| 4136 /// Should not be null except temporarily during IR construction. Should | 4139 /// Should not be null except temporarily during IR construction. Should |
| 4137 /// be set to the root class for type parameters without an explicit bound. | 4140 /// be set to the root class for type parameters without an explicit bound. |
| 4138 DartType bound; | 4141 DartType bound; |
| 4139 | 4142 |
| 4143 /// Offset of the declaration, set and used when writing the binary. |
| 4144 int binaryOffset = 0; |
| 4145 |
| 4140 TypeParameter([this.name, this.bound]); | 4146 TypeParameter([this.name, this.bound]); |
| 4141 | 4147 |
| 4142 accept(TreeVisitor v) => v.visitTypeParameter(this); | 4148 accept(TreeVisitor v) => v.visitTypeParameter(this); |
| 4143 | 4149 |
| 4144 visitChildren(Visitor v) { | 4150 visitChildren(Visitor v) { |
| 4145 bound.accept(v); | 4151 bound.accept(v); |
| 4146 } | 4152 } |
| 4147 | 4153 |
| 4148 transformChildren(Transformer v) { | 4154 transformChildren(Transformer v) { |
| 4149 bound = v.visitDartType(bound); | 4155 bound = v.visitDartType(bound); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4474 /// typedef has not been assigned a canonical name yet. | 4480 /// typedef has not been assigned a canonical name yet. |
| 4475 /// | 4481 /// |
| 4476 /// Returns `null` if the typedef is `null`. | 4482 /// Returns `null` if the typedef is `null`. |
| 4477 CanonicalName getCanonicalNameOfTypedef(Typedef typedef_) { | 4483 CanonicalName getCanonicalNameOfTypedef(Typedef typedef_) { |
| 4478 if (typedef_ == null) return null; | 4484 if (typedef_ == null) return null; |
| 4479 if (typedef_.canonicalName == null) { | 4485 if (typedef_.canonicalName == null) { |
| 4480 throw '$typedef_ has no canonical name'; | 4486 throw '$typedef_ has no canonical name'; |
| 4481 } | 4487 } |
| 4482 return typedef_.canonicalName; | 4488 return typedef_.canonicalName; |
| 4483 } | 4489 } |
| OLD | NEW |