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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 2690083002: Add MultiSourceInformationStrategy (Closed)
Patch Set: Cleanup. 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
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 js_backend.backend; 5 library js_backend.backend;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
10 10
(...skipping 12 matching lines...) Expand all
23 import '../constants/values.dart'; 23 import '../constants/values.dart';
24 import '../core_types.dart' show CommonElements, ElementEnvironment; 24 import '../core_types.dart' show CommonElements, ElementEnvironment;
25 import '../deferred_load.dart' show DeferredLoadTask; 25 import '../deferred_load.dart' show DeferredLoadTask;
26 import '../dump_info.dart' show DumpInfoTask; 26 import '../dump_info.dart' show DumpInfoTask;
27 import '../elements/elements.dart'; 27 import '../elements/elements.dart';
28 import '../elements/entities.dart'; 28 import '../elements/entities.dart';
29 import '../elements/resolution_types.dart'; 29 import '../elements/resolution_types.dart';
30 import '../elements/types.dart'; 30 import '../elements/types.dart';
31 import '../enqueue.dart' 31 import '../enqueue.dart'
32 show Enqueuer, EnqueueTask, ResolutionEnqueuer, TreeShakingEnqueuerStrategy; 32 show Enqueuer, EnqueueTask, ResolutionEnqueuer, TreeShakingEnqueuerStrategy;
33 import '../io/multi_information.dart' show MultiSourceInformationStrategy;
33 import '../io/position_information.dart' show PositionSourceInformationStrategy; 34 import '../io/position_information.dart' show PositionSourceInformationStrategy;
34 import '../io/source_information.dart' show SourceInformationStrategy; 35 import '../io/source_information.dart' show SourceInformationStrategy;
35 import '../io/start_end_information.dart' 36 import '../io/start_end_information.dart'
36 show StartEndSourceInformationStrategy; 37 show StartEndSourceInformationStrategy;
37 import '../js/js.dart' as jsAst; 38 import '../js/js.dart' as jsAst;
38 import '../js/js.dart' show js; 39 import '../js/js.dart' show js;
39 import '../js/js_source_mapping.dart' show JavaScriptSourceInformationStrategy; 40 import '../js/js_source_mapping.dart' show JavaScriptSourceInformationStrategy;
40 import '../js/rewrite_async.dart'; 41 import '../js/rewrite_async.dart';
41 import '../js_emitter/js_emitter.dart' show CodeEmitterTask; 42 import '../js_emitter/js_emitter.dart' show CodeEmitterTask;
42 import '../kernel/task.dart'; 43 import '../kernel/task.dart';
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 final BackendImpacts impacts; 514 final BackendImpacts impacts;
514 515
515 /// Common classes used by the backend. 516 /// Common classes used by the backend.
516 BackendClasses backendClasses; 517 BackendClasses backendClasses;
517 518
518 /// Backend access to the front-end. 519 /// Backend access to the front-end.
519 final JSFrontendAccess frontend; 520 final JSFrontendAccess frontend;
520 521
521 Tracer tracer; 522 Tracer tracer;
522 523
524 static SourceInformationStrategy createSourceInformationStrategy(
525 {bool generateSourceMap: false,
526 bool useMultiSourceInfo: false,
527 bool useNewSourceInfo: false}) {
528 if (!generateSourceMap) return const JavaScriptSourceInformationStrategy();
529 if (useMultiSourceInfo) {
530 if (useNewSourceInfo) {
531 return const MultiSourceInformationStrategy(const [
532 const PositionSourceInformationStrategy(),
533 const StartEndSourceInformationStrategy()
534 ]);
535 } else {
536 return const MultiSourceInformationStrategy(const [
537 const StartEndSourceInformationStrategy(),
538 const PositionSourceInformationStrategy()
539 ]);
540 }
541 } else if (useNewSourceInfo) {
542 return const PositionSourceInformationStrategy();
543 } else {
544 return const StartEndSourceInformationStrategy();
545 }
546 }
547
523 JavaScriptBackend(Compiler compiler, 548 JavaScriptBackend(Compiler compiler,
524 {bool generateSourceMap: true, 549 {bool generateSourceMap: true,
525 bool useStartupEmitter: false, 550 bool useStartupEmitter: false,
551 bool useMultiSourceInfo: false,
526 bool useNewSourceInfo: false, 552 bool useNewSourceInfo: false,
527 bool useKernel: false}) 553 bool useKernel: false})
528 : rti = new _RuntimeTypes(compiler), 554 : rti = new _RuntimeTypes(compiler),
529 rtiEncoder = new _RuntimeTypesEncoder(compiler), 555 rtiEncoder = new _RuntimeTypesEncoder(compiler),
530 annotations = new Annotations(compiler), 556 annotations = new Annotations(compiler),
531 this.sourceInformationStrategy = generateSourceMap 557 this.sourceInformationStrategy = createSourceInformationStrategy(
532 ? (useNewSourceInfo 558 generateSourceMap: generateSourceMap,
533 ? new PositionSourceInformationStrategy() 559 useMultiSourceInfo: useMultiSourceInfo,
534 : const StartEndSourceInformationStrategy()) 560 useNewSourceInfo: useNewSourceInfo),
535 : const JavaScriptSourceInformationStrategy(),
536 impacts = new BackendImpacts(compiler), 561 impacts = new BackendImpacts(compiler),
537 frontend = new JSFrontendAccess(compiler), 562 frontend = new JSFrontendAccess(compiler),
538 this.compiler = compiler { 563 this.compiler = compiler {
539 helpers = new BackendHelpers(compiler.elementEnvironment, commonElements); 564 helpers = new BackendHelpers(compiler.elementEnvironment, commonElements);
540 emitter = 565 emitter =
541 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); 566 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter);
542 typeVariableHandler = new TypeVariableHandler(compiler); 567 typeVariableHandler = new TypeVariableHandler(compiler);
543 customElementsAnalysis = new CustomElementsAnalysis(this); 568 customElementsAnalysis = new CustomElementsAnalysis(this);
544 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); 569 lookupMapAnalysis = new LookupMapAnalysis(this, reporter);
545 jsInteropAnalysis = new JsInteropAnalysis(this); 570 jsInteropAnalysis = new JsInteropAnalysis(this);
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after
3191 } 3216 }
3192 3217
3193 @override 3218 @override
3194 FieldEntity get symbolField => helpers.symbolImplementationField; 3219 FieldEntity get symbolField => helpers.symbolImplementationField;
3195 3220
3196 @override 3221 @override
3197 InterfaceType get symbolType { 3222 InterfaceType get symbolType {
3198 return _env.getRawType(helpers.symbolImplementationClass); 3223 return _env.getRawType(helpers.symbolImplementationClass);
3199 } 3224 }
3200 } 3225 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js/js_source_mapping.dart ('k') | pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698