| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.resolver_test; | 5 library engine.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 119 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
| 120 coreContext.setContents(coreSource, ""); | 120 coreContext.setContents(coreSource, ""); |
| 121 coreUnit.source = coreSource; | 121 coreUnit.source = coreSource; |
| 122 ClassElementImpl proxyClassElement = ElementFactory.classElement2("_Proxy"); | 122 ClassElementImpl proxyClassElement = ElementFactory.classElement2("_Proxy"); |
| 123 coreUnit.types = <ClassElement>[ | 123 coreUnit.types = <ClassElement>[ |
| 124 provider.boolType.element, | 124 provider.boolType.element, |
| 125 provider.deprecatedType.element, | 125 provider.deprecatedType.element, |
| 126 provider.doubleType.element, | 126 provider.doubleType.element, |
| 127 provider.functionType.element, | 127 provider.functionType.element, |
| 128 provider.intType.element, | 128 provider.intType.element, |
| 129 provider.iterableType.element, |
| 130 provider.iteratorType.element, |
| 129 provider.listType.element, | 131 provider.listType.element, |
| 130 provider.mapType.element, | 132 provider.mapType.element, |
| 131 provider.nullType.element, | 133 provider.nullType.element, |
| 132 provider.numType.element, | 134 provider.numType.element, |
| 133 provider.objectType.element, | 135 provider.objectType.element, |
| 134 proxyClassElement, | 136 proxyClassElement, |
| 135 provider.stackTraceType.element, | 137 provider.stackTraceType.element, |
| 136 provider.stringType.element, | 138 provider.stringType.element, |
| 137 provider.symbolType.element, | 139 provider.symbolType.element, |
| 138 provider.typeType.element]; | 140 provider.typeType.element]; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 154 false, | 156 false, |
| 155 proxyClassElement.type); | 157 proxyClassElement.type); |
| 156 TopLevelVariableElement deprecatedTopLevelVariableElt = | 158 TopLevelVariableElement deprecatedTopLevelVariableElt = |
| 157 ElementFactory.topLevelVariableElement3( | 159 ElementFactory.topLevelVariableElement3( |
| 158 "deprecated", | 160 "deprecated", |
| 159 true, | 161 true, |
| 160 false, | 162 false, |
| 161 provider.deprecatedType); | 163 provider.deprecatedType); |
| 162 coreUnit.accessors = <PropertyAccessorElement>[ | 164 coreUnit.accessors = <PropertyAccessorElement>[ |
| 163 proxyTopLevelVariableElt.getter, | 165 proxyTopLevelVariableElt.getter, |
| 164 proxyTopLevelVariableElt.setter, | 166 deprecatedTopLevelVariableElt.getter]; |
| 165 deprecatedTopLevelVariableElt.getter, | |
| 166 deprecatedTopLevelVariableElt.setter]; | |
| 167 coreUnit.topLevelVariables = <TopLevelVariableElement>[ | 167 coreUnit.topLevelVariables = <TopLevelVariableElement>[ |
| 168 proxyTopLevelVariableElt, | 168 proxyTopLevelVariableElt, |
| 169 deprecatedTopLevelVariableElt]; | 169 deprecatedTopLevelVariableElt]; |
| 170 LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode( | 170 LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode( |
| 171 coreContext, | 171 coreContext, |
| 172 AstFactory.libraryIdentifier2(["dart", "core"])); | 172 AstFactory.libraryIdentifier2(["dart", "core"])); |
| 173 coreLibrary.definingCompilationUnit = coreUnit; | 173 coreLibrary.definingCompilationUnit = coreUnit; |
| 174 // | 174 // |
| 175 // dart:async | 175 // dart:async |
| 176 // | 176 // |
| (...skipping 16 matching lines...) Expand all Loading... |
| 193 futureElement.type.typeArguments; | 193 futureElement.type.typeArguments; |
| 194 futureElement.constructors = <ConstructorElement>[futureConstructor]; | 194 futureElement.constructors = <ConstructorElement>[futureConstructor]; |
| 195 // Future then(onValue(T value), { Function onError }); | 195 // Future then(onValue(T value), { Function onError }); |
| 196 List<ParameterElement> parameters = <ParameterElement>[ | 196 List<ParameterElement> parameters = <ParameterElement>[ |
| 197 ElementFactory.requiredParameter2( | 197 ElementFactory.requiredParameter2( |
| 198 "value", | 198 "value", |
| 199 futureElement.typeParameters[0].type)]; | 199 futureElement.typeParameters[0].type)]; |
| 200 FunctionTypeAliasElementImpl aliasElement = | 200 FunctionTypeAliasElementImpl aliasElement = |
| 201 new FunctionTypeAliasElementImpl.forNode(null); | 201 new FunctionTypeAliasElementImpl.forNode(null); |
| 202 aliasElement.synthetic = true; | 202 aliasElement.synthetic = true; |
| 203 aliasElement.shareParameters(parameters); | 203 aliasElement.parameters = parameters; |
| 204 aliasElement.returnType = provider.dynamicType; | 204 aliasElement.returnType = provider.dynamicType; |
| 205 aliasElement.enclosingElement = asyncUnit; |
| 205 FunctionTypeImpl aliasType = new FunctionTypeImpl.con2(aliasElement); | 206 FunctionTypeImpl aliasType = new FunctionTypeImpl.con2(aliasElement); |
| 206 aliasElement.shareTypeParameters(futureElement.typeParameters); | 207 aliasElement.shareTypeParameters(futureElement.typeParameters); |
| 207 aliasType.typeArguments = futureElement.type.typeArguments; | 208 aliasType.typeArguments = futureElement.type.typeArguments; |
| 208 MethodElement thenMethod = ElementFactory.methodElementWithParameters( | 209 MethodElement thenMethod = ElementFactory.methodElementWithParameters( |
| 209 "then", | 210 "then", |
| 210 futureElement.type.typeArguments, | 211 futureElement.type.typeArguments, |
| 211 futureType, | 212 futureType, |
| 212 [ | 213 [ |
| 213 ElementFactory.requiredParameter2("onValue", aliasType), | 214 ElementFactory.requiredParameter2("onValue", aliasType), |
| 214 ElementFactory.namedParameter2("onError", provider.functionType)]); | 215 ElementFactory.namedParameter2("onError", provider.functionType)]); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 InterfaceType contextElementType = contextElement.type; | 247 InterfaceType contextElementType = contextElement.type; |
| 247 ClassElementImpl context2dElement = | 248 ClassElementImpl context2dElement = |
| 248 ElementFactory.classElement("CanvasRenderingContext2D", contextElementTy
pe); | 249 ElementFactory.classElement("CanvasRenderingContext2D", contextElementTy
pe); |
| 249 canvasElement.methods = <MethodElement>[ | 250 canvasElement.methods = <MethodElement>[ |
| 250 ElementFactory.methodElement( | 251 ElementFactory.methodElement( |
| 251 "getContext", | 252 "getContext", |
| 252 contextElementType, | 253 contextElementType, |
| 253 [provider.stringType])]; | 254 [provider.stringType])]; |
| 254 canvasElement.accessors = <PropertyAccessorElement>[ | 255 canvasElement.accessors = <PropertyAccessorElement>[ |
| 255 ElementFactory.getterElement("context2D", false, context2dElement.type)]
; | 256 ElementFactory.getterElement("context2D", false, context2dElement.type)]
; |
| 257 canvasElement.fields = canvasElement.accessors.map( |
| 258 (PropertyAccessorElement accessor) => accessor.variable).toList(); |
| 256 ClassElementImpl documentElement = | 259 ClassElementImpl documentElement = |
| 257 ElementFactory.classElement("Document", elementType); | 260 ElementFactory.classElement("Document", elementType); |
| 258 ClassElementImpl htmlDocumentElement = | 261 ClassElementImpl htmlDocumentElement = |
| 259 ElementFactory.classElement("HtmlDocument", documentElement.type); | 262 ElementFactory.classElement("HtmlDocument", documentElement.type); |
| 260 htmlDocumentElement.methods = <MethodElement>[ | 263 htmlDocumentElement.methods = <MethodElement>[ |
| 261 ElementFactory.methodElement( | 264 ElementFactory.methodElement( |
| 262 "query", | 265 "query", |
| 263 elementType, | 266 elementType, |
| 264 <DartType>[provider.stringType])]; | 267 <DartType>[provider.stringType])]; |
| 265 htmlUnit.types = <ClassElement>[ | 268 htmlUnit.types = <ClassElement>[ |
| (...skipping 13369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13635 // check propagated type | 13638 // check propagated type |
| 13636 FunctionType propagatedType = node.propagatedType as FunctionType; | 13639 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 13637 expect(propagatedType.returnType, test.typeProvider.stringType); | 13640 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 13638 } on AnalysisException catch (e, stackTrace) { | 13641 } on AnalysisException catch (e, stackTrace) { |
| 13639 thrownException[0] = new CaughtException(e, stackTrace); | 13642 thrownException[0] = new CaughtException(e, stackTrace); |
| 13640 } | 13643 } |
| 13641 } | 13644 } |
| 13642 return null; | 13645 return null; |
| 13643 } | 13646 } |
| 13644 } | 13647 } |
| OLD | NEW |