| 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 3143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3154 accept(StatementVisitor v) => v.visitEmptyStatement(this); | 3154 accept(StatementVisitor v) => v.visitEmptyStatement(this); |
| 3155 accept1(StatementVisitor1 v, arg) => v.visitEmptyStatement(this, arg); | 3155 accept1(StatementVisitor1 v, arg) => v.visitEmptyStatement(this, arg); |
| 3156 | 3156 |
| 3157 visitChildren(Visitor v) {} | 3157 visitChildren(Visitor v) {} |
| 3158 transformChildren(Transformer v) {} | 3158 transformChildren(Transformer v) {} |
| 3159 } | 3159 } |
| 3160 | 3160 |
| 3161 class AssertStatement extends Statement { | 3161 class AssertStatement extends Statement { |
| 3162 Expression condition; | 3162 Expression condition; |
| 3163 Expression message; // May be null. | 3163 Expression message; // May be null. |
| 3164 int conditionStartOffset; |
| 3165 int conditionEndOffset; |
| 3164 | 3166 |
| 3165 AssertStatement(this.condition, [this.message]) { | 3167 AssertStatement(this.condition, |
| 3168 {this.message, this.conditionStartOffset, this.conditionEndOffset}) { |
| 3166 condition?.parent = this; | 3169 condition?.parent = this; |
| 3167 message?.parent = this; | 3170 message?.parent = this; |
| 3168 } | 3171 } |
| 3169 | 3172 |
| 3170 accept(StatementVisitor v) => v.visitAssertStatement(this); | 3173 accept(StatementVisitor v) => v.visitAssertStatement(this); |
| 3171 accept1(StatementVisitor1 v, arg) => v.visitAssertStatement(this, arg); | 3174 accept1(StatementVisitor1 v, arg) => v.visitAssertStatement(this, arg); |
| 3172 | 3175 |
| 3173 visitChildren(Visitor v) { | 3176 visitChildren(Visitor v) { |
| 3174 condition?.accept(v); | 3177 condition?.accept(v); |
| 3175 message?.accept(v); | 3178 message?.accept(v); |
| (...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4613 /// typedef has not been assigned a canonical name yet. | 4616 /// typedef has not been assigned a canonical name yet. |
| 4614 /// | 4617 /// |
| 4615 /// Returns `null` if the typedef is `null`. | 4618 /// Returns `null` if the typedef is `null`. |
| 4616 CanonicalName getCanonicalNameOfTypedef(Typedef typedef_) { | 4619 CanonicalName getCanonicalNameOfTypedef(Typedef typedef_) { |
| 4617 if (typedef_ == null) return null; | 4620 if (typedef_ == null) return null; |
| 4618 if (typedef_.canonicalName == null) { | 4621 if (typedef_.canonicalName == null) { |
| 4619 throw '$typedef_ has no canonical name'; | 4622 throw '$typedef_ has no canonical name'; |
| 4620 } | 4623 } |
| 4621 return typedef_.canonicalName; | 4624 return typedef_.canonicalName; |
| 4622 } | 4625 } |
| OLD | NEW |