Commit Graph

2821 Commits

Author SHA1 Message Date
Vijay Menon e64630186d Add non-nullability logic for primitives
Still need to:
- Fix our dart:core errors
- Change DownCastLiteral to error
- Handle "int x;", etc.

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

Review URL: https://chromereviews.googleplex.com/156787013
2015-02-11 12:08:34 -08:00
John Messerly d1cffd61c4 fix indent for generic classes. the previous change intentionally skipped indent for easier diff viewing.
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/157687013
2015-02-11 10:10:57 -08:00
John Messerly 083e4c4889 reified generics baby steps
introduces a memoized function that produces the generic type instance
generic type parameters are closed over, making it easy to get them and ensure they flow correctly through base class/mixins.

also implements the unimplemented features in _typeName.

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

Review URL: https://chromereviews.googleplex.com/157627013
2015-02-11 09:03:03 -08:00
Leaf Petersen aca4469d51 Workaround type name bug
There's a bug in the analyzer (fixed in ToT) that results in screwy names for function types sometimes.  This works around it for now.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/156727013
2015-02-10 17:37:13 -08:00
John Messerly f85c2eb649 fix mixin field init, implicit-this
also slight change to sunflower example

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/144247014
2015-02-09 13:11:26 -08:00
John Messerly 591834b748 improve cascades
* better code for the case we already supported
* support the general case

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/154757013
2015-02-09 13:04:55 -08:00
John Messerly 73adf003e6 use cli_utils to get SDK dir
also a small cleanup to make it easier to construct TypeResolver (fixes a TODO) and fix a couple of typos

R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/145437014
2015-02-09 11:25:17 -08:00
John Messerly bf682828f8 implement try and switch
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/144527014
2015-02-06 10:25:13 -08:00
John Messerly 9957696748 improve invoke/as code
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/149937013
2015-02-05 15:46:42 -08:00
Vijay Menon 29718b72e8 Support Function object typing
R=jmesserly@google.com, leafp@google.com

Review URL: https://chromereviews.googleplex.com/147547013
2015-02-05 14:06:09 -08:00
John Messerly 170c06e3d4 partial support for IsExpression
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/148937013
2015-02-05 09:52:33 -08:00
Vijay Menon c2a2fa5a79 Minor dbinary fix
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/148987014
2015-02-05 09:40:20 -08:00
John Messerly 7b60c4140f simplify named ctors
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/150947013
2015-02-05 09:18:50 -08:00
John Messerly 6d41af0fe4 another attempt to pin dart_style to a working version.
we need the fix for https://github.com/dart-lang/dart_style/issues/156
and https://github.com/dart-lang/dart_style/issues/67 is nice too

Review URL: https://chromereviews.googleplex.com/147537013
2015-02-04 16:46:49 -08:00
Vijay Menon add3878570 Pin dart_style to 0.1.3 until we roll analyzer
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/154667013
2015-02-04 16:04:04 -08:00
John Messerly 61c793fb5a remove unused import
Review URL: https://chromereviews.googleplex.com/153677013
2015-02-04 09:47:11 -08:00
John Messerly 27ba5723d9 some test script fixes to get it running cleanly on dart_codegen
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/150927013
2015-02-04 09:31:50 -08:00
John Messerly 1c26c3e1a6 fix user-defined operators in classes
well, at least they don't generate blatantly illegal ES6 code now :)
also fixes incorrect implicit this generation, dynamic get/index, and set/setindex

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/146497013
2015-02-03 16:56:24 -08:00
Leaf Petersen 3b3f101787 This CL rolls up a number of changes to the dart code generation.
Import/export directives are preserved, and new ones are generated using package syntax using Vijay's logic.  This is not yet robust for relative URIs, but is sufficient for our purposes.

Wrapper hoisting is disabled, and various wrapper generation bugs are fixed.

Type name qualification is done more selectively, and more correctly.

Casting is disabled in const contexts, with a severe warning.

Coercions and wrappers now both call into the dart logging runtime, and pass various useful information (currently mostly ignored).

This also adds some preliminary dart codegen tests, and hence includes a number of expected output files in the test/dart_codegen/expect directory.

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

Review URL: https://chromereviews.googleplex.com/141427014
2015-02-03 16:42:13 -08:00
John Messerly b6b72621d6 named arguments
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/152597013
2015-02-03 15:00:36 -08:00
Vijay Menon 2d3d41f892 Add caching on logging
This speeds up loading and running by 1-2 orders of magnitude.

R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/145507013
2015-02-02 09:33:02 -08:00
John Messerly 19e334e7af add support for iterable/for-each
also adds break/continue and labels, and cleans up if-else formatting

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/140457014
2015-01-30 13:57:48 -08:00
John Messerly 0d6e8de00f fix a hint and formatting
TBR

Review URL: https://chromereviews.googleplex.com/144447013
2015-01-30 13:54:18 -08:00
John Messerly a6cde17998 fix static fields, add map literals
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/141557013
2015-01-30 13:23:55 -08:00
Vijay Menon 08918b851b Fixes for logging
R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/148157013
2015-01-30 12:52:29 -08:00
Vijay Menon 793131178f Remove non-nullability check
So ... I'd forgotten to remove this logic ... but maybe we still want it?  :-)

R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/140257013
2015-01-30 12:22:08 -08:00
John Messerly 6c6a6d5163 fix typo 2015-01-30 11:46:23 -08:00
John Messerly 9f318a484c add support for mixins
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/147247013
2015-01-30 11:19:31 -08:00
Vijay Menon 7f0a64cce5 Suppress CastError in logging mode
R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/150617013
2015-01-30 09:22:13 -08:00
John Messerly 25a0f9fba4 implement function statements, assert
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/145367013
2015-01-30 08:00:42 -08:00
John Messerly 8463f421ad implement notNull checking for num -> int and num -> double
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/144347013
2015-01-30 07:59:36 -08:00
John Messerly 4aea11009f improve computed js library name
at least it's not generating names that were invalid JS now :)

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/148037013
2015-01-29 07:56:53 -08:00
John Messerly 3438d26f5f check in SDK dart:core snapshot for tests
also tweaks the formatter to ignore it for ease of diffing

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/145337013
2015-01-28 16:41:34 -08:00
Vijay Menon 930e25d495 Generate output directories to match package paths
Still need to investigate the assert I commented out, but much closer now.

John: This also affects the path passed in the js backend.  If the package-paths env is not set, it'll fall back to the old behavior.

R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/147977013
2015-01-28 14:35:37 -08:00
John Messerly c64afcf15a add SDK baseline
lots of things wrong with this generated code, but it's a start
(this builds on https://chromereviews.googleplex.com/148007013/)

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/147147014
2015-01-28 13:11:08 -08:00
Leaf Petersen 16d731d3b8 As translation
Translate as expressions in to the appropriate calls into the dart runtime.  When I have span information, I emit a key with the location of the cast from the original code.  For wrappers, I currently don't have the span information plumbed through, so leave the key off.  We can probably get this information plumbed through if needed.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/148627013
2015-01-28 12:57:33 -08:00
John Messerly cad9b49ae4 generate JS per-library instead of per-unit
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/148007013
2015-01-28 12:51:45 -08:00
John Messerly 39746cb45e fixes to start codegen for sdk
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/145237013
2015-01-28 10:02:40 -08:00
Sigmund Cherem b99e710e89 Make _visitToken public to remove new analyzer warnigns
TBR=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/146217014
2015-01-27 16:11:08 -08:00
John Messerly c08494e36f add sdk version check
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/140347013
2015-01-27 15:14:53 -08:00
John Messerly bc57422371 catch more things in dartanalyzer
inspired by kevmoo's change here --> https://chromereviews.googleplex.com/126507013/

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/126517013
2015-01-27 14:36:39 -08:00
Leaf Petersen 7685506b1f Bug fixes
Guard against calling override checking directly with Object while checking the SDK, and fix up the exit status code when compiling.

BUG=
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/145227013
2015-01-27 13:31:33 -08:00
Sigmund Cherem 2bc4a36580 Run formatter in test.sh
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/133597013
2015-01-27 12:18:46 -08:00
Sigmund Cherem 2df05920ae Run formatter, remove dead code detected from analyzer
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/145197013
2015-01-27 12:17:12 -08:00
Sigmund Cherem 763e61f4d3 Compile library-by-library. This is a step closer to our incremental compile.
As part of this change I made codegen synchronous. Technically is not necessary,
but I think it reduces complexity a lot. For example, keeping it async would
have required more changes to the testing infrastructure. Let me know if you
want to keep that change separate though.

With this change, I'm removing one more use of element.node, which is necessary
to achileve our goal. There is only one more use of this API, for which John has
a CL out.

BUG=
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/145167013
2015-01-27 09:49:26 -08:00
John Messerly fa30a6c69f add harmony feature testing
R=jacobr@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/133307014
2015-01-27 09:34:16 -08:00
John Messerly 728258ba48 improve top-level field codegen: avoid Element.node getter
also correctly exports the values of top-level fields, and ensures it uses the most up-to-date value for mutable top-level fields

we can likely improve this further once we have ES6 modules, but it seems like an okay start

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/147927013
2015-01-27 08:25:53 -08:00
John Messerly cc18e50d84 fix analyzer warnings and hints
found this with:
$ dartanalyzer --fatal-warnings --package-warnings bin/devc.dart | (! grep $PWD)

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

Review URL: https://chromereviews.googleplex.com/147897013
2015-01-27 08:16:34 -08:00
Leaf Petersen 86ef75389e Handle wrapping of null
This CL fixes a bug in the coercion reifier in which a null value would get wrapped by the reifier, turning it into a non-null value.

There are also some small fixes for some types from the DownCastBase refactoring which weren't quite right.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/140327013
2015-01-26 17:47:13 -08:00
Sigmund Cherem d213f77ba2 Remove .node in checker and a few other places
A couple places remain:
 * how codegen is driven (we should change the pipeline for this)
 * how js-codegen determines whether an top-level expression is a constant field
 (this might require tracking additional information in our checker)

R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/143177014
2015-01-26 15:32:39 -08:00