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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 void set isConst(bool value) { | 990 void set isConst(bool value) { |
991 flags = value ? (flags | FlagConst) : (flags & ~FlagConst); | 991 flags = value ? (flags | FlagConst) : (flags & ~FlagConst); |
992 } | 992 } |
993 | 993 |
994 bool get isInstanceMember => !isStatic; | 994 bool get isInstanceMember => !isStatic; |
995 bool get isGetter => kind == ProcedureKind.Getter; | 995 bool get isGetter => kind == ProcedureKind.Getter; |
996 bool get isSetter => kind == ProcedureKind.Setter; | 996 bool get isSetter => kind == ProcedureKind.Setter; |
997 bool get isAccessor => isGetter || isSetter; | 997 bool get isAccessor => isGetter || isSetter; |
998 bool get hasGetter => kind != ProcedureKind.Setter; | 998 bool get hasGetter => kind != ProcedureKind.Setter; |
999 bool get hasSetter => kind == ProcedureKind.Setter; | 999 bool get hasSetter => kind == ProcedureKind.Setter; |
1000 bool get isFactory => kind == ProcedureKind.Factory; | |
1001 | 1000 |
1002 accept(MemberVisitor v) => v.visitProcedure(this); | 1001 accept(MemberVisitor v) => v.visitProcedure(this); |
1003 | 1002 |
1004 acceptReference(MemberReferenceVisitor v) => v.visitProcedureReference(this); | 1003 acceptReference(MemberReferenceVisitor v) => v.visitProcedureReference(this); |
1005 | 1004 |
1006 visitChildren(Visitor v) { | 1005 visitChildren(Visitor v) { |
1007 visitList(annotations, v); | 1006 visitList(annotations, v); |
1008 name?.accept(v); | 1007 name?.accept(v); |
1009 function?.accept(v); | 1008 function?.accept(v); |
1010 } | 1009 } |
(...skipping 3221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4232 /// library has not been assigned a canonical name yet. | 4231 /// library has not been assigned a canonical name yet. |
4233 /// | 4232 /// |
4234 /// Returns `null` if the library is `null`. | 4233 /// Returns `null` if the library is `null`. |
4235 CanonicalName getCanonicalNameOfLibrary(Library library) { | 4234 CanonicalName getCanonicalNameOfLibrary(Library library) { |
4236 if (library == null) return null; | 4235 if (library == null) return null; |
4237 if (library.canonicalName == null) { | 4236 if (library.canonicalName == null) { |
4238 throw '$library has no canonical name'; | 4237 throw '$library has no canonical name'; |
4239 } | 4238 } |
4240 return library.canonicalName; | 4239 return library.canonicalName; |
4241 } | 4240 } |
OLD | NEW |