| 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/context/context.dart' as newContext; | 9 import 'package:analyzer/src/context/context.dart' as newContext; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // | 129 // |
| 130 // dart:core | 130 // dart:core |
| 131 // | 131 // |
| 132 TestTypeProvider provider = new TestTypeProvider(); | 132 TestTypeProvider provider = new TestTypeProvider(); |
| 133 CompilationUnitElementImpl coreUnit = | 133 CompilationUnitElementImpl coreUnit = |
| 134 new CompilationUnitElementImpl("core.dart"); | 134 new CompilationUnitElementImpl("core.dart"); |
| 135 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 135 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
| 136 coreContext.setContents(coreSource, ""); | 136 coreContext.setContents(coreSource, ""); |
| 137 coreUnit.librarySource = coreUnit.source = coreSource; | 137 coreUnit.librarySource = coreUnit.source = coreSource; |
| 138 ClassElementImpl proxyClassElement = ElementFactory.classElement2("_Proxy"); | 138 ClassElementImpl proxyClassElement = ElementFactory.classElement2("_Proxy"); |
| 139 proxyClassElement.constructors = <ConstructorElement>[]; |
| 139 ClassElement objectClassElement = provider.objectType.element; | 140 ClassElement objectClassElement = provider.objectType.element; |
| 140 coreUnit.types = <ClassElement>[ | 141 coreUnit.types = <ClassElement>[ |
| 141 provider.boolType.element, | 142 provider.boolType.element, |
| 142 provider.deprecatedType.element, | 143 provider.deprecatedType.element, |
| 143 provider.doubleType.element, | 144 provider.doubleType.element, |
| 144 provider.functionType.element, | 145 provider.functionType.element, |
| 145 provider.intType.element, | 146 provider.intType.element, |
| 146 provider.iterableType.element, | 147 provider.iterableType.element, |
| 147 provider.iteratorType.element, | 148 provider.iteratorType.element, |
| 148 provider.listType.element, | 149 provider.listType.element, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 <TypeDefiningElement>[streamElement.typeParameters[0]], null) | 252 <TypeDefiningElement>[streamElement.typeParameters[0]], null) |
| 252 .type, | 253 .type, |
| 253 ]; | 254 ]; |
| 254 // TODO(brianwilkerson) This is missing the optional parameters. | 255 // TODO(brianwilkerson) This is missing the optional parameters. |
| 255 MethodElementImpl listenMethod = | 256 MethodElementImpl listenMethod = |
| 256 ElementFactory.methodElement('listen', returnType, parameterTypes); | 257 ElementFactory.methodElement('listen', returnType, parameterTypes); |
| 257 (listenMethod.type as FunctionTypeImpl).typeArguments = | 258 (listenMethod.type as FunctionTypeImpl).typeArguments = |
| 258 streamElement.type.typeArguments; | 259 streamElement.type.typeArguments; |
| 259 (parameterTypes[0] as FunctionTypeImpl).typeArguments = | 260 (parameterTypes[0] as FunctionTypeImpl).typeArguments = |
| 260 streamElement.type.typeArguments; | 261 streamElement.type.typeArguments; |
| 261 (parameterTypes[0].element as FunctionElementImpl) | 262 (parameterTypes[0].element as FunctionElementImpl).enclosingElement = |
| 262 .enclosingElement = listenMethod; | 263 listenMethod; |
| 263 streamElement.methods = <MethodElement>[listenMethod]; | 264 streamElement.methods = <MethodElement>[listenMethod]; |
| 264 | 265 |
| 265 asyncUnit.types = <ClassElement>[ | 266 asyncUnit.types = <ClassElement>[ |
| 266 completerElement, | 267 completerElement, |
| 267 futureElement, | 268 futureElement, |
| 268 streamElement | 269 streamElement |
| 269 ]; | 270 ]; |
| 270 LibraryElementImpl asyncLibrary = new LibraryElementImpl.forNode( | 271 LibraryElementImpl asyncLibrary = new LibraryElementImpl.forNode( |
| 271 coreContext, AstFactory.libraryIdentifier2(["dart", "async"])); | 272 coreContext, AstFactory.libraryIdentifier2(["dart", "async"])); |
| 272 asyncLibrary.definingCompilationUnit = asyncUnit; | 273 asyncLibrary.definingCompilationUnit = asyncUnit; |
| (...skipping 14850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15123 | 15124 |
| 15124 void _resolveTestUnit(String code) { | 15125 void _resolveTestUnit(String code) { |
| 15125 testCode = code; | 15126 testCode = code; |
| 15126 testSource = addSource(testCode); | 15127 testSource = addSource(testCode); |
| 15127 LibraryElement library = resolve2(testSource); | 15128 LibraryElement library = resolve2(testSource); |
| 15128 assertNoErrors(testSource); | 15129 assertNoErrors(testSource); |
| 15129 verify([testSource]); | 15130 verify([testSource]); |
| 15130 testUnit = resolveCompilationUnit(testSource, library); | 15131 testUnit = resolveCompilationUnit(testSource, library); |
| 15131 } | 15132 } |
| 15132 } | 15133 } |
| OLD | NEW |