When fileUri was added to Constructors a few tests had to be marked as
failing. This CL fixes the issue.
Bug:
Change-Id: I1168fab05a8edfcd17416476b3abbaf9322d88b9
Reviewed-on: https://dart-review.googlesource.com/29580
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
When building source maps it is currently assumed that the fileUri is
non-null (or at least that the location extracted from the Uri and
offset is non-null.
That might not always be the case (e.g. see CL 29003).
Bug:
Change-Id: I29c928a0d5fcd2bd5e1d1ef6c6d6ac97d2e7408c
Reviewed-on: https://dart-review.googlesource.com/29120
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
* Fix possibly null-pointer at end of batch mode
* Fix changed fileUri type in source map printer
* Silence a few warnings in tests.
Bug:
Change-Id: Ief1b9b62205a7bc20924a9e5efc06b9c9c34896a
Reviewed-on: https://dart-review.googlesource.com/27945
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This CL creates the initial DDC-specific CFE entry point.
It is currently mostly a matter of copying the DDC code for running the
front-end into the front-end, although it also applies a workaround for
making batch-mode faster.
Local timings of running
tools/test.py -mrelease -cdartdevk -rnone --strong --checked language_2
before and after change:
* Before: [05:49 | 100% | + 5136 | - 0]
* After: [00:20 | 100% | + 5136 | - 0]
Change-Id: I799b54b406970c4aa8653b71aaffa2ba476ee9d9
Reviewed-on: https://dart-review.googlesource.com/24921
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Uri.base.resolve will correctly resolve relative paths to a absolute URI, but
when given any URI with a scheme (not just package: or dart:) it will resolve it
appropriately.
This change is needed to be able to specify a custom URI for an app-root
location from package:build.
Change-Id: Iecbda1690974d8bb7db5c5f227699dfa1fcb0619
Reviewed-on: https://dart-review.googlesource.com/25503
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This CL deprecates the front-end API and moves it into src/api_prototype.
For now all usages have been updated to point to the new location,
but they should be updated to use custom-client invocations instead (e.g.
one specific way for DDC, another for dart2js etc.)
Bug:
Change-Id: I9b4f41f6ebf55d42510fd35240d942d1dc7292d6
Reviewed-on: https://dart-review.googlesource.com/24822
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
This CL "finishes" the first iteration of adding sourcemaps to the
DDC-kernel pipeline. There will likely still be some work left to do,
but it can be added as it is noticed. Ideally by adding a test first.
This CL adds testing and fixes source maps for
- (Better) handling of async, async* and sync*
- Conditional expressions
- await for
- multi catch (catch on (...) { ... } catch on (...) { ... })
- yield
- variable set
- static set
- == and identical
- string concatenation
- is and as
- throw
- map literals
Bug:
Change-Id: Ia3e5145eff049d9829cb636864ef76f300e09615
Reviewed-on: https://dart-review.googlesource.com/24105
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
The simple nullability predicate would report that static fields are always
non-nullable. Change this to report that they are always nullable.
Bug:
Change-Id: I47336bc9686c3bee90d77e6130bd5cddfb9f8a68
Reviewed-on: https://dart-review.googlesource.com/23674
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
1. Catch bodies were unconditionally wrapped in a block, even when
they were already a block.
2. Finally was on a line by itself and indented incorrectly because of
an extra newline.
Bug:
Change-Id: I006cd2841c159a0fc86501bfaf282c7ad4c0ab0b
Reviewed-on: https://dart-review.googlesource.com/23580
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Compilation of Kernel's try/finally included a flattening optimization
when the body was a JS try/catch. This optimization duplicated the
catch block, which changes the semantics of exceptions thrown from the
catch block.
Bug:
Change-Id: I65aefa798d7f9026ab24ed6d1d484dea53235955
Reviewed-on: https://dart-review.googlesource.com/23560
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This CL adds source information to the wrapping code for async and named
parameters. This is done for the source mapping not making Chrome (etc)
point to something completely wrong.
Tests are added too.
Bug:
Change-Id: Ifcd16428e0ca8c273fd6377e93297bbfbb37d773
Reviewed-on: https://dart-review.googlesource.com/23480
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This CL adds a test for stepping into a constructor with initializers.
It additionally changes the stack map in the kernel pipeline to produce
a better result in this case.
Bug:
Change-Id: If0a43b030446c4a7370f386f0f51411d223dda83
Reviewed-on: https://dart-review.googlesource.com/20720
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Unlabeled while loops in Kernel (these are ones that are not the
target of a break) did not shadow labeled ones. The compiler would
generate a break without a label in JS which would target the wrong
loop.
Bug:
Change-Id: Ib060ab66326a3ea0779eaceccaf1ca06ccfafb75
Reviewed-on: https://dart-review.googlesource.com/23421
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This CL adds the bare minimum of source map generation for the kernel
pipeline in DDC.
It additionally introduces a testing framework that compiles dart files
with DDC (with or without kernel), steps through it via D8 and compares
the positions stopped at to the expected stop positions.
Bug:
Change-Id: Ie9e06164d8e51c973b83c46a8472e044876e4317
Reviewed-on: https://dart-review.googlesource.com/20662
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This involves a few main pieces:
- Add code to the GN scripts to generate DDC's patched SDK and then
compile it to summaries and JS in the build output directory.
- Add support to the underlying DDC build scripts to support controlling
which files are built where.
- Update test.dart to use the DDC SDK from the build directory.
- Update create_sdk to use the built SDK instead of the checked in one.
- Fix various internal DDC tools to build their own copy of the SDK
(since they can't easily find the one in the build directory because
it's path if config-specific) and use those.
- Delete the checked DDC SDK JS and summaries.
I think I got everything working. The built Dart SDK looks fine -- it's
identical to one built using the old build scripts.
The various tools and DDC's little test runner I *think* work, but there
may be a bug or two in there. I tried the various things I could and it
seems like they work but it's hard to tell since they may be kind of
broken right now anyway.
Bug:
Change-Id: Iea77915a5c1cc8450f60ebfbdf8c725c7ea2f32c
Reviewed-on: https://dart-review.googlesource.com/18144
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Kernel represents break and continue in Dart uniformly as break. When
compiling to JavaScript we would like to use continue where possible and
avoid labeling statements that do not need to be labeled.
The basic idea is: at compile time maintain a list of Kernel targets
(LabeledStatements) that can be compiled to JS break without a label at a
given point in the program, and a list of Kernel targets that can be
compiled to JS continue without a label, and a map from Kernel targets to
the 'effective' target that will be labeled if necessary when compiled to
JS, and a mapping from effective targets to their label names if they must
be labeled.
Change-Id: Ie660cf3dd68399ebff128116fe38c250cb6b7f35
Reviewed-on: https://dart-review.googlesource.com/21120
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Kernel try and finally statements do not necessarily compile to JS
blocks, but the JS AST requires blocks for try and finally. Ensure
that these statements are blocks.
Bug:
Change-Id: I7abe6ae55650dc726cc89d86d12757d21a783064
Reviewed-on: https://dart-review.googlesource.com/20721
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
In many cases function bodies were a block containing a single nested
block. Flatten these cases.
Change the test for whether a lexically-scoped local variable clashes
with a parameter to work on the generated code, not the source.
Change-Id: I74d37fe686e481e3300bb9d37b30857e8e375cb5
Reviewed-on: https://dart-review.googlesource.com/20661
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
It's added as a new compiler, so pass "-c dartdevk" to use it.
It doesn't support any test packages yet, so tests that, say, import
package expect won't compile. I'll work on that next, but it will
require adding some stuff to the build scripts to build .dill files for
those packages.
This does get test.dart invoking the compiler, running the resulting
test, and correctly reporting the result:
- A test that doesn't throw an exception and stays within the bounds of
what is currently implemented in dartdevk passes.
- A test that compiles correctly but fails at runtime fails with a
RuntimeError.
- A test that contains a compile error fails with a non-zero exit code
and is reported as a CompileTimeError.
Change-Id: Icacbf1ff54dfe7aa4d245382d3b0aeb375cf105b
Reviewed-on: https://dart-review.googlesource.com/15420
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Compile return statements. Kernel function bodies are statements, not
necessarily blocks. In that case, blockify the JS function body.
Bug:
Change-Id: Ibbed1c2039b103151b7244774f3daf8992264a88
Reviewed-on: https://dart-review.googlesource.com/15280
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
pkg/front_end/test/fasta/analyze_test is incorrectly failing because of DDC changes.
This must be fixed, but in the meantime this works around it.
Change-Id: I72fd56f9b306dce9b1f34e810c6ece3f6d8f49fb
Reviewed-on: https://dart-review.googlesource.com/14342
Reviewed-by: Jenny Messerly <jmesserly@google.com>
This ports a fairly large part of DDC's Analyzer-based code generator,
however most nodes are not supported yet.
The goal is to preserve all functionality of code that was ported,
except for deprecated features (e.g. mirrors, fuzzy arrows, libraryRoot).
Change-Id: I3b10d5773c7c10a740fa336720243b03c6b82529
Reviewed-on: https://dart-review.googlesource.com/10705
Reviewed-by: Vijay Menon <vsm@google.com>