Commit Graph

3345 Commits

Author SHA1 Message Date
Peter von der Ahé b98efcf98d Fasta logging.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2636523002 .
2017-02-01 12:27:35 +01:00
Peter von der Ahé 81c682c654 Fasta source builders.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2627223005 .
2017-02-01 12:27:35 +01:00
Peter von der Ahé f2a545adf0 Fasta builders.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2629063005 .
2017-02-01 12:27:35 +01:00
Peter von der Ahé 4a85ae8691 Fasta outline builder.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2633663002 .
2017-02-01 12:27:35 +01:00
Peter von der Ahé 7b77b6e403 Fasta kernel AST builder.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2628043005 .
2017-02-01 12:27:35 +01:00
Peter von der Ahé 6e852cced2 Fasta infrastructure.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2634453004 .
2017-02-01 12:27:35 +01:00
Peter von der Ahé 3d70457812 Add Fasta tests.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2631613003 .
2017-02-01 12:27:35 +01:00
Peter von der Ahé fa8301d55b Add code review settings for fasta.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2629573007 .
2017-02-01 12:27:35 +01:00
Peter von der Ahé ee00e623d3 Add README.md for package:fasta.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2629353002 .
2017-02-01 12:27:35 +01:00
Peter von der Ahé d0d27c1c38 Use parser and scanner from package:front_end.
Originally reviewed as:

    Review-Url: https://codereview.chromium.org/2650413002 .
    Review-Url: https://codereview.chromium.org/2652203002 .
    Review-Url: https://codereview.chromium.org/2655843002 .
    Review-Url: https://codereview.chromium.org/2654433009 .
    Review-Url: https://codereview.chromium.org/2647343003 .
    Review-Url: https://codereview.chromium.org/2652663005 .
    Review-Url: https://codereview.chromium.org/2650813002 .
    Review-Url: https://codereview.chromium.org/2650803002 .
    Review-Url: https://codereview.chromium.org/2651843004 .
    Review-Url: https://codereview.chromium.org/2649923002 .
    Review-Url: https://codereview.chromium.org/2651563003 .
    Review-Url: https://codereview.chromium.org/2649123002 .
    Review-Url: https://codereview.chromium.org/2644843006 .
    Review-Url: https://codereview.chromium.org/2647043002 .
    Review-Url: https://codereview.chromium.org/2642903003 .
    Review-Url: https://codereview.chromium.org/2645513002 .
    Review-Url: https://codereview.chromium.org/2642663003 .
    Review-Url: https://codereview.chromium.org/2642713002 .
    Review-Url: https://codereview.chromium.org/2635473002 .
    Review-Url: https://codereview.chromium.org/2624373003 .
    Review-Url: https://codereview.chromium.org/2627723006 .
    Review-Url: https://codereview.chromium.org/2627093007 .
    Review-Url: https://codereview.chromium.org/2629543008 .
    Review-Url: https://codereview.chromium.org/2629543007 .
    Review-Url: https://codereview.chromium.org/2631503002 .
    Review-Url: https://codereview.chromium.org/2621153006 .
2017-02-01 10:29:25 +01:00
Peter von der Ahé 2a4bc2c7e5 Move parser, scanner, and link to front_end.
Originally reviewed as:

    Review-Url: https://codereview.chromium.org/2650413002 .
    Review-Url: https://codereview.chromium.org/2652203002 .
    Review-Url: https://codereview.chromium.org/2655843002 .
    Review-Url: https://codereview.chromium.org/2654433009 .
    Review-Url: https://codereview.chromium.org/2647343003 .
    Review-Url: https://codereview.chromium.org/2652663005 .
    Review-Url: https://codereview.chromium.org/2650813002 .
    Review-Url: https://codereview.chromium.org/2650803002 .
    Review-Url: https://codereview.chromium.org/2651843004 .
    Review-Url: https://codereview.chromium.org/2649923002 .
    Review-Url: https://codereview.chromium.org/2651563003 .
    Review-Url: https://codereview.chromium.org/2649123002 .
    Review-Url: https://codereview.chromium.org/2644843006 .
    Review-Url: https://codereview.chromium.org/2647043002 .
    Review-Url: https://codereview.chromium.org/2642903003 .
    Review-Url: https://codereview.chromium.org/2645513002 .
    Review-Url: https://codereview.chromium.org/2642663003 .
    Review-Url: https://codereview.chromium.org/2642713002 .
    Review-Url: https://codereview.chromium.org/2635473002 .
    Review-Url: https://codereview.chromium.org/2624373003 .
    Review-Url: https://codereview.chromium.org/2627723006 .
    Review-Url: https://codereview.chromium.org/2627093007 .
    Review-Url: https://codereview.chromium.org/2629543008 .
    Review-Url: https://codereview.chromium.org/2629543007 .
    Review-Url: https://codereview.chromium.org/2631503002 .
    Review-Url: https://codereview.chromium.org/2621153006 .
2017-02-01 10:29:25 +01:00
Paul Berry b489ae5a5f Simplify the API for incremental_resolved_ast_generator.
The use of a two-layer map will dovetail well with changes I have
planned for the AnalysisDriver.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2665043003 .
2017-01-31 13:34:55 -08:00
Paul Berry d8fc3630cf Move resolveRelativeUri into front_end.
Note: I removed the exception wrapping code as part of the migration.
Rationale: this function performs a small task and has been operating
successfully for a long time; removing the exception wrapping code
avoids making front_end dependent upon AnalysisException and
CaughtException at this time.  In the unlikely event that an exception
occurs in this function, we still have many avenues available for
tracking down the problem: examine the stack trace of the exception,
isolate a repeatable test case (if the exception happened in
e.g. command-line analyzer), or reproduce the exception from file
state information recorded by the AnalysisDriver (if the exception
happened in analysis server).

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2668553002 .
2017-01-30 15:05:52 -08:00
Konstantin Shcheglov 0888722a53 Implement SourceFactory.forUri2() to fix front_end after f28e8afb23.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2659943002 .
2017-01-27 09:35:46 -08:00
Dan Rubel 2cc2e63f63 IncrementalKernalGenerator watch source callback
Update the IncrementalKernalGenerator.computeDelta() method
with an optional "watch this source" callback.
This new callback notifies the caller when a source should be watched
for modifications, and when a source is no longer part of the program
and thus no longer needs to be watched.

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2653143003 .
2017-01-26 08:25:28 -05:00
Paul Berry 7d314c99bb Always pass "allocate: true" when converting URIs to paths.
There's no need to special case the handling of "dart:" URIs.
Eventually we will need the "allocate:" behavior for all URIs anyhow,
because we won't have a pre-traversal of the import graph to populate
the FileRepository.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2651193002 .
2017-01-25 09:21:59 -08:00
Konstantin Shcheglov fcd5f16d10 Stop using SDK summary bundle. Analyze dart:xxx as any other libraries.
Unfortunately this makes runnings tests about 30% slower :-(

I suspect that's because we have to build unlinked and linked summaries
for SDK libraries again and again for every tiny test.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2653683004 .
2017-01-24 18:32:26 -08:00
Konstantin Shcheglov b206c84210 Reland c9e1b88 and 56726fc with a DDC fix.
Revert "Revert "Use single InputPackagesResultProvider, without SdkSummaryResultProvider.""

This reverts commit b701ad6453.

R=brianwilkerson@google.com, vsm@google.com
BUG=

Review-Url: https://codereview.chromium.org/2647323006 .
2017-01-24 09:13:26 -08:00
Vijay Menon b701ad6453 Revert "Use single InputPackagesResultProvider, without SdkSummaryResultProvider."
This reverts commit c9e1b888a3.

Revert "Remove parent from SummaryResynthesizer."

This reverts commit 56726fcce0.

TBR=scheglov@google.com

Review-Url: https://codereview.chromium.org/2648213007 .
2017-01-24 06:21:38 -08:00
Konstantin Shcheglov c9e1b888a3 Use single InputPackagesResultProvider, without SdkSummaryResultProvider.
Each SummaryResynthesizer is now responsible for creating its TypeProvider.
And with the new AnalysisDriver we stop using SDK CachePartition.

For now we add SDK's summary bundle into SummaryDataStore.
Eventually we will get rid of it and add individual SDK libraries.

R=brianwilkerson@google.com, paulberry@google.com, vsm@google.com
BUG=

Review-Url: https://codereview.chromium.org/2652823002 .
2017-01-23 16:54:17 -08:00
Paul Berry 7bfc3ced58 Clean up hacky handling of "dart:" URIs in incremental resolved AST generator.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2643033003 .
2017-01-20 08:54:01 -08:00
Paul Berry 6acc2c2611 Store a file state in the incremental resolved AST generator.
This is necessary to make invalidation work properly.  It also ensures
that we don't do redundant reads from the filesystem.

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2644953002 .
2017-01-19 13:58:57 -08:00
Paul Berry c04ba40745 Add initial support for parts to the incremental kernel generator.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2642083003 .
2017-01-19 12:32:27 -08:00
Paul Berry 28bfd11a70 Create a "file repository" data structure to help interface analyzer and front_end code.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2645923002 .
2017-01-19 10:55:50 -08:00
Brian Wilkerson d06a2326f1 Add parser support for covariant parameters
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2639883005 .
2017-01-19 09:38:35 -08:00
Paul Berry 2adae270d6 Fix incremental kernel builder to handle multiple calls to computeDelta.
Note that the invalidate() method is not supported yet; you must use
invalidateAll().

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2638423002 .
2017-01-18 14:43:06 -08:00
Konstantin Shcheglov 8d326e9a14 Report StateError if the DartSDK for an AnalysisDriver does not have summary.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2639743002 .
2017-01-17 20:46:00 -08:00
Paul Berry 05a417034a Initial implementation of front_end hot reload API.
This implementation is based on the existing kernel and analysis
driver logic, using proxy classes to account for interface
incompatibilities between those components.  In future CLs, I
hope we can (a) move the necessary analysis driver logic into
front_end, and (b) reduce or eliminate the number of proxy
classes needed.

This CL represents the very first inklings of functionality; all that
is confirmed to work at this point is compilation of a single source
file containing an empty `main` method.

R=danrubel@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2624193003 .
2017-01-17 06:10:02 -08:00
Paul Berry fdbdd8a4d8 Add code to ProcessedOptions to fetch the SDK summary bundle.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2625533002 .
2017-01-11 06:19:40 -08:00
Paul Berry ba241c0c8d Use URIs rather than paths in front end API.
This carries a number of benefits:

- It allows the front end to trivially support schemes other than
  "file:" (e.g. "http:") by allowing the client to supply a FileSystem
  implementation that handles them.

- It is more consistent with the functionality of the ".packages" file
  (which allows packages to map to any kind of URI).

- It allows the "bazel root" feature to be rewritten to use a magic
  scheme rather than a magic path.  (This eliminates concerns about
  the magic path overlapping with a user's use case).  Note that this
  feature has been renamed to "multi root" since it is sufficiently
  generic to be applicable to build systems other than Bazel.

- It reduces the risk of forgetting to use the front end's FileSystem
  abstraction to access the file system, since the native file system
  interfaces do not accept URIs.

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2614063007 .
2017-01-09 11:19:38 -08:00
Paul Berry 1d57e1b096 Extract code from dependency_grapher.dart for easier re-use elsewhere in the front end.
In the process I've made the constructors for Graph, LibraryCycleNode,
and LibraryNode public.  I don't think this should be a problem, since
these are simple data structures, so there is no harm in allowing
clients to create them.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2617483007 .
2017-01-06 11:37:12 -08:00
Paul Berry ca271d003e Create a wrapper class to handle CompilerOptions in a uniform way.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2618633006 .
2017-01-06 10:40:45 -08:00
Paul Berry 848d059581 Add a missing copyright notice.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2611183004 .
2017-01-06 10:03:35 -08:00
Paul Berry 4e33530fbf Add front end code for reading the SDK's "libraries.dart" file.
R=danrubel@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2578693002 .
2016-12-14 15:23:31 -08:00
Paul Berry b29fa08444 Implement URI resolution in the front end.
R=danrubel@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2577503002 .
2016-12-13 13:21:14 -08:00
Paul Berry 4ee949c154 Add an async version of dependency_walker.dart.
This is intended to be used in situations where computing dependencies
and/or evaluating nodes is an asynchronous operation.  (For example,
when performing a compilation, computing dependencies of a library
requires file I/O to read the files constituting the library;
evaluating a library cycle might potentially be performed
asynchronously by a separate isolate).

At the moment the implementation is nearly the same as that of
dependency_walker.dart, except asynchronous.  In future CLs I will
look into allowing computeDependencies(), evaluate(), and
evaluateScc() to operate in parallel.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2552383002 .
2016-12-06 12:29:07 -08:00
Paul Berry 11d43180af Add missing copyrights
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2550323003 .
2016-12-06 11:20:05 -08:00
Paul Berry 2bf75c0550 Move dependency walker logic to front end.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2554973002 .
2016-12-06 10:18:24 -08:00
Paul Berry 1c2268b13e Move scanner tests into the front_end package.
This required moving the following classes into front_end as well:
- CharSequenceReader
- SubSequenceReader
- JenkinsSmiHash

A small amount of the functionality of GatheringErrorListener and
AnalysisError had to be replicated, to avoid a dependency on the
analyzer package.  In a future CL I will either refactor this code to
make it available to the rest of the front end, or, if
GatheringErrorListener and AnalysisError wind up getting moved into
the front end, I will un-do the replication.

I also took the liberty of addition functionality to JenkinsSmiHash to
make it easier to use.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2508483002 .
2016-11-15 14:53:49 -08:00
Paul Berry 0c928771fc Revert "Connect analyzer's AnalysisError object to front_end's CompilationError."
This reverts commit fc5270df72.

TBR=scheglov@google.com, brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2503803003 .
2016-11-15 10:00:34 -08:00
Paul Berry fc5270df72 Connect analyzer's AnalysisError object to front_end's CompilationError.
AnalysisError implements CompilationError but provides additional
services, such as extensibility via the `getProperty` method.

Note: CompilationError.location has been renamed to
CompilationError.span to avoid confusion (since its type is
`SourceSpan`, not `SourceLocation`).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2498133002 .
2016-11-14 15:30:10 -08:00
Paul Berry 4cd9b28eb6 Create pkg/front_end/src/base and begin populating with general use classes.
In the long run, pkg/front_end/src/base is intended to contain code
that is useful to many components of the front end.

In this initial implementation, it contains:
- Source and the classes it references
- ErrorCode, ErrorSeverity, and ErrorType
- SyntacticEntity

Note that AnalysisTarget is included (even though strictly speaking it
is part of the analyzer task model) because it was too hard to
disentangle from Source.

Note that Token classes remain in pkg/front_end/src/scanner for now; I
plan to reorganize them at the time the parser is moved into the front
end.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2486923007 .
2016-11-14 09:20:18 -08:00
Paul Berry 981e2660bf Remove deprecated members from ErrorCode.
These existed as an effort to avoid causing breaking changes in the
analyzer package, but it turns out that the analyzer package already has
breaking changes in progress, so there is no benefit.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2491593003 .
2016-11-09 18:11:42 -08:00
Paul Berry e790b44c63 Update copyright notices in front_end package.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2483313003 .
2016-11-08 14:23:58 -08:00
Paul Berry 0a1fb8d248 Move scanner into pkg/front_end/lib/src/scanner.
Several support classes also had to move to front_end along with the
scanner.  Some of these support classes arguably don't belong to the
scanner itself, since they have other uses (e.g. SyntacticEntity,
ErrorCode, ErrorSeverity, ErrorType, and StringUtilities).  They will
be reorganized into a more appropriate location in future CLs, at the
time that they become needed by other components of the front end.

In order to avoid dragging in a lot of dependencies, the following
changes were made:

1. Scanner no longer reports errors through Source and
AnalysisErrorListener objects passed to the constructor.  Instead, it
provides an abstract reportError() method which clients may override
to perform error reporting in any way they wish.  Analyzer contains an
override of Scanner that mimics the old behavior in order to maintain
compatibility.

2. Static members of ErrorCode (`values` and `byUniqueName`) have been
moved to top level, and remain in analyzer.  To maintain
compatibility, these static members remain in ErrorCode (as deprecated
members that simply wrap the implementations in analyzer).  This means
we have a reverse dependency (front_end depends on analyzer), but this
dependency will go away as soon as we publish the next breaking change
release of analyzer.

R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2486873003 .
2016-11-08 13:47:17 -08:00