Commit Graph

2821 Commits

Author SHA1 Message Date
John Messerly 0efa91a94e implement tear offs
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1088943006
2015-04-21 15:30:18 -07:00
John Messerly bbe6801eff fixes #145, optional params+initializing formals+private fields
R=vsm@google.com

Review URL: https://codereview.chromium.org/1082333004
2015-04-21 15:28:46 -07:00
Vijay Menon b5e4a91941 Add flag to disable hashing
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1088703003
2015-04-21 14:52:04 -07:00
Vijay Menon cafe427ad0 Handle symbol literals
(Hitting this in angular / stack_trace.)

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1060813008
2015-04-21 14:49:25 -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
John Messerly 1e43b3ad50 [refactor] js_codegen: remove currentClass, simplify visitSimpleIdentifier
We were tracking currentClass for no real reason.

Also attempted to discern what visitSimpleIdentifier was actually doing. It now prefers the original element (the "field" not the synthetic getter/setter) whenever possible. Previously was a mismash.

This little change tripped on the (larger, not fixed yet) issue #138 ... but I think I found a way around the issue for now, by tweaking the private TypeDataArray class.

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1095563003
2015-04-21 11:21:20 -07:00
Vijay Menon 9efc804f94 Remove workaround
Upstream bug is fixed now.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1096353002
2015-04-21 10:09:45 -07:00
John Messerly b01750fb6e fix super ctor logic
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1095683005
2015-04-21 09:33:41 -07:00
John Messerly 3eca59c586 fix fields that override getters/setters
R=leafp@google.com

Review URL: https://codereview.chromium.org/1099743002
2015-04-21 09:07:22 -07:00
Vijay Menon cf793cbe3f Disable karma on travis
I suspect the version of chromium on travis is too old.

TBR=jacobr@google.com

Review URL: https://codereview.chromium.org/1054283004
2015-04-20 20:25:37 -07:00
Vijay Menon 6f1f1bfc99 Travis workaround
Not sure how to test this locally.  Trying again.  If this breaks, I can just disable the travis part.

TBR=jacobr@google.com

Review URL: https://codereview.chromium.org/1096253002
2015-04-20 20:02:11 -07:00
Vijay Menon 6fda542355 Use travis's version of chromium
TBR=jacobr@google.com

Review URL: https://codereview.chromium.org/1100653002
2015-04-20 19:43:54 -07:00
Vijay Menon f79e110387 Automated runtime tests using Karma
To use:

1. Install node (e.g., install from nodejs.org or sudo apt-get install npm)
2. npm install
3. npm test

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1092213003
2015-04-20 19:31:18 -07:00
Vijay Menon 07ff7edfae Fill out pubspec.yaml
In prep for publishing.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1100623002
2015-04-20 15:17:48 -07:00
Leaf Petersen 1a942eaf49 Handle calls through call methods
This CL makes us recognizes calls through call methods as not requiring dynamic invokes.  The analyzer seems to do the wrong thing on the return types though, so we'll still get casts on the results.  Bug filed here: dartbug.com/23252 .

This fixes #7.

BUG=
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1092183003
2015-04-17 16:37:19 -07:00
Leaf Petersen a880c6fcb9 Reifier hookup
Hook the coercion reifier into the JS backend.

The principle observed changes in the output are from the downward type inference eliminating casts.

The coercion reifier changes in this CL in two ways.

The first is a relatively minor change to factor out the instrumented runtime calls.  The reifier is now parameterized by a runtime object.  If present, casts, wraps, and type object creation are delegated to the runtime.  Otherwise the reifier just produces cast objects directly.  The JS codegen always does the latter.

The larger change is an attempt to make the new AST nodes be resolved.  This is principally done for the typedefs produced for casts - we're not using wrapping right now so I've left that for future if we want it.  This is a bit painful - if we continue down this path I think I'll want to factor this out into a ResolvedAstBuilder or somesuch, but for now this seems to be working.

The rest of the changes are just plumbing in the coercion reifier and its dependencies into the js backend.

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1096583002
2015-04-17 13:56:04 -07:00
John Messerly 457d5c606b [refactor] kick some stuff out of js_codegen.dart
the potentiallyMutated stuff goes into side_effect_analysis
printing stuff goes into js_printer

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1062913004
2015-04-16 11:14:58 -07:00
John Messerly c9c3d7f056 remove another old analyzer workaround
R=leafp@google.com

Review URL: https://codereview.chromium.org/1089693002
2015-04-16 08:38:55 -07:00
John Messerly 33322cb95b Smarter js temp naming, fixes #136
JSTemporary is now identified by instance, not its String name. This provides enough information to do renaming correctly and avoid the bug in #136.

The namer now considers all scopes where the temporary is visible, and chooses a name that doesn't conflict with other identifiers. Because it only considers scopes where the temp appears, it does less renaming that the previous version.
2015-04-15 14:47:29 -07:00
John Messerly da91435c66 fixes for angular hello: String + and disable broken arg parsing
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1085723002
2015-04-14 18:04:14 -07:00
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
Vijay Menon 472d7c09af Update README
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1046393003
2015-04-10 10:08:42 -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
Sigmund Cherem edded6a37c Pin git dependency
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1062193002
2015-04-07 10:35:55 -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 db9e46344b update baseline
forgot to do this after a merge

Review URL: https://codereview.chromium.org/1067553002
2015-04-06 09:20:40 -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
Kenneth Endfinger 94ef55832d Fix Typo in Pubspec 2015-04-03 19:44:24 -04: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