| 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 analyzer.test.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2393 // We cannot use either ElementFactory or TestTypeProvider (which uses | 2393 // We cannot use either ElementFactory or TestTypeProvider (which uses |
| 2394 // ElementFactory) because we side-effect the elements in ways that would | 2394 // ElementFactory) because we side-effect the elements in ways that would |
| 2395 // break other tests. | 2395 // break other tests. |
| 2396 // | 2396 // |
| 2397 InterfaceType objectType = _classElement("Object", null).type; | 2397 InterfaceType objectType = _classElement("Object", null).type; |
| 2398 InterfaceType boolType = _classElement("bool", objectType).type; | 2398 InterfaceType boolType = _classElement("bool", objectType).type; |
| 2399 InterfaceType numType = _classElement("num", objectType).type; | 2399 InterfaceType numType = _classElement("num", objectType).type; |
| 2400 InterfaceType doubleType = _classElement("double", numType).type; | 2400 InterfaceType doubleType = _classElement("double", numType).type; |
| 2401 InterfaceType functionType = _classElement("Function", objectType).type; | 2401 InterfaceType functionType = _classElement("Function", objectType).type; |
| 2402 InterfaceType futureType = _classElement("Future", objectType, ["T"]).type; | 2402 InterfaceType futureType = _classElement("Future", objectType, ["T"]).type; |
| 2403 InterfaceType futureOrType = _classElement("FutureOr", objectType, ["T"]).ty
pe; |
| 2403 InterfaceType intType = _classElement("int", numType).type; | 2404 InterfaceType intType = _classElement("int", numType).type; |
| 2404 InterfaceType iterableType = | 2405 InterfaceType iterableType = |
| 2405 _classElement("Iterable", objectType, ["T"]).type; | 2406 _classElement("Iterable", objectType, ["T"]).type; |
| 2406 InterfaceType listType = _classElement("List", objectType, ["E"]).type; | 2407 InterfaceType listType = _classElement("List", objectType, ["E"]).type; |
| 2407 InterfaceType mapType = _classElement("Map", objectType, ["K", "V"]).type; | 2408 InterfaceType mapType = _classElement("Map", objectType, ["K", "V"]).type; |
| 2408 InterfaceType stackTraceType = _classElement("StackTrace", objectType).type; | 2409 InterfaceType stackTraceType = _classElement("StackTrace", objectType).type; |
| 2409 InterfaceType streamType = _classElement("Stream", objectType, ["T"]).type; | 2410 InterfaceType streamType = _classElement("Stream", objectType, ["T"]).type; |
| 2410 InterfaceType stringType = _classElement("String", objectType).type; | 2411 InterfaceType stringType = _classElement("String", objectType).type; |
| 2411 InterfaceType symbolType = _classElement("Symbol", objectType).type; | 2412 InterfaceType symbolType = _classElement("Symbol", objectType).type; |
| 2412 InterfaceType typeType = _classElement("Type", objectType).type; | 2413 InterfaceType typeType = _classElement("Type", objectType).type; |
| 2413 CompilationUnitElementImpl coreUnit = | 2414 CompilationUnitElementImpl coreUnit = |
| 2414 new CompilationUnitElementImpl("core.dart"); | 2415 new CompilationUnitElementImpl("core.dart"); |
| 2415 coreUnit.types = <ClassElement>[ | 2416 coreUnit.types = <ClassElement>[ |
| 2416 boolType.element, | 2417 boolType.element, |
| 2417 doubleType.element, | 2418 doubleType.element, |
| 2418 functionType.element, | 2419 functionType.element, |
| 2419 intType.element, | 2420 intType.element, |
| 2420 iterableType.element, | 2421 iterableType.element, |
| 2421 listType.element, | 2422 listType.element, |
| 2422 mapType.element, | 2423 mapType.element, |
| 2423 objectType.element, | 2424 objectType.element, |
| 2424 stackTraceType.element, | 2425 stackTraceType.element, |
| 2425 stringType.element, | 2426 stringType.element, |
| 2426 symbolType.element, | 2427 symbolType.element, |
| 2427 typeType.element | 2428 typeType.element |
| 2428 ]; | 2429 ]; |
| 2429 CompilationUnitElementImpl asyncUnit = | 2430 CompilationUnitElementImpl asyncUnit = |
| 2430 new CompilationUnitElementImpl("async.dart"); | 2431 new CompilationUnitElementImpl("async.dart"); |
| 2431 asyncUnit.types = <ClassElement>[futureType.element, streamType.element]; | 2432 asyncUnit.types = <ClassElement>[futureType.element, futureOrType.element, s
treamType.element]; |
| 2432 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); | 2433 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); |
| 2433 LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode( | 2434 LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode( |
| 2434 context, AstTestFactory.libraryIdentifier2(["dart.core"])); | 2435 context, AstTestFactory.libraryIdentifier2(["dart.core"])); |
| 2435 coreLibrary.definingCompilationUnit = coreUnit; | 2436 coreLibrary.definingCompilationUnit = coreUnit; |
| 2436 LibraryElementImpl asyncLibrary = new LibraryElementImpl.forNode( | 2437 LibraryElementImpl asyncLibrary = new LibraryElementImpl.forNode( |
| 2437 context, AstTestFactory.libraryIdentifier2(["dart.async"])); | 2438 context, AstTestFactory.libraryIdentifier2(["dart.async"])); |
| 2438 asyncLibrary.definingCompilationUnit = asyncUnit; | 2439 asyncLibrary.definingCompilationUnit = asyncUnit; |
| 2439 // | 2440 // |
| 2440 // Create a type provider and ensure that it can return the expected types. | 2441 // Create a type provider and ensure that it can return the expected types. |
| 2441 // | 2442 // |
| 2442 TypeProviderImpl provider = new TypeProviderImpl(coreLibrary, asyncLibrary); | 2443 TypeProviderImpl provider = new TypeProviderImpl(coreLibrary, asyncLibrary); |
| 2443 expect(provider.boolType, same(boolType)); | 2444 expect(provider.boolType, same(boolType)); |
| 2444 expect(provider.bottomType, isNotNull); | 2445 expect(provider.bottomType, isNotNull); |
| 2445 expect(provider.doubleType, same(doubleType)); | 2446 expect(provider.doubleType, same(doubleType)); |
| 2446 expect(provider.dynamicType, isNotNull); | 2447 expect(provider.dynamicType, isNotNull); |
| 2447 expect(provider.functionType, same(functionType)); | 2448 expect(provider.functionType, same(functionType)); |
| 2448 expect(provider.futureType, same(futureType)); | 2449 expect(provider.futureType, same(futureType)); |
| 2450 expect(provider.futureOrType, same(futureOrType)); |
| 2449 expect(provider.intType, same(intType)); | 2451 expect(provider.intType, same(intType)); |
| 2450 expect(provider.listType, same(listType)); | 2452 expect(provider.listType, same(listType)); |
| 2451 expect(provider.mapType, same(mapType)); | 2453 expect(provider.mapType, same(mapType)); |
| 2452 expect(provider.objectType, same(objectType)); | 2454 expect(provider.objectType, same(objectType)); |
| 2453 expect(provider.stackTraceType, same(stackTraceType)); | 2455 expect(provider.stackTraceType, same(stackTraceType)); |
| 2454 expect(provider.streamType, same(streamType)); | 2456 expect(provider.streamType, same(streamType)); |
| 2455 expect(provider.stringType, same(stringType)); | 2457 expect(provider.stringType, same(stringType)); |
| 2456 expect(provider.symbolType, same(symbolType)); | 2458 expect(provider.symbolType, same(symbolType)); |
| 2457 expect(provider.typeType, same(typeType)); | 2459 expect(provider.typeType, same(typeType)); |
| 2458 } | 2460 } |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3589 */ | 3591 */ |
| 3590 class _StaleElement extends ElementImpl { | 3592 class _StaleElement extends ElementImpl { |
| 3591 _StaleElement() : super("_StaleElement", -1); | 3593 _StaleElement() : super("_StaleElement", -1); |
| 3592 | 3594 |
| 3593 @override | 3595 @override |
| 3594 get kind => throw "_StaleElement's kind shouldn't be accessed"; | 3596 get kind => throw "_StaleElement's kind shouldn't be accessed"; |
| 3595 | 3597 |
| 3596 @override | 3598 @override |
| 3597 /*=T*/ accept/*<T>*/(_) => throw "_StaleElement shouldn't be visited"; | 3599 /*=T*/ accept/*<T>*/(_) => throw "_StaleElement shouldn't be visited"; |
| 3598 } | 3600 } |
| OLD | NEW |