| OLD | NEW |
| 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 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 Map messageArguments, | 1848 Map messageArguments, |
| 1849 {DartType userProvidedBadType, | 1849 {DartType userProvidedBadType, |
| 1850 Element erroneousElement}) { | 1850 Element erroneousElement}) { |
| 1851 if (malformedIsError) { | 1851 if (malformedIsError) { |
| 1852 visitor.error(node, messageKind, messageArguments); | 1852 visitor.error(node, messageKind, messageArguments); |
| 1853 } else { | 1853 } else { |
| 1854 registry.registerThrowRuntimeError(); | 1854 registry.registerThrowRuntimeError(); |
| 1855 visitor.warning(node, messageKind, messageArguments); | 1855 visitor.warning(node, messageKind, messageArguments); |
| 1856 } | 1856 } |
| 1857 if (erroneousElement == null) { | 1857 if (erroneousElement == null) { |
| 1858 erroneousElement = new ErroneousElementX( | 1858 registry.registerThrowRuntimeError(); |
| 1859 erroneousElement = new ErroneousElementX( |
| 1859 messageKind, messageArguments, typeName.source, | 1860 messageKind, messageArguments, typeName.source, |
| 1860 visitor.enclosingElement); | 1861 visitor.enclosingElement); |
| 1861 } | 1862 } |
| 1862 List<DartType> arguments = <DartType>[]; | 1863 List<DartType> arguments = <DartType>[]; |
| 1863 resolveTypeArguments(visitor, node, const <DartType>[], arguments); | 1864 resolveTypeArguments(visitor, node, const <DartType>[], arguments); |
| 1864 return new MalformedType(erroneousElement, | 1865 return new MalformedType(erroneousElement, |
| 1865 userProvidedBadType, arguments); | 1866 userProvidedBadType, arguments); |
| 1866 } | 1867 } |
| 1867 | 1868 |
| 1868 // Try to construct the type from the element. | 1869 // Try to construct the type from the element. |
| (...skipping 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4872 element = resolveConstructor(cls, diagnosticNode, ''); | 4873 element = resolveConstructor(cls, diagnosticNode, ''); |
| 4873 } else { | 4874 } else { |
| 4874 element = failOrReturnErroneousElement( | 4875 element = failOrReturnErroneousElement( |
| 4875 element, diagnosticNode, element.name, MessageKind.NOT_A_TYPE, | 4876 element, diagnosticNode, element.name, MessageKind.NOT_A_TYPE, |
| 4876 {'node': diagnosticNode}); | 4877 {'node': diagnosticNode}); |
| 4877 } | 4878 } |
| 4878 } else if (element.isErroneous && element is! ErroneousElementX) { | 4879 } else if (element.isErroneous && element is! ErroneousElementX) { |
| 4879 element = new ErroneousConstructorElementX( | 4880 element = new ErroneousConstructorElementX( |
| 4880 MessageKind.NOT_A_TYPE, {'node': diagnosticNode}, | 4881 MessageKind.NOT_A_TYPE, {'node': diagnosticNode}, |
| 4881 element.name, element); | 4882 element.name, element); |
| 4883 registry.registerThrowRuntimeError(); |
| 4882 } | 4884 } |
| 4883 | 4885 |
| 4884 if (type == null) { | 4886 if (type == null) { |
| 4885 if (Elements.isUnresolved(element)) { | 4887 if (Elements.isUnresolved(element)) { |
| 4886 type = const DynamicType(); | 4888 type = const DynamicType(); |
| 4887 } else { | 4889 } else { |
| 4888 type = element.enclosingClass.rawType; | 4890 type = element.enclosingClass.rawType; |
| 4889 } | 4891 } |
| 4890 } | 4892 } |
| 4891 resolver.registry.setType(expression, type); | 4893 resolver.registry.setType(expression, type); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4945 MessageKind.CANNOT_RESOLVE, | 4947 MessageKind.CANNOT_RESOLVE, |
| 4946 {'name': name}); | 4948 {'name': name}); |
| 4947 } else if (element.isErroneous) { | 4949 } else if (element.isErroneous) { |
| 4948 return element; | 4950 return element; |
| 4949 } else if (element.isTypedef) { | 4951 } else if (element.isTypedef) { |
| 4950 error(node, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, | 4952 error(node, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, |
| 4951 {'typedefName': name}); | 4953 {'typedefName': name}); |
| 4952 element = new ErroneousConstructorElementX( | 4954 element = new ErroneousConstructorElementX( |
| 4953 MessageKind.CANNOT_INSTANTIATE_TYPEDEF, | 4955 MessageKind.CANNOT_INSTANTIATE_TYPEDEF, |
| 4954 {'typedefName': name}, name, resolver.enclosingElement); | 4956 {'typedefName': name}, name, resolver.enclosingElement); |
| 4957 registry.registerThrowRuntimeError(); |
| 4955 } else if (element.isTypeVariable) { | 4958 } else if (element.isTypeVariable) { |
| 4956 error(node, MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, | 4959 error(node, MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, |
| 4957 {'typeVariableName': name}); | 4960 {'typeVariableName': name}); |
| 4958 element = new ErroneousConstructorElementX( | 4961 element = new ErroneousConstructorElementX( |
| 4959 MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, | 4962 MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, |
| 4960 {'typeVariableName': name}, name, resolver.enclosingElement); | 4963 {'typeVariableName': name}, name, resolver.enclosingElement); |
| 4964 registry.registerThrowRuntimeError(); |
| 4961 } else if (!element.isClass && !element.isPrefix) { | 4965 } else if (!element.isClass && !element.isPrefix) { |
| 4962 error(node, MessageKind.NOT_A_TYPE, {'node': name}); | 4966 error(node, MessageKind.NOT_A_TYPE, {'node': name}); |
| 4963 element = new ErroneousConstructorElementX( | 4967 element = new ErroneousConstructorElementX( |
| 4964 MessageKind.NOT_A_TYPE, {'node': name}, name, | 4968 MessageKind.NOT_A_TYPE, {'node': name}, name, |
| 4965 resolver.enclosingElement); | 4969 resolver.enclosingElement); |
| 4970 registry.registerThrowRuntimeError(); |
| 4966 } | 4971 } |
| 4967 return element; | 4972 return element; |
| 4968 } | 4973 } |
| 4969 | 4974 |
| 4970 /// Assumed to be called by [resolveRedirectingFactory]. | 4975 /// Assumed to be called by [resolveRedirectingFactory]. |
| 4971 Element visitRedirectingFactoryBody(RedirectingFactoryBody node) { | 4976 Element visitRedirectingFactoryBody(RedirectingFactoryBody node) { |
| 4972 Node constructorReference = node.constructorReference; | 4977 Node constructorReference = node.constructorReference; |
| 4973 return finishConstructorReference(visit(constructorReference), | 4978 return finishConstructorReference(visit(constructorReference), |
| 4974 constructorReference, node); | 4979 constructorReference, node); |
| 4975 } | 4980 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5039 } | 5044 } |
| 5040 | 5045 |
| 5041 /// The result for the resolution of the `assert` method. | 5046 /// The result for the resolution of the `assert` method. |
| 5042 class AssertResult implements ResolutionResult { | 5047 class AssertResult implements ResolutionResult { |
| 5043 const AssertResult(); | 5048 const AssertResult(); |
| 5044 | 5049 |
| 5045 Element get element => null; | 5050 Element get element => null; |
| 5046 | 5051 |
| 5047 String toString() => 'AssertResult()'; | 5052 String toString() => 'AssertResult()'; |
| 5048 } | 5053 } |
| OLD | NEW |