Commit Graph

115 Commits

Author SHA1 Message Date
Asger Feldthaus 49746d5092 [kernel] Remove ProcudureKind.IndexGetter and IndexSetter.
They are now ProcedureKind.Operator.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/433267013 .
2016-05-27 11:27:19 +02:00
Asger Feldthaus c5649381a8 [kernel] Document that variable declaration statement must be in a Block.
BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/437797013 .
2016-05-25 16:49:39 +02:00
Asger Feldthaus 9e4e37a4ae [kernel] Add more convenience methods and tweak the behavior of toString().
Also contains a bugfix for a missing visitor call.

BUG=
R=ahe@google.com

Review URL: https://chromereviews.googleplex.com/438627013 .
2016-05-25 13:56:43 +02:00
Asger Feldthaus c3bb92a04f [kernel] Support redirecting factory constructors.
BUG=
R=ahe@google.com

Review URL: https://chromereviews.googleplex.com/434877013 .
2016-05-25 12:56:25 +02:00
Asger Feldthaus c4d30e587f [kernel] Ensure dart:core is always loaded when loading whole programs.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/422447013 .
2016-05-24 17:27:40 +02:00
Asger Feldthaus c7606c752c [kernel] Flag external static procedures as external.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/426927013 .
2016-05-13 13:46:43 +02:00
Asger Feldthaus 77d0b4b244 [kernel] Support member resolution in class hierarchy.
Review URL: https://chromereviews.googleplex.com/417107013 .
2016-05-09 14:12:40 +02:00
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 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 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