Commit Graph

2256 Commits

Author SHA1 Message Date
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
Vijay Menon 4a8c10f58c Initial support for runtime logging
This is very half baked.  Putting it down to work on better type literal support for the moment.

Qs:
(1) What should we measure?  cast failures mapped back to source?  I don't think we inject anything else right now.
(2) How should we report?  I just have dump function right now, but that'll be unwieldy on large apps.

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

Review URL: https://chromereviews.googleplex.com/146737013
2015-01-26 10:51:38 -08:00
John Messerly b9fce8ad51 add lazy fields, cleanup library identifiers
R=leafp@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/146777014
2015-01-26 10:25:45 -08:00
Vijay Menon 9e7634e0e6 Support for generic 'literals' in dart checks
Jacob, Siggi, and I were discussing something like this yesterday morning as a way to write List<String>.  Hacky, but does allow for inline checks.

R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/143037014
2015-01-23 10:01:19 -08:00
John Messerly c9d86483ef rename dart_runtime to dart
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/147667013
2015-01-22 11:09:21 -08:00
John Messerly 69add413d2 add work-in-progress deltablue
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/147607013
2015-01-22 09:49:48 -08:00
John Messerly 411803ffd4 don't use deprecated constant visitor
R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/145987013
2015-01-21 15:51:26 -08:00
Vijay Menon 5e6edcbade Support covariant generics at runtime
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/142887013
2015-01-20 14:53:15 -08:00
John Messerly 6f58b51389 add test for field order
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/137317015
2015-01-20 13:24:13 -08:00
Sigmund Cherem 33e1aa1313 Rerun formatter, remove unused import
BUG=
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/137587013
2015-01-16 08:34:24 -08:00
Sigmund Cherem 7592e0e9e9 Cleanup on invalid overrides logic. THis is a follow up with Leaf's comments.
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/143757013
2015-01-16 08:24:40 -08:00
Sigmund Cherem 6effcffa67 Check for invalid method overrides between interfaces, base classes, and mixins.
Closes #13

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/138367013
2015-01-15 17:43:49 -08:00
Sigmund Cherem 7732dd9d8e Provide better error messages when files are not found
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/141947013
2015-01-15 14:23:22 -08:00
John Messerly c350bb7816 use harmony features in js codegen, including classes
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/138327013
2015-01-14 14:35:50 -08:00
John Messerly 102fcb9d20 small cleanup to the writer
The contract around indentation should be tighter now and easier to follow. This fixes cases that caused indent to be skipped.

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/140867013
2015-01-14 12:26:22 -08:00
Vijay Menon 20cf4c9c4b Runtime arity helper function
We'll need to figure out an efficient way to do this in JS output.

An alternative, suggested by Jacob, is only provide something like an applyTruncated function.  E.g., something like:

dynamic applyTruncated(Function f, List args) {
  var arity = getArity(f);
  assert(args.length >= arity.min);
  args = args.sublist(0, arity.max);
  return Function.apply(f, args);
}

Jacob: is this what you have in mind?

If so, we could *only* provide this.  The dart2j impl could use the existing code pattern of is-checks.  The ddc implementation could map to JS apply (with a check for named params?).

Thoughts?

R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/137047014
2015-01-13 17:55:44 -08:00