Commit Graph

1589 Commits

Author SHA1 Message Date
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 2749eaa496 Summarize only per logging level
This prunes out INFO messages by default - they end up being a substantial chunk of the payload in server mode.  You can still serve them up by passing '-l ALL' or '-l INFO'.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1126243004
2015-05-14 10:46:35 -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
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
John Messerly 32f3c78b82 fix temps that have the same name to have different Elements
this was happening because we picked up an == operator from analyzer's Element

also adds an assert, because I took way too much time figuring out what the heck was happening there :)

R=vsm@google.com

Review URL: https://codereview.chromium.org/1139673005
2015-05-11 16:40:16 -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
Vijay Menon c1d7b44212 Return obj in setType
We use the pattern:
  var x = dart.setType([1, 2, 3], List$(int));
in generated code.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1140523002
2015-05-11 09:49:21 -07:00
John Messerly a7c860173c fixes #177, FunctionDeclarationStatement and closing over this
R=vsm@google.com

Review URL: https://codereview.chromium.org/1132113003
2015-05-08 14:52:52 -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 da208152ea fixes #157, renaming local library identifiers if needed.
readability regression, but fairly simple fix. looks okay in libraries with few imports, bad if they have a lot. ultimately I think this gets cleaned up as part of emitting modules + handling module lowering in JS codegen, see issue #34.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1122133003
2015-05-06 13:47:38 -07:00
Leaf Petersen bf567bb94b Typing fixes to eliminate casts/dcalls
Tightens up some typing issues (mostly in the collections) to eliminate some casts and dynamic calls.  Also adds inference through parenthesized expressions.

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1122313002
2015-05-05 16:47:19 -07:00
John Messerly a281dba3f5 fixes #158, precendence of call and access in new
R=vsm@google.com

Review URL: https://codereview.chromium.org/1122283002
2015-05-05 14:55:02 -07:00
Leaf Petersen 071e6d0d46 SDK fixes
This fixes all of the static errors from generating the SDK except those in the _interceptors library, and a set of errors associated with checks of the form (v is E) for generic type parameter E.  Most of the fixes consist of adding missing generic parameters, or making overrides consistent.  There are a few fixes to resolve issues around code that moved implicitly between hidden implementation classes and their public API classes, and some other miscellaneous fixes.

All of my changes are in the tool/input_sdk directory - the rest of the diff is generated code.

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1112403004
2015-05-05 10:58:33 -07:00
Leaf Petersen 3161bc578e Inference through conditional expressions.
Push type info down through conditional expressions.  This eliminates some casts (mostly due to a bug in the analyzer lub code).

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1121993004
2015-05-05 10:47:42 -07:00
John Messerly 9d32ea0069 fixes #147, add this and super to isStateless
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1117373002
2015-05-05 09:16:56 -07:00
John Messerly c58318a8ef fixes #130, accept anything with iterator in for loops
R=vsm@google.com

Review URL: https://codereview.chromium.org/1126713002
2015-05-05 09:06:45 -07:00
Vijay Menon 1a0efac4e5 Do not suppress implicit constructors that need a super call.
This fixes a bug creating an _AsyncCompleter (_Completer.future was not being initialized).

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1122883002
2015-05-04 14:50:34 -07:00
John Messerly b0899d64df fixes #150, broken code in js_number.dart
R=vsm@google.com

Review URL: https://codereview.chromium.org/1121853002
2015-05-01 14:37:19 -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 da405c9357 Fix some static member emits
Fixes:
- Lazy static fields - Jmesserly's suggestion from a previous cl
- Private named constructors (was failing at runtime in angular)

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1117333002
2015-05-01 11:34:15 -07:00
Vijay Menon d9298be76c Treat our type objects as core.Type and other minor fixes
R=leafp@google.com

Review URL: https://codereview.chromium.org/1099703003
2015-05-01 10:26:46 -07:00
John Messerly 56c75ff912 fix #159, static renames for caller/arguments
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1111803005
2015-04-29 16:07:37 -07:00
John Messerly dc4b3d5be9 fix static members in _emitMemberName
static/top-levels don't need extension method, operator renames, or different slots* for private members

(static members are qualified by the static type, so they aren't ambiguous, e.g. Foo._foo and Bar._foo where Foo and Bar are in same/different libraries)

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1111863002
2015-04-29 14:45:14 -07:00
John Messerly ff2749c270 small refactor: use JS.* prefix for our other JS extensions
it's not clear what will end up in js_ast vs ddc, so nice to use js_ast conventions for the JS nodes

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1111893002
2015-04-29 14:41:48 -07:00
John Messerly 63be67e05a fix ClassTypeAlias extends
R=vsm@google.com

Review URL: https://codereview.chromium.org/1083383006
2015-04-24 16:06:25 -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 5af860f9ac fix #155, numeric integer literals
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1090613006
2015-04-23 13:43:53 -07:00
Jacob Richman e19f967ce0 Fix Array constructor bug impacting dart2js and ddc running on the same page.
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1094243007
2015-04-23 13:19:39 -07:00
John Messerly 5a1c3bacfa small refactor to move JsPeer code out of _finishClassDef
Nothing wrong with it there, but it was tangled up with the _emitClassIfNeeded code I'm trying to fix for use-before-define issues. Also _finishClassDef's reason for existing is shared code between FunctionTypeAlias/ClassTypeAlias/ClassDeclaration, so the fact that only one of those cares about jsPeer was a sign.

(My first thought was actually _finishClassMembers, but discovered the generics issue: https://github.com/dart-lang/dev_compiler/issues/154)

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1061543004
2015-04-23 10:17:14 -07:00
John Messerly a127bab753 canonicalize const
R=vsm@google.com

Review URL: https://codereview.chromium.org/1099333002
2015-04-23 09:12:26 -07:00
Jacob Richman 2a1e4985d4 fuse List and js Array together and a few other misc fixes.
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1071393007
2015-04-22 17:23:31 -07:00
John Messerly 36518b8cfb fixes #146, JS globals were not understood by the renamer
there are two basic strategies to fix: we either provide globals to the renamer, or it determines them based on use. I went with the second approach, as it fits more naturally with the current code generator.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1099813006
2015-04-22 10:43:54 -07:00
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
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
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