Commit Graph

2256 Commits

Author SHA1 Message Date
vsmenon 07fe48f5b9 Update devc.dart 2016-02-12 12:29:24 -08:00
vsmenon 0c8ddd7795 Update package.json 2016-02-12 12:29:07 -08:00
vsmenon 8cc738f468 Update pubspec.yaml 2016-02-12 12:28:49 -08:00
Vijay Menon fce423e295 Get travis back to green
Just commenting out the pub run test step.

TBR=ochafik@google.com

Review URL: https://codereview.chromium.org/1690393003 .
2016-02-12 12:18:51 -08:00
Olivier Chafik 7a373c1984 e2e test for transformer (webdriver + pub serve)
BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1672563002 .
2016-02-12 14:53:17 +00:00
Olivier Chafik 037f9bfcb9 Make tool/get_chrome_canary.sh work on Mac 2016-02-12 14:23:18 +00:00
Vijay Menon 3f85417199 Support for dart:typed_data
Fixes #441
Fixes #444

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1680263002 .
2016-02-11 14:36:27 -08:00
Olivier Chafik 1851561638 Fix JS-intrinsic definition of SDK classes
`let Foo = class Foo {};` -> `class Foo {}`

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1681293005 .
2016-02-11 17:31:35 +00:00
Olivier Chafik 0e659e17c4 Use Uris for corelibOrder
(Seems to make some sdk imports not lazy anymore, without even burning the house)

Also, tiny module-related fixes to help with some es6 tools such as rollup:
- Avoid self-importing in eager corelibOrder hack
- Always export exports in es6 module builder

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1689013002 .
2016-02-11 17:28:06 +00:00
Olivier Chafik 4ad758998a Emit TypeScript / Closure ES6_TYPED type annotations in --closure mode (instead of closure comments).
- Replaced ClosureType by a general JS.TypeRef, used in AST for identifier types, return types
- Convert DartType to JS.TypeRef (in mixin JsTypeRefCodegen), including type parameters (also added to AST in Fun & ClassExpression)
- Emit field declarations expected by TS
- Wrote a TypeScriptTypePrinter (mixed in by Printer) and a ClosureTypePrinter (might disappear soon)
- Simplified annotation code, called in more places (seems to gives more source info)

Example input:

  List/*<T>*/ func/*<T>*/(List/*<T>*/ items, dynamic/*=T*/ seed) {}

  class Foo<T> {
    int i;
    static var x;
    Foo(this.i, o, {String v : "?"}) {}
  }

Output:

  function func<T>(items: core.List<T>, seed: T): core.List<T> {}

  const Foo$ = dart.generic(function(T) {
    class Foo<T> extends core.Object {
      i: number;
      static x;
      Foo(i: number, o, {v = "?"}: {v?: string} = {}) {
        this.i = i;
      }
    }
    ...
    Foo.x = null;
    return Foo;
  });

Known remaining issues:
- typedefs expect a `type Callback = (...) => ...;` statement
- `exports` is a reserved keyword in TS (either we change the way we do exports, or we'll need a different temp + extra type annotations of the default-exported object).
- Generic type is currently locked inside the generic call. Might be able to solve by exporting signatures in .d.ts file, or changing the way we do generics.

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1676463002 .
2016-02-10 18:22:21 +00:00
Olivier Chafik b4df401e51 Add ./tool/override_analyzer_dependency.sh to checkout latest analyzer + set is as override
Note that pub get is needed after this.

When DDC works with analyzer@master, we can setup a travis env by adding the following lines to .travis.yml:

before_install:
  - test -z "$ANALYZER_BRANCH" || ./tool/override_analyzer_dependency.sh
env:
  - ANALYZER_BRANCH=""
  - ANALYZER_BRANCH="master"

Currently the latest analyzer provides null elements for CompilationUnit parts of dart._runtime (see failure: https://travis-ci.org/dart-lang/dev_compiler/jobs/107936636#L465)

BUG=
R=leafp@google.com

Review URL: https://codereview.chromium.org/1682673002 .
2016-02-10 03:09:38 +00:00
Vijay Menon 817fbc5714 Fix checked mode break in server mode
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1679873004 .
2016-02-09 11:26:30 -08:00
Olivier Chafik 3f4667bc5d Proper span/asset location for DDC errors in the transformer
BUG=
R=rnystrom@google.com

Review URL: https://codereview.chromium.org/1667173002 .
2016-02-09 17:06:09 +00:00
Olivier Chafik 0afdd61031 Improve --destructure-named-params:
- Destructure named params that clash with JS reserved names:
  `f({arguments = 1}) {}` becomes `function f({['arguments']: arguments$ = 1} = {}) {}`
- Use ES6 default params for positional & optional parameters
- Added simple tests

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1677863002 .
2016-02-09 16:46:32 +00:00
Olivier Chafik 7cabe2b1df Fix a couple of references in _runtime that should have been resolved as quasiquotes
(found when doing tree-shaking :-))

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1681593004 .
2016-02-09 16:35:09 +00:00
Vijay Menon a4d4a8dd54 Infra for running lib tests
This is in prep for #441

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1673863002 .
2016-02-05 14:49:16 -08:00
Olivier Chafik f2a26256e4 Simple transformer to run ddc in pub build/serve
- Added simple test that exercises relative and absolute imports
- Introduced FileSystem abstraction to collect compilation outputs /
seed runtime inputs
2016-02-04 19:08:50 +00:00
Olivier Chafik 98b21b030e Revert "Use a symbol for static length/name (and other Function properties) for Closure, to avoid ES5->ES6 lowering bug (https://github.com/google/closure-compiler/issues/1460)."
This reverts commit a637e1b048487629d0d44620eb41e703531ce18d.
2016-02-03 20:35:59 +00:00
Olivier Chafik 84043ffd1e Use a symbol for static length/name (and other Function properties) for Closure, to avoid ES5->ES6 lowering bug (https://github.com/google/closure-compiler/issues/1460).
This is part of the overall "simple closure" effort (issue #312)

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1630963003 .
2016-02-03 20:25:07 +00:00
Olivier Chafik f7f21ca65e Create local alias for super class in --closure mode (issue #312)
Closure compiler chokes on super classes that aren't qualified paths.

(example: http://goo.gl/5mHC7S)

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1638533004 .
2016-02-03 20:21:12 +00:00
vsmenon 76326585b7 Update GENERIC_METHODS.md 2016-02-03 10:45:54 -08:00
vsmenon 1d0cf65b95 Update USAGE.md 2016-02-03 05:50:25 -08:00
Vijay Menon a763c43486 Refactored this and uploaded here:
https://github.com/dart-lang/dev_compiler/blob/strong/STRONG_MODE.md

PTAL

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

Review URL: https://codereview.chromium.org/1541833002 .
2016-02-03 05:44:22 -08:00
John Messerly dee054e23b fixes #415, correct type for map literals
Not sure why this wasn't implemented. Lists seem to be okay.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1611753002 .
2016-02-01 15:39:54 -08:00
John Messerly f43b756b2f fix #43, remove => workaround
also fixes node.js test to use a temp directory, instead of creating "tmp" under dev_compiler checkout

R=vsm@google.com

Review URL: https://codereview.chromium.org/1643523008 .
2016-02-01 12:54:58 -08:00
vsmenon c43cb167b2 Update CHANGELOG.md 2016-01-29 10:17:17 -08:00
vsmenon 980c580483 Update devc.dart 2016-01-29 10:16:19 -08:00
vsmenon ff2eaeff82 Update package.json 2016-01-29 10:16:01 -08:00
vsmenon f89b0931a0 Update pubspec.yaml 2016-01-29 10:15:46 -08:00
Vijay Menon 0fbd992505 Builds / serves multiple HTML files.
With this, I can build multiple Angular samples simultaneously:

[dist/dart/playground/build/web] dart ~/git/dev_compiler/bin/dartdevc.dart -o /tmp/ddc-out --force-compile src/*/index.html

Fixes #430

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1645343002 .
2016-01-29 10:13:28 -08:00
John Messerly cf6bca8596 Remove library tags, they aren't needed
(with one exception: libs that have parts)

R=rnystrom@google.com

Review URL: https://codereview.chromium.org/1644823002 .
2016-01-29 09:25:34 -08:00
Olivier Chafik edaf069dba Add --modules=node support
- Force import order in all sdk files + simplify module builders
- Stub a node_test.sh with hello world + DeltaBlue (to be expanded to language tests in a followup change)
- Use global_ from dart:_runtime in html lib
- Better export for symbols that node chokes upon: throw, const, void, implements, export... (define as throw_ locally, with proper local resolution, then export as throw).
- Cleanup node module builder

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1633003002 .
2016-01-29 10:01:48 +00:00
Vijay Menon b56617b947 Add CustomEvent
This just mechanically adds CustomEvent.

Fixes #423

R=jacobr@google.com

Review URL: https://codereview.chromium.org/1616263005 .
2016-01-28 17:04:13 -08:00
vsmenon 82e0fc2cae Update CHANGELOG.md 2016-01-28 15:46:16 -08:00
vsmenon 81625ea6b8 Update devc.dart 2016-01-28 15:45:19 -08:00
vsmenon 87db9db7a1 Update package.json 2016-01-28 15:45:02 -08:00
vsmenon cd61e898bd Update pubspec.yaml 2016-01-28 15:44:43 -08:00
Vijay Menon a693930830 Roll analyzer to 0.27.2-alpha.1
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1641643004 .
2016-01-28 15:35:59 -08:00
Vijay Menon c274b6f9e9 Regen tests
Forgot to do this after changing the flatten tests.  pkg:collection also updated with some file moves.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1642903004 .
2016-01-28 14:39:15 -08:00
Vijay Menon bd34d574be Skip flatten tests
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1643003003 .
2016-01-28 14:24:05 -08:00
Olivier Chafik 04d4be0982 Less dart.notNull checks for local vars using flow-insensitive nullability inference.
Within some AST context (at library granularity, for convenience), we
collect all the assignments to local vars:
- Declaration with no initializer amounts to `null` assignment
- Assignment ops are expanded naively: `x++` yield an assigned value of
`x + 1`, etc

We detect "trivially nullable" variables (e.g. `var x;`, `x =
breaking.out;`) by spotting assigned values that are nullable under the
optimistic assumption that all known variables are non-nullable.

Then we build a nullability dependency graph in linear time: whenever
we see `x = y;`, we know that "y is nullable" implies "x is nullable".

Finally, we propagate "trivial nullabilities" through that graph: any
variable that wasn't reached is deemed not-nullable.

(this is similar to mark and sweep garbage collection, where the roots
are the "trivially nullable" variables; credits to leafpetersen@ for
linear solution)
2016-01-28 15:47:49 +00:00
John Messerly 33c186f49c fix a typo in generic method docs 2016-01-27 15:56:26 -08:00
Vijay Menon 731dc0633b Handle local files better in server mode
We're already serving sources from the original directory (for source
maps).  This lets us serve other resources as well.  Makes it simpler
to run angular todo and other apps with xhr'ed data.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1644673002 .
2016-01-27 14:03:52 -08:00
John Messerly 0b646eb520 fixes #427, static fields emitted outside the scope of their class
mainly, this backs off of some readability optimizations around static and top-level fields that were too aggressive. On their own, they were okay, but they collide with the library-cycle issues. Once we can remove that issue, we could consider restoring some of this. In the meantime, simplicity is good.

The new operation in the declaration loader is to allow us to see if an initializer has all its dependencies satisfied, but without changing any ordering if they are not.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1636233002 .
2016-01-27 09:35:40 -08:00
Vijay Menon d043d05544 Rebase on latest package:collection
pub get now pulls in a new one

TBR=jmesserly@google.com

Review URL: https://codereview.chromium.org/1645633002 .
2016-01-27 08:49:43 -08:00
John Messerly de8e3a0cff Merge pull request #429 from dart-lang/module-builder-followup
Import package:path with an alias in module_builder
2016-01-26 13:47:03 -08:00
Vijay Menon a2ced17c9a Run format
Looks like a recent commit missed a format / presubmit.

TBR=jmesserly@google.com,ochafik@google.com

Review URL: https://codereview.chromium.org/1631303003 .
2016-01-26 09:54:26 -08:00
Olivier Chafik c119af7d32 Import package:path with an alias in module_builder
(follow-up to hasty
https://github.com/dart-lang/dev_compiler/commit/b379f403d556a6eca9a7e07
74611999c623f03e6)
2016-01-26 17:44:58 +00:00
John Messerly 1aa4073a8f Merge pull request #420 from dart-lang/fix_419_docs
fixes #419, clarify docs around /*=T*/
2016-01-26 08:50:23 -08:00
Olivier Chafik 4eec9f5ff4 Resolve local paths in es6 modules (+ refactor ModuleBuilder) 2016-01-26 14:00:46 +00:00