Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: pkg/analyzer/test/src/context/abstract_context.dart

Issue 2226613004: Suppress follow-on errors when a file is imported with either a prefix or a show clause (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cache URI existence in a modifier' Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.src.context.abstract_context; 5 library analyzer.test.src.context.abstract_context;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/dart/element/visitor.dart'; 9 import 'package:analyzer/dart/element/visitor.dart';
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 outputs = task.outputs; 116 outputs = task.outputs;
117 for (ResultDescriptor descriptor in task.descriptor.results) { 117 for (ResultDescriptor descriptor in task.descriptor.results) {
118 expect(outputs, contains(descriptor)); 118 expect(outputs, contains(descriptor));
119 } 119 }
120 } 120 }
121 121
122 AnalysisContextImpl createAnalysisContext() { 122 AnalysisContextImpl createAnalysisContext() {
123 return new AnalysisContextImpl(); 123 return new AnalysisContextImpl();
124 } 124 }
125 125
126 DartSdk createDartSdk() => new MockSdk(); 126 DartSdk createDartSdk() => new MockSdk(resourceProvider: resourceProvider);
127 127
128 Source newSource(String path, [String content = '']) { 128 Source newSource(String path, [String content = '']) {
129 File file = resourceProvider.newFile(path, content); 129 File file = resourceProvider.newFile(path, content);
130 return file.createSource(); 130 return file.createSource();
131 } 131 }
132 132
133 List<Source> newSources(Map<String, String> sourceMap) { 133 List<Source> newSources(Map<String, String> sourceMap) {
134 List<Source> sources = <Source>[]; 134 List<Source> sources = <Source>[];
135 sourceMap.forEach((String path, String content) { 135 sourceMap.forEach((String path, String content) {
136 Source source = newSource(path, content); 136 Source source = newSource(path, content);
137 sources.add(source); 137 sources.add(source);
138 }); 138 });
139 return sources; 139 return sources;
140 } 140 }
141 141
142 void prepareAnalysisContext([AnalysisOptions options]) { 142 void prepareAnalysisContext([AnalysisOptions options]) {
143 sdk = createDartSdk(); 143 sdk = createDartSdk();
144 sdkResolver = new DartUriResolver(sdk); 144 sdkResolver = new DartUriResolver(sdk);
145 resourceResolver = new ResourceUriResolver(resourceProvider); 145 resourceResolver = new ResourceUriResolver(resourceProvider);
146 sourceFactory = 146 sourceFactory = new SourceFactory(
147 new SourceFactory(<UriResolver>[sdkResolver, resourceResolver]); 147 <UriResolver>[sdkResolver, resourceResolver], null, resourceProvider);
148 context = createAnalysisContext(); 148 context = createAnalysisContext();
149 if (options != null) { 149 if (options != null) {
150 context.analysisOptions = options; 150 context.analysisOptions = options;
151 } 151 }
152 context.sourceFactory = sourceFactory; 152 context.sourceFactory = sourceFactory;
153 analysisCache = context.analysisCache; 153 analysisCache = context.analysisCache;
154 analysisDriver = context.driver; 154 analysisDriver = context.driver;
155 } 155 }
156 156
157 CompilationUnit resolveLibraryUnit(Source source) { 157 CompilationUnit resolveLibraryUnit(Source source) {
(...skipping 22 matching lines...) Expand all
180 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { 180 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor {
181 final _ElementVisitorFunction function; 181 final _ElementVisitorFunction function;
182 182
183 _ElementVisitorFunctionWrapper(this.function); 183 _ElementVisitorFunctionWrapper(this.function);
184 184
185 visitElement(Element element) { 185 visitElement(Element element) {
186 function(element); 186 function(element);
187 super.visitElement(element); 187 super.visitElement(element);
188 } 188 }
189 } 189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698