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

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

Issue 840723003: Recover from crash in xcodebuild/ReleaseIA32/generated_tests/language/async_test_constructor4.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed issues in tests. Created 5 years, 11 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) 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 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 AnalyzableElement get analyzedElement; 8 AnalyzableElement get analyzedElement;
9 Iterable<Node> get superUses; 9 Iterable<Node> get superUses;
10 10
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 // Ensure the signature of the synthesized element is 613 // Ensure the signature of the synthesized element is
614 // resolved. This is the only place where the resolver is 614 // resolved. This is the only place where the resolver is
615 // seeing this element. 615 // seeing this element.
616 element.computeSignature(compiler); 616 element.computeSignature(compiler);
617 if (!target.isErroneous) { 617 if (!target.isErroneous) {
618 registry.registerStaticUse(target); 618 registry.registerStaticUse(target);
619 registry.registerImplicitSuperCall(target); 619 registry.registerImplicitSuperCall(target);
620 } 620 }
621 return registry.mapping; 621 return registry.mapping;
622 } else { 622 } else {
623 assert(element.isDeferredLoaderGetter); 623 assert(element.isDeferredLoaderGetter || element.isErroneous);
624 return _ensureTreeElements(element); 624 return _ensureTreeElements(element);
625 } 625 }
626 } else { 626 } else {
627 element.parseNode(compiler); 627 element.parseNode(compiler);
628 element.computeType(compiler); 628 element.computeType(compiler);
629 processAsyncMarker(compiler, element); 629 processAsyncMarker(compiler, element);
630 FunctionElementX implementation = element; 630 FunctionElementX implementation = element;
631 if (element.isExternal) { 631 if (element.isExternal) {
632 implementation = compiler.backend.resolveExternalFunction(element); 632 implementation = compiler.backend.resolveExternalFunction(element);
633 } 633 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 764
765 // [factory] must already be analyzed but the [TreeElements] might not 765 // [factory] must already be analyzed but the [TreeElements] might not
766 // have been stored in the enqueuer cache yet. 766 // have been stored in the enqueuer cache yet.
767 // TODO(johnniwinther): Store [TreeElements] in the cache before 767 // TODO(johnniwinther): Store [TreeElements] in the cache before
768 // resolution of the element. 768 // resolution of the element.
769 TreeElements treeElements = factory.treeElements; 769 TreeElements treeElements = factory.treeElements;
770 assert(invariant(node, treeElements != null, 770 assert(invariant(node, treeElements != null,
771 message: 'No TreeElements cached for $factory.')); 771 message: 'No TreeElements cached for $factory.'));
772 FunctionExpression functionNode = factory.parseNode(compiler); 772 FunctionExpression functionNode = factory.parseNode(compiler);
773 RedirectingFactoryBody redirectionNode = functionNode.body; 773 RedirectingFactoryBody redirectionNode = functionNode.body;
774 InterfaceType factoryType = treeElements.getType(redirectionNode); 774 DartType factoryType = treeElements.getType(redirectionNode);
775 775 if (!factoryType.isDynamic) {
776 targetType = targetType.substByContext(factoryType); 776 targetType = targetType.substByContext(factoryType);
777 }
777 factory.effectiveTarget = target; 778 factory.effectiveTarget = target;
778 factory.effectiveTargetType = targetType; 779 factory.effectiveTargetType = targetType;
779 } 780 }
780 } 781 }
781 782
782 /** 783 /**
783 * Load and resolve the supertypes of [cls]. 784 * Load and resolve the supertypes of [cls].
784 * 785 *
785 * Warning: do not call this method directly. It should only be 786 * Warning: do not call this method directly. It should only be
786 * called by [resolveClass] and [ClassSupertypeResolver]. 787 * called by [resolveClass] and [ClassSupertypeResolver].
(...skipping 4066 matching lines...) Expand 10 before | Expand all | Expand 10 after
4853 if (element.isClass) { 4854 if (element.isClass) {
4854 ClassElement cls = element; 4855 ClassElement cls = element;
4855 cls.ensureResolved(compiler); 4856 cls.ensureResolved(compiler);
4856 // The unnamed constructor may not exist, so [e] may become unresolved. 4857 // The unnamed constructor may not exist, so [e] may become unresolved.
4857 element = resolveConstructor(cls, diagnosticNode, ''); 4858 element = resolveConstructor(cls, diagnosticNode, '');
4858 } else { 4859 } else {
4859 element = failOrReturnErroneousElement( 4860 element = failOrReturnErroneousElement(
4860 element, diagnosticNode, element.name, MessageKind.NOT_A_TYPE, 4861 element, diagnosticNode, element.name, MessageKind.NOT_A_TYPE,
4861 {'node': diagnosticNode}); 4862 {'node': diagnosticNode});
4862 } 4863 }
4864 } else if (element.isErroneous && element is! ErroneousElementX) {
4865 element = new ErroneousConstructorElementX(
4866 MessageKind.NOT_A_TYPE, {'node': diagnosticNode},
4867 element.name, element);
4863 } 4868 }
4869
4864 if (type == null) { 4870 if (type == null) {
4865 if (Elements.isUnresolved(element)) { 4871 if (Elements.isUnresolved(element)) {
4866 type = const DynamicType(); 4872 type = const DynamicType();
4867 } else { 4873 } else {
4868 type = element.enclosingClass.rawType; 4874 type = element.enclosingClass.rawType;
4869 } 4875 }
4870 } 4876 }
4871 resolver.registry.setType(expression, type); 4877 resolver.registry.setType(expression, type);
4872 return element; 4878 return element;
4873 } 4879 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
4955 } 4961 }
4956 } 4962 }
4957 4963
4958 /// Looks up [name] in [scope] and unwraps the result. 4964 /// Looks up [name] in [scope] and unwraps the result.
4959 Element lookupInScope(Compiler compiler, Node node, 4965 Element lookupInScope(Compiler compiler, Node node,
4960 Scope scope, String name) { 4966 Scope scope, String name) {
4961 return Elements.unwrap(scope.lookup(name), compiler, node); 4967 return Elements.unwrap(scope.lookup(name), compiler, node);
4962 } 4968 }
4963 4969
4964 TreeElements _ensureTreeElements(AnalyzableElementX element) { 4970 TreeElements _ensureTreeElements(AnalyzableElementX element) {
4971 if (element.isErroneous) return new TreeElementMapping(element);
4965 if (element._treeElements == null) { 4972 if (element._treeElements == null) {
4966 element._treeElements = new TreeElementMapping(element); 4973 element._treeElements = new TreeElementMapping(element);
4967 } 4974 }
4968 return element._treeElements; 4975 return element._treeElements;
4969 } 4976 }
4970 4977
4971 abstract class AnalyzableElementX implements AnalyzableElement { 4978 abstract class AnalyzableElementX implements AnalyzableElement {
4972 TreeElements _treeElements; 4979 TreeElements _treeElements;
4973 4980
4974 bool get hasTreeElements => _treeElements != null; 4981 bool get hasTreeElements => _treeElements != null;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5018 } 5025 }
5019 5026
5020 /// The result for the resolution of the `assert` method. 5027 /// The result for the resolution of the `assert` method.
5021 class AssertResult implements ResolutionResult { 5028 class AssertResult implements ResolutionResult {
5022 const AssertResult(); 5029 const AssertResult();
5023 5030
5024 Element get element => null; 5031 Element get element => null;
5025 5032
5026 String toString() => 'AssertResult()'; 5033 String toString() => 'AssertResult()';
5027 } 5034 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698