| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 407 |
| 408 /** | 408 /** |
| 409 * Helper for creating and managing single [AnalysisContext]. | 409 * Helper for creating and managing single [AnalysisContext]. |
| 410 */ | 410 */ |
| 411 class AnalysisContextHelper { | 411 class AnalysisContextHelper { |
| 412 AnalysisContext context; | 412 AnalysisContext context; |
| 413 | 413 |
| 414 /** | 414 /** |
| 415 * Creates new [AnalysisContext] using [AnalysisContextFactory.contextWithCore
]. | 415 * Creates new [AnalysisContext] using [AnalysisContextFactory.contextWithCore
]. |
| 416 */ | 416 */ |
| 417 AnalysisContextHelper() { | 417 AnalysisContextHelper([AnalysisOptionsImpl options]) { |
| 418 context = AnalysisContextFactory.contextWithCore(); | 418 if (options == null) { |
| 419 AnalysisOptionsImpl options = | 419 options = new AnalysisOptionsImpl(); |
| 420 new AnalysisOptionsImpl.from(context.analysisOptions); | 420 } |
| 421 options.cacheSize = 256; | 421 options.cacheSize = 256; |
| 422 context.analysisOptions = options; | 422 context = AnalysisContextFactory.contextWithCoreAndOptions(options); |
| 423 } | 423 } |
| 424 | 424 |
| 425 Source addSource(String path, String code) { | 425 Source addSource(String path, String code) { |
| 426 Source source = new FileBasedSource(FileUtilities2.createFile(path)); | 426 Source source = new FileBasedSource(FileUtilities2.createFile(path)); |
| 427 if (path.endsWith(".dart") || path.endsWith(".html")) { | 427 if (path.endsWith(".dart") || path.endsWith(".html")) { |
| 428 ChangeSet changeSet = new ChangeSet(); | 428 ChangeSet changeSet = new ChangeSet(); |
| 429 changeSet.addedSource(source); | 429 changeSet.addedSource(source); |
| 430 context.applyChanges(changeSet); | 430 context.applyChanges(changeSet); |
| 431 } | 431 } |
| 432 context.setContents(source, code); | 432 context.setContents(source, code); |
| (...skipping 13378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13811 // check propagated type | 13811 // check propagated type |
| 13812 FunctionType propagatedType = node.propagatedType as FunctionType; | 13812 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 13813 expect(propagatedType.returnType, test.typeProvider.stringType); | 13813 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 13814 } on AnalysisException catch (e, stackTrace) { | 13814 } on AnalysisException catch (e, stackTrace) { |
| 13815 thrownException[0] = new CaughtException(e, stackTrace); | 13815 thrownException[0] = new CaughtException(e, stackTrace); |
| 13816 } | 13816 } |
| 13817 } | 13817 } |
| 13818 return null; | 13818 return null; |
| 13819 } | 13819 } |
| 13820 } | 13820 } |
| OLD | NEW |