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
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
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
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
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
9f318a484c
add support for mixins
...
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/147247013
2015-01-30 11:19:31 -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
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
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
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
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
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
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
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
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
Leaf Petersen
fcf7a98525
Call method subtyping
...
Allow objects with an appropriately typed call method to subtype function types. Fixes #19 .
BUG=
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/140757013
2015-01-13 16:10:48 -08:00
Leaf Petersen
b8500e008c
Tests for for loop inference. We haven't implemented inference for foreach loops, and don't seem to be propagating inferred types correctly for regular for loops. This CL adds some tests to document this.
...
BUG=
R=jmesserly@google.com , sigmund@google.com
Review URL: https://chromereviews.googleplex.com/136957014
2015-01-13 11:28:04 -08:00
John Messerly
c8da19d3a2
for loop regression test, closes #20 and #21
...
R=leafp@google.com
Review URL: https://chromereviews.googleplex.com/139837013
2015-01-13 11:18:32 -08:00
John Messerly
7a91b971a4
Check for valid super constructor call placement
...
Generated code can be cleaner if this rule is enforced
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/137157014
2015-01-12 14:35:46 -08:00
Leaf Petersen
b0a7024e5d
Formatter run
...
Run the formatter on the repository
BUG=
R=jacobr@google.com
Review URL: https://chromereviews.googleplex.com/138207013
2015-01-12 13:16:35 -08:00
Vijay Menon
85f2c2ca5e
Compound operator fixes
...
This permits:
- double += int
- int|double += num
- int|double|num += dynamic
These used to be rejected.
R=jacobr@google.com
Review URL: https://chromereviews.googleplex.com/138217013
2015-01-09 13:34:10 -08:00
Leaf Petersen
37752f763c
Relaxed casts
...
Allow implicit sideways casts between types that are assignable in regular dart.
BUG=
R=jacobr@google.com , vsm@google.com
Review URL: https://chromereviews.googleplex.com/135247013
2015-01-09 10:22:29 -08:00
Vijay Menon
1b936601fb
Differentiate wrapped closure literals and down casts on constructors
...
R=leafp@google.com
Review URL: https://chromereviews.googleplex.com/130427015
2015-01-09 05:55:42 -08:00