Import/export directives are preserved, and new ones are generated using package syntax using Vijay's logic. This is not yet robust for relative URIs, but is sufficient for our purposes.
Wrapper hoisting is disabled, and various wrapper generation bugs are fixed.
Type name qualification is done more selectively, and more correctly.
Casting is disabled in const contexts, with a severe warning.
Coercions and wrappers now both call into the dart logging runtime, and pass various useful information (currently mostly ignored).
This also adds some preliminary dart codegen tests, and hence includes a number of expected output files in the test/dart_codegen/expect directory.
BUG=
R=jmesserly@google.com, vsm@google.com
Review URL: https://chromereviews.googleplex.com/141427014
Still need to investigate the assert I commented out, but much closer now.
John: This also affects the path passed in the js backend. If the package-paths env is not set, it'll fall back to the old behavior.
R=jmesserly@google.com
Review URL: https://chromereviews.googleplex.com/147977013
Translate as expressions in to the appropriate calls into the dart runtime. When I have span information, I emit a key with the location of the cast from the original code. For wrappers, I currently don't have the span information plumbed through, so leave the key off. We can probably get this information plumbed through if needed.
BUG=
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/148627013
As part of this change I made codegen synchronous. Technically is not necessary,
but I think it reduces complexity a lot. For example, keeping it async would
have required more changes to the testing infrastructure. Let me know if you
want to keep that change separate though.
With this change, I'm removing one more use of element.node, which is necessary
to achileve our goal. There is only one more use of this API, for which John has
a CL out.
BUG=
R=jmesserly@google.com
Review URL: https://chromereviews.googleplex.com/145167013
also correctly exports the values of top-level fields, and ensures it uses the most up-to-date value for mutable top-level fields
we can likely improve this further once we have ES6 modules, but it seems like an okay start
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/147927013
This CL fixes a bug in the coercion reifier in which a null value would get wrapped by the reifier, turning it into a non-null value.
There are also some small fixes for some types from the DownCastBase refactoring which weren't quite right.
BUG=
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/140327013
A couple places remain:
* how codegen is driven (we should change the pipeline for this)
* how js-codegen determines whether an top-level expression is a constant field
(this might require tracking additional information in our checker)
R=leafp@google.com
Review URL: https://chromereviews.googleplex.com/143177014
This is very half baked. Putting it down to work on better type literal support for the moment.
Qs:
(1) What should we measure? cast failures mapped back to source? I don't think we inject anything else right now.
(2) How should we report? I just have dump function right now, but that'll be unwieldy on large apps.
R=jacobr@google.com, jmesserly@google.com
Review URL: https://chromereviews.googleplex.com/146737013
We'll need to figure out an efficient way to do this in JS output.
An alternative, suggested by Jacob, is only provide something like an applyTruncated function. E.g., something like:
dynamic applyTruncated(Function f, List args) {
var arity = getArity(f);
assert(args.length >= arity.min);
args = args.sublist(0, arity.max);
return Function.apply(f, args);
}
Jacob: is this what you have in mind?
If so, we could *only* provide this. The dart2j impl could use the existing code pattern of is-checks. The ddc implementation could map to JS apply (with a check for named params?).
Thoughts?
R=jacobr@google.com
Review URL: https://chromereviews.googleplex.com/137047014