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
This CL adds a general reification pass which makes abstract coercions concrete by modifiying the ast. Casts are reified as "as" expressions, and wrappers are reified by creating functions which take the old function as arguments and produce a new wrapped function. There are a number of known issues not yet addressed:
1) No distinction between dart "as" and our special "as" is made yet.
2) Wrapper generation functions do not check for null arguments yet.
3) Types introduced via wrappers and "as" expressions are not yet added to the set of types for which new imports may be required.
4) Wrapper functions for non-literals can't be guaranteed not to change the runtime type without more backend support, since we only have their static type.
This CL also adds support for rewriting import directives in the dart backend to reflect the directory structure that we currently use for output. Probably this should be rethought. Currently I just use absolute file URIs, which is not what we want.
This CL also adds support for adding in the import directives needed to account for type names added via inference. This is not yet correct for "part of" files, since we need to add the imports to the main library file.
BUG=
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/137957013
- bin/
devc.dart
- lib/
devc.dart
src/
info.dart # static info we compute, used by checker & backends
checker/ # implementation details for the checker
checker.dart # checking algorithm
rules.dart # type checking rules
resolver.dart # same as today, type resolution via analyzer
emitter/
...
- test/
checker/ # unit tests for the checker internals
codegen/ # left as is - maybe should rename to emitter?
samples/ # stand alone samples that we run in the end_to_end tests.
...
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/128957013
This adds a skeleton new type checker which just reuses the existing checker for now, but will be filled in with the new type rules.
It also adds a dart backend code generator which currently just spits out the original dart code unchanged (except for (lack of) formatting) into the output directory. By default it uses the dart_style formatter to format the output. This sometimes hits issues, so there is an option to turn this off.
There are flags to control the various options added.
BUG=
R=jmesserly@google.com, vsm@google.com
Review URL: https://chromereviews.googleplex.com/128857013