Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: pkg/analyzer/lib/src/fasta/element_store.dart

Issue 2788913002: Prepare for separate setter scope. (Closed)
Patch Set: Address comments. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 factory ElementStoreImplementation( 69 factory ElementStoreImplementation(
70 LibraryBuilder coreLibrary, Map<Uri, LibraryBuilder> libraries) { 70 LibraryBuilder coreLibrary, Map<Uri, LibraryBuilder> libraries) {
71 Map<Builder, Element> elements = <Builder, Element>{}; 71 Map<Builder, Element> elements = <Builder, Element>{};
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.members.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 DillMemberBuilder) { 82 } else if (builder is DillMemberBuilder) {
83 Member member = builder.member; 83 Member member = builder.member;
84 if (member is Field) {} else if (member is Procedure) { 84 if (member is Field) {} else if (member is Procedure) {
85 buildDillFunctionElement(builder, unit, elements); 85 buildDillFunctionElement(builder, unit, elements);
86 } else { 86 } else {
87 internalError("Unhandled $name ${member.runtimeType} in $uri"); 87 internalError("Unhandled $name ${member.runtimeType} in $uri");
88 } 88 }
89 } else if (builder is KernelProcedureBuilder) { 89 } else if (builder is KernelProcedureBuilder) {
90 buildKernelFunctionElement(builder, unit, elements); 90 buildKernelFunctionElement(builder, unit, elements);
91 } else if (builder is BuiltinTypeBuilder) { 91 } else if (builder is BuiltinTypeBuilder) {
92 // TODO(ahe): Set up elements for dynamic and void. 92 // TODO(ahe): Set up elements for dynamic and void.
93 } else { 93 } else {
94 internalError("Unhandled $name ${builder.runtimeType} in $uri"); 94 internalError("Unhandled $name ${builder.runtimeType} in $uri");
95 } 95 }
96 builder = builder.next; 96 builder = builder.next;
97 } while (builder != null); 97 } while (builder != null);
98 }); 98 });
99 }); 99 });
100 return new ElementStoreImplementation.internal(coreLibrary, elements); 100 return new ElementStoreImplementation.internal(coreLibrary, elements);
101 } 101 }
102 102
103 bool get ignoreRedirectingFactories => false; 103 bool get ignoreRedirectingFactories => false;
104 104
105 Constructor getCoreClassConstructorReference(String className, 105 Constructor getCoreClassConstructorReference(String className,
106 {String constructorName, String library}) { 106 {String constructorName, String library}) {
107 assert(library == null); 107 assert(library == null);
108 KernelClassBuilder cls = coreLibrary.members[className]; 108 return coreLibrary
109 Constructor constructor = constructorName == null 109 .getConstructor(className, constructorName: constructorName)
110 ? cls.cls.constructors.first 110 .target;
111 : cls.cls.constructors
112 .firstWhere((Constructor c) => c.name.name == constructorName);
113 return constructor;
114 } 111 }
115 112
116 Library getLibraryReference(LibraryElement element) { 113 Library getLibraryReference(LibraryElement element) {
117 return internalError("not supported."); 114 return internalError("not supported.");
118 } 115 }
119 116
120 Class getClassReference(covariant KernelClassElement cls) => cls.builder.cls; 117 Class getClassReference(covariant KernelClassElement cls) => cls.builder.cls;
121 118
122 Member getMemberReference(Element element) { 119 Member getMemberReference(Element element) {
123 if (element is KernelFunctionElement) { 120 if (element is KernelFunctionElement) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 289 }
293 } 290 }
294 291
295 class KernelInterfaceType extends MockInterfaceType { 292 class KernelInterfaceType extends MockInterfaceType {
296 final KernelClassElement element; 293 final KernelClassElement element;
297 294
298 KernelInterfaceType(this.element); 295 KernelInterfaceType(this.element);
299 296
300 List<analyzer.DartType> get typeArguments => const <analyzer.DartType>[]; 297 List<analyzer.DartType> get typeArguments => const <analyzer.DartType>[];
301 } 298 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/fasta/analyzer.dart ('k') | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698