Commit Graph

1019 Commits

Author SHA1 Message Date
John Messerly f17187f3aa fix for 1.12.0-dev SDK and 0.25.1 analyzer breaking changes
unfortunately we can't run on stable anymore

R=vsm@google.com

Review URL: https://codereview.chromium.org/1228063003.
2015-07-09 10:11:32 -07:00
John Messerly 98d14b14da initial sync*, part of #221
Right now it maps straight to ES6 generators. This should handle some basic cases, but there's more work to get all of the corners working. For example: it doesn't implement Iterable yet.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1207313002.
2015-06-26 16:02:30 -07:00
Vijay Menon 7837d31936 Fixes #246
Type checks await

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1209413002.
2015-06-26 09:59:43 -07:00
John Messerly c2e65df22c fixes #168, dart:js implementation with a test
R=vsm@google.com

Review URL: https://codereview.chromium.org/1200233004.
2015-06-25 13:18:52 -07:00
Vijay Menon 4bb9fdce71 Fixes #151
Type check async-return, async*-yield, and sync*-yield.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1190413005.
2015-06-22 10:22:23 -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
John Messerly 8d76f5f34e have build/test scripts automatically update baselines
we already have to review them, so running a diff and failing the rest of the test pass seems unhelpful. Instead operate like our generated SDK does, and update in place

R=vsm@google.com

Review URL: https://codereview.chromium.org/1188173003.
2015-06-17 09:05:59 -07:00
John Messerly de6df99db0 fixes #226 super == and fixes #227 escape \r \f
R=vsm@google.com

Review URL: https://codereview.chromium.org/1183453005.
2015-06-16 16:52:32 -07:00
Vijay Menon d48b153193 dart:mirrors
This is a very bare bones version - just enough to get angular running.

See #199

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1186683005.
2015-06-15 16:22:54 -07:00
John Messerly b769aa5fbc fixes #25, most analyzer errors were not computed
It helps to call computeErrors ;)

R=vsm@google.com

Review URL: https://codereview.chromium.org/1183733004.
2015-06-15 08:55:59 -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
John Messerly 8f4db8f514 expose strong checker API, for use by analyzer_cli
most of the changes here are around making options sane(r), which fixes #204

R=vsm@google.com

Review URL: https://codereview.chromium.org/1174643003.
2015-06-11 07:47:12 -07:00
John Messerly b62fdb577d fixes #217, Object members on extension types
R=vsm@google.com

Review URL: https://codereview.chromium.org/1173023004.
2015-06-10 13:52:18 -07:00
John Messerly 86a8ac2b0c fix #214, check type of inferred initializing formal with default value
Analyzer does this inference (probably from spec?) very early in the compilation.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1180513002.
2015-06-10 12:59:55 -07:00
John Messerly d52346c201 fixes #215, removes special case for length
R=vsm@google.com

Review URL: https://codereview.chromium.org/1178523004.
2015-06-10 12:21:49 -07:00
Vijay Menon 5ff3864a18 Load on demand
This fixes ordering issues.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1171843002
2015-06-09 08:05:26 -07:00
John Messerly a5132e6436 remove covariant generics option
Thoughts? Seems unlikely we'll go with invariant at this point.
I'd like to see covariant generics go, but it seems we need variance annotations of some sort before that becomes realistic. (e.g. Iterable is used all over the place)

R=leafp@google.com

Review URL: https://codereview.chromium.org/1165303002
2015-06-08 14:35:56 -07:00
John Messerly 73be4cab48 remove ClosureWrap option and related implementation
Vijay thought that we don't need this anymore, as we decided not to wrap.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1171713002
2015-06-08 14:32:42 -07:00
John Messerly d88c36af77 remove unused allowConstCast option
this was for the Dart backend?

R=vsm@google.com

Review URL: https://codereview.chromium.org/1166163002
2015-06-08 13:19:06 -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
John Messerly cac786f671 fixes #173, ability to use native JS indexers
dom_experimental could opt-in to use this

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1145833004
2015-06-05 12:14:09 -07:00
John Messerly 89b3d920d6 fixes #206, add checking for unary ops
fixes #207, checking for boolean conversions

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

Review URL: https://codereview.chromium.org/1147143007
2015-06-05 12:12:27 -07:00
Leaf Petersen 695ae10131 Delete dart2js specific private library code.
This trims out a large chunk of the more obviously dart2js specific stuff from js_helper.dart and its dependencies.

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

Review URL: https://codereview.chromium.org/1152333009
2015-06-05 09:52:18 -07:00
John Messerly 6c3cdd707d fixes #40, extension methods for primitive types
fixes #138, extension methods for Iterable/List injected as needed, regardless of how the methods started

fixes #142, extension methods and dynamic dispatch

small change that fixes #139, recognize that '.length' doesn't need an extension method

Also restores JSArray, moved the methods out of List, which is back to just being an interface.

NOTE: this removes the capability of types that mix native JS members and some Dart extension members, instead it now *hides* all JS members for these native types. We'll want to bring that feature back to support dart:html, so it's just a simplification for now. Should be easy to add that capability when we pull in dart:html for reals.

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

Review URL: https://codereview.chromium.org/1153003003
2015-06-04 14:58:18 -07:00
Vijay Menon 4aaeaf6125 Remove dart backend
Fixes #205

R=jmesserly@google.com, leafp@google.com

Review URL: https://codereview.chromium.org/1148283010
2015-06-03 14:01:28 -07:00
John Messerly 2722aed77e fixes #201, add support for custom URL mapping
R=vsm@google.com

Review URL: https://codereview.chromium.org/1150143006
2015-06-03 09:40:48 -07:00
John Messerly 85242175d4 fixes #202, check IndexExpression
R=leafp@google.com

Review URL: https://codereview.chromium.org/1160673003
2015-06-02 17:10:43 -07:00
John Messerly 33eee25590 fixes #43, remove => workaround
R=leafp@google.com

Review URL: https://codereview.chromium.org/1169473003
2015-06-02 16:30:23 -07:00
John Messerly 2b55297c68 remove generated_sdk from checked in code
R=leafp@google.com

Review URL: https://codereview.chromium.org/1162723007
2015-06-02 12:39:25 -07:00
John Messerly 9a95d18c13 fixes #182, avoid injecting a duplicate link rel=stylesheet
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1145893008
2015-06-01 16:54:01 -07:00
John Messerly e15f53d923 upgrade dependencies, including migration to package:test
dart_style becomes a dev_dependency, and remove the ability to auto-run it from dart backend, instead use the test formatter
migrate to package:test, which has a few tricky bits:
* expect can only appear inside a test now (https://github.com/dart-lang/test/issues/132)
* mirrors is needed to get the test folder (https://github.com/dart-lang/test/issues/110)
* test `main` can't take arguments. not sure what's up there, but not a big deal for us either.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1166683005
2015-06-01 14:54:13 -07:00
John Messerly 92773980ab Revert "fixes #173, ability to use native JS indexers"
This reverts commit 8dc1eeeb4dcc4d186f59513abd18f98e67c36339.

Review URL: https://codereview.chromium.org/1160343003
2015-06-01 09:31:01 -07:00
John Messerly 59852b526b fixes #173, ability to use native JS indexers
dom_experimental could opt-in to use this

Review URL: https://codereview.chromium.org/1145833004
2015-06-01 08:46:26 -07:00
John Messerly 81fc365b95 fixes #193, factory constructors as static methods
R=vsm@google.com

Review URL: https://codereview.chromium.org/1156993015
2015-05-29 14:52:10 -07:00
Vijay Menon 526ac2e153 Modified sunflower
Need to rebase over this pending CL before it's ready for review / landing:

https://codereview.chromium.org/1143953004/

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1147053003
2015-05-29 06:24:48 -07:00
Vijay Menon 562313e113 Fixes for sunflower
R=leafp@google.com

Review URL: https://codereview.chromium.org/1143953004
2015-05-28 09:28:55 -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
Vijay Menon 980c0904b3 Add types to shift operations
Not sure why these weren't typed in the first place.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1143273002
2015-05-22 09:08:35 -07:00
Leaf Petersen e270186901 Fix names in named parameter lists
This fixes #195.

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1150623004
2015-05-21 15:04:22 -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 99433b7121 No dynamic at runtime.
Reify dynamic as bottom or Object as appropriate in the generated code.

For general function types, dynamic parameters become bottom, and all other uses of dynamic become Object.

For concrete function types (the rtti attached to function objects) dynamic parameters also become Object.

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1148333003
2015-05-20 16:36:25 -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 406e68ccec Check whether type parameters are loaded before emitting.
This fixes #190.

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1143253003
2015-05-20 09:47:39 -07:00
Vijay Menon 0ce490561c Type check binary expressions
Fixes #188

R=leafp@google.com

Review URL: https://codereview.chromium.org/1137543005
2015-05-20 09:24:16 -07:00
John Messerly 772f6f6d1b fixes #185, track const ctor dependencies, plus a static field fix
R=vsm@google.com

Review URL: https://codereview.chromium.org/1141663003
2015-05-20 09:19:08 -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 6c7b497346 Bump to the latest analyzer
R=leafp@google.com

Review URL: https://codereview.chromium.org/1138993010
2015-05-19 14:24:45 -07:00