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

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

Issue 1130773002: Differentiate between unresolved class and constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 part of dart2js.semantics_visitor; 5 part of dart2js.semantics_visitor;
6 6
7 enum SendStructureKind { 7 enum SendStructureKind {
8 GET, 8 GET,
9 SET, 9 SET,
10 INVOKE, 10 INVOKE,
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } else { 412 } else {
413 return handleStaticallyResolvedAccess(node, element, getter); 413 return handleStaticallyResolvedAccess(node, element, getter);
414 } 414 }
415 } 415 }
416 } 416 }
417 417
418 ConstructorAccessSemantics computeConstructorAccessSemantics( 418 ConstructorAccessSemantics computeConstructorAccessSemantics(
419 ConstructorElement constructor, 419 ConstructorElement constructor,
420 DartType type) { 420 DartType type) {
421 if (constructor.isErroneous) { 421 if (constructor.isErroneous) {
422 if (constructor is ErroneousElement) {
423 ErroneousElement error = constructor;
424 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) {
425 return new ConstructorAccessSemantics(
426 ConstructorAccessKind.UNRESOLVED_CONSTRUCTOR, constructor, type);
427 }
428 }
422 return new ConstructorAccessSemantics( 429 return new ConstructorAccessSemantics(
423 ConstructorAccessKind.ERRONEOUS, constructor, type); 430 ConstructorAccessKind.UNRESOLVED_TYPE, constructor, type);
424 } else if (constructor.isRedirectingFactory) { 431 } else if (constructor.isRedirectingFactory) {
425 ConstructorElement effectiveTarget = constructor.effectiveTarget; 432 ConstructorElement effectiveTarget = constructor.effectiveTarget;
426 if (effectiveTarget == constructor || 433 if (effectiveTarget == constructor ||
427 effectiveTarget.isErroneous) { 434 effectiveTarget.isErroneous) {
428 return new ConstructorAccessSemantics( 435 return new ConstructorAccessSemantics(
429 ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY, 436 ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY,
430 constructor, 437 constructor,
431 type); 438 type);
432 } 439 }
433 ConstructorAccessSemantics effectiveTargetSemantics = 440 ConstructorAccessSemantics effectiveTargetSemantics =
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 482
476 Element element = elements[node.send]; 483 Element element = elements[node.send];
477 Selector selector = elements.getSelector(node.send); 484 Selector selector = elements.getSelector(node.send);
478 DartType type = elements.getType(node); 485 DartType type = elements.getType(node);
479 486
480 ConstructorAccessSemantics constructorAccessSemantics; 487 ConstructorAccessSemantics constructorAccessSemantics;
481 if (node.isConst) { 488 if (node.isConst) {
482 // This is a non-constant constant constructor invocation, like 489 // This is a non-constant constant constructor invocation, like
483 // `const Const(method())`. 490 // `const Const(method())`.
484 constructorAccessSemantics = new ConstructorAccessSemantics( 491 constructorAccessSemantics = new ConstructorAccessSemantics(
485 ConstructorAccessKind.ERRONEOUS, element, type); 492 ConstructorAccessKind.NON_CONSTANT_CONSTRUCTOR, element, type);
486 } else { 493 } else {
487 constructorAccessSemantics = 494 constructorAccessSemantics =
488 computeConstructorAccessSemantics(element, type); 495 computeConstructorAccessSemantics(element, type);
489 } 496 }
490 return new NewInvokeStructure(constructorAccessSemantics, selector); 497 return new NewInvokeStructure(constructorAccessSemantics, selector);
491 } 498 }
492 } 499 }
493 500
494 abstract class DeclStructure<R, A> { 501 abstract class DeclStructure<R, A> {
495 final FunctionElement element; 502 final FunctionElement element;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 return internalError(node, "Unexpected variable $element."); 797 return internalError(node, "Unexpected variable $element.");
791 } 798 }
792 if (element.isConst) { 799 if (element.isConst) {
793 ConstantExpression constant = elements.getConstant(element.initializer); 800 ConstantExpression constant = elements.getConstant(element.initializer);
794 return new ConstantVariableStructure(kind, node, element, constant); 801 return new ConstantVariableStructure(kind, node, element, constant);
795 } else { 802 } else {
796 return new NonConstantVariableStructure(kind, node, element); 803 return new NonConstantVariableStructure(kind, node, element);
797 } 804 }
798 } 805 }
799 } 806 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart ('k') | pkg/compiler/lib/src/resolution/send_structure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698