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 ProcedureKind; | 7 import 'package:kernel/ast.dart' show ProcedureKind; |
8 | 8 |
9 import '../../base/resolve_relative_uri.dart' show resolveRelativeUri; | 9 import '../../base/resolve_relative_uri.dart' show resolveRelativeUri; |
10 | 10 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 String documentationComment, | 212 String documentationComment, |
213 List<MetadataBuilder> metadata, | 213 List<MetadataBuilder> metadata, |
214 String name, | 214 String name, |
215 List<TypeVariableBuilder> typeVariables, | 215 List<TypeVariableBuilder> typeVariables, |
216 int modifiers, | 216 int modifiers, |
217 T mixinApplication, | 217 T mixinApplication, |
218 List<T> interfaces, | 218 List<T> interfaces, |
219 int charOffset); | 219 int charOffset); |
220 | 220 |
221 void addField( | 221 void addField( |
222 String documentationComment, | |
223 List<MetadataBuilder> metadata, | 222 List<MetadataBuilder> metadata, |
224 int modifiers, | 223 int modifiers, |
225 T type, | 224 T type, |
226 String name, | 225 String name, |
227 int charOffset, | 226 int charOffset, |
228 Token initializerTokenForInference, | 227 Token initializerTokenForInference, |
229 bool hasInitializer); | 228 bool hasInitializer); |
230 | 229 |
231 void addFields(String documentationComment, List<MetadataBuilder> metadata, | 230 void addFields(List<MetadataBuilder> metadata, int modifiers, T type, |
232 int modifiers, T type, List<Object> fieldsInfo) { | 231 List<Object> fieldsInfo) { |
233 for (int i = 0; i < fieldsInfo.length; i += 4) { | 232 for (int i = 0; i < fieldsInfo.length; i += 4) { |
234 String name = fieldsInfo[i]; | 233 String name = fieldsInfo[i]; |
235 int charOffset = fieldsInfo[i + 1]; | 234 int charOffset = fieldsInfo[i + 1]; |
236 bool hasInitializer = fieldsInfo[i + 2] != null; | 235 bool hasInitializer = fieldsInfo[i + 2] != null; |
237 Token initializerTokenForInference = | 236 Token initializerTokenForInference = |
238 type == null ? fieldsInfo[i + 2] : null; | 237 type == null ? fieldsInfo[i + 2] : null; |
239 if (initializerTokenForInference != null) { | 238 if (initializerTokenForInference != null) { |
240 Token beforeLast = fieldsInfo[i + 3]; | 239 Token beforeLast = fieldsInfo[i + 3]; |
241 beforeLast.setNext(new Token.eof(beforeLast.next.offset)); | 240 beforeLast.setNext(new Token.eof(beforeLast.next.offset)); |
242 } | 241 } |
243 addField(documentationComment, metadata, modifiers, type, name, | 242 addField(metadata, modifiers, type, name, charOffset, |
244 charOffset, initializerTokenForInference, hasInitializer); | 243 initializerTokenForInference, hasInitializer); |
245 } | 244 } |
246 } | 245 } |
247 | 246 |
248 void addProcedure( | 247 void addProcedure( |
249 String documentationComment, | |
250 List<MetadataBuilder> metadata, | 248 List<MetadataBuilder> metadata, |
251 int modifiers, | 249 int modifiers, |
252 T returnType, | 250 T returnType, |
253 String name, | 251 String name, |
254 List<TypeVariableBuilder> typeVariables, | 252 List<TypeVariableBuilder> typeVariables, |
255 List<FormalParameterBuilder> formals, | 253 List<FormalParameterBuilder> formals, |
256 ProcedureKind kind, | 254 ProcedureKind kind, |
257 int charOffset, | 255 int charOffset, |
258 int charOpenParenOffset, | 256 int charOpenParenOffset, |
259 int charEndOffset, | 257 int charEndOffset, |
(...skipping 10 matching lines...) Expand all Loading... |
270 FunctionTypeBuilder type, | 268 FunctionTypeBuilder type, |
271 int charOffset); | 269 int charOffset); |
272 | 270 |
273 FunctionTypeBuilder addFunctionType( | 271 FunctionTypeBuilder addFunctionType( |
274 T returnType, | 272 T returnType, |
275 List<TypeVariableBuilder> typeVariables, | 273 List<TypeVariableBuilder> typeVariables, |
276 List<FormalParameterBuilder> formals, | 274 List<FormalParameterBuilder> formals, |
277 int charOffset); | 275 int charOffset); |
278 | 276 |
279 void addFactoryMethod( | 277 void addFactoryMethod( |
280 String documentationComment, | |
281 List<MetadataBuilder> metadata, | 278 List<MetadataBuilder> metadata, |
282 int modifiers, | 279 int modifiers, |
283 ConstructorReferenceBuilder name, | 280 ConstructorReferenceBuilder name, |
284 List<FormalParameterBuilder> formals, | 281 List<FormalParameterBuilder> formals, |
285 ConstructorReferenceBuilder redirectionTarget, | 282 ConstructorReferenceBuilder redirectionTarget, |
286 int charOffset, | 283 int charOffset, |
287 int charOpenParenOffset, | 284 int charOpenParenOffset, |
288 int charEndOffset, | 285 int charEndOffset, |
289 String nativeMethodName); | 286 String nativeMethodName); |
290 | 287 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 /// synthesize type variables on the factory matching the class'. | 649 /// synthesize type variables on the factory matching the class'. |
653 void addFactoryDeclaration( | 650 void addFactoryDeclaration( |
654 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 651 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
655 factoryDeclarations[procedure] = factoryDeclaration; | 652 factoryDeclarations[procedure] = factoryDeclaration; |
656 } | 653 } |
657 | 654 |
658 Scope toScope(Scope parent) { | 655 Scope toScope(Scope parent) { |
659 return new Scope(members, setters, parent, isModifiable: false); | 656 return new Scope(members, setters, parent, isModifiable: false); |
660 } | 657 } |
661 } | 658 } |
OLD | NEW |