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

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution.dart

Issue 2456643006: More functionality in kernel_impact. (Closed)
Patch Set: Fix errors. Created 4 years, 1 month 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.resolution; 5 library dart2js.resolution;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/names.dart' show Identifiers; 10 import '../common/names.dart' show Identifiers;
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 308 }
309 if (element.isSynthesized) { 309 if (element.isSynthesized) {
310 if (element.isGenerativeConstructor) { 310 if (element.isGenerativeConstructor) {
311 ResolutionRegistry registry = 311 ResolutionRegistry registry =
312 new ResolutionRegistry(this.target, _ensureTreeElements(element)); 312 new ResolutionRegistry(this.target, _ensureTreeElements(element));
313 ConstructorElement constructor = element.asFunctionElement(); 313 ConstructorElement constructor = element.asFunctionElement();
314 ConstructorElement target = constructor.definingConstructor; 314 ConstructorElement target = constructor.definingConstructor;
315 // Ensure the signature of the synthesized element is 315 // Ensure the signature of the synthesized element is
316 // resolved. This is the only place where the resolver is 316 // resolved. This is the only place where the resolver is
317 // seeing this element. 317 // seeing this element.
318 element.computeType(resolution); 318 FunctionType type = element.computeType(resolution);
319 if (!target.isMalformed) { 319 if (!target.isMalformed) {
320 registry.registerStaticUse(new StaticUse.superConstructorInvoke( 320 registry.registerStaticUse(new StaticUse.superConstructorInvoke(
321 target, CallStructure.NO_ARGS)); 321 // TODO(johnniwinther): Provide the right call structure for
322 // forwarding constructors.
323 target,
324 CallStructure.NO_ARGS));
322 } 325 }
326 // TODO(johnniwinther): Remove this substitution when synthesized
327 // constructors handle type variables correctly.
328 type = type.substByContext(
329 constructor.enclosingClass.asInstanceOf(target.enclosingClass));
330 type.parameterTypes.forEach(registry.registerCheckedModeCheck);
331 type.optionalParameterTypes
332 .forEach(registry.registerCheckedModeCheck);
333 type.namedParameterTypes.forEach(registry.registerCheckedModeCheck);
323 return registry.impactBuilder; 334 return registry.impactBuilder;
324 } else { 335 } else {
325 assert(element.isDeferredLoaderGetter || element.isMalformed); 336 assert(element.isDeferredLoaderGetter || element.isMalformed);
326 _ensureTreeElements(element); 337 _ensureTreeElements(element);
327 return const ResolutionImpact(); 338 return const ResolutionImpact();
328 } 339 }
329 } else { 340 } else {
330 element.parseNode(resolution.parsingContext); 341 element.parseNode(resolution.parsingContext);
331 element.computeType(resolution); 342 element.computeType(resolution);
332 FunctionElementX implementation = element; 343 FunctionElementX implementation = element;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // `Foo<Unresolved>`. 386 // `Foo<Unresolved>`.
376 element.variables.type.toString() == type.toString(), 387 element.variables.type.toString() == type.toString(),
377 message: "Unexpected type computed for $element. " 388 message: "Unexpected type computed for $element. "
378 "Was ${element.variables.type}, computed $type.")); 389 "Was ${element.variables.type}, computed $type."));
379 element.variables.type = type; 390 element.variables.type = type;
380 } else if (element.variables.type == null) { 391 } else if (element.variables.type == null) {
381 // Only assign the dynamic type if the element has no known type. This 392 // Only assign the dynamic type if the element has no known type. This
382 // happens for enum fields where the type is known but is not in the 393 // happens for enum fields where the type is known but is not in the
383 // synthesized AST. 394 // synthesized AST.
384 element.variables.type = const DynamicType(); 395 element.variables.type = const DynamicType();
396 } else {
397 registry.registerCheckedModeCheck(element.variables.type);
385 } 398 }
386 399
387 Expression initializer = element.initializer; 400 Expression initializer = element.initializer;
388 Modifiers modifiers = element.modifiers; 401 Modifiers modifiers = element.modifiers;
389 if (initializer != null) { 402 if (initializer != null) {
390 // TODO(johnniwinther): Avoid analyzing initializers if 403 // TODO(johnniwinther): Avoid analyzing initializers if
391 // [Compiler.analyzeSignaturesOnly] is set. 404 // [Compiler.analyzeSignaturesOnly] is set.
392 ResolutionResult result = visitor.visit(initializer); 405 ResolutionResult result = visitor.visit(initializer);
393 if (result.isConstant) { 406 if (result.isConstant) {
394 element.constant = result.constant; 407 element.constant = result.constant;
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 TreeElements get treeElements { 1137 TreeElements get treeElements {
1125 assert(invariant(this, _treeElements != null, 1138 assert(invariant(this, _treeElements != null,
1126 message: "TreeElements have not been computed for $this.")); 1139 message: "TreeElements have not been computed for $this."));
1127 return _treeElements; 1140 return _treeElements;
1128 } 1141 }
1129 1142
1130 void reuseElement() { 1143 void reuseElement() {
1131 _treeElements = null; 1144 _treeElements = null;
1132 } 1145 }
1133 } 1146 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | pkg/compiler/lib/src/resolution/signatures.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698