Index: pkg/compiler/lib/src/js_backend/backend.dart |
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart |
index bdd1cc3a191627127c1f758e0476e1f6ecff0083..a6aff4b0a211d913c0acaf45959430b43f7e2e66 100644 |
--- a/pkg/compiler/lib/src/js_backend/backend.dart |
+++ b/pkg/compiler/lib/src/js_backend/backend.dart |
@@ -1451,7 +1451,15 @@ class JavaScriptBackend extends Backend { |
} |
} |
- generatedCode[element] = functionCompiler.compile(work); |
+ jsAst.Fun code = functionCompiler.compile(work); |
+ if (const bool.fromEnvironment('instrumentForCoverage') |
+ && compiler.dumpInfo) { |
+ // TODO(sigmund): do this properly (e.g. add an embedded global, etc). |
+ code.body.statements.insert(0, js.statement( |
+ '__record_use("${element.hashCode}", "${element.name}")')); |
+ } |
+ |
+ generatedCode[element] = code; |
return const WorldImpact(); |
} |