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 library fasta.dill_member_builder; | 5 library fasta.dill_member_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
8 show Constructor, Field, Member, Procedure, ProcedureKind; | 8 show Constructor, Field, Member, Procedure, ProcedureKind; |
9 | 9 |
10 import '../errors.dart' show internalError; | 10 import '../errors.dart' show internalError; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 bool get isSetter => identical(ProcedureKind.Setter, kind); | 46 bool get isSetter => identical(ProcedureKind.Setter, kind); |
47 | 47 |
48 bool get isOperator => identical(ProcedureKind.Operator, kind); | 48 bool get isOperator => identical(ProcedureKind.Operator, kind); |
49 | 49 |
50 bool get isFactory => identical(ProcedureKind.Factory, kind); | 50 bool get isFactory => identical(ProcedureKind.Factory, kind); |
51 | 51 |
52 bool get isRedirectingGenerativeConstructor { | 52 bool get isRedirectingGenerativeConstructor { |
53 return isConstructor && | 53 return isConstructor && |
54 isRedirectingGenerativeConstructorImplementation(member); | 54 isRedirectingGenerativeConstructorImplementation(member); |
55 } | 55 } |
| 56 |
| 57 bool get isSynthetic { |
| 58 // TODO(ahe): Kernel should eventually support a synthetic bit. |
| 59 return isConstructor && |
| 60 name == "" && |
| 61 (charOffset == parent.charOffset || charOffset == -1); |
| 62 } |
56 } | 63 } |
57 | 64 |
58 int computeModifiers(Member member) { | 65 int computeModifiers(Member member) { |
59 int modifier = member.isAbstract ? abstractMask : 0; | 66 int modifier = member.isAbstract ? abstractMask : 0; |
60 modifier |= member.isExternal ? externalMask : 0; | 67 modifier |= member.isExternal ? externalMask : 0; |
61 if (member is Field) { | 68 if (member is Field) { |
62 modifier |= member.isConst ? constMask : 0; | 69 modifier |= member.isConst ? constMask : 0; |
63 modifier |= member.isFinal ? finalMask : 0; | 70 modifier |= member.isFinal ? finalMask : 0; |
64 modifier |= member.isStatic ? staticMask : 0; | 71 modifier |= member.isStatic ? staticMask : 0; |
65 } else if (member is Procedure) { | 72 } else if (member is Procedure) { |
66 modifier |= member.isConst ? constMask : 0; | 73 modifier |= member.isConst ? constMask : 0; |
67 modifier |= member.isStatic ? staticMask : 0; | 74 modifier |= member.isStatic ? staticMask : 0; |
68 } else if (member is Constructor) { | 75 } else if (member is Constructor) { |
69 modifier |= member.isConst ? constMask : 0; | 76 modifier |= member.isConst ? constMask : 0; |
70 } else { | 77 } else { |
71 internalError("Unhandled: ${member.runtimeType}"); | 78 internalError("Unhandled: ${member.runtimeType}"); |
72 } | 79 } |
73 return modifier; | 80 return modifier; |
74 } | 81 } |
OLD | NEW |