dart-sdk/pkg/test_runner
Ömer Sinan Ağacan 10742d9a12 [dart2wasm] Generate source maps
This implements generating source maps for the generated Wasm files.

Copying dart2js's command line interface, a source map file with the
name `<program name>.wasm.map` is generated unless `--no-source-maps` is
passed.

When a source map is generated, the generated .wasm file gets a new
section `sourceMappingURL` with the contents `<program name>.wasm.map`.

This section seems to be undocumented, but Chrome and binaryen recognize
it as the URI to the source map file. Chrome is then loads it
automatically in the DevTools.

## Implementation

- `wasm_builder` package is updated with the new `source_map` library,
  which describes the source mapping entries.

- `wasm_builder`'s `InstructionsBuilder` is updated with the new public
  members:

  - `startSourceMapping`: starts mapping the instructions generated to
    the given source code.

  - `stopSourceMapping`: stops mapping the instructions generated to a
    source code. These instructions won't have a mapping in the source
    map.

- `CodeGenerator` sets the source file URI and location in the file
  when:

  - Starting compiling a new member
  - Compiling an expression and statement

Change-Id: Ic8f723f7a154402c0d34710689db57d640b83b86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370500
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-07-04 09:25:39 +00:00
..
bin
lib [dart2wasm] Generate source maps 2024-07-04 09:25:39 +00:00
test [test_runner] Fix error parsing: paths do not contain newlines. 2024-03-18 09:10:25 +00:00
tool [wiki] move the https://github.com/dart-lang/sdk/wiki to the docs/ dir 2024-05-16 18:19:40 +00:00
.gitignore
analysis_options.yaml [pkg] remove duplicate config from the analysis options files 2023-11-14 00:37:53 +00:00
OWNERS
pubspec.yaml