Commit Graph

66 Commits

Author SHA1 Message Date
John Messerly 77e62cc7fb implement private members, fixes #74
naturally, lots of things to iterate on, but this expresses the key idea (per-library ES6 symbols for privacy).

R=vsm@google.com

Review URL: https://codereview.chromium.org/963343002
2015-03-03 06:44:25 -08:00
John Messerly a3aebf03ed fix dummy setters -- grammar requires an identifier
R=vsm@google.com

Review URL: https://codereview.chromium.org/974703003
2015-03-03 06:42:04 -08:00
John Messerly 5d52de79e1 implement rethrow
R=sigmund@google.com

Review URL: https://codereview.chromium.org/969783002
2015-03-02 09:49:17 -08:00
John Messerly a260ce7a62 fixes #69, avoid module name inside module scope
R=vsm@google.com

Review URL: https://codereview.chromium.org/967713002
2015-03-02 07:10:55 -08:00
John Messerly bd06d9e7f4 support the JS builtin
* fix a few cases where we regressed js_ast parser interpolations
* infer correct static type for JS call expressions

R=vsm@google.com

Review URL: https://codereview.chromium.org/962083002
2015-02-27 11:28:41 -08:00
John Messerly 2a5adfe05a fix analysis messages
seen on the latest dev channel editor w/ analysis server

R=sigmund@google.com

Review URL: https://codereview.chromium.org/962213003
2015-02-27 09:06:13 -08:00
John Messerly a3bbe2a291 cleans up sdk patching so we no longer have unresolved names
js_codegen.dart and patch_sdk.dart are the only human-changed files.

This also pulls in dart:isolate, which is depended on from one of the implementation libraries

This also moves dart:_* files back to `lib/_internal/compiler/js_lib/` because there's where libraries.dart points to, and hence Analyzer looks for them there. Alternatively, we could put them somewhere like `tool/input_sdk_internal` and then copy that file into the right path.

R=vsm@google.com

Review URL: https://codereview.chromium.org/955513008
2015-02-26 17:58:13 -08:00
Vijay Menon 50753e3a47 Typecheck constructor initializers properly
R=leafp@google.com

Review URL: https://codereview.chromium.org/959003003
2015-02-26 16:19:27 -08:00
John Messerly ead4fe2e85 merge class extensions from patch files.
There are a few examples of classes like this:

```dart
@patch
class StringBuffer {
  ... various @patch members ...
  // no @patch here
  void _writeString(str) { ... }
}
```

we need to merge in those members too

R=vsm@google.com

Review URL: https://codereview.chromium.org/955513007
2015-02-26 08:08:21 -08:00
John Messerly b82e83f383 use js_ast instead of strings to generate JS
fixes https://github.com/dart-lang/dev_compiler/issues/61

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

Review URL: https://codereview.chromium.org/949383003
2015-02-25 11:14:19 -08:00
Vijay Menon 5c1c9c2381 Add LICENSE and corresponding headers
Fix expectations where line number has changed.

R=dgrove@google.com

Review URL: https://chromereviews.googleplex.com/158257013
2015-02-24 15:02:26 -08:00
Sigmund Cherem 608906db87 Fixes needed so we work correctly with the latest analyzer
Review URL: https://chromereviews.googleplex.com/157367013
2015-02-20 15:39:28 -08:00
Sigmund Cherem d2834b49a6 Reenable type promotion
R=jmesserly@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/159667013
2015-02-20 13:56:46 -08:00
John Messerly 6c7cd9b731 Begin to handle some of the *_patch.dart files
Moves: test/sdk --> tool/input_sdk_src
Also moves: test/sdk/lib/_internal/js_lib --> tool/input_sdk_patch
we'll eventually need to customize that code

Adds tool/patch_sdk.dart, an offline transformation step that produces: test/generated_sdk

Essentially this merges the "external" declarations and the @patch syntactically. There's a comment in tool/patch_sdk.dart explaining the rationale behind this approach.

There's still *lots* to do in the generated code. This does none of that. The only new code is tool/patch_sdk.dart and the minimum changes to test/codegen_test.dart and js_codegen.dart to get test.sh running and debuggable.

Tracking bug for SDK is https://github.com/dart-lang/dart-dev-compiler/issues/58

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

Review URL: https://chromereviews.googleplex.com/157137013
2015-02-20 08:58:01 -08:00
Sigmund Cherem d78ecd3241 Infer consts and final fields based on RHS
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/142457013
2015-02-19 08:34:01 -08:00
Sigmund Cherem ce3dd48740 Accept compilng HTML files
R=jmesserly@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/153157013
2015-02-18 16:48:56 -08:00
John Messerly 7c1ab1f04d work around issue #51, super restrictions in V8
Adds an explicit "extends dart.Object", which we probably want for other reasons (e.g. toString, runtimeType, hashCode)

Attempts to recover some readability by tweaking the name of the initialize functions. This closes #51, but we should open another tracking bug because there are concerning aspects to this workaround.

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

Review URL: https://chromereviews.googleplex.com/150417015
2015-02-18 16:27:32 -08:00
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
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
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
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
Vijay Menon 9265d63a32 Fix core libs for primitives
R=jacobr@google.com, jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/155017013
2015-02-11 14:10:27 -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
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 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
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 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
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
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 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
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
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 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
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