also fixes various bugs:
* setters now use the correct memberName symbol, fixes#30223
* object members work for callable classes, fixes#30213
* some test fixes to work in strong mode
* a few other small cleanups (e.g. obsolete `dart.list` is removed)
R=vsm@google.com
Review-Url: https://codereview.chromium.org/2979353002 .
This reverts commit 3a23e604e2.
The problem was unrelated to the CL; it appears to be a dart:async break of package:async.
In the meantime we have turned on --unsafe-force-compile to DDC's shapshotting step
Review-Url: https://codereview.chromium.org/2869733006 .
we still have an init method, for better or worse, to break out of ES6 restrictions
The idea here is default Dart constructor (really an initialization method) is always called `new` instead of the class name. We already do this for unnamed factory.
R=leafp@google.com
Review URL: https://codereview.chromium.org/1965213003 .
- Instead of using the raw runtime type that DDC uses for its type
checks, use a WrappedType that correctly implements Type's interface.
- Compile class literals to wrap the type in a WrappedType.
- Make Object.runtimeType() do the same thing.
Fixes#488. Fixes#511.
R=jmesserly@google.com
Review URL: https://codereview.chromium.org/1944483002 .
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 .
- 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 .
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 .
Failures generate a StrongModeError. Fixes#236. Partially addresses #238.
Some issues to do:
- We're too eager to throw a StrongModeError. E.g., <int>[] is List<String> will throw.
- We don't differentiate between implicit and explicit casts.
R=leafp@google.com
Review URL: https://codereview.chromium.org/1298893003 .
This changes the way we handle dynamic at runtime to be more correct and cleaner. We now simply emit dynamic as dynamic instead of as core.Object. There are now two ways to construct a function type: one can construct a fuzzy function type (the default), or a definite function type. The constructor for a fuzzy function type replaces all uses of dynamic with bottom. This function type is used for all type annotations. Definite function types do not replace dynamic with bottom. These only occur as the runtime type of actual functions, for which we really know the type. Because we now eagerly sort this out when we create the function type, the subtyping code doesn't need to deal with this.
This allows some additional subtyping: closures which actually are typed to take dynamic would previously not have been allowed to be cast to something with a concrete argument type. Now this is allowed (see the change in runtime_tests.js for an example of this).
This fixes#107.
BUG=
R=vsm@google.com
Review URL: https://codereview.chromium.org/1195523002
The dart runtime files are roughly split around functional boundaries. Comments at the top of each file describe the function of the library. I'm not sure that these are 100% right yet, but they're closer. We may want to iterate on the organization.
The main dart runtime file just re-exports various symbols from the sub-libraries. It has hard dependencies on the other runtime files, some of which have soft (lazy) dependencies on SDK files. The generated code now depends on dart and dartx as a imported libraries, rather than as top level symbols.
This CL also includes some new code to make type representations a bit better. This is mostly in the new types.js file, which makes all of the non-instance types (dynamic, bottom, void, function types) subtypes of a common representation type. Among other things, they now have the correct runtime type (core.Type). Some of the type code has been rationalized around this a bit, but there is more left to do here. The setSignature code in classes.js now also places the correct runtime type on nominal (instance) types. There are new tests in the runtime_tests.js file to test for this.
The static object method code that implements the Object methods has not yet been updated to dispatch on type representations. I will do that in a separate CL.
BUG=
R=jmesserly@google.com, vsm@google.com
Review URL: https://codereview.chromium.org/1182653002
This bites us on Angular - dart:collection and angular's collection
(facade) lib smash on top of each other, silently causing issues.
We'll need a better naming convention - perhaps we should use the lib
name and require uniqueness.
Fixes#208R=jmesserly@google.com
Review URL: https://codereview.chromium.org/1145243013
* fixes generic List. Because generic arrays have the proto of JSArray, which itself extends Array, we need to make sure we don't override members from Array.
* fixes tear offs, they were not preserving type signatures in some cases. This doesn't change how we store signatures, but perhaps something we could consider, to make this bug less likely.
* the defineExtensionMembers call was not getting emitted unless the type implemented at least one interface.
R=leafp@google.com
Review URL: https://codereview.chromium.org/1156273010
When we tear off a method, replace the obj.foo.bind(obj) pattern with dart.tearoff(obj, 'foo'), and the dart.bind(exp, 'foo') pattern with dart.tearoff(exp, 'foo'). This helper does both the bind and attaches rtti.
This CL also stops binding of static methods when they are town off, since I think this is unnecessary.
BUG=
R=vsm@google.com
Review URL: https://codereview.chromium.org/1142293002
For every class, we now generate a setSignature call which attaches properties to the constructor recording the method signatures, the static function signatures, and the names of all of the static methods. This call also attaches a getter to every static method which returns the type of the function. Methods are only decorated with runtime types when torn off. At a tear-off, the type is looked up in the constructor, and then attached to the bound function.
Top level functions and statement level functions get annotated with their type immediately after their declaration. We could consider moving all of the top level function annotations to the end of the file, but for now I've left it inline.
Closures (function expressions) get wrapped in calls to a dart.fn helper, with type information attached in one of various forms. This is currently the least attractive part of this CL. We may want to iterate on the syntax for this.
I've added some support for NSM checking to the dsend/dcall case as well.
We may wish to iterate on the syntax, and on the runtime representation of types, but this should move us forward from a functionality standpoint.
BUG=
R=jmesserly@google.com, vsm@google.com
Review URL: https://codereview.chromium.org/1138793002
Notes:
- We probably should have a general type object class for all types. Just handling function types for now.
- Not yet encoding the type on functions during codegen ... falling back on arity effectively.
- typedefs are lazy to avoid ordering issues. Could perhaps reuse existing logic instead.
R=jmesserly@google.com
Review URL: https://codereview.chromium.org/1076883003