Commit graph

2161 commits

Author SHA1 Message Date
Asger Feldthaus c808dd897c [kernel] Allow variable declarations that are not direct children of a block.
For example:

  if (foo) var x = 5, y = foo(x);

Becomes:

  if (foo) {
    var x = 5;
    var y = foo(x);
  }

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/419297013 .
2016-05-04 13:38:04 +02:00
Asger Feldthaus c1e99a7b9e [kernel] Avoid using empty strings as library names.
Previously, anonymous libraries would have an empty name when loaded
from Dart, but a null name when loaded from binary.

The textual printer will use synthetic names for null, but not for empty
names, so we should prefer null.

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/419187013 .
2016-05-03 12:59:16 +02:00
Asger Feldthaus 78fea36888 [kernel] Add codereview.settings 2016-04-29 12:58:45 +02:00
Asger Feldthaus afd71681e9 [kernel] Do not use the return value from calls to '[]='.
If an index assignment occurs where its result is used, we bind
the value in a 'let' to reuse the value.

For example:
  return x[y] = z

would become:
  return let #x = x
      in let #y = y
      in #x.[]=(#y, z)

but now becomes:
  return let #x = x
      in let #y = y
      in let #z = z
      in let #dummy = #x.[]=(#y, #z)
      in #z

It clearly looks worse, but it makes the semantics of MethodInvocation
node a lot more uniform when there is no special case for invoking a
method named '[]='.
2016-04-29 10:03:57 +02:00
Asger Feldthaus 272a9e51c6 [kernel] Avoid creating a 'let' binding for 'this' in property and index access.
Some analyses can perform special treatment of 'this' accesses, so we
should preserve them when desugaring.

For example:
  this.foo += 1

would become:
  let #1 = this in #1.foo = #1.foo.+(1)

but now instead becomes:
  this.foo = this.foo.+(1)
2016-04-29 08:43:13 +02:00
Asger Feldthaus a117d3f8f7 [kernel] Add 'const' modifier to StaticInvocation.
This is to distinguish constant calls to an external constant factory.

This changes the binary format.
2016-04-28 12:58:42 +02:00
Asger Feldthaus 6f060282f4 [kernel] Support external constant factories such as String.fromEnvironment.
Also fixes a bug in translation of factory calls.
2016-04-28 12:29:40 +02:00
Asger Feldthaus 3bcde6d532 [kernel] Handle redirecting factory constructors.
Redirecting factories are desugared to a factory procedure with a
return and call in the body.

Constant calls to a constant redirecting factory are redirected at the
call-site to the effective target, which must be a constant constructor.
2016-04-28 09:37:22 +02:00
Asger Feldthaus bc46000f4b [kernel] Make test package use ^ and fix a comment 2016-04-27 16:44:25 +02:00
Asger Feldthaus 811a47d430 [kernel] Initial implementation of Dart Kernel.
Contains:
- Command-line tool
- Kernel AST
- Binary serialization
- Printing as text
- Frontend based on analyzer
- Class hierarchy and type algebra
2016-04-26 10:39:15 +02:00
Asger Feldthaus 953adb31fa [kernel] Initial commit. 2016-04-26 10:29:55 +02:00