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.analyzer.element_store; | 5 library fasta.analyzer.element_store; |
6 | 6 |
7 import 'package:analyzer/src/kernel/loader.dart' show ReferenceLevelLoader; | 7 import 'package:analyzer/src/kernel/loader.dart' show ReferenceLevelLoader; |
8 | 8 |
9 import 'package:kernel/ast.dart'; | 9 import 'package:kernel/ast.dart'; |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 libraries.forEach((Uri uri, LibraryBuilder library) { | 72 libraries.forEach((Uri uri, LibraryBuilder library) { |
73 KernelCompilationUnitElement unit = | 73 KernelCompilationUnitElement unit = |
74 new KernelCompilationUnitElement(library); | 74 new KernelCompilationUnitElement(library); |
75 KernelLibraryElement element = new KernelLibraryElement(unit); | 75 KernelLibraryElement element = new KernelLibraryElement(unit); |
76 elements[library] = element; | 76 elements[library] = element; |
77 unit.library = element; | 77 unit.library = element; |
78 library.forEach((String name, Builder builder) { | 78 library.forEach((String name, Builder builder) { |
79 do { | 79 do { |
80 if (builder is ClassBuilder) { | 80 if (builder is ClassBuilder) { |
81 elements[builder] = new KernelClassElement(builder); | 81 elements[builder] = new KernelClassElement(builder); |
| 82 } else if (builder is KernelFunctionTypeAliasBuilder) { |
| 83 elements[builder] = new KernelFunctionTypeAliasElement(builder); |
82 } else if (builder is DillMemberBuilder) { | 84 } else if (builder is DillMemberBuilder) { |
83 Member member = builder.member; | 85 Member member = builder.member; |
84 if (member is Field) {} else if (member is Procedure) { | 86 if (member is Field) {} else if (member is Procedure) { |
85 buildDillFunctionElement(builder, unit, elements); | 87 buildDillFunctionElement(builder, unit, elements); |
86 } else { | 88 } else { |
87 internalError("Unhandled $name ${member.runtimeType} in $uri"); | 89 internalError("Unhandled $name ${member.runtimeType} in $uri"); |
88 } | 90 } |
89 } else if (builder is KernelProcedureBuilder) { | 91 } else if (builder is KernelProcedureBuilder) { |
90 buildKernelFunctionElement(builder, unit, elements); | 92 buildKernelFunctionElement(builder, unit, elements); |
91 } else if (builder is BuiltinTypeBuilder) { | 93 } else if (builder is BuiltinTypeBuilder) { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 class KernelClassElement extends MockClassElement { | 284 class KernelClassElement extends MockClassElement { |
283 final KernelClassBuilder builder; | 285 final KernelClassBuilder builder; |
284 | 286 |
285 KernelInterfaceType rawType; | 287 KernelInterfaceType rawType; |
286 | 288 |
287 KernelClassElement(this.builder) { | 289 KernelClassElement(this.builder) { |
288 rawType = new KernelInterfaceType(this); | 290 rawType = new KernelInterfaceType(this); |
289 } | 291 } |
290 } | 292 } |
291 | 293 |
| 294 class KernelFunctionTypeAliasElement extends MockFunctionTypeAliasElement { |
| 295 final KernelFunctionTypeAliasBuilder builder; |
| 296 |
| 297 KernelFunctionTypeAliasElement(this.builder); |
| 298 |
| 299 @override |
| 300 analyzer.DartType get returnType { |
| 301 return internalError("not supported."); |
| 302 } |
| 303 |
| 304 @override |
| 305 analyzer.FunctionType get type { |
| 306 return internalError("not supported."); |
| 307 } |
| 308 |
| 309 @override |
| 310 List<TypeParameterElement> get typeParameters { |
| 311 return internalError("not supported."); |
| 312 } |
| 313 } |
| 314 |
292 class KernelInterfaceType extends MockInterfaceType { | 315 class KernelInterfaceType extends MockInterfaceType { |
293 final KernelClassElement element; | 316 final KernelClassElement element; |
294 | 317 |
295 KernelInterfaceType(this.element); | 318 KernelInterfaceType(this.element); |
296 | 319 |
297 List<analyzer.DartType> get typeArguments => const <analyzer.DartType>[]; | 320 List<analyzer.DartType> get typeArguments => const <analyzer.DartType>[]; |
298 } | 321 } |
OLD | NEW |