Commit Graph

1589 Commits

Author SHA1 Message Date
John Messerly 9dae584632 remove one more analyzer related TODO
Review URL: https://codereview.chromium.org/1063073005
2015-04-14 17:57:00 -07:00
John Messerly 4c1504d439 use Analyzer's computed constants instead of pattern matching the annotation AST
R=jacobr@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/1084783005
2015-04-14 17:38:45 -07:00
John Messerly 267050cdac refactor emitMemberName to be used more consistently
other changes:
* adds _emitSend for more consistent emitting of method calls. can't be used everywhere yet, but it unifies some things
* more consistent use of the core.String.* static pattern
* fix dynamic invoke to private members
* fix implicit-this to use emitMemberName, which makes them work with extension methods
* build the global extension method table up-front and optimize lookups (method name first, then subtype test if needed)
* teach the compiler that IsExpression never returns null

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1083763003
2015-04-14 16:07:28 -07:00
John Messerly ca2fff3c05 rename dart_runtime.js helpers
this should make the diff simpler in the other CL

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1074923003
2015-04-14 13:48:31 -07:00
John Messerly 9076b84165 update analyzer to 0.24.4 and remove an old workaround
stackTrace was fixed in CL https://codereview.chromium.org/1060373003/ for analyzer

also update a comment in resolver.dart to explain why we need to visit the MethodInvocation's methodName identifier.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1088833008
2015-04-14 12:49:56 -07:00
Leaf Petersen ad4af9c482 Refactor reifier to make it less dart_codegen specific.
This is some first steps towards hooking the reifier into the js backend.  I've made the reifier operate on whole libraries instead of per compilation unit so that it can be hoisted out as a separate pass.  I changed the API of the reifier to return a map from new type identifiers to information about their library of origin, so that the code generators can deal with these appropriately.  Take a look, see what you think - suggestions as to how to structure this to interact well with the JS backend welcome.

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

Review URL: https://codereview.chromium.org/1070453002
2015-04-13 16:14:32 -07:00
John Messerly 5dec9de2f9 update interceptor.js file
this wasn't checked in with previous CL

Review URL: https://codereview.chromium.org/1083803002
2015-04-13 14:29:51 -07:00
John Messerly 880a99c1bd fix sunflower -- dom types were not resolving
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1088663002
2015-04-13 13:22:23 -07:00
Sigmund Cherem fc141ad405 Show message that server is running when it really is
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1088603002
2015-04-13 11:14:02 -07:00
Vijay Menon bbbee7c524 Fix a couple codegen crashers
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1062823004
2015-04-10 13:41:43 -07:00
Vijay Menon 68f2e32775 Enable downward inference on default params
R=leafp@google.com

Review URL: https://codereview.chromium.org/1064933006
2015-04-10 10:20:04 -07:00
John Messerly 13cf3805b8 implement opassign, fix bugs in pre/postfix, introduce a let* helper
Simplifies js_codegen to remove the special cases for things like cascades and statement parent, instead these "fall out" of JSMetaLet node and the various to* methods in js_ast. As a result of handling things more uniformly, code gets cleaner in a lot of cases. One slight "regression" is a cascade at the end of a variable init list with multiple variables. But multiple variables aren't very common so doesn't seem worth optimizing readability there.

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

Review URL: https://codereview.chromium.org/1069493002
2015-04-10 09:53:35 -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
Sigmund Cherem d6f915e407 Use analyzer 0.24.3: now that our changes are integrated into analyzer, we can
simply use the latest release of analyser. Woo hoo!

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

Review URL: https://codereview.chromium.org/1069833002
2015-04-08 14:11:05 -07:00
Sigmund Cherem 1b0031b31a Update to use the latest analyzer
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1054343004
2015-04-08 13:47:27 -07:00
Vijay Menon c769240b6b Don't call dinvoke on Object methods
There is the separate, but related question of how to invoke Object
methods when the receiver is Object or a JS primitive.  That should be
handled in the JS backend.  I can tackle that next if no one else is.

See #98.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1055923002
2015-04-07 16:27:59 -07:00
Leaf Petersen 033ab827dc Factor out reporting from rules
This changes the RestrictedTypeRules to eliminate a direct dependency on CheckerReporter.  Instead of logging a missing type error with the reporter directly, it now calls an optional callback.  The Checker registers an appropriate callback for its errors.  Currently the code generators don't log these errors.  This eliminates the dependency of the code generators on the checker reporter.

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1067553004
2015-04-07 09:58:14 -07:00
Vijay Menon acde775091 Update dart_runtime.dart rules
This should bring it in line with rules.dart.

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

Review URL: https://codereview.chromium.org/1043323002
2015-04-07 05:57:20 -07:00
John Messerly 941dda3403 use VariableElement instead of VariableElementImpl in _isStateless
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1056183003
2015-04-06 09:13:04 -07:00
Vijay Menon cad0430c0d Tweaks to warning level and reporting
R=leafp@google.com

Review URL: https://codereview.chromium.org/1059873002
2015-04-03 15:46:58 -07:00
Leaf Petersen 7321b609d5 Inference casts to dynamic, fuzzy types handled
During inference, allow sub-expressions of type dynamic to be cast to the inferred type.

This CL also adds special case support for the case where we are trying to infer a type for a closure literal with a fuzzy type - often these closures are already well-typed (or easily inferable) if we eliminate the fuzziness.

This gets rid of two of the static errors on angular hello world, along with most of the InferableClosure warnings (turning them into InferredTypeClosure infos).

Most of the remaining InferableClosure cases are function literals with block function bodies, which I don't handle in general yet.

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1059763003
2015-04-03 15:36:27 -07:00
Jacob Richman 5a5ddca7bc Extension method support to move us closer to a valid List implementation.
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1059583002
2015-04-03 14:52:04 -07:00
Vijay Menon 78cb0608b3 Disable closure wrapping by default
R=leafp@google.com

Review URL: https://codereview.chromium.org/1052383003
2015-04-03 14:26:11 -07:00
Leaf Petersen 25e87d9748 Better error messages
This records the actual point at which type inference fails and uses that to give a better error message.  So where before we would say:

severe: line 76, column 38 of package:angular2/src/forms/directives.dart: [StaticTypeError] Type check failed: [c.validator, this.validator] (List<dynamic>) is not of type List<Function>
    c.validator = validators.compose([c.validator, this.validator]);

we will now in addition say:

because c.validator cannot be typed as Function

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1056183002
2015-04-03 12:49:04 -07:00
Leaf Petersen 0399992b81 Downwards closure inference. This implements a basic form of downwards closure inference. It only handles expression functions (=> e), and it does not try to narrow the type of parameters.
BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1050703002
2015-04-03 09:17:30 -07:00
John Messerly 0eba3903b9 move => bind this workaround to js_ast
cleaner since we only worry about it in one place, and the "this" check is easier and more precise now.

incidentally, I saw a CL go by on the V8 bug, looks like it's close to being fixed

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1052693004
2015-04-02 12:17:01 -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
John Messerly 864299081e partially implement instance of checks and some codegen fixes
R=vsm@google.com

Review URL: https://codereview.chromium.org/1050723002
2015-04-01 09:44:37 -07:00
Vijay Menon 2e895d355e Update mock sdk to fix test
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1051523002
2015-03-31 13:26:12 -07:00
Leaf Petersen da58b9d8aa Downward inference
This is a first cut at downwards inference. The interaction with InferableLiteral etc isn't well sorted out yet, so while downwards inference on nested expressions works, there will currently be spurious warnings.

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1038213003
2015-03-31 13:24:25 -07:00
Sigmund Cherem c48018ee62 Update widget with latext fix from source_span
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1047083002
2015-03-31 13:11:14 -07:00
John Messerly 3ce5a11d77 compute interfaces lazily
otherwise we'd have to make a lot more classes lazy

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1047203002
2015-03-31 09:14:37 -07:00
Vijay Menon 75ee9c6cc5 Handle for-in loops
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1048863003
2015-03-30 17:22:46 -07:00
John Messerly 5472d0cfcd keep mixin and interface implementation info at runtime
R=jacobr@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1043003002
2015-03-30 16:09:48 -07:00
Vijay Menon e4fdeb376d Fix logging test
Just updating the broken test.  The dart_runtime.dart type rules are still out of date.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1045753003
2015-03-30 16:03:50 -07:00
John Messerly fc02cba0f4 use == and != to enable handling null/undefined
R=jacobr@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1047023002
2015-03-30 16:01:22 -07:00
John Messerly 1515ceaa8e fixes private named constructors
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1042943003
2015-03-30 14:30:01 -07:00
John Messerly f0e35ab12c fix arguments keyword used in our helper method
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1048873002
2015-03-30 10:46:13 -07:00
John Messerly af714fed80 fix for static methods and names banned in strict mode
* static methods qualified properly
* static method privacy is now enforced
* avoid static method names banned in strict mode
* avoid variable names banned in strict mode

We might want to relax privacy (for both instance and static), but for now it's nice and consistent with instance methods using ES6 Symbol

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1034273003
2015-03-30 10:09:56 -07:00
Jacob Richman a6ca53ee49 fix list literal initialization call fix typeof calls for primitive JS types add dart/collection.js to defaultRuntimeFiles list Enclose switch statement case blocks with braces to insure a block scope matching dart semantics
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1042003002
2015-03-30 09:42:29 -07:00
Jacob Richman 0e0cff2e17 Fix try catch crasher bug due to null else case.
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1036333003
2015-03-27 10:53:54 -07:00
John Messerly 34e2fbabd7 fix temp used in postfix ops
Review URL: https://codereview.chromium.org/1039243002
2015-03-27 07:26:57 -07:00
John Messerly 2357e3013b more care around generated names, fixes #60 #82 and #97
R=vsm@google.com

Review URL: https://codereview.chromium.org/1030063004
2015-03-26 17:47:31 -07:00
Sigmund Cherem 3ab4f01149 Pass through context information in error messages
R=vsm@google.com

Review URL: https://codereview.chromium.org/1023893004
2015-03-26 15:25:24 -07:00
John Messerly 48e334237b [js_ast] adds Identifier that merges VariableDeclaration/Use and Parameter
Also changes Printer to not walk the tree an extra time unless we are minifiying.

The tree structure appears to be helping VarCollector, by encoding some information into the static AST structure. (although some aspects were unused, such as function names). It's easy enough to encode this behavior in VarCollector itself. Having a unified Identifier benefits our tree transform, since we don't need to worry about generating three different types of things under largely identical circumstances.

I'm planning to build on this later, but this version is purely a refactor.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1029583011
2015-03-25 16:01:02 -07:00
Vijay Menon 67e4bc583a Rationalize coercions
This breaks out casts / coercions into:

Standard (on by default)
- DynamicCasts: dynamic -> T
- AssignmentCasts: T x = expr; // T must be a ground type

Inference (this will go away)
- InferableLiteral
- InferableClosure
- InferableAllocation

Implicit (no flag yet, but i'll add to disable by default)
- DownCastComposite: Any cast to a non-ground type
- DownCastImplicit: Any other implicit downcast not covered above

A flag is also added to enable/disable all wrapping.  This is not off by default yet, but that is the intent.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1038583004
2015-03-25 14:51:54 -07:00
John Messerly 5306aa2384 Remove PropertyName from js_ast
This was added to our version, while still figuring out js_ast. As it is now, Printer handles property names quite well on its own, so the extra AST node doesn't add anything.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1030243002
2015-03-25 13:28:55 -07:00
Sigmund Cherem 232375de7c Add missing visit methods
R=vsm@google.com

Review URL: https://codereview.chromium.org/1033443003
2015-03-23 16:06:59 -07:00
Sigmund Cherem c24a91895a Migrate to package:html
R=kevmoo@google.com

Review URL: https://codereview.chromium.org/1008533004
2015-03-23 13:28:43 -07:00
Sigmund Cherem 2bf7e0aed8 Transitive inference using SCC
BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1028793002
2015-03-23 13:11:33 -07:00