Index: pkg/compiler/lib/src/js_backend/codegen/task.dart |
diff --git a/pkg/compiler/lib/src/js_backend/codegen/task.dart b/pkg/compiler/lib/src/js_backend/codegen/task.dart |
index 3a46bda3aaa8787271882c77f8890c7f66c6519b..89cf74c200ca98c655a7461c10752d06096165c7 100644 |
--- a/pkg/compiler/lib/src/js_backend/codegen/task.dart |
+++ b/pkg/compiler/lib/src/js_backend/codegen/task.dart |
@@ -21,7 +21,7 @@ import '../../types/types.dart' show TypeMask, UnionTypeMask, FlatTypeMask, |
ForwardingTypeMask; |
import '../../elements/elements.dart'; |
import '../../js/js.dart' as js; |
-import '../../io/source_information.dart' show StartEndSourceInformation; |
+import '../../io/source_information.dart' show SourceInformationFactory; |
import '../../tree_ir/tree_ir_builder.dart' as tree_builder; |
import '../../dart_backend/backend_ast_emitter.dart' as backend_ast_emitter; |
import '../../cps_ir/optimizers.dart'; |
@@ -39,6 +39,7 @@ class CpsFunctionCompiler implements FunctionCompiler { |
final ConstantSystem constantSystem; |
final Compiler compiler; |
final Glue glue; |
+ final SourceInformationFactory sourceInformationFactory; |
TypeSystem types; |
@@ -50,9 +51,10 @@ class CpsFunctionCompiler implements FunctionCompiler { |
IrBuilderTask get irBuilderTask => compiler.irBuilder; |
CpsFunctionCompiler(Compiler compiler, JavaScriptBackend backend, |
- {bool generateSourceMap: true}) |
+ SourceInformationFactory sourceInformationFactory) |
: fallbackCompiler = |
- new ssa.SsaFunctionCompiler(backend, generateSourceMap), |
+ new ssa.SsaFunctionCompiler(backend, sourceInformationFactory), |
+ this.sourceInformationFactory = sourceInformationFactory, |
constantSystem = backend.constantSystem, |
compiler = compiler, |
glue = new Glue(compiler); |
@@ -221,7 +223,6 @@ class CpsFunctionCompiler implements FunctionCompiler { |
js.Fun compileToJavaScript(CodegenWorkItem work, |
tree_ir.FunctionDefinition definition) { |
CodeGenerator codeGen = new CodeGenerator(glue, work.registry); |
- |
return attachPosition(codeGen.buildFunction(definition), work.element); |
} |
@@ -232,6 +233,7 @@ class CpsFunctionCompiler implements FunctionCompiler { |
js.Node attachPosition(js.Node node, AstElement element) { |
return node.withSourceInformation( |
- StartEndSourceInformation.computeSourceInformation(element)); |
+ sourceInformationFactory.forContext(element) |
+ .buildDeclaration(element)); |
} |
} |