| 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4141 /// different [FunctionType] objects. | 4144 /// different [FunctionType] objects. |
| 4142 class TypeParameter extends TreeNode { | 4145 class TypeParameter extends TreeNode { |
| 4143 String name; // Cosmetic name. | 4146 String name; // Cosmetic name. |
| 4144 | 4147 |
| 4145 /// The bound on the type variable. | 4148 /// The bound on the type variable. |
| 4146 /// | 4149 /// |
| 4147 /// Should not be null except temporarily during IR construction. Should | 4150 /// Should not be null except temporarily during IR construction. Should |
| 4148 /// be set to the root class for type parameters without an explicit bound. | 4151 /// be set to the root class for type parameters without an explicit bound. |
| 4149 DartType bound; | 4152 DartType bound; |
| 4150 | 4153 |
| 4154 /// Offset of the declaration, set and used when writing the binary. |
| 4155 int binaryOffset = 0; |
| 4156 |
| 4151 TypeParameter([this.name, this.bound]); | 4157 TypeParameter([this.name, this.bound]); |
| 4152 | 4158 |
| 4153 accept(TreeVisitor v) => v.visitTypeParameter(this); | 4159 accept(TreeVisitor v) => v.visitTypeParameter(this); |
| 4154 | 4160 |
| 4155 visitChildren(Visitor v) { | 4161 visitChildren(Visitor v) { |
| 4156 bound.accept(v); | 4162 bound.accept(v); |
| 4157 } | 4163 } |
| 4158 | 4164 |
| 4159 transformChildren(Transformer v) { | 4165 transformChildren(Transformer v) { |
| 4160 bound = v.visitDartType(bound); | 4166 bound = v.visitDartType(bound); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4480 /// typedef has not been assigned a canonical name yet. | 4486 /// typedef has not been assigned a canonical name yet. |
| 4481 /// | 4487 /// |
| 4482 /// Returns `null` if the typedef is `null`. | 4488 /// Returns `null` if the typedef is `null`. |
| 4483 CanonicalName getCanonicalNameOfTypedef(Typedef typedef_) { | 4489 CanonicalName getCanonicalNameOfTypedef(Typedef typedef_) { |
| 4484 if (typedef_ == null) return null; | 4490 if (typedef_ == null) return null; |
| 4485 if (typedef_.canonicalName == null) { | 4491 if (typedef_.canonicalName == null) { |
| 4486 throw '$typedef_ has no canonical name'; | 4492 throw '$typedef_ has no canonical name'; |
| 4487 } | 4493 } |
| 4488 return typedef_.canonicalName; | 4494 return typedef_.canonicalName; |
| 4489 } | 4495 } |
| OLD | NEW |