Commit Graph

2004 Commits

Author SHA1 Message Date
Konstantin Shcheglov ef166a6481 Add CommentToken.parent and implement CommentToken.remove().
R=danrubel@google.com, ahe@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2796723002 .
2017-04-03 14:27:26 -07:00
Konstantin Shcheglov ed1152fe8d Scan generic method comments with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2792053002 .
2017-04-03 12:01:54 -07:00
Peter von der Ahé 5bdc1199ca Fix dart2js warnings and add test to ensure it stays clean.
Filed https://github.com/dart-lang/sdk/issues/29224 to track all the problems that require ignore.

R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2791993002 .
2017-04-03 15:08:40 +02:00
Dan Rubel c22c6bad6c flag to enable fasta scanner in analyzer
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2784363002 .
2017-03-30 14:16:12 -04:00
Dan Rubel 4a783d1465 move synthetic fasta closers into the token stream
* add new SyntheticSymbolToken class

* whenever fasta inserts a closer ( '}', ']', ')' ) that is not part
  of the original source, ensure that the inserted closer is
  synthetic (isSynthetic returns true) and in the token stream

* make EOF a synthetic token

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

Review-Url: https://codereview.chromium.org/2777153002 .
2017-03-29 15:02:12 -04:00
Peter von der Ahé a62c5631bf Use message.yaml in parser.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2778213002 .
2017-03-29 11:02:23 +02:00
Peter von der Ahé a91ebba200 Complain about assignments to parenthesized expressions.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2780483002 .
2017-03-29 10:28:05 +02:00
Peter von der Ahé 0b4706ce30 Make catch variables final.
Fixes https://github.com/dart-lang/sdk/issues/28410.

R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2775163003 .
2017-03-29 10:20:07 +02:00
Peter von der Ahé 02573b3caa Remove Fasta's copy of accessors.dart.
R=asgerf@google.com, jensj@google.com

Review-Url: https://codereview.chromium.org/2777883002 .
2017-03-27 14:04:43 +02:00
Dan Rubel 0fa52686f3 fix missing digit error translation
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2772513006 .
2017-03-25 22:33:59 -04:00
Dan Rubel 05300ea2df change "deferred" keyword isPseudo --> isBuiltIn
Fix https://github.com/dart-lang/sdk/issues/29069

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

Review-Url: https://codereview.chromium.org/2769253002 .
2017-03-25 21:20:11 -04:00
Konstantin Shcheglov 713847a71b Parse LabeledStatement and SwitchStatement with Fasta.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2776743002 .
2017-03-24 11:49:47 -07:00
Dan Rubel 186c6f23bd fasta scanner recovery and error code translation improvements
* cleanup defaultRecoveryStrategy next/previous and eof

* add SymbolToken.eof() constructor to ensure that EOF tokens
  are correctly self referencing

* add fasta.scanString method to match scan method

* add fasta.ScannerResult.hasErrors field
  so that scan and scanString callers can quickly check for errors

* new scanner replacement test
  which scans using fasta then asserts as if it were from analyzer

* improve SymbolToken.toString() for EOF
* update analyzer test :: fasta scanner considers "<" to be an opener
* extract and move translateErrorToken into front_end
* address comments in https://codereview.chromium.org/2763833002

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

Review-Url: https://codereview.chromium.org/2767083002 .
2017-03-24 11:40:22 -04:00
Peter von der Ahé 62b39e746a Report compile-time error on invalid constructors.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2777533002 .
2017-03-24 14:11:32 +01:00
Konstantin Shcheglov 9b6c63a39d Parse YieldStatement with Fasta.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2769133004 .
2017-03-23 17:32:26 -07:00
Peter von der Ahé ee591a87d2 Fix warnings in dart2js and analyzer caused by Fasta.
Review-Url: https://codereview.chromium.org/2766323005 .
2017-03-23 15:39:03 +01:00
Peter von der Ahé 0087af4e3c Report compile-time errors on cyclic hierarchies.
R=karlklose@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2767633004 .
2017-03-23 12:41:04 +01:00
Peter von der Ahé ccf7597fb5 Rename analyzer options file.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2756243002 .
2017-03-22 12:19:26 +01:00
Peter von der Ahé 6f422b93fc Improve handling of complicated getters and setters.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2765943002 .
2017-03-22 10:49:03 +01:00
Peter von der Ahé d50bfcde53 Implement dynamic and void as types exported by core library.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2761173004 .
2017-03-22 10:25:08 +01:00
Dan Rubel 99336edc79 fasta.BeginGroupToken implement analyzer.BeginToken
* fasta.BeginGroupToken implement analyzer.BeginToken
* update token translator initialization of head and tail EOF
* update fasta.Token value() and type accessor to match analyzer

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2762103003 .
2017-03-21 11:46:45 -04:00
Dan Rubel 80c8479587 fasta.CommentToken implement analyzer.CommentToken
* update the fasta scanner to generate comment and dartdoc tokens

* replace fasta.preceedingComments field
  with preceedingCommentTokens field and preceedingComments getter/setter

* update token translator

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2763833002 .
2017-03-21 11:40:47 -04:00
danrubel 3e78da649e fix scriptTag scanner_round_trip test
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2761683002 .
2017-03-20 15:18:18 -04:00
danrubel 08402f5789 update fasta scanner to generate two types of comments
* replace fasta.COMMENT_INFO
  with fasta.SINGLE_LINE_COMMENT_INFO and fasta.MULTI_LINE_COMMENT_INFO
  so that it matches analyzer scanner output

* added test for fasta.isUserDefinableOperator

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

Review-Url: https://codereview.chromium.org/2757153002 .
2017-03-20 15:12:28 -04:00
danrubel e93ad0d4fc fasta.Token implement analyzer.Token
* fasta.Token implements analyzer.Token
* cleanup and improve PrecedenceInfo tests

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

Review-Url: https://codereview.chromium.org/2757113002 .
2017-03-20 14:06:06 -04:00
danrubel 8bef633d3f fasta.PrecedenceInfo implement analyzer.TokenType
This updates PrecedenceInfo to implement TokenType
so that fasta.Token.type can return info for the token type.

In addition, the TokenType consts are now reference the corresponding
PrecedenceInfo consts so that parsing using either scanner will result
in token types that are identical.

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

Review-Url: https://codereview.chromium.org/2758113002 .
2017-03-20 13:40:59 -04:00
danrubel d7c4cad542 align fasta.PrecedenceInfo.precedence with analyzer.TokenType.precedence
This updates fasta precedence to match analyzer:

* '!'   0  --> 15
* '~'   0  --> 15

* '--'  15 --> 16
* '++'  15 --> 16
* '.'   15 --> 16
* '?.'  15 --> 16
* '('   15 --> 16
* '['   15 --> 16

And updates analyzer precedence to match fasta:

* '--'  15 --> 16
* '++'  15 --> 16

* '[]'  16 --> 0
* '[]=' 16 --> 0

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

Review-Url: https://codereview.chromium.org/2755433004 .
2017-03-20 12:47:33 -04:00
Dmitry Olshansky 2eec4275a5 Reland: [Fasta] Do not emit default arguments at callsite
This actually fixes a few performance regressions.

BUG= https://github.com/dart-lang/sdk/issues/29089
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2750503015 .
2017-03-17 18:58:47 +01:00
Paul Berry 685045d619 Start unraveling circularities between analyzer and front_end/kernel.
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 .
2017-03-17 05:56:06 -07:00
Paul Berry ecb5abbd36 Tighten up subpackage_relationships_test.dart
This CL adds checks to ensure that the assertions in
subpackage_relationships_test.dart aren't too generous.  For example,
if a subpackage is allowed to import analyzer, we now check that it
actually does import analyzer.

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2748073007 .
2017-03-16 11:34:07 -07:00
Konstantin Shcheglov ae85bcf954 Parse for-loop statements with Fasta.
R=ahe@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2746333005 .
2017-03-15 11:40:32 -07:00
Dan Rubel 32f492b54b fasta.Token implement analyzer.Token.isOperator
One more step closer to fasta.Token implements analyzer.Token

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2749033003 .
2017-03-14 18:06:57 -04:00
Konstantin Shcheglov f873c5657b Parse try-catch statements with Fasta.
There are still failing tests because we cannot access the comma between
the exception and the stack trace parameters. I will make a change
to Analyzer AST to remember commas in parameters, and send another CL
to use it in AST builder.

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

Review-Url: https://codereview.chromium.org/2752543005 .
2017-03-14 13:03:35 -07:00
Konstantin Shcheglov d21cc7750f Parse 'while' and 'do-while' statements with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2748183002 .
2017-03-14 12:57:24 -07:00
Paul Berry c78b4d66bb Move some of analyzer's code generation utilities into front_end.
These utilities are needed for generating the code that supports
summaries; in order to move summary logic into front_end, we will need
these code generation tools in front_end as well.

Also make a minor change to summary code generation logic so that it
talks to the file system directly rather than depending on analyzer's
file system abstraction.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2742333005 .
2017-03-14 12:30:18 -07:00
danrubel 4c050a6a6a fasta.Keyword implement analyzer.Keyword
* update fasta.Keyword to implement analyzer.Keyword
* update analyzer.Keyword to have fasta.Keyword consts
* make analyzer.Keyword abstract

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2746023003 .
2017-03-14 11:26:30 -04:00
Dan Rubel deb6eb8f82 update fasta scanner to always generate INDEX or INDEX_EQ tokens
* updated scanner to always generate INDEX and INDEX_EQ for "[]" and "[]="
* updated parser to generate ErrorKind.EmptyOptionalParameterList when "[]" detected
* updated unparser to prevent INDEX token from being generated as [][]

Take 2 of https://codereview.chromium.org/2744463003/

Fix https://github.com/dart-lang/sdk/issues/28665

Review-Url: https://codereview.chromium.org/2747683003 .
2017-03-13 10:59:41 -04:00
danrubel 75c23fec4b Revert "update fasta scanner to always generate INDEX or INDEX_EQ tokens"
This reverts commit b8d318e94e.

Review-Url: https://codereview.chromium.org/2746543007 .
2017-03-12 18:44:05 -04:00
danrubel c330fc471f fix missed rename fasta.Token.value --> lexeme
Review-Url: https://codereview.chromium.org/2748583002 .
2017-03-12 14:27:29 -04:00
danrubel b8d318e94e update fasta scanner to always generate INDEX or INDEX_EQ tokens
* updated scanner to always generate INDEX and INDEX_EQ for "[]" and "[]="
* updated parser to generate ErrorKind.EmptyOptionalParameterList when "[]" detected
* updated unparser to prevent INDEX token from being generated as [][]

Fix https://github.com/dart-lang/sdk/issues/28665

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2744463003 .
2017-03-12 14:19:25 -04:00
danrubel 42f6586f36 rename fasta.Token.value --> lexeme
This renames the fasta.Token.value field to .lexeme so that
it will not collide with an already existing analyzer.Token accessor.

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

Review-Url: https://codereview.chromium.org/2738313002 .
2017-03-12 13:16:14 -04:00
Peter von der Ahé 9514a2c231 Shell script to ease running fasta tools.
Fixes https://github.com/dart-lang/sdk/issues/29000

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2740323002 .
2017-03-10 17:19:08 +01:00
Peter von der Ahé d1bdc9596d Improve detection of compile-time errors.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2739213004 .
2017-03-10 14:14:49 +01:00
Peter von der Ahé 6ac2b0ced4 Make parser and scanner suites able to run standalone.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2737753002 .
2017-03-09 14:57:06 +01:00
Peter von der Ahé 3ed36f5c46 Install default constructors on broken mixin applications.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2732293004 .
2017-03-09 13:12:34 +01:00
Peter von der Ahé 8608d1b436 Use correct types on cloned constructors in mixin applications.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2736103004 .
2017-03-09 12:52:00 +01:00
Paul Berry b505603f5f Create a TokenStreamRewriter class.
This class will allow parser error recovery to insert synthetic tokens
into the token stream.  It makes use of Token.previousToken when it's
available, but does not depend on it; when it's not available, it
falls back on heuristics which should still be fast, and which don't
impose any performance burden until the first synthetic token is
inserted.

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2732193007 .
2017-03-08 13:40:31 -08:00
Konstantin Shcheglov 271ea5a551 Parse script tags with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2738693004 .
2017-03-07 11:59:14 -08:00
danrubel dd3ab83eee add previous token field
This adds fasta Token.previous and sets that field to point
to the previous token in the fasta token stream.

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2739583002 .
2017-03-07 13:03:52 -05:00
danrubel 69ad5c37a1 move comment tokens into preceedingComments field
Fix https://github.com/dart-lang/sdk/issues/28850

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2731863002 .
2017-03-07 12:50:33 -05:00