Commit Graph

1367 Commits

Author SHA1 Message Date
Vijay Menon 260cfc05d2 Make nonnullability configurable
John: I added code in the JS codegen to query which primitives are non-nullable.

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

Review URL: https://chromereviews.googleplex.com/155407013
2015-02-18 14:20:22 -08:00
Vijay Menon eb3c51e6f3 Check default parameters properly
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/155367013
2015-02-18 12:13:30 -08:00
Sigmund Cherem b23578984b Unify naming of output libraries in both backends
R=jmesserly@google.com, leafp@google.com

Review URL: https://chromereviews.googleplex.com/157197015
2015-02-18 10:12:54 -08:00
John Messerly 694c93c61f fix #41, named arguments with conversions
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/150407013
2015-02-17 13:27:37 -08:00
Sigmund Cherem ae910f2860 Infer return types and field types based on overrides
R=jmesserly@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/145247013
2015-02-13 16:53:58 -08:00
Sigmund Cherem 46dfefcae7 Fix check of functions agasint void.
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/156137013
2015-02-13 16:48:37 -08:00
Sigmund Cherem 0ab8340e79 Minor improvement on dart:mocks mocks, and fix related test.
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/155267013
2015-02-13 16:18:36 -08:00
Sigmund Cherem c08003a36e Add options and move the multi-package options to normal flags
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/149487013
2015-02-13 13:04:16 -08:00
Vijay Menon 394bb7fbe7 Fix typename for bottom
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/151297013
2015-02-13 09:35:24 -08:00
John Messerly f7a5ff4523 workaround for arrow function bind this
I filed https://github.com/dart-lang/dart-dev-compiler/issues/43 to track removal of this workaround

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/154077013
2015-02-12 15:18:22 -08:00
Sigmund Cherem 26061d84eb Get rid of redundant error messages.
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/146637013
2015-02-12 13:23:14 -08:00
John Messerly fe19170e93 better handling of string literals and interpolation
fixes https://github.com/dart-lang/dart-dev-compiler/issues/42
V8 has shipped template strings: https://code.google.com/p/v8/issues/detail?id=3230

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/152127013
2015-02-12 11:45:39 -08:00
Vijay Menon 266b6df92d Error on uninitialized non-nullables
R=jmesserly@google.com, leafp@google.com

Review URL: https://chromereviews.googleplex.com/157727013
2015-02-12 09:44:41 -08:00
Sigmund Cherem bd5ab4bfb4 Upgrade to use latest ddc_analyzer
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/156657014
2015-02-11 16:57:15 -08:00
John Messerly bf9a2b9015 add test tools, implement generic type constructor
test tools are from https://github.com/webcomponents/webcomponentsjs/tree/master/tests/tools

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/151127013
2015-02-11 16:53:05 -08:00
Sigmund Cherem 0680aea0a7 Change to use dcc_analyzer to make it easier to rev other dependencies on analyzer
BUG=
R=dgrove@google.com, jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/154617014
2015-02-11 15:26:33 -08:00
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 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