| 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 14cc633582ddab1c59fb77b351d27f1dcd54554d..d784197b177673efbf2cfc3424983d78a736760d 100644
|
| --- a/pkg/compiler/lib/src/js_backend/codegen/task.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/codegen/task.dart
|
| @@ -34,6 +34,7 @@ import '../../cps_ir/cps_ir_nodes_sexpr.dart';
|
|
|
| class CpsFunctionCompiler implements FunctionCompiler {
|
| final ConstantSystem constantSystem;
|
| + // TODO(karlklose): remove the compiler.
|
| final Compiler compiler;
|
| final Glue glue;
|
| final SourceInformationStrategy sourceInformationFactory;
|
| @@ -56,6 +57,8 @@ class CpsFunctionCompiler implements FunctionCompiler {
|
|
|
| String get name => 'CPS Ir pipeline';
|
|
|
| + JavaScriptBackend get backend => compiler.backend;
|
| +
|
| /// Generates JavaScript code for `work.element`.
|
| js.Fun compile(CodegenWorkItem work) {
|
| AstElement element = work.element;
|
| @@ -213,7 +216,13 @@ 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);
|
| + Element element = work.element;
|
| + js.Fun code = codeGen.buildFunction(definition);
|
| + if (element is FunctionElement && element.asyncMarker != AsyncMarker.SYNC) {
|
| + code = backend.rewriteAsync(element, code);
|
| + work.registry.registerAsyncMarker(element);
|
| + }
|
| + return attachPosition(code, element);
|
| }
|
|
|
| Iterable<CompilerTask> get tasks {
|
|
|