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

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

Issue 2970273004: Deprecate all diagnostics methods that use strings. (Closed)
Patch Set: Merged with 4df146dd9a465d63344330bf3e45524b927c92ec Created 3 years, 5 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
11 import 'package:analyzer/analyzer.dart' show ParameterKind; 11 import 'package:analyzer/analyzer.dart' show ParameterKind;
12 12
13 import 'package:analyzer/analyzer.dart' as analyzer; 13 import 'package:analyzer/analyzer.dart' as analyzer;
14 14
15 import 'package:analyzer/dart/element/element.dart'; 15 import 'package:analyzer/dart/element/element.dart';
16 16
17 import 'package:analyzer/dart/element/type.dart' as analyzer; 17 import 'package:analyzer/dart/element/type.dart' as analyzer;
18 18
19 import 'package:front_end/src/fasta/errors.dart' show internalError; 19 import 'package:front_end/src/fasta/deprecated_problems.dart'
20 show deprecated_internalProblem;
20 21
21 import 'package:front_end/src/fasta/kernel/kernel_builder.dart'; 22 import 'package:front_end/src/fasta/kernel/kernel_builder.dart';
22 23
23 import 'package:front_end/src/fasta/dill/dill_member_builder.dart'; 24 import 'package:front_end/src/fasta/dill/dill_member_builder.dart';
24 25
25 import 'mock_element.dart'; 26 import 'mock_element.dart';
26 27
27 import 'mock_type.dart'; 28 import 'mock_type.dart';
28 29
29 abstract class ElementStore implements ReferenceLevelLoader { 30 abstract class ElementStore implements ReferenceLevelLoader {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 do { 80 do {
80 if (builder is ClassBuilder) { 81 if (builder is ClassBuilder) {
81 elements[builder] = new KernelClassElement(builder); 82 elements[builder] = new KernelClassElement(builder);
82 } else if (builder is KernelFunctionTypeAliasBuilder) { 83 } else if (builder is KernelFunctionTypeAliasBuilder) {
83 elements[builder] = new KernelFunctionTypeAliasElement(builder); 84 elements[builder] = new KernelFunctionTypeAliasElement(builder);
84 } else if (builder is DillMemberBuilder) { 85 } else if (builder is DillMemberBuilder) {
85 Member member = builder.member; 86 Member member = builder.member;
86 if (member is Field) {} else if (member is Procedure) { 87 if (member is Field) {} else if (member is Procedure) {
87 buildDillFunctionElement(builder, unit, elements); 88 buildDillFunctionElement(builder, unit, elements);
88 } else { 89 } else {
89 internalError("Unhandled $name ${member.runtimeType} in $uri"); 90 deprecated_internalProblem(
91 "Unhandled $name ${member.runtimeType} in $uri");
90 } 92 }
91 } else if (builder is KernelProcedureBuilder) { 93 } else if (builder is KernelProcedureBuilder) {
92 buildKernelFunctionElement(builder, unit, elements); 94 buildKernelFunctionElement(builder, unit, elements);
93 } else if (builder is BuiltinTypeBuilder) { 95 } else if (builder is BuiltinTypeBuilder) {
94 // TODO(ahe): Set up elements for dynamic and void. 96 // TODO(ahe): Set up elements for dynamic and void.
95 } else { 97 } else {
96 internalError("Unhandled $name ${builder.runtimeType} in $uri"); 98 deprecated_internalProblem(
99 "Unhandled $name ${builder.runtimeType} in $uri");
97 } 100 }
98 builder = builder.next; 101 builder = builder.next;
99 } while (builder != null); 102 } while (builder != null);
100 }); 103 });
101 }); 104 });
102 return new ElementStoreImplementation.internal(coreLibrary, elements); 105 return new ElementStoreImplementation.internal(coreLibrary, elements);
103 } 106 }
104 107
105 bool get ignoreRedirectingFactories => false; 108 bool get ignoreRedirectingFactories => false;
106 109
107 Constructor getCoreClassConstructorReference(String className, 110 Constructor getCoreClassConstructorReference(String className,
108 {String constructorName, String library}) { 111 {String constructorName, String library}) {
109 assert(library == null); 112 assert(library == null);
110 return coreLibrary 113 return coreLibrary
111 .getConstructor(className, constructorName: constructorName) 114 .getConstructor(className, constructorName: constructorName)
112 .target; 115 .target;
113 } 116 }
114 117
115 Library getLibraryReference(LibraryElement element) { 118 Library getLibraryReference(LibraryElement element) {
116 return internalError("not supported."); 119 return deprecated_internalProblem("not supported.");
117 } 120 }
118 121
119 Class getClassReference(covariant KernelClassElement cls) => cls.builder.cls; 122 Class getClassReference(covariant KernelClassElement cls) => cls.builder.cls;
120 123
121 Member getMemberReference(Element element) { 124 Member getMemberReference(Element element) {
122 if (element is KernelFunctionElement) { 125 if (element is KernelFunctionElement) {
123 return element.procedure; 126 return element.procedure;
124 } else { 127 } else {
125 return internalError("getMemberReference(${element.runtimeType})"); 128 return deprecated_internalProblem(
129 "getMemberReference(${element.runtimeType})");
126 } 130 }
127 } 131 }
128 132
129 Class getRootClassReference() => internalError("not supported."); 133 Class getRootClassReference() => deprecated_internalProblem("not supported.");
130 134
131 Constructor getRootClassConstructorReference() { 135 Constructor getRootClassConstructorReference() {
132 return internalError("not supported."); 136 return deprecated_internalProblem("not supported.");
133 } 137 }
134 138
135 Class getCoreClassReference(String className) { 139 Class getCoreClassReference(String className) {
136 return internalError("not supported."); 140 return deprecated_internalProblem("not supported.");
137 } 141 }
138 142
139 TypeParameter tryGetClassTypeParameter(TypeParameterElement element) { 143 TypeParameter tryGetClassTypeParameter(TypeParameterElement element) {
140 return internalError("not supported."); 144 return deprecated_internalProblem("not supported.");
141 } 145 }
142 146
143 Class getSharedMixinApplicationClass( 147 Class getSharedMixinApplicationClass(
144 Library library, Class supertype, Class mixin) { 148 Library library, Class supertype, Class mixin) {
145 return internalError("not supported."); 149 return deprecated_internalProblem("not supported.");
146 } 150 }
147 151
148 bool get strongMode => false; 152 bool get strongMode => false;
149 153
150 static void buildDillFunctionElement(DillMemberBuilder builder, 154 static void buildDillFunctionElement(DillMemberBuilder builder,
151 KernelCompilationUnitElement unit, Map<Builder, Element> elements) { 155 KernelCompilationUnitElement unit, Map<Builder, Element> elements) {
152 Procedure procedure = builder.member; 156 Procedure procedure = builder.member;
153 List<VariableDeclaration> positionalParameters = 157 List<VariableDeclaration> positionalParameters =
154 procedure.function.positionalParameters; 158 procedure.function.positionalParameters;
155 List<VariableDeclaration> namedParameters = 159 List<VariableDeclaration> namedParameters =
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 String get name => variable.name.name; 257 String get name => variable.name.name;
254 258
255 bool get isFinal => false; // TODO(ahe): implement this. 259 bool get isFinal => false; // TODO(ahe): implement this.
256 260
257 bool get isConst => false; // TODO(ahe): implement this. 261 bool get isConst => false; // TODO(ahe): implement this.
258 262
259 analyzer.VariableDeclaration get target => variable; 263 analyzer.VariableDeclaration get target => variable;
260 264
261 get type => null; 265 get type => null;
262 266
263 get constantValue => internalError("not supported."); 267 get constantValue => deprecated_internalProblem("not supported.");
264 268
265 computeConstantValue() => internalError("not supported."); 269 computeConstantValue() => deprecated_internalProblem("not supported.");
266 } 270 }
267 271
268 /// Both an [Element] and [Builder] to using memory to store local elements in 272 /// Both an [Element] and [Builder] to using memory to store local elements in
269 /// [ElementStore]. 273 /// [ElementStore].
270 class AnalyzerParameterElement extends MockParameterElement { 274 class AnalyzerParameterElement extends MockParameterElement {
271 final analyzer.FormalParameter parameter; 275 final analyzer.FormalParameter parameter;
272 276
273 AnalyzerParameterElement(this.parameter); 277 AnalyzerParameterElement(this.parameter);
274 278
275 String get name => parameter.identifier.name; 279 String get name => parameter.identifier.name;
(...skipping 15 matching lines...) Expand all
291 } 295 }
292 } 296 }
293 297
294 class KernelFunctionTypeAliasElement extends MockFunctionTypeAliasElement { 298 class KernelFunctionTypeAliasElement extends MockFunctionTypeAliasElement {
295 final KernelFunctionTypeAliasBuilder builder; 299 final KernelFunctionTypeAliasBuilder builder;
296 300
297 KernelFunctionTypeAliasElement(this.builder); 301 KernelFunctionTypeAliasElement(this.builder);
298 302
299 @override 303 @override
300 analyzer.DartType get returnType { 304 analyzer.DartType get returnType {
301 return internalError("not supported."); 305 return deprecated_internalProblem("not supported.");
302 } 306 }
303 307
304 @override 308 @override
305 analyzer.FunctionType get type { 309 analyzer.FunctionType get type {
306 return internalError("not supported."); 310 return deprecated_internalProblem("not supported.");
307 } 311 }
308 312
309 @override 313 @override
310 List<TypeParameterElement> get typeParameters { 314 List<TypeParameterElement> get typeParameters {
311 return internalError("not supported."); 315 return deprecated_internalProblem("not supported.");
312 } 316 }
313 } 317 }
314 318
315 class KernelInterfaceType extends MockInterfaceType { 319 class KernelInterfaceType extends MockInterfaceType {
316 final KernelClassElement element; 320 final KernelClassElement element;
317 321
318 KernelInterfaceType(this.element); 322 KernelInterfaceType(this.element);
319 323
320 List<analyzer.DartType> get typeArguments => const <analyzer.DartType>[]; 324 List<analyzer.DartType> get typeArguments => const <analyzer.DartType>[];
321 } 325 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/fasta/ast_builder.dart ('k') | pkg/analyzer/lib/src/fasta/mock_element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698