Commit Graph

857 Commits

Author SHA1 Message Date
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
John Messerly 08fb2161f7 fixes #184, type literals now use emitTypeName
this fixes `dart.dynamic` as well as other cases covered by emitTypeName

R=vsm@google.com

Review URL: https://codereview.chromium.org/1142713004
2015-05-18 13:41:25 -07:00
John Messerly 01d39ba3f2 cleanup: simplify creation of AnalysisContext
removes TypeResolver class, introduces function to create analysis context, simplifies a few other things around mock vs real SDK sources.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1143683002
2015-05-18 10:20:29 -07:00
John Messerly b0ff84eedc fixes #183, remove our InMemory* in favor of analyzer's impl
this should improve test coverage too, as analyzer's MemoryResourceProvider/ResourceUriResolver matches the real semantics more closely than ours did.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1146503003
2015-05-15 11:17:24 -07:00
John Messerly f728691ac8 Fixes #179 -- compile error if editing files during server mode
this avoids reloading file contents many times during a compile. `.contents.data` == bad!
also fixes #73, using Analyzer's LineInfo instead of FileSpan to avoid finding line breaks over and over
I did some manual testing on sunflower as well as diffing SDK messages before and after

The one baseline change (23 -> 22) seems more accurate than it was before.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1141013002
2015-05-14 16:42:33 -07:00
John Messerly 995e0f0bb3 remove #177 workaround
this issue was fixed

R=vsm@google.com

Review URL: https://codereview.chromium.org/1142553002
2015-05-14 16:02:39 -07:00
Vijay Menon 3377d2b7c5 Angular workarounds
- Workaround for symbolized methods (e.g., core.$map)
- dload/dput workarounds
- NSM workaround
- generic method type check workarounds

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1131143002
2015-05-14 12:47:32 -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
John Messerly ef1739d8eb Make typedefs lazy again
reverts part of https://github.com/dart-lang/dev_compiler/commit/3dcea8bf156b3947c4dbf4b36da55a64cd9dc492
On its own, it's probably okay, but trips on other issues we have w.r.t. JsName types and NoInterfaceObject apis

R=vsm@google.com

Review URL: https://codereview.chromium.org/1135883004
2015-05-14 09:45:41 -07:00
Vijay Menon b013a71e30 Create html if needed in server mode
This allows just serving up a dart file:

dart ./bin/devc.dart --server foo.dart

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1130093007
2015-05-14 09:26:19 -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
Sigmund Cherem dfdaff85bb Load time improvements (fixes #140):
- move hash to a query parameter (it works!)
- do widget request later, let app render/loading in case the request is fast
enough.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1131933003
2015-05-12 16:53:32 -07:00
John Messerly aba85e3d9f fixes #131, use before define from variables to classes
Factored the load order logic into its own file, as it was easier to work with that way. We could definitely tweak the structure.

Also tried hoisting constants out to top level, but it's not quite ready yet, so splitting that work out into a separate CL.

(also fixes #152 about cleaning up lazyClass, and fixes #181 about static fields)

R=vsm@google.com

Review URL: https://codereview.chromium.org/1133593004
2015-05-12 11:47:36 -07:00