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:analysis_testing/mock_sdk.dart'; | 7 import 'package:analysis_testing/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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 | 40 |
41 class AbstractContextTest { | 41 class AbstractContextTest { |
42 static final DartSdk SDK = new MockSdk(); | 42 static final DartSdk SDK = new MockSdk(); |
43 static final UriResolver SDK_RESOLVER = new DartUriResolver(SDK); | 43 static final UriResolver SDK_RESOLVER = new DartUriResolver(SDK); |
44 | 44 |
45 MemoryResourceProvider provider = new MemoryResourceProvider(); | 45 MemoryResourceProvider provider = new MemoryResourceProvider(); |
46 UriResolver resourceResolver; | 46 UriResolver resourceResolver; |
47 AnalysisContext context; | 47 AnalysisContext context; |
48 | 48 |
49 | |
50 Source addSource(String path, String content) { | 49 Source addSource(String path, String content) { |
51 File file = provider.newFile(path, content); | 50 File file = provider.newFile(path, content); |
52 Source source = file.createSource(UriKind.FILE_URI); | 51 Source source = file.createSource(); |
53 ChangeSet changeSet = new ChangeSet(); | 52 ChangeSet changeSet = new ChangeSet(); |
54 changeSet.addedSource(source); | 53 changeSet.addedSource(source); |
55 context.applyChanges(changeSet); | 54 context.applyChanges(changeSet); |
56 context.setContents(source, content); | 55 context.setContents(source, content); |
57 return source; | 56 return source; |
58 } | 57 } |
59 | 58 |
60 /** | 59 /** |
61 * Performs all analysis tasks in [context]. | 60 * Performs all analysis tasks in [context]. |
62 */ | 61 */ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 * [engine.GeneralizingElementVisitor]. | 94 * [engine.GeneralizingElementVisitor]. |
96 */ | 95 */ |
97 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { | 96 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { |
98 final _ElementVisitorFunction function; | 97 final _ElementVisitorFunction function; |
99 _ElementVisitorFunctionWrapper(this.function); | 98 _ElementVisitorFunctionWrapper(this.function); |
100 visitElement(Element element) { | 99 visitElement(Element element) { |
101 function(element); | 100 function(element); |
102 super.visitElement(element); | 101 super.visitElement(element); |
103 } | 102 } |
104 } | 103 } |
OLD | NEW |