Commit Graph

146 Commits

Author SHA1 Message Date
Johnni Winther 05f3b12960 Add test for native declarations
Change-Id: Iea9d8d27e6fdefa6f47471a459cdb4363aab65e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98011
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-28 10:29:11 +00:00
Nate Bosch 69a4f20347 Add override annotations consistently
This makes it easier to follow class hierarchies and understand where a
class is changing the interface. I hit this when I found a class that
had the annotation on some methods it was overriding, but not all, which
made it confusing.

Prepares for adding the lint rule and enforcing it.

40% of overridden methods were annotated - add annotations to the remaining 60%.

Change-Id: I02472f4b6c5026a820cf9ff1a7ada663a60f1868
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96666
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-13 22:36:11 +00:00
Mayank Patke bc5d613533 Fix typo in diagnostic when non-bool is passed to logical or.
Change-Id: I406c062359a0dfbb89f22a6a6cb25017eed740e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96823
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-03-13 18:12:23 +00:00
Sigmund Cherem bb4a880777 Report duplicate set entries with a different error
It will take some time until the CFE will take on reporting this error (and
duplicate keys in maps).

For now: detect whether a map is used as the implementation of a set literal,
and if so report the error differently.

Change-Id: I9f657189c79a4532023f615aa91bf63602f27664
Reviewed-on: https://dart-review.googlesource.com/c/91102
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2019-01-25 17:12:43 +00:00
Johnni Winther 3e7801294e Remove unneeded code in OrderedTypeSet
* _supertypes was accidentally a multiset instead of a set, but is no
  longer needed (types.tail contains the same set)
* _reporter and reportMultiInheritanceIssue is no longer needed

Change-Id: Ic8310fe79f604a280938689a92c4868d8ed24ab4
Reviewed-on: https://dart-review.googlesource.com/c/89520
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-01-16 08:22:09 +00:00
Stephen Adams f0c7d971c4 [dart2js] Run dartfmt --fix-doc-comments
Change-Id: I004a5da3f3e3adb5fc6f3088ba8dc3ca5082fbef
Reviewed-on: https://dart-review.googlesource.com/c/89163
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-01-11 21:13:17 +00:00
Johnni Winther dc9d6785de Report compile-time errors on invalid switch cases
This is a temporary fix for issue 32557 until CFE handles it.

Change-Id: I4f0cfa5a98af6b25536f0c8e0a257940f8ce708b
Reviewed-on: https://dart-review.googlesource.com/c/79561
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
2018-10-12 17:52:12 +00:00
Peter von der Ahé 248954117a Consolidate dart2js front-end dependencies
Also, convert dart2js to use onDiagnostic.

Change-Id: Ifdf89349eaf2ebe8cfcd1994712b3d1be2dd4197
Reviewed-on: https://dart-review.googlesource.com/77400
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-10-02 12:34:28 +00:00
Johnni Winther d456532124 Disallow non-js interop external members
Change-Id: Ic73a3e2b16bdf77a2cd94fdcfaffe7989a798909
Reviewed-on: https://dart-review.googlesource.com/70513
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-22 06:59:46 +00:00
Johnni Winther 70747047b0 Add hint for .runtimeType.toString()
Change-Id: I0a20f1fc42bc475c9acdf40b3d8aae16edbc8ea9
Reviewed-on: https://dart-review.googlesource.com/64845
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-19 08:09:15 +00:00
Johnni Winther 7c27ebe8e3 Remove unused messages
Change-Id: I3b81dd5dfecf2dee881ec1901d68df71aa703260
Reviewed-on: https://dart-review.googlesource.com/64844
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-07-18 10:28:59 +00:00
Johnni Winther b558a9c2f4 Handle missing compile-time errors
Closes #33468

Change-Id: I6da12012103ed465257335ce5bb81ba1fc54c81a
Reviewed-on: https://dart-review.googlesource.com/60500
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-06-18 07:34:46 +00:00
Johnni Winther f1f660fe1e Small cleanup
Change-Id: I368fbaa3bac5a5a47c374f26998cce8ad8b265a6
Reviewed-on: https://dart-review.googlesource.com/55890
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-18 19:33:48 +00:00
Johnni Winther baf09db165 Remove Resolution and Target
Change-Id: I30fb47acd820077b0dd9efebc3460a9a8a1e6e1f
Reviewed-on: https://dart-review.googlesource.com/55200
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther f4fb1fe932 Remove most references to tree/tree.dart
Change-Id: I2ebcfdc616ee204e8e39277537e7e3c622caee42
Reviewed-on: https://dart-review.googlesource.com/55121
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Dan Rubel fd87a11ad0 Update fasta parser to generate error when "throw" missing expression
Change-Id: I6610400204e111a3a6cc7971159bfdd6c2e58794
Reviewed-on: https://dart-review.googlesource.com/49880
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-06 16:10:12 +00:00
Sigmund Cherem 0284fdab6b dart2js: allow as expressions in constants
The CFE doesn't allow them explicitly yet, but implicit casts do show up by the
time we see them in dart2js.

Closes https://github.com/dart-lang/sdk/issues/32773

Change-Id: Idb566625ce7c8edc74a4eea0109491bd72357051
Reviewed-on: https://dart-review.googlesource.com/49801
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-04-06 00:46:30 +00:00
Dan Rubel 7450e2ad60 Fix parsing of invalid interpolation in string literal
Change-Id: I7151cee5f97a5a43314885326e4806a0314af544
Reviewed-on: https://dart-review.googlesource.com/47582
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-22 18:50:13 +00:00
Sigmund Cherem e33f4f7c2e Fail if mirrors are really used.
Some legacy libraries may import dart:mirrors, but not use it. This CL turns them
into a runtime error temporarily to give some time for the library
maintainers to remove the import to dart:mirrors in the future.

Change-Id: I876133908d2a61300256915aab54730bdff51649
Reviewed-on: https://dart-review.googlesource.com/43640
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-02-27 04:57:27 +00:00
Johnni Winther f2b8cafb44 Handle assert in initializers of constant constructors.
Change-Id: Ibb4053af00392b3c43177c60c8551cc6ffe937eb
Reviewed-on: https://dart-review.googlesource.com/38320
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-13 14:00:01 +00:00
Dan Rubel ec7435945d Remove findMemberName from parseTopLevelMember
This CL refactors parseTopLevelMember so that it does not scan ahead
using findMemberName. This is the next step in removing findMemberName
to improve top level declaration recovery.

Change-Id: I4d949f72cba5618541448c08e1756bf45a4d1762
Reviewed-on: https://dart-review.googlesource.com/37680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-01-31 12:04:56 +00:00
danrubel 6f6689889c Update fasta parser to report ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR
In addition to adding missing errors, this CL inlines modifier parsing
as part of a multi step effort to parse modifiers once and provide
better error recovery for class member and top level declarations.

Change-Id: Ibea91a4a3e2073ed6079f0f44ff4bbbb4a98a614
Reviewed-on: https://dart-review.googlesource.com/35300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-01-17 18:28:48 +00:00
Sigmund Cherem 0e1a407823 Produce a static error when using kernel and mirrors
Just noticed that the 'supportsRelection' flag was not checked when running with
'--use-kernel'.

Change-Id: I9f4bd540ad963c33c8b9013860ac63b1c6707299
Reviewed-on: https://dart-review.googlesource.com/35006
Reviewed-by: Harry Terkelsen <het@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-01-17 00:56:12 +00:00
Dan Rubel b79696982d Improve extraneous or out of position modifier recovery
In addition to improving modifier recovery, this CL
* Improves recovery when builtin keywords are used as types
* Updates ModifierContext to avoid parsing modifiers used as identifiers
* Addresses comment in https://dart-review.googlesource.com/c/sdk/+/34200
* Streamlines missing class body recovery
* Ensures the endMember event is sent during recovery

Change-Id: I87bda7c7da9d0e951427037087c7aa7e8e4da109
Reviewed-on: https://dart-review.googlesource.com/34520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-01-16 17:24:12 +00:00
Johnni Winther ab636dfbd1 Reenable warnings/hints for method type variables in dart2js
Change-Id: I09662afc8b1a4e8c9fdbfe2e342e80ea58351593
Reviewed-on: https://dart-review.googlesource.com/32060
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-01-08 12:48:02 +00:00
Brian Wilkerson 1d0f198eea Replace function arguments to assert with invocations of those functions
Change-Id: I09a3da573c7c936d4d381405c1a68805cbc065c4
Reviewed-on: https://dart-review.googlesource.com/32120
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-03 18:48:25 +00:00
Dan Rubel 3ab29148f4 Add fasta parser cascade recovery
Change-Id: I1cf32604acf2124a9d61621fbb4cfb9343d98d33
Reviewed-on: https://dart-review.googlesource.com/28840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2017-12-13 18:30:25 +00:00
Erik Ernst f95a3cc1e6 dart2js no longer warns that function type variables are not reified
Change-Id: I69746c92912fcbbc35e1f6c37e310352f92708f6
Reviewed-on: https://dart-review.googlesource.com/28641
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-12-13 14:01:16 +00:00
Dan Rubel 2a883a9c33 More fasta parser expression recovery
Change-Id: Ie3a71d4febcb9e0c277ddd6038eb1cc40c6fdf26
Reviewed-on: https://dart-review.googlesource.com/24240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-04 16:22:04 +00:00
Sigmund Cherem 606e8502f8 fix recovery on ||= and &&= in dart2js
Bug: https://github.com/dart-lang/sdk/issues/31061
Change-Id: I3f8667d5dab92d256122484a6fc83b3527228085
Reviewed-on: https://dart-review.googlesource.com/12760
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-11 22:37:17 +00:00
Brian Wilkerson b4d179e58a Recover from missing identifiers
Change-Id: I3c7a908449861eeed0915c4d74b10f4d1e46fde4
Reviewed-on: https://dart-review.googlesource.com/7558
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2017-10-03 13:41:02 +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
Johnni Winther fd247b1539 Add ErroneousConstructorConstant
+ use source locations for fasta messages

Change-Id: I1abba76f4f5653f8d7278cb2b368ae25ce33160b
Reviewed-on: https://dart-review.googlesource.com/8840
Reviewed-by: Stephen Adams <sra@google.com>
2017-09-28 08:06:42 +00:00
Johnni Winther 772a0aff33 Handle and report erroneous compile time constants
Change-Id: I2ee86dbd714227e8e0894539ca64258fd11badfc
Reviewed-on: https://dart-review.googlesource.com/7820
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2017-09-22 18:57:37 +00:00
Harry Terkelsen b7666dd327 dart2js: Remove lookup map support
Change-Id: Id435dc0f54165285c0d291d2e1c984da92bfd22a
Reviewed-on: https://dart-review.googlesource.com/5284
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Harry Terkelsen <het@google.com>
2017-09-12 20:16:12 +00:00
Johnni Winther c8ae9ba422 Handle js interop members in impact computation.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2998543002 .
2017-08-09 10:40:28 +02:00
Johnni Winther 5fe6282ec0 Reformat untouched files.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2990223002 .
2017-08-04 14:52:58 +02:00
Stephen Adams f4946f54e8 Use failedAt in more places
I saw some inconsistency in one file so I did a global cleanup.

BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2982783003 .
2017-07-14 12:10:31 -07:00
Stephen Adams a146d932e5 invariant cleanup
- remove inariant(), since all calls replaced wif failedAt()
- delete unused typedef

R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2918253002 .
2017-06-06 08:41:25 -07:00
Sigmund Cherem dd70d8b655 Remove factory body in *.fromEnvironment, and implement this same behavior
directly inside dart2js.

A few notes:
  * I ended up adding support for this feature also in dart2js with --use-kernel, it was not implemented correctly before. This is why more tests are passing.

  * I played with two other ideas:
    (a) making this a compile-time error instead
    (b) making it a warning if the arguments were constant and implement it as a constant, treat it as an error if they were not.

Unfortunately both are a breaking changes, so I backed out from them. IMO (a) is the cleanest thing to do long term, and we should raise this with the language team.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2896393003 .
2017-05-26 14:49:19 -07:00
Stephen Adams c7b3400eb5 Use failedAt in more places (misc)
TBR=sigmund@google.com

Review-Url: https://codereview.chromium.org/2904783002 .
2017-05-23 18:13:28 -07:00
Stephen Adams d2688c4ce6 Redo "dart2js: replace 'invariant' with 'failedAt' to defer interpolation"
TBR=johnniwinther@google.com
BUG=

Review-Url: https://codereview.chromium.org/2904613002 .
2017-05-23 11:44:52 -07:00
Stephen Adams 3e72e09a97 Revert "dart2js: replace 'invariant' with 'failedAt' to defer interpolation"
Investigating some analyzer warnings.

TBR=johnniwinther@google.com
BUG=

Review-Url: https://codereview.chromium.org/2897093002 .
2017-05-23 10:48:41 -07:00
Stephen Adams 641767c1da dart2js: replace 'invariant' with 'failedAt' to defer interpolation
Speeds up dart2js_builds by ~5% (probably more with more replacements).

BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2902633002 .
2017-05-23 08:25:52 -07:00
Johnni Winther ebe69e6060 Support loading binary data in dart2js
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2897903003 .
2017-05-23 10:43:20 +02:00
Erik Corry 4b9bba55b4 Stoppp using trippple consonants
R=ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2833073002 .
2017-04-21 17:50:13 +02:00
Jacob Richman 33717e010a Run dartfmt on dart2js codebase.
BUG=
R=sra@google.com

Review-Url: https://codereview.chromium.org/2746333008 .
2017-03-15 20:38:18 -07:00
Johnni Winther cb8b56523c Pending renames and cleanups after commits
Review-Url: https://codereview.chromium.org/2751983002 .
2017-03-15 15:33:42 +01:00
Lasse R.H. Nielsen 5ae186153c Make Analyzer, VM and dart2js accept URI strings as part-of library identifier.
R=brianwilkerson@google.com, floitsch@google.com, hausner@google.com, johnniwinther@google.com, sigmund@google.com

Committed: https://github.com/dart-lang/sdk/commit/ef097edad6e5e4e82c3891ad2d8f9cde8fa8cfdc
Review-Url: https://codereview.chromium.org/2640853005 .
2017-03-13 08:31:40 +01: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