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