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.kernel_enum_builder; | 5 library fasta.kernel_enum_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' show | 7 import 'package:kernel/ast.dart' show |
8 Arguments, | 8 Arguments, |
9 AsyncMarker, | 9 AsyncMarker, |
10 Class, | 10 Class, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 new KernelFieldBuilder(null, selfType, name, constMask | staticMask); | 129 new KernelFieldBuilder(null, selfType, name, constMask | staticMask); |
130 members[name] = fieldBuilder; | 130 members[name] = fieldBuilder; |
131 toStringEntries.add(new MapEntry( | 131 toStringEntries.add(new MapEntry( |
132 new IntLiteral(index), new StringLiteral("$className.$name"))); | 132 new IntLiteral(index), new StringLiteral("$className.$name"))); |
133 index++; | 133 index++; |
134 } | 134 } |
135 MapLiteral toStringMap = new MapLiteral(toStringEntries, isConst: true); | 135 MapLiteral toStringMap = new MapLiteral(toStringEntries, isConst: true); |
136 KernelEnumBuilder enumBuilder = new KernelEnumBuilder.internal(metadata, | 136 KernelEnumBuilder enumBuilder = new KernelEnumBuilder.internal(metadata, |
137 name, members, types, cls, constants, toStringMap, intType, stringType, | 137 name, members, types, cls, constants, toStringMap, intType, stringType, |
138 parent); | 138 parent); |
139 members.forEach((String name, MemberBuilder builder) { | 139 // TODO(sigmund): dynamic should be `covariant MemberBuilder`. |
| 140 members.forEach((String name, dynamic b) { |
| 141 MemberBuilder builder = b; |
140 builder.parent = enumBuilder; | 142 builder.parent = enumBuilder; |
141 }); | 143 }); |
142 selfType.builder = enumBuilder; | 144 selfType.builder = enumBuilder; |
143 return enumBuilder; | 145 return enumBuilder; |
144 } | 146 } |
145 | 147 |
146 InterfaceType buildType(List<KernelTypeBuilder> arguments) { | 148 InterfaceType buildType(List<KernelTypeBuilder> arguments) { |
147 return cls.rawType; | 149 return cls.rawType; |
148 } | 150 } |
149 | 151 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 Arguments arguments = | 184 Arguments arguments = |
183 new Arguments(<Expression>[new IntLiteral(index++)]); | 185 new Arguments(<Expression>[new IntLiteral(index++)]); |
184 field.initializer = | 186 field.initializer = |
185 new ConstructorInvocation(constructor, arguments, isConst: true); | 187 new ConstructorInvocation(constructor, arguments, isConst: true); |
186 } | 188 } |
187 return super.build(libraryBuilder); | 189 return super.build(libraryBuilder); |
188 } | 190 } |
189 | 191 |
190 Builder findConstructorOrFactory(String name) => null; | 192 Builder findConstructorOrFactory(String name) => null; |
191 } | 193 } |
OLD | NEW |