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.source_library_builder; | 5 library fasta.source_library_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; | 7 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; |
8 | 8 |
9 import '../combinator.dart' show Combinator; | 9 import '../combinator.dart' show Combinator; |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 List<TypeVariableBuilder> typeVariables, | 177 List<TypeVariableBuilder> typeVariables, |
178 int modifiers, | 178 int modifiers, |
179 T mixinApplication, | 179 T mixinApplication, |
180 List<T> interfaces, | 180 List<T> interfaces, |
181 int charOffset); | 181 int charOffset); |
182 | 182 |
183 void addField(List<MetadataBuilder> metadata, int modifiers, T type, | 183 void addField(List<MetadataBuilder> metadata, int modifiers, T type, |
184 String name, int charOffset); | 184 String name, int charOffset); |
185 | 185 |
186 void addFields(List<MetadataBuilder> metadata, int modifiers, T type, | 186 void addFields(List<MetadataBuilder> metadata, int modifiers, T type, |
187 List<String> names) { | 187 List<Object> namesAndOffsets) { |
188 for (String name in names) { | 188 for (int i = 0; i < namesAndOffsets.length; i += 2) { |
189 // TODO(ahe): Get charOffset of name. | 189 String name = namesAndOffsets[i]; |
190 addField(metadata, modifiers, type, name, -1); | 190 int charOffset = namesAndOffsets[i + 1]; |
| 191 addField(metadata, modifiers, type, name, charOffset); |
191 } | 192 } |
192 } | 193 } |
193 | 194 |
194 void addProcedure( | 195 void addProcedure( |
195 List<MetadataBuilder> metadata, | 196 List<MetadataBuilder> metadata, |
196 int modifiers, | 197 int modifiers, |
197 T returnType, | 198 T returnType, |
198 String name, | 199 String name, |
199 List<TypeVariableBuilder> typeVariables, | 200 List<TypeVariableBuilder> typeVariables, |
200 List<FormalParameterBuilder> formals, | 201 List<FormalParameterBuilder> formals, |
201 AsyncMarker asyncModifier, | 202 AsyncMarker asyncModifier, |
202 ProcedureKind kind, | 203 ProcedureKind kind, |
203 int charOffset, | 204 int charOffset, |
204 int charOpenParenOffset, | 205 int charOpenParenOffset, |
205 int charEndOffset, | 206 int charEndOffset, |
206 String nativeMethodName, | 207 String nativeMethodName, |
207 {bool isTopLevel}); | 208 {bool isTopLevel}); |
208 | 209 |
209 void addEnum(List<MetadataBuilder> metadata, String name, | 210 void addEnum(List<MetadataBuilder> metadata, String name, |
210 List<String> constants, int charOffset, int charEndOffset); | 211 List<Object> constantNamesAndOffsets, int charOffset, int charEndOffset); |
211 | 212 |
212 void addFunctionTypeAlias( | 213 void addFunctionTypeAlias( |
213 List<MetadataBuilder> metadata, | 214 List<MetadataBuilder> metadata, |
214 T returnType, | 215 T returnType, |
215 String name, | 216 String name, |
216 List<TypeVariableBuilder> typeVariables, | 217 List<TypeVariableBuilder> typeVariables, |
217 List<FormalParameterBuilder> formals, | 218 List<FormalParameterBuilder> formals, |
218 int charOffset); | 219 int charOffset); |
219 | 220 |
220 FunctionTypeBuilder addFunctionType( | 221 FunctionTypeBuilder addFunctionType( |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 } | 526 } |
526 | 527 |
527 /// Called to register [procedure] as a factory whose types are collected in | 528 /// Called to register [procedure] as a factory whose types are collected in |
528 /// [factoryDeclaration]. Later, once the class has been built, we can | 529 /// [factoryDeclaration]. Later, once the class has been built, we can |
529 /// synthesize type variables on the factory matching the class'. | 530 /// synthesize type variables on the factory matching the class'. |
530 void addFactoryDeclaration( | 531 void addFactoryDeclaration( |
531 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 532 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
532 factoryDeclarations[procedure] = factoryDeclaration; | 533 factoryDeclarations[procedure] = factoryDeclaration; |
533 } | 534 } |
534 } | 535 } |
OLD | NEW |