| 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 testing.abstract_context; | 5 library testing.abstract_context; |
| 6 | 6 |
| 7 import 'mock_sdk.dart'; | 7 import 'mock_sdk.dart'; |
| 8 import 'package:analyzer/file_system/file_system.dart'; | 8 import 'package:analyzer/file_system/file_system.dart'; |
| 9 import 'package:analyzer/file_system/memory_file_system.dart'; | 9 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 CompilationUnit resolveLibraryUnit(Source source) { | 75 CompilationUnit resolveLibraryUnit(Source source) { |
| 76 return context.resolveCompilationUnit2(source, source); | 76 return context.resolveCompilationUnit2(source, source); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void setUp() { | 79 void setUp() { |
| 80 resourceResolver = new ResourceUriResolver(provider); | 80 resourceResolver = new ResourceUriResolver(provider); |
| 81 context = AnalysisEngine.instance.createAnalysisContext(); | 81 context = AnalysisEngine.instance.createAnalysisContext(); |
| 82 context.sourceFactory = new SourceFactory([SDK_RESOLVER, resourceResolver]); | 82 context.sourceFactory = new SourceFactory([SDK_RESOLVER, resourceResolver]); |
| 83 { |
| 84 AnalysisOptionsImpl options = |
| 85 new AnalysisOptionsImpl.con1(context.analysisOptions); |
| 86 options.enableAsync = true; |
| 87 options.enableEnum = true; |
| 88 context.analysisOptions = options; |
| 89 } |
| 83 } | 90 } |
| 84 | 91 |
| 85 void tearDown() { | 92 void tearDown() { |
| 86 context = null; | 93 context = null; |
| 87 provider = null; | 94 provider = null; |
| 88 } | 95 } |
| 89 } | 96 } |
| 90 | 97 |
| 91 | 98 |
| 92 /** | 99 /** |
| 93 * Wraps the given [_ElementVisitorFunction] into an instance of | 100 * Wraps the given [_ElementVisitorFunction] into an instance of |
| 94 * [engine.GeneralizingElementVisitor]. | 101 * [engine.GeneralizingElementVisitor]. |
| 95 */ | 102 */ |
| 96 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { | 103 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { |
| 97 final _ElementVisitorFunction function; | 104 final _ElementVisitorFunction function; |
| 98 _ElementVisitorFunctionWrapper(this.function); | 105 _ElementVisitorFunctionWrapper(this.function); |
| 99 visitElement(Element element) { | 106 visitElement(Element element) { |
| 100 function(element); | 107 function(element); |
| 101 super.visitElement(element); | 108 super.visitElement(element); |
| 102 } | 109 } |
| 103 } | 110 } |
| OLD | NEW |