Highlights
* compile one module at a time
* use summaries to speed up compiles
* use command runner so we can add more commands later
* some long needed renames and file organization
* various other technical debt has been addressed
Lowlights
* lost node.js runner/tests (node output format still supported)
* possibly lost some closure support/workarounds (format still supported)
* needs more end-to-end tests of the new system
R=vsm@google.com
Review URL: https://codereview.chromium.org/1879373004 .
A couple notes:
- regress_18535_test started failing at runtime. It's using unimplemented mirrors code, so perhaps a static failure before.
- typed_data_sublist_type_dart started failing at runtime. It was inferring Is<EfficientLength> with the type omitted. :-(
- my local chrome is newer than the one on travis failing on generators. not seeing that error.
TBR=jmesserly@google.com
Review URL: https://codereview.chromium.org/1847163002 .
* factor the class heritage workaround so it's out of the way & easier to remove later.
* always emit type parameters in the AST, and pass the flag to the printer to skip printing them.
* cleanup an unnecessary sync* method for closure field decls.
* also, reformats. I think I forgot to do that in previous CL.
R=vsm@google.com
Review URL: https://codereview.chromium.org/1767803002 .
fixes https://github.com/dart-lang/dev_compiler/issues/471
Changes here are:
* Analyzer now infers list/map literals
* Analyzer changed how isPotentiallyMutated* APIs work, so we need to track current function
* Another fix to arrow functions. We shouldn't skip generating covariant arg checks. If there were any, we use `=> { block }` form rather than `=> expr` form.
R=vsm@google.com
Review URL: https://codereview.chromium.org/1757343002 .
Some of the high level changes are:
* visit catch body, fixes#463
* handle temps created by the compiler. These were in some cases treated incorrectly as non-null (see tests diff)
* compute nullable in the same pass as visiting assignments
* simplify visiting += and ++, fix ++ (it was dead code, #463)
* simplify _isNullable
* if we fail to see a variable declaration, treat it as nullable
* stack trace in catch is treated as non-null
R=vsm@google.com
Review URL: https://codereview.chromium.org/1751963002 .
Two more small bug caught/fixed in the process:
* Dart lambdas must generate as `=>` functions or we'll get the wrong `this`
* Another case where generators we using destructuring in a mismatched way
R=vsm@google.com
Review URL: https://codereview.chromium.org/1736723002 .
- Replaced ClosureType by a general JS.TypeRef, used in AST for identifier types, return types
- Convert DartType to JS.TypeRef (in mixin JsTypeRefCodegen), including type parameters (also added to AST in Fun & ClassExpression)
- Emit field declarations expected by TS
- Wrote a TypeScriptTypePrinter (mixed in by Printer) and a ClosureTypePrinter (might disappear soon)
- Simplified annotation code, called in more places (seems to gives more source info)
Example input:
List/*<T>*/ func/*<T>*/(List/*<T>*/ items, dynamic/*=T*/ seed) {}
class Foo<T> {
int i;
static var x;
Foo(this.i, o, {String v : "?"}) {}
}
Output:
function func<T>(items: core.List<T>, seed: T): core.List<T> {}
const Foo$ = dart.generic(function(T) {
class Foo<T> extends core.Object {
i: number;
static x;
Foo(i: number, o, {v = "?"}: {v?: string} = {}) {
this.i = i;
}
}
...
Foo.x = null;
return Foo;
});
Known remaining issues:
- typedefs expect a `type Callback = (...) => ...;` statement
- `exports` is a reserved keyword in TS (either we change the way we do exports, or we'll need a different temp + extra type annotations of the default-exported object).
- Generic type is currently locked inside the generic call. Might be able to solve by exporting signatures in .d.ts file, or changing the way we do generics.
BUG=
R=jmesserly@google.com
Review URL: https://codereview.chromium.org/1676463002 .
- Force import order in all sdk files + simplify module builders
- Stub a node_test.sh with hello world + DeltaBlue (to be expanded to language tests in a followup change)
- Use global_ from dart:_runtime in html lib
- Better export for symbols that node chokes upon: throw, const, void, implements, export... (define as throw_ locally, with proper local resolution, then export as throw).
- Cleanup node module builder
BUG=
R=jmesserly@google.com
Review URL: https://codereview.chromium.org/1633003002 .
Within some AST context (at library granularity, for convenience), we
collect all the assignments to local vars:
- Declaration with no initializer amounts to `null` assignment
- Assignment ops are expanded naively: `x++` yield an assigned value of
`x + 1`, etc
We detect "trivially nullable" variables (e.g. `var x;`, `x =
breaking.out;`) by spotting assigned values that are nullable under the
optimistic assumption that all known variables are non-nullable.
Then we build a nullability dependency graph in linear time: whenever
we see `x = y;`, we know that "y is nullable" implies "x is nullable".
Finally, we propagate "trivial nullabilities" through that graph: any
variable that wasn't reached is deemed not-nullable.
(this is similar to mark and sweep garbage collection, where the roots
are the "trivially nullable" variables; credits to leafpetersen@ for
linear solution)
We're already serving sources from the original directory (for source
maps). This lets us serve other resources as well. Makes it simpler
to run angular todo and other apps with xhr'ed data.
R=jmesserly@google.com
Review URL: https://codereview.chromium.org/1644673002 .
mainly, this backs off of some readability optimizations around static and top-level fields that were too aggressive. On their own, they were okay, but they collide with the library-cycle issues. Once we can remove that issue, we could consider restoring some of this. In the meantime, simplicity is good.
The new operation in the declaration loader is to allow us to see if an initializer has all its dependencies satisfied, but without changing any ordering if they are not.
R=vsm@google.com
Review URL: https://codereview.chromium.org/1636233002 .
Known issues:
- Import syntax: using 'dart/core' right now, but should be
'./dart/core' or something else?
- _jsModuleValue not supported in es6 output yet (how is it meant to be
used?)
BUG=
R=jmesserly@google.com
Review URL: https://codereview.chromium.org/1612083002 .
The following part files were ported from the original .js (lib/runtime/dart/_foo.js -> input_sdk/private/foo.dart):
- input_sdk/private/rtti.dart
- input_sdk/private/types.dart
- input_sdk/private/classes.dart
- input_sdk/private/errors.dart
- input_sdk/private/generators.dart
- input_sdk/private/operations.dart
- input_sdk/private/runtime.dart
Notes:
- Introduced genericTypeConstructor intrinsic: `JS('', '#(type)', genericTypeConstructor(List))` generates `core.List$(type)`
- Used new JS quasiquotes everywhere
- Depends on new internal `@JSExportName` annotation to alias symbols like dart.{as, is, const, assert, export, implements, throw, async, dynamic, void} (see https://codereview.chromium.org/1580413002/)
BUG=
R=jmesserly@google.com
Review URL: https://codereview.chromium.org/1530563003 .