Eliminate uses of the comment syntax in lib/async. This is mostly
done simply by turning explicit (but commented) casts into implicit
casts to avoid regressing dart2js performance.
Bug:
Change-Id: I286c7bffbf609b5e2fa24b9d48b90876c2c45a9b
Reviewed-on: https://dart-review.googlesource.com/21566
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Casts for function types got moved off of the generic path, and hence
are missing the memo cache. Added a second function type cast cache.
Fixes#31392
Bug:
Change-Id: Ie1b87adf630f5059b57d01956778f5adde0533fc
Reviewed-on: https://dart-review.googlesource.com/21525
Reviewed-by: Vijay Menon <vsm@google.com>
For ObjectFormatter right now we just show the class name. Some objects,
e.g. Int64, have descriptive toString() operations that are much more
informative than their internal structure.
This changes the default header to be
Instance of 'Thing'
rather than just
Thing
which is a little worse, but it's much better for these kinds of classes.
For Int64 we will now show
12345 (Int64)
We also clip the toString() if it's too long.
Bug:
Change-Id: Iae6a8e66fdbe1d9f5c157ecdb983a833e26d00f4
Reviewed-on: https://dart-review.googlesource.com/21522
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Alan Knight <alanknight@google.com>
The new front end doesn't support generic comment syntax yet, so it's
getting the wrong type for LineSplitter in strong mode. Since we no
longer to preserve legacy mode semantics for LineSplitter, we can just
use the correct strong mode types without generic comment syntax.
Change-Id: If2dcb2fb3fae9eb49685838e4e84958e545650c7
Reviewed-on: https://dart-review.googlesource.com/21286
Reviewed-by: Florian Loitsch <floitsch@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Paul Berry <paulberry@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>
The parameter defaults to false. This enables creating a
SecurityContext that includes the trusted root certificates that can
be modified per-connection.
fixes#24693
Change-Id: I22e5736838755ce4055f77b1b17aeb5176329240
Reviewed-on: https://dart-review.googlesource.com/20580
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Zach Anderson <zra@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>
This is for compatibility with Kernel, as well as fixing several bugs,
and generally being a more robust architecture.
This may also perform better than the current design.
Notable fixes include several issues around deferred classes.
Change-Id: I1b6f44ebdf6304b10b47d19026156a25e04146ef
Reviewed-on: https://dart-review.googlesource.com/16337
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Other improvements:
* avoids an extra intermediate future in `async`, and unnecessary type tests
* uses optimized type tests instead of older isSubtypeOf
* avoids an extra closure for async/async*
* avoids Function.apply for async/async*/sync*
* avoids an extra cosure for sync* if the arguments are not modified
Change-Id: I897708387fce59a97696f05b01cc668f1043fe5c
Reviewed-on: https://dart-review.googlesource.com/16332
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@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>
Generic function types were not previously renamed before using them
for inference, which resulted in capture problems when doing inference
on recursive generic method invocations.
Fixes#30980
Bug:
Change-Id: I1c610606dd65d86735cb615e077d720066a85e1a
Reviewed-on: https://dart-review.googlesource.com/15040
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
- Fix fuzzy arrow errors.
- Default the Dart repo URI so it doesn't always need to be explicitly
set.
- Run dartfmt on everything.
- Move some members out of the garbage bin "TestUtils" class:
- Move the stuff around the Dart repo directory to a new Repository
class.
- Move absolute() into Path where it belongs.
- Move workingDirectory in Path since it is a Path.
- Delete the random number stuff since it was apparently unused.
Change-Id: I3dab3a4f1713b7a749e64b6776149d05a0ce1b69
Reviewed-on: https://dart-review.googlesource.com/14502
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
This doesn't use our own source map mapper (which is harder to
integrate here). This appear to use V8 specific hooks, but seems to
work more seamlessly.
Change-Id: I622314f9190ca161e37d77a8ba1b659891469834
Reviewed-on: https://dart-review.googlesource.com/14500
Reviewed-by: Jacob Richman <jacobr@google.com>
Commit-Queue: Vijay Menon <vsm@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>