Commit Graph

66 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
Sam Rawlins bf3f7bad7a Remove unused imports with shared prefixes
The analyzer will start reporting these when
https://github.com/dart-lang/sdk/issues/38784 is fixed.

Change-Id: I5a75b305f52812f07406057b8f0f624e6171ccd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172882
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-19 14:59:24 +00:00
Mike Fairhurst 3095a082cd [analyzer] Add an API to get a language comment token off a unit.
Change-Id: I377fdc44d5e514d6d9a601b3947c3908e5a4497a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140768
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-03-26 03:47:57 +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
danrubel 879cdeffb3 update scanner test
Fix https://github.com/dart-lang/sdk/issues/38112

Change-Id: I81912b40972b1753af9bd994c9b5798fd2a248c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116247
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-09-09 19:46:36 +00:00
Jens Johansen 5601eabda6 [CFE] Spell check messages and dart code
This CL adds a simple spell-checker, adds a spell-checking-phase to
messages_test to spell-check our messages, adds a new test that
spell-check our dart-code and fixes a lot of spelling mistakes / typos.

Change-Id: I8943a5bd67970e9a8a775251ae0aa97799eab097
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112346
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-09 08:47:00 +00:00
Dan Rubel c62bd8f3f4 prepend unterminated comment error token and others
Change-Id: I18fd270e9b74e1fd94403ef90f275001983aa86d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-24 18:38:43 +00:00
Dan Rubel 34ed30f020 prepend unterminated string error code
Change-Id: I95884700f7a43abfb89753b7381167bac19e4c2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110144
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-24 18:38:43 +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
Dan Rubel bc34b65a13 cleanup tests
* fix TokenType.IDENTIFIER name
* fix utf8 scanner tests to actually test the utf8 scanner

Change-Id: Ib87d322cf30402f9f95bae0e66a07e13192ed368
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102404
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-14 19:30:23 +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 a62ab22c48 remove languageVersionField and update scanner tests
Change-Id: I5fbb25d5f743fc00fe188da02390a67ded8b1c69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-01 18:01:19 +00:00
Dan Rubel b9c87ebbda Add scanner languageVersionChanged callback
Change-Id: I64835e303efd83ac1f7cb0015407be8c196a5249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100925
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-01 13:07:15 +00:00
Dan Rubel a20e7eee15 update scanner config based on language comment
... and add ScannerConfiguration.nonNullable const

Change-Id: I6917c535e40e94cb591f2c4f5582dc0127be17f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100884
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-30 21:28:02 +00:00
Dan Rubel aebc542801 update scanner to process language version comment
This CL is the next step in moving the language version comment
detecting from parser to scanner.

* update the scanner to produce a new LanguageVersionToken
* expose the languageVersion in the scanner result
* include languageVersion as a comment if includeComments == true
* rename languageVersionToken to languageVersion

Change-Id: Ie6be6e95e2fa6b7d3b9123bea556bcd5e89888f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-30 18:36:31 +00:00
danrubel 485640df2e update scanner tests to use scanString
... rather than directly referencing the scanner classes

Change-Id: I4b42ef7318d66b412bb57c396c1b3980aad6c8fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-03-22 13:44:40 +00:00
danrubel 266d823f5c remove unused scanner error list
Change-Id: I3dd5d66dcf05ae2bf9f2087724801cae4f3b6036
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97542
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-03-21 22:33:02 +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
Dan Rubel 91b62553ce Make scanner reportErrors field final
Address comments in https://dart-review.googlesource.com/c/sdk/+/80509

Change-Id: Ifc19f283513f201c6d0935e4b20169a528feab20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97047
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-03-18 17:24:06 +00:00
Dan Rubel 21edbbbac6 Add spread collection token to scanner
Change-Id: I1932d7c7fa6daba244ad2d93ddc7e2de18100fee
Reviewed-on: https://dart-review.googlesource.com/c/89600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-01-15 16:42:39 +00:00
Dan Rubel 1061c83779 Optionally report scanner errors via errors list rather than in the token stream
This is the first in a multi step process of moving scanner errors
out of the token stream and into a separate errors list produced by the scanner.
As of this CL, if the scanner.reportErrors flag is set then the scanner will report
the unterminated string error via the errors list rather than the token stream.
Once all scanner clients have been updated to process errors reported
through the scanner's error list, then the scanner.reportErrors flag will be removed.

Change-Id: I6ef73df786d98a387cbf2044c4c8325412573f11
Reviewed-on: https://dart-review.googlesource.com/c/80509
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-18 11:55:01 +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 be741ba511 Add beforeSynthetic field for synthetic ")", "]", and "}" tokens
This CL updates SyntheticToken to have a new beforeSynthetic field
and the fasta scanner to set that field for synthetic ")", "]", and "}" tokens.
This makes it much more efficient for the parser to move a synthetic
closer when the scanner has inserted it in a less than optimal location
in the token stream.

This CL also addresses a comment in
Address comment in https://dart-review.googlesource.com/c/sdk/+/51561

Change-Id: I7f056ac25f2ca4cf5edb0ef4bce7f1e9dd76de9a
Reviewed-on: https://dart-review.googlesource.com/52040
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-20 12:21:09 +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 cf3ced607e Update scanner to gracefully degrade given invalid UTF-8
Fix https://github.com/dart-lang/sdk/issues/31193

Change-Id: I8ede0268ebff9c7e3dab003eff93a263a5d0b6ef
Reviewed-on: https://dart-review.googlesource.com/18740
Reviewed-by: Florian Loitsch <floitsch@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2017-11-07 18:19:29 +00:00
Aske Simon Christensen accddd1d97 Use error message templates for error tokens
Also fixes unicode U+ notation in error messages to use uppercase
letters for the hex code, as per the Unicode Standard conventions.

Closes https://github.com/dart-lang/sdk/issues/29985
Change-Id: I6397e03cb3e0d5eca156621bb4b19dfa643d9437
Reviewed-on: https://dart-review.googlesource.com/9320
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-02 14:23:26 +00:00
Dan Rubel 63991ba171 generate synthetic and error tokens when missing digit
Fix #30321

R=ahe@google.com

Review-Url: https://codereview.chromium.org/3002493002 .
2017-08-14 09:09:40 -04:00
danrubel 5909efe401 Fix scanning of unterminated strings
This fixes
* lineStart tracking when synthetic strings added
* token charOffset when scanning UTF-8 stream

These changes prevent the crashes mentioned in
#29976 and #29982.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2984713002 .
2017-08-01 17:31:07 -04:00
danrubel b8b9e3eae4 add test for internal scanner API
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2952153003 .
2017-06-23 12:35:09 -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 5b6d7653fe fix unterminated interpolation expression handling
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2914213003 .
2017-06-02 13:47:08 -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
danrubel 427c06c2fe fix fasta scanner adapter lineStarts
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2913043002 .
2017-05-30 16:54:05 -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 136698a734 remove fasta <--> analyzer token translation
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2902813005 .
2017-05-24 17:34:08 -04:00
Dan Rubel dff793d05f update lazy assignment operators
and remove scanLazyAssignmentOperators flag

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2903063003 .
2017-05-24 17:05:02 -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 278c7bfbeb merge fasta.Token into analyzer.Token
This eliminates much of the duplication between the two token hierarchies
by merging much of the fasta.Token hierarchy into the analyzer.Token.

* merge token hierarchies
* cleanup fasta.Token.copy()
* set preceedingComments field via constructor
* replace isBuiltInIdentifier --> type.isBuiltIn
* change all fasta.Token references to analyzer.Token
* move fasta.Token.value() implementation into analyzer.SimpleToken

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2890523002 .
2017-05-16 11:50:14 -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
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
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
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 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