Commit Graph

52 Commits

Author SHA1 Message Date
Leaf Petersen f744dea741 Fix DDC presubmit status.
Update some status entries and fix a few miscellaneous issues.

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/3002133002 .
2017-08-22 16:29:18 -07:00
Jennifer Messerly 65e609548d fix #28988, remove throw on Dart1 incompatible is-checks for dartdevc
We've had this flag off in testing for quite a while. This should not affect user code because it's removing a throw.

R=leafp@google.com

Review-Url: https://codereview.chromium.org/2996573002 .
2017-08-07 16:41:18 -07:00
Jennifer Messerly 04f3c8835f implement Invocation.typeArguments in DDC
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 .
2017-07-21 15:51:16 -07:00
Jennifer Messerly 334354f968 fix #29753, use ES5 constructors for ddc
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2934623003 .
2017-06-12 15:31:32 -07:00
Jennifer Messerly 811a9eed1d Revert "Revert "fix #27256, track type bounds for generic functions""
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 .
2017-05-09 14:20:25 -07:00
Alan Knight 3a23e604e2 Revert "fix #27256, track type bounds for generic functions"
This reverts commit b58f826976.

BUG=

Review URL: https://codereview.chromium.org/2870543005 .
2017-05-09 12:58:03 -07:00
Jennifer Messerly b58f826976 fix #27256, track type bounds for generic functions
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2867493002 .
2017-05-09 11:42:40 -07:00
Jennifer Messerly bed6f8242a add an option to turn off errors from strong mode is-checks
This adds an option and also has our tests run with it turned off.

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2835743002 .
2017-04-21 15:24:32 -07:00
Vijay Menon 466d4ffb9c Add runtime tests for ignored checks
Tests for https://codereview.chromium.org/2788933002/

R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2789933002 .
2017-03-31 13:31:59 -07:00
Leaf Petersen dba842bcc8 Handle casts from Number to FutureOr<double>.
Fixes https://github.com/dart-lang/sdk/issues/29128 .

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2772573003 .
2017-03-23 13:33:33 -07:00
Jennifer Messerly 5817ba47e2 fix #28642, handling of top and bottom types in DDC
in particular: void, Null, and combinations with FutureOr<T>

R=leafp@google.com

Review-Url: https://codereview.chromium.org/2671113002 .
2017-02-06 14:56:10 -08:00
Vijay Menon 9af2fb0115 More DDC mirrors support
(Note, this is a straight migration of the old DDC repo CL. :-))

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2301973002 .
2016-09-01 10:13:31 -07:00
John Messerly c1139934a7 fix #626, add AMD module format and make it default
R=nweiz@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/2249233002 .
2016-08-25 09:39:36 -07:00
Leaf Petersen 3e9ed11db6 Name and hoist types
Adds infrastructure for naming and hoisting types in various ways. Makes an initial cut at how to slice the naming, but we will want to adjust.

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1988023008 .
2016-05-25 11:07:38 -07:00
John Messerly f950e422b8 fix #577 - correctly toString ES Symbols
R=sra@google.com

Review URL: https://codereview.chromium.org/1993293002 .
2016-05-19 12:33:06 -07:00
John Messerly 0cedeb49af simplify constructors, fixes #564
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 .
2016-05-17 14:36:56 -07:00
Leaf Petersen 2031f66a95 Canonicalize function types. Brings sample app load time
down to the 6-7s range.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1969523002 .
2016-05-11 10:08:29 -07:00
Leaf Petersen 7c634031e5 Fix void subtype checks.
BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1958683002 .
2016-05-06 14:04:03 -07:00
Leaf Petersen a860134afc Fix subtyping for generic typedefs. Generic typedefs were being
treated as classes.

Fixes https://github.com/dart-lang/dev_compiler/issues/550 .

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1948253002 .
2016-05-04 18:35:59 -07:00
Leaf Petersen 2f00ebd41c Better is/as check handling. With this CL, the subtype function in
the DDC runtime returns null when a difference from the spec mode
result is possible.

Fixes https://github.com/dart-lang/dev_compiler/issues/524 .

BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1945113003 .
2016-05-04 13:25:55 -07:00
Bob Nystrom 44db042cd8 Redo how Type objects are exposed from DDC.
- 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 .
2016-05-03 14:24:08 -07:00
John Messerly 6598fa0f7d implement generic method runtime behavior, fixes #301
R=leafp@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1926283002 .
2016-04-29 10:41:48 -07:00
John Messerly 0c148ecef4 Implement modular compilation
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 .
2016-04-14 11:28:12 -07:00
Olivier Chafik edaf069dba Add --modules=node support
- 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 .
2016-01-29 10:01:48 +00:00
Olivier Chafik 3886194414 Generate _runtime.js from dart (https://github.com/dart-lang/dev_compiler/issues/310)
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 .
2016-01-21 00:45:31 +00:00
John Messerly cc2f706ded partial fix for #414, nSM message for dcall should show correct target
R=vsm@google.com

Review URL: https://codereview.chromium.org/1601353002 .
2016-01-19 13:33:54 -08:00
Olivier Chafik 6410051fd0 Convert dart_utils.js to input_sdk/lib/_internal/utils.dart (#310)
BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1486473002 .
2015-12-01 19:02:43 +00:00
Olivier Chafik 7add882a7a Move runtime js files down to lib/runtime/dart
Prepare for writing all the runtime in Dart:
- Move js runtime files to lib/runtime/dart (dart_runtime.js ->
dart/_runtime.js),
- Use rest params instead of arguments slicing in a couple of places.

BUG=https://github.com/dart-lang/dev_compiler/issues/310
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1413683006 .
2015-10-29 16:44:49 +00:00
Leaf Petersen 8d36859187 Attach type info to extension method and object method tear-offs
Fixes #189.

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1293293002 .
2015-08-19 10:01:12 -07:00
Vijay Menon 8f9c38b128 Enable is and as checks on non-ground types
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 .
2015-08-19 06:15:04 -07:00
John Messerly c56eec5708 fixes dart.throw to work for non-objects
language tests use this, for example

R=vsm@google.com

Review URL: https://codereview.chromium.org/1245023004 .
2015-07-23 09:34:41 -07:00
Leaf Petersen 4e7920c487 Handle dynamic as bottom inside of function type reps.
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
2015-06-17 16:46:38 -07:00
Leaf Petersen b9c83e0013 Most of this CL just re-organizes the runtime code into multiple sub-libraries. js_utils and loader remain as top level symbols (the former so that it has no dependencies, the latter since it defines the module system that the rest use).
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
2015-06-12 13:34:39 -07:00
Vijay Menon c139653fcb Check for duplicate library names
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 #208

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1145243013
2015-06-05 16:34:10 -07:00
John Messerly a7adab29fa fixes browser/runtime_test, and a few of extension member fixes
* 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
2015-06-05 16:22:37 -07:00
Leaf Petersen aac783cfcf Allow null args to dynamic invocations
Fixes #194.

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1149243002
2015-05-26 11:28:59 -07:00
Leaf Petersen 694240c2ea Add constructors to signatures.
This adds the types of constructors onto class signatures and makes them available via an exported function in the dart runtime.

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1152583002
2015-05-21 14:49:11 -07:00
Leaf Petersen 50e50530ab Use short array syntax in method signatures.
This follows up on a suggestion from jmesserly to use a shorter syntax in methods signatures.  Replaces:

dart.functionType(t, [t0,..., tn], extras)

with

[t, [t0, ..., tn], extras]

BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1145283002
2015-05-20 16:11:42 -07:00
Leaf Petersen fcb7dfad95 Use signature inheritance when method types are unchanged
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1144303003
2015-05-20 13:41:48 -07:00
Leaf Petersen 8322940ecd Use dart.tearoff helper at tearoff sites.
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
2015-05-20 11:13:36 -07:00
Leaf Petersen 8040611a79 This CL implements tagging of functions and methods with function types.
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
2015-05-19 16:24:35 -07:00
Vijay Menon 7ca96fd202 Revert "Update runtime tests"
TBR=jmesserly@google.com

Review URL: https://codereview.chromium.org/1141873003
2015-05-14 09:57:57 -07:00
Vijay Menon c569af4ba8 Update runtime tests
TBR=jmesserly@google.com

Review URL: https://codereview.chromium.org/1143433002
2015-05-13 08:54:30 -07:00
Vijay Menon 286a2f36c5 Fixes #178
Expand out constructor call if needed.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1135543003
2015-05-11 10:56:11 -07:00
John Messerly ef8edb1273 fixes #175, fixed arrays
R=vsm@google.com

Review URL: https://codereview.chromium.org/1138533003
2015-05-08 14:33:37 -07:00
John Messerly 36373f06f2 add checks needed for covariant generics, and fixes #154, List<E> now has the right runtime type.
R=leafp@google.com

Review URL: https://codereview.chromium.org/1117793002
2015-05-01 14:11:52 -07:00
Vijay Menon 0d49f0175a Generate static calls for Object fields and methods
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1100633006
2015-04-23 14:23:39 -07:00
John Messerly af584262c5 fix list initializers
also removes the int.parse hack, adds a special case to dindex instead.

R=jacobr@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1093353004
2015-04-21 11:25:03 -07:00
Vijay Menon cb7143a32f Initial support for runtime function types and type checking
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
2015-04-09 18:39:59 -07:00
John Messerly a4cbcc0c07 implement mixins in subtype checks, more codegen fixes
or: how creating a SplayTreeSet<String> leads to fixing a bunch of stuff

R=vsm@google.com

Review URL: https://codereview.chromium.org/1058653002
2015-04-02 12:16:24 -07:00