Commit Graph

29 Commits

Author SHA1 Message Date
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00
Johnni Winther 00c2962db8 [cfe+analyzer] Move messages, scanner and parser to package:_fe_analyzer_shared
Change-Id: I4fa87aee65f30a9868a6cf8f0342591869ece7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123663
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-01 09:37:57 +00:00
Jens Johansen 48af666c9f [CFE] apply curly_braces_in_flow_control_structures lint
Change-Id: Id6c7e60b40f7dd0ffd68d007fe86abb785ac0dba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113025
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-14 13:00:44 +00:00
danrubel 7983fac33b add "extension" built-in keyword for extension methods
Change-Id: I6529fff31f681fd24c22f8c7579d2a35097f4d07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-17 22:24:15 +00:00
danrubel c33f1a079e revise scanner api so that error tokens are always prepended
This CL revises the scanner API so that tokens are always prepended
to the beginning of the token stream. This allows the parser handling
of error tokens to be simplified. Any clients using the scanner directly
rather than through the scanner API should call scannerRecovery
if the scanner has detected errors in the content.

Change-Id: I32510da10205bd964f80898a238489d1508733e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-17 20:59:51 +00:00
danrubel a83fbc5edb remove unused enable lazyAssignmentOperators flag
Change-Id: I4112fe4ad5a08916d124216753a995d607a9892d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101485
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-07 13:06:39 +00:00
danrubel 1d7dcfff97 Cleanup scanner tests
Change-Id: I9d579b136c6ff8f83cea1715f3e698eeca8692f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97446
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-03-21 15:01:18 +00:00
Sam Rawlins 3154bb0d37 Stop using external deprecated members in front_end
Change-Id: I3fa03de568f72bfc3adb46efcfa2b61b781c706b
Reviewed-on: https://dart-review.googlesource.com/c/89020
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-01-15 18:55:10 +00:00
Dan Rubel 8c7e83aed2 Remove generic method comment support
Change-Id: I1149ff9c61748fe8d3a51c95e40c02ec5115b0e7
Reviewed-on: https://dart-review.googlesource.com/72122
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-30 17:52:40 +00:00
danrubel 10b441b16b Improve conditional import expression recovery
This improves recovery when parsing conditional import expressions
by repositioning the synthetic closing ')' that was inserted by the
scanner in a less than optimal location.

This approach relies on the beforeSynthetic field being set correctly.
While the scanner still sets the 'next' and 'beforeSynthetic' fields
directly for efficiency, most other functions which update an existing
token stream have been revised to call 'setNext()' rather than setting
the 'next' field directly. This ensures that the 'beforeSynthetic' field
will be correctly updated.

Change-Id: Id631fd600c64d1feaf00593acb74a7070e354f07
Reviewed-on: https://dart-review.googlesource.com/52120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-20 13:58:50 +00:00
Lasse R.H. Nielsen 973a1a0219 Remove uses of upper-case constants in remaining SDK code.
This includes Fasta, tools and observatory, so the checked-in SDK must
have the lower-case constants.

Change-Id: I8380ad041ad058f7d02ae19caccfecd434d13d75
Reviewed-on: https://dart-review.googlesource.com/50201
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-16 16:11:57 +00:00
Dan Rubel 6f710ee546 Update AstBuilder to report scanner errors
Change-Id: I7b33a86378a7c816ccdfb1a7e0869ccd5c3b8f7c
Reviewed-on: https://dart-review.googlesource.com/43900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-02-27 17:20:58 +00:00
Dan Rubel 07a00fc258 remove old fasta missing exponent recovery
As of https://codereview.chromium.org/3002493003
fasta recovers from a missing exponent by
first issuing an error and then appending '0' to the number
so that 347e becomes 347e0

This CL removes the old error recovery that appends NaN
to the token stream as it is no longer needed.

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

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/3004573002 .
2017-08-25 08:57:24 -04:00
Dan Rubel c36936f37f translate remaining fasta scanner error codes
This updates the fasta scanner to translate the remaining
previously untranslated error codes so that they will be seen
by the analyzer when the fasta scanner is used by analyzer.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2923113002 .
2017-06-06 09:08:13 -04:00
Dan Rubel c4449efa33 improve handling of missing interpolation identifier
When the fasta scanner finds a STRING_INTERPOLATION_IDENTIFIER token '$'
without an identifier, it now inserts a synthetic identifier

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

Review-Url: https://codereview.chromium.org/2922563002 .
2017-06-02 15:16:44 -04:00
Dan Rubel b61f9f2343 improve fasta unterminated string recovery
This updates the fasta scanner
to append synthetic closing quotes to unterminated strings.

Rework of https://codereview.chromium.org/2912693002/

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

Review-Url: https://codereview.chromium.org/2915093002 .
2017-06-02 11:51:11 -04:00
Dan Rubel 767d5ecbfd Revert "improve fasta unterminated string recovery"
This reverts commit 6907345fb9.

Review-Url: https://codereview.chromium.org/2907093002 .
2017-05-28 23:40:08 -04:00
Dan Rubel 6907345fb9 improve fasta unterminated string recovery
* enhance handling of unterminated strings
* update ast builder and string validator to handle unterminated strings

Review-Url: https://codereview.chromium.org/2906193004 .
2017-05-28 23:35:32 -04:00
Dan Rubel 8928329339 improve fasta interpolation recovery
* improve fasta interpolation recovery by adding closing brace
    for unterminated string
* update analyzer scanner test because fasta does not support
    does not support \r line endings

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2910583002 .
2017-05-26 08:43:48 -04:00
Dan Rubel 54d6e3a1c5 cleanup fasta token classes
* replace fasta.SymbolToken --> analyzer.Token
* replace fasta.BeginGroupToken --> analyzer.BeginToken
* replace fasta.SymbolToken.eof --> analyzer.Token.eof

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2899043006 .
2017-05-25 07:26:50 -04:00
Dan Rubel 3c447ab35d add fasta.scanner support for lazy assignment operators
R=paulberry@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2895803002 .
2017-05-20 23:02:47 -04:00
Dan Rubel 81d25f4c71 more work aligning fasta.Token with analyzer.Token
* move isPseudo getter out of Token into TokenType
* move special case charCount logic out of fasta.Token into fasta.ErrorToken
* move more accessors from fasta.Token into analyzer.Token
* add @overrides to denote which methods have been declared in analyzer.Token
* make fasta LazySubstring and its subclasses private
* rename fasta.previousToken to previous to match analyzer.Token
* flatten fasta.Token.preceedingCommentTokens into preceedingComments
* normalize fasta.Token.next and analyzer.Token.next

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2872433005 .
2017-05-09 00:09:56 -04:00
Dan Rubel 3347169016 cleanup TokenType var names
* rename TokenType info --> type
* rename fasta Token.info --> Token.type

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

Review-Url: https://codereview.chromium.org/2872453004 .
2017-05-08 12:43:08 -04:00
Konstantin Shcheglov f2f1c60904 Add 'scanGenericMethodComments' parameter to constructors and scan() functions.
R=ahe@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2850853004 .
2017-04-28 14:47:29 -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
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
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
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 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