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 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3005 bool isConst: false, | 3005 bool isConst: false, |
3006 this.type: const DynamicType()}) { | 3006 this.type: const DynamicType()}) { |
3007 assert(type != null); | 3007 assert(type != null); |
3008 initializer?.parent = this; | 3008 initializer?.parent = this; |
3009 this.isFinal = isFinal; | 3009 this.isFinal = isFinal; |
3010 this.isConst = isConst; | 3010 this.isConst = isConst; |
3011 } | 3011 } |
3012 | 3012 |
3013 static const int FlagFinal = 1 << 0; // Must match serialized bit positions. | 3013 static const int FlagFinal = 1 << 0; // Must match serialized bit positions. |
3014 static const int FlagConst = 1 << 1; | 3014 static const int FlagConst = 1 << 1; |
| 3015 static const int FlagInScope = 1 << 2; // Temporary flag used by verifier. |
3015 | 3016 |
3016 bool get isFinal => flags & FlagFinal != 0; | 3017 bool get isFinal => flags & FlagFinal != 0; |
3017 bool get isConst => flags & FlagConst != 0; | 3018 bool get isConst => flags & FlagConst != 0; |
3018 | 3019 |
3019 void set isFinal(bool value) { | 3020 void set isFinal(bool value) { |
3020 flags = value ? (flags | FlagFinal) : (flags & ~FlagFinal); | 3021 flags = value ? (flags | FlagFinal) : (flags & ~FlagFinal); |
3021 } | 3022 } |
3022 | 3023 |
3023 void set isConst(bool value) { | 3024 void set isConst(bool value) { |
3024 flags = value ? (flags | FlagConst) : (flags & ~FlagConst); | 3025 flags = value ? (flags | FlagConst) : (flags & ~FlagConst); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3631 | 3632 |
3632 @override | 3633 @override |
3633 defaultTreeNode(TreeNode node) { | 3634 defaultTreeNode(TreeNode node) { |
3634 if (node == child) { | 3635 if (node == child) { |
3635 return replacement; | 3636 return replacement; |
3636 } else { | 3637 } else { |
3637 return node; | 3638 return node; |
3638 } | 3639 } |
3639 } | 3640 } |
3640 } | 3641 } |
OLD | NEW |