Commit Graph

4770 Commits

Author SHA1 Message Date
Sigmund Cherem 06189b271a loader, target, diet_listener moved
from front_end/lib/src/fasta/analyzer/
   to   analyzer/lib/src/fasta/

analyzer_compile and compile_platform_dartk moved
   from front_end/lib/src/fasta/analyzer/
   to   front_end/tool/_fasta/

front_end/src/fasta/testing/* continues to have some shared testing logic,
 - logic to compute the patched sdk is moved up one level
 - TestContext, Run, and suite.dart (which depend on analyzer) moved to pkg/front_end/test/fasta/testing/
 - only a copy of TestContext is duplicated under pkg/kernel/test/closure/.

R=ahe@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2828583003 .
2017-04-25 13:16:14 -07:00
Kevin Millikin 9adfa8a105 Fix a pair of issues in the Dart code for the front end.
- A type needed for an annotation was not visible.
- An iterable was passed instead of a list.

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2838983002 .
2017-04-25 21:45:28 +02:00
Kevin Millikin 385f8fb054 Read platform.dill in the VM.
1. A --platform flag is added to dart to give a path to a Kernel
   binary for the platform libraries (as produced by building the
   runtime_kernel target).

2. This binary is used for bootstrapping.  Since it contains libraries
   other then the VM's bootstrap libraries, they are also loaded.

3. The frontend does not send any library with a dart: import URI
   scheme.  Note that it does not (yet) prune the canonical name
   table, which will contain a lot of unnecessary names used for
   internal linkages in the platform libraries.

4. There is a single dependency in the platform libraries on the
   script: _getMainClosure in dart:_builtin.  This is patched after
   the script is loaded.

BUG=
R=ahe@google.com, kustermann@google.com, vegorov@google.com

Review-Url: https://codereview.chromium.org/2786083002 .
2017-04-25 20:04:25 +02:00
Paul Berry a3311858a7 Introduce initial plumbing for type promotion in fasta.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2829223007 .
2017-04-25 09:06:51 -07:00
Dan Rubel 684065855f merge PrecedenceInfo into TokenType and update all refs
* replace PrecedenceInfo *_INFO with TokenType.*
* remove outdated PrecedenceInfo tests
* delete unused precedence_info.dart

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2832403002 .
2017-04-25 08:51:52 -04:00
Paul Berry 3785385083 Make it possible to represent type schemas in the front end.
See https://github.com/dart-lang/sdk/pull/29371/files for more
information.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2839513002 .
2017-04-24 11:40:20 -07:00
Erik Corry 2fb5d08102 Spelling a
R=ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2841543002 .
2017-04-24 14:53:51 +02:00
Erik Corry 6617737ff5 Replace 'the the' with 'the'
R=kmillikin@google.com
BUG=

Review-Url: https://codereview.chromium.org/2830353002 .
2017-04-24 08:50:37 +02:00
Dan Rubel 54d131ebd9 merge fasta.PrecedenceInfo into analyzer.TokenType
* move precedence consts into analyzer token.dart
* move PrecedenceInfo.all to TokenType.all
* replace references to PrecedenceInfo with TokenType
* merge fasta.PrecedenceInfo into analyzer.TokenType

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

Review-Url: https://codereview.chromium.org/2837473002 .
2017-04-23 09:13:24 -04:00
Dan Rubel a76255249b start merging fasta.precedence into analyzer.TokenType
* move methods and fields from PrecedenceInfo into TokenType
* extract precedence consts

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2835543002 .
2017-04-23 09:08:56 -04:00
Paul Berry 925a0a5777 Split up TypeInferrer class.
This CL makes four classes:

- TypeInferrer, which is the API for type inference within a method
  body or field initializer, used by BodyBuilder.

- TypeInferrerImpl, which is the generic implementation of
  TypeInferrer.

- TypeInferenceEngine, which is the API for top level type inference
  and for creating TypeInferrers.

- TypeInferenceEngineImpl, which is the generic implementation of
  TypeInferenceEngine.

R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2830313002 .
2017-04-21 05:39:09 -07:00
Paul Berry 77d26a330c Add top level type inference logic for integer literals.
This CL hooks up enough infrastructure for doing simple top level type
inference of variables whose initializer is an int.

Additional type inference rules will be added in follow-up CLs.

R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2828253003 .
2017-04-21 04:38:18 -07:00
Sigmund Cherem 4a19708532 Remove use of package:analyzer in dependency_grapher
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2834543002 .
2017-04-20 17:06:04 -07:00
Paul Berry f9189fdfe2 Make AstFactory.variableDeclaration(charOffset) a required parameter.
This prevents bugs where we forget to set the offset.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2829113002 .
2017-04-20 10:31:25 -07:00
Jacob Richman 997b4e62af Run formatter on a few frontend and kernel files that hadn't been formatted.
BUG=
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2820323005 .
2017-04-20 09:25:13 -07:00
Paul Berry e3347e03f7 Use a non-null TypeInferrer even in non-strong mode.
This is necessary because some of the TypeInferrer's roles (e.g. type
promotion and determination of the types of constants) are still
needed in non-strong mode.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2829683008 .
2017-04-20 04:11:19 -07:00
Paul Berry e8e8359cdf Add local type inference logic for integer literals.
This CL introduces Fasta's first type inference rule, and hooks it up
to all the necessary testing infrastructure.  The rule is that a local
variable whose initializer is an integer literal should have an
inferred type of int.

Only variables occurring at top level within a method are inferred (we
don't yet recurse inside sub-blocks).

Additional type inference rules will be added in follow-up CLs.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2828693003 .
2017-04-20 03:36:19 -07:00
Peter von der Ahé 9356e3cd61 Check const constructors.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2799973003 .
2017-04-20 10:55:58 +02:00
Paul Berry b5c6053deb Add explicit return types to work around #29398.
In a future CL I need to add an import to this file, and for reasons I
haven't been able to track down, doing so causes type inference
failures.  This CL works around the problem by making the affected
types explicit.

Once the bug is fixed, I hope to be able to revert this.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2833563004 .
2017-04-20 01:29:49 -07:00
Peter von der Ahé e2eee219ac Complain about incorrect this/super constructor initializers.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2800083002 .
2017-04-20 10:04:12 +02:00
Peter von der Ahé cf6b2736ec Wrap VariableDeclarations in Blocks as specified by Kernel.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2801283002 .
2017-04-20 09:31:36 +02:00
Peter von der Ahé 6bd0085ec1 Throw isn't a constant expression.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2801873008 .
2017-04-19 15:55:05 +02:00
Paul Berry a682c6a97e Introduce a testing framework for use with fasta type inference.
The framework will allow test source files to be annotated with
comments indicating where types are expected to be inferred, for
example:

    var /*@type=dart.core::int*/ x = 1;

Other features of the testing framework:

- Normally only those expectations explicitly listed will be checked.
  The special comment "/*@testedFeatures=inference*/" at the top of
  the file turns on extra checking which will cause the test to fail
  if any unexpected type inference occurs.

- Should be easy to extend to support other features, such as checking
  that the proper errors and warnings are generated at the proper
  locations.

- If the test is run with "-DupdateExpectations=true", the
  expectations will be updated in place.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2824393002 .
2017-04-19 06:54:08 -07:00
Peter von der Ahé 0ceb30a5e0 Make zero-termination optional.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2827543006 .
2017-04-19 15:29:00 +02:00
Peter von der Ahé e534a45cec Handle bad rethrows.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2802203002 .
2017-04-19 15:17:10 +02:00
Peter von der Ahé ba0e07846f Produce a compile-time error if there's no main method.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2801853006 .
2017-04-19 14:28:10 +02:00
Peter von der Ahé 2d9956a93d Move kernel baseline tests to front_end.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2825063002 .
2017-04-19 10:57:58 +02:00
Paul Berry 13941eaa03 Plumb TypeInferrer through KernelExpression._inferExpression.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2827793003 .
2017-04-18 18:40:46 -07:00
Paul Berry ea0c1d8f35 Address nits from https://codereview.chromium.org/2823243002/
I thought I'd made these changes prior to landing the above CL, but I
accidentally made them to the wrong branch, so they didn't wind up
getting committed.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2821193004 .
2017-04-18 15:46:08 -07:00
Paul Berry 6d737cb684 Introduce initial plumbing for type inference in fasta.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2823243002 .
2017-04-18 09:37:54 -07:00
Paul Berry ed41766091 Simplify shadow class hierarchy.
Change the front_end's shadow class hierarchy so that instead of
containing implementation classes and mixin classes, it only contains
implementation classes.  The mixins proved to be unnecessary.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2819423004 .
2017-04-18 06:31:42 -07:00
Konstantin Shcheglov 07347d84fc Parse type substitution comments /*=T*/ in variable declarations with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2804753003 .
2017-04-07 12:59:02 -07:00
Peter von der Ahé 20aefd34f5 Document file names in deps files.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2805663002 .
2017-04-07 12:37:29 +02:00
Peter von der Ahé b8d63c3890 Use identical to compare strings.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2801963003 .
2017-04-07 12:35:34 +02:00
Peter von der Ahé 1e70fef1a2 Small steps towards deferred loading.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2803833003 .
2017-04-07 12:23:35 +02:00
Dan Rubel 46b0c1da56 merge fasta.Keyword into analyzer.Keyword
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2797133008 .
2017-04-06 16:52:01 -04:00
Dan Rubel 4b8a2eb03b enhance analyzer to parse uppercase and built-in/pseudo keywords
Retrying https://codereview.chromium.org/2803563003

* update analyzer.Keyword list to include all of the fasta keywords

* enhance the analyzer scanner keyword table to handle uppercase
  keywords such as "Function"

* update analyzer's parser to process the new KeywordTokens

* fix analyzer error verification

* update translation of fasta <--> analyzer tokens

* update tests and cleanup analyzer warnings

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2799133003 .
2017-04-06 15:24:53 -04:00
Konstantin Shcheglov 1b0b94c6e6 Fix for parsing annotations before variables in for-loop with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2797303003 .
2017-04-06 10:59:53 -07:00
Peter von der Ahé af73802a67 Document the parser's design.
R=johnniwinther@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2799043004 .
2017-04-06 17:53:01 +02:00
Peter von der Ahé 32e2d2af84 Handle const list and map literals.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2802693004 .
2017-04-06 14:51:35 +02:00
Peter von der Ahé 7751bb7fe4 Missing file from CL 2804843003.
Review-Url: https://codereview.chromium.org/2804973002 .
2017-04-06 12:29:39 +02:00
Peter von der Ahé d515791312 Handle bad packages files and #void without crashing.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2804843003 .
2017-04-06 12:05:54 +02:00
Peter von der Ahé 0df001cebf Implement various getters on DillMember.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2799783004 .
2017-04-06 10:54:48 +02:00
danrubel e7f700ae66 Revert "enhance analyzer to parse uppercase and built-in/pseudo keywords"
This reverts commit 0c9e871b0f.

Review-Url: https://codereview.chromium.org/2797353002 .
2017-04-05 17:27:41 -04:00
Dan Rubel 0c9e871b0f enhance analyzer to parse uppercase and built-in/pseudo keywords
* update analyzer.Keyword list to include all of the fasta keywords

* enhance the analyzer scanner keyword table to handle uppercase
  keywords such as "Function"

* update analyzer's parser to process the new KeywordTokens

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2803563003 .
2017-04-05 16:37:30 -04:00
Konstantin Shcheglov c9407b4544 Include ':' before constructor separators into AST with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2802753002 .
2017-04-05 13:25:46 -07:00
Dan Rubel a370462274 move fasta.Keyword methods to analyzer.Keyword
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2800583002 .
2017-04-05 13:51:53 -04:00
Peter von der Ahé 0fcc4ee024 Implement parsing of metadata on local variables.
R=johnniwinther@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2798603003 .
2017-04-05 19:12:42 +02:00
Paul Berry 191be2df39 Make the AstFactory API refer to kernel types rather than "shadow" types.
This dramatically reduces the amount of type casting that has to
happen in the Fasta type inference prototype.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2802433003 .
2017-04-05 09:04:53 -07:00
Peter von der Ahé b06e4d5754 Create separate scopes for constructors, setters, and other members.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2788153002 .
2017-04-05 16:07:32 +02:00