This CL moves many of the files from
pkg/front_end/lib/src/fasta/analyzer/ to pkg/analyzer/lib/src/fasta/.
It also moves two files from pkg/kernel/lib/analyzer/ to
pkg/analyzer/lib/src/kernel/.
This reduces the amount of circularity between analyzer and
front_end/kernel so that there are no files in front_end or kernel
which are both dependend upon by analyzer and depend upon analyzer. I
will clean up the remaining circularities in future CLs.
There should be no functional change.
R=ahe@google.com, asgerf@google.com, kmillikin@google.com, scheglov@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2756593004 .
All generic methods are equipped with one extra named parameter for
passing type arguments as a list of type values.
Additinally, this change forces strong mode usage for 'dartk' in
'reified_dart'. Strong mode is required for loader to not strip away
type arguments from generic methods. In future, a command line argument
may be implemented for that (e.g. --generic-methods), if generic method
support will land before the strong mode.
R=karlklose@google.com
Review-Url: https://codereview.chromium.org/2713163002 .
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
This CL adds the work done at https://github.com/dart-lang/reify to SDK.
The commit that is used for the merge is
a2066a68374d49de92ff75f5e1ffc36335fd9451 (Nov 23, 2016). The code is
adjusted to respect the changes of the kernel package in SDK since that
commit.
The reify transformation is run by specifying 'vmreify' target to
'dartk'. The transformation requires its runtime library to present in
the program being transformed. The library is found in its default
location in SDK checkout if 'dartk' is run from its default location in
SDK checkout. To preserve the library in the output, TreeShaker is
disabled in 'vmreify' target.
The "golden" set of tests is also copied from 'dart-lang/reify'
repository, and the appropriate test suite is defined for it.
The bash script 'bin/reified_dart' from 'dart-lang/reify' is rewritten
as Dart script 'pkg/kernel/bin/reified_dart.dart'. It requires path to
'dartk' and path to SDK. Those are taken from their default locations in
SDK if 'reified_dart.dart' is run from its default location in SDK.
The added files were formatted using 'dartfmt' with default settings.
Additionally, the files were checked with 'dartanalyzer --strong'. The
necessary changes were made to fix the error messages. There are some
'hint' and 'error' messages left for some .dart files from the added
test cases, but they reflect intentional errors or conventions in those
files.
R=asgerf@google.com, karlklose@google.com
Review-Url: https://codereview.chromium.org/2697873007 .
When a class from a different build unit is mixed in, the instance
members of the mixed-in class are retained in the external library
definition, so the mixin resolution pass can clone them.
BUG=
R=kmillikin@google.com
Review-Url: https://codereview.chromium.org/2669303002 .
Target-specific modular transformations have to be able to cope with
external libraries. Target-specific global transformations should be
optimizations, and not required for correctness, since a simple linker
may choose not to perform them.
Make mixin resolution modular by making it fail when a mixed-in class
comes from an external library. (We cannot mix in such a class because
we do not necessarily have all class members.)
R=asgerf@google.com
Review-Url: https://codereview.chromium.org/2671653003 .
Updates to kernel that sets more offsets (and introduces end offests
and 'debuggability') - but doesn't necessarily persist them,
i.e. the format doesn't change and no C++ changes are neccessary yet.
This is step #1 in introducing these things, next step(s) will be
persisting the new stuff and using it on the C++ side.
R=asgerf@google.com, kmillikin@google.com
Review-Url: https://codereview.chromium.org/2610133002 .
This is the result of:
- taking the diff of the branch closure_conversion to master in the kernel
repository
- updating the file paths
- applying the diff to the Dart SDK
- fixing conflicts between the changes to pkg/kernel in the Dart SDK and the master branch in the kernel repository
R=asgerf@google.com
Review-Url: https://codereview.chromium.org/2561723003 .
In kernel, library import URIs now support an "app" scheme as an
alternative to the "file" scheme, representing a path relative to
the application root.
dartk takes an --app-root flag giving the application root. If none
is given, file URIs are used instead.
The intention is that kernel binaries should not carry irrelevant
path information, such as the path to the home directory of the
user who compiled a given file.
It is not the intention that end-users should see an app URI.
Import paths are currently not shown to users at all, and if we need
to do this, they should be translated to file paths first.
In theory we could stick to file URIs with relative paths, but the Uri
class from dart:core makes this difficult, as certain operations on it
assume that file paths should be absolute.
Source mapping URIs are not yet affected by this change.
R=kmillikin@google.com
Committed: https://github.com/dart-lang/sdk/commit/60adb852ad706ecf9424c77d47fa05583d543def
Review URL: https://codereview.chromium.org/2532053005 .
Reverted: https://github.com/dart-lang/sdk/commit/bb540416f27c39d75ee7f243899939fc37a2cd03
In kernel, library import URIs now have the "app" scheme instead of
the "file" scheme, representing a path relative to the application root.
dartk takes an --app-root flag giving the application root. This
defaults to the current working directory.
The intention is that kernel binaries should not carry irrelevant
path information, such as the path to the home directory of the
user who compiled a given file.
It is not the intention that end-users should see an app URI.
Import paths are currently not shown to users at all, and if we need
to do this, they should be translated to file paths first.
In theory we could stick to file URIs with relative paths, but the Uri
class from dart:core makes this difficult, as certain operations on it
assume that file paths should be absolute.
Source mapping URIs are not yet affected by this change.
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/2532053005 .
This replaces the old --sanity-check flag from dartk. Some files have
been renamed to avoid the wording "sanity check".
Compared to --sanity-check, the following checks have been added:
- variables are not referenced out of scope
- variables are not redeclared
- class type parameters are not referenced from static context
A unit test has been added to check that the verifier rejects certain
invalid ASTs.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/2531873002 .
Sanity checks now run in a single pass rather than two, and
instead of building a set consisting of all members, it uses
a bit from the transformer flags to remember which members are
not orphaned.
As an additional check, it now checks that members are not
declared more than once.
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/2529973002 .
This file is not strong-mode clean, but since a more recent version
of closure conversion still exists in a branch on the kernel github
repo, there is not much point in fixing this version of it.
BUG=
R=ahe@google.com
Review URL: https://codereview.chromium.org/2526793002 .
The concept of a binary library file no longer exists.
A kernel file can contain any number of libraries, and some of these
libraries can be "external". To reference a class or member from
another build, the class or member must be declared in an external
library.
Members in an external library contain all their type information,
but have no body.
Classes in an external library have their hierarchy information
present, but are not guaranteed to contain all their actual members.
The idea is that references themselves don't really cross module
boundaries, but rather refer to a local definition whose body is
contributed from elsewhere, much like 'external' members in Dart.
A modular backend such as DDC should be able to compile from one of
these kernel files without needing to load auxiliary information from
summaries or other kernel files.
For whole program transformations or backends, a linking step, which
is not yet implemented, must merge classes and members in external
libraries based on their name.
External libraries share the same IR and binary format as ordinary
libraries. Transformations that affect the interface for a member
or class should transform the external libraries alongside with the
internal ones, ideally without needing to treat them any different.
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/516847013 .
dartk and other command-line tools no longer rely on analyzer classes
like AnalysisContext or DartSdk, and instead use only the interface
defined in loader.dart.
The class AnalyzerLoader has been renamed to DartLoader.
The sharing of state in batch mode is now owned by loader.dart, so
dartk.dart does not deal with DartSdk and package_config.
Repository no longer has a package or SDK path. These concepts are
now specific to the Dart frontend. Consequently, loading a binary
file no longer relies on URI resolution.
The Repository class is now more clearly focused on linking symbolic
names to their IR objects, which for the time being is only
URI-to-library bindings, but should be extended to support linking
class and member references across different files and different
loaders.
BUG=
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/512907013 .
Allocate contexts to hold captured variables. Rewrite captured variable
access to context access. Outside of a local function, this is a single
indirection through a named context. Inside a local function it requires
traversing (a statically known number of) parent links.
R=ahe@google.com
Review URL: https://chromereviews.googleplex.com/507717013 .
The analyzer keeps a separate AnalysisContext for the SDK, and the
options we set on our own context did not match those on the SDK,
mainly causing issues for strong mode.
Also, the BatchModeState is now used to share the Dart SDK, instead of
using a single instance held in a static variable.
BUG=
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/504827013 .
Some backend targets require extra libraries that are not used
explicitly by a program (e.g., the Dart VM requires its bootstrap
libraries). Add a target-specific list of these libraries and ensure
that they are loaded when loading a program from Dart sources.
BUG=
R=asgerf@google.com
Review URL: https://chromereviews.googleplex.com/495497014 .
This makes super calls name-based (no target) and add direct calls with
both receiver and explicit target.
Super call resolution translates the name-based super calls into direct
calls after they have been cloned into the mixin application.
For JS backends, it should suffice to clone mixed-in methods that
contain super calls, but that transformation is not part of this CL.
This also adds a --target option to dartk designating the target to
which the kernel IR should be specialized. The new transformation
is run when --target=vm.
BUG=
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/486537013 .
- Rewrite all expressions in functions, not only expression-statements.
- Inject :await_ctx_var and :await_jump_var into the wrapper.
- Don't use transformed expression directly as part of completer.complete call.
BUG=
R=kustermann@google.com
Review URL: https://chromereviews.googleplex.com/468717014 .