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

Side by Side Diff: pkg/compiler/lib/src/common/resolution.dart

Issue 2675103003: Refactor BackendHelpers to be reusageable with KernelWorldBuilder (Closed)
Patch Set: Updated cf. comments Created 3 years, 10 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
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.common.resolution; 5 library dart2js.common.resolution;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../compile_time_constants.dart'; 8 import '../compile_time_constants.dart';
9 import '../constants/expressions.dart' show ConstantExpression; 9 import '../constants/expressions.dart' show ConstantExpression;
10 import '../constants/values.dart' show ConstantValue; 10 import '../constants/values.dart' show ConstantValue;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 /// impact. 206 /// impact.
207 void emptyCache(); 207 void emptyCache();
208 208
209 /// Returns `true` if [value] is the top-level [proxy] annotation from the 209 /// Returns `true` if [value] is the top-level [proxy] annotation from the
210 /// core library. 210 /// core library.
211 bool isProxyConstant(ConstantValue value); 211 bool isProxyConstant(ConstantValue value);
212 } 212 }
213 213
214 /// A container of commonly used dependencies for tasks that involve parsing. 214 /// A container of commonly used dependencies for tasks that involve parsing.
215 abstract class ParsingContext { 215 abstract class ParsingContext {
216 factory ParsingContext(DiagnosticReporter reporter, ParserTask parser, 216 factory ParsingContext(
217 ScannerTask scanner, PatchParserTask patchParser, Backend backend) 217 DiagnosticReporter reporter,
218 = _ParsingContext; 218 ParserTask parser,
219 ScannerTask scanner,
220 PatchParserTask patchParser,
221 Backend backend) = _ParsingContext;
219 222
220 DiagnosticReporter get reporter; 223 DiagnosticReporter get reporter;
221 ParserTask get parser; 224 ParserTask get parser;
222 ScannerTask get scanner; 225 ScannerTask get scanner;
223 PatchParserTask get patchParser; 226 PatchParserTask get patchParser;
224 227
225 /// Use [patchParser] directly instead. 228 /// Use [patchParser] directly instead.
226 @deprecated 229 @deprecated
227 void parsePatchClass(ClassElement cls); 230 void parsePatchClass(ClassElement cls);
228 231
229 /// Use [parser] and measure directly instead. 232 /// Use [parser] and measure directly instead.
230 @deprecated 233 @deprecated
231 measure(f()); 234 measure(f());
232 235
233 /// Get the [ScannerOptions] to scan the given [element]. 236 /// Get the [ScannerOptions] to scan the given [element].
234 ScannerOptions getScannerOptionsFor(Element element); 237 ScannerOptions getScannerOptionsFor(Element element);
235 } 238 }
236 239
237 class _ParsingContext implements ParsingContext { 240 class _ParsingContext implements ParsingContext {
238 final DiagnosticReporter reporter; 241 final DiagnosticReporter reporter;
239 final ParserTask parser; 242 final ParserTask parser;
240 final ScannerTask scanner; 243 final ScannerTask scanner;
241 final PatchParserTask patchParser; 244 final PatchParserTask patchParser;
242 final Backend backend; 245 final Backend backend;
243 246
244 _ParsingContext(this.reporter, this.parser, this.scanner, this.patchParser, 247 _ParsingContext(
245 this.backend); 248 this.reporter, this.parser, this.scanner, this.patchParser, this.backend);
246 249
247 @override 250 @override
248 measure(f()) => parser.measure(f); 251 measure(f()) => parser.measure(f);
249 252
250 @override 253 @override
251 void parsePatchClass(ClassElement cls) { 254 void parsePatchClass(ClassElement cls) {
252 patchParser.measure(() { 255 patchParser.measure(() {
253 if (cls.isPatch) { 256 if (cls.isPatch) {
254 patchParser.parsePatchClassNode(cls); 257 patchParser.parsePatchClassNode(cls);
255 } 258 }
256 }); 259 });
257 } 260 }
258 261
259 @override 262 @override
260 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( 263 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions(
261 canUseNative: backend.canLibraryUseNative(element.library)); 264 canUseNative: backend.canLibraryUseNative(element.library));
262 } 265 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698