Change in dart/sdk[master]: Adjust Dart.g to allow constructor tearoffs

已查看 6 次
跳至第一个未读帖子

Erik Ernst (Gerrit)

未读,
2021年7月8日 07:26:302021/7/8
收件人 Lasse R.H. Nielsen、rev...@dartlang.org

Attention is currently required from: Lasse R.H. Nielsen.

Erik Ernst would like Lasse R.H. Nielsen to review this change.

View Change

Adjust Dart.g to allow constructor tearoffs

This CL updates the grammar Dart.g such that it
supports constructor tearoffs, as well as explicit
instantiations of generic functions and methods,
and parameterized types as type literals.

Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
---
M tools/spec_parser/Dart.g
1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/tools/spec_parser/Dart.g b/tools/spec_parser/Dart.g
index f166720..5f79d24 100644
--- a/tools/spec_parser/Dart.g
+++ b/tools/spec_parser/Dart.g
@@ -420,11 +420,11 @@
;

constructorName
- : typeIdentifier ('.' identifier)?
+ : typeIdentifier ('.' (identifier | NEW))?
;

redirection
- : ':' THIS ('.' identifier)? arguments
+ : ':' THIS ('.' (identifier | NEW))? arguments
;

initializers
@@ -433,7 +433,7 @@

initializerListEntry
: SUPER arguments
- | SUPER '.' identifier arguments
+ | SUPER '.' (identifier | NEW) arguments
| fieldInitializer
| assertion
;
@@ -519,10 +519,12 @@
| '(' expression ')'
| literal
| identifier
+ | constructorTearoff
;

constructorInvocation
- : typeName typeArguments '.' identifier arguments
+ : typeName typeArguments '.' NEW arguments
+ | typeName '.' NEW arguments
;

literal
@@ -598,6 +600,10 @@
: AWAIT? FOR '(' forLoopParts ')' element
;

+constructorTearoff
+ : typeName typeArguments? '.' NEW
+ ;
+
throwExpression
: THROW expression
;
@@ -850,6 +856,7 @@
: '!'
| assignableSelector
| argumentPart
+ | typeArguments
;

argumentPart
@@ -900,8 +907,8 @@
;

qualifiedName
- : typeIdentifier '.' identifier
- | typeIdentifier '.' typeIdentifier '.' identifier
+ : typeIdentifier '.' (identifier | NEW)
+ | typeIdentifier '.' typeIdentifier '.' (identifier | NEW)
;

typeIdentifier
@@ -1249,7 +1256,7 @@
constructorDesignation
: typeIdentifier
| qualifiedName
- | typeName typeArguments ('.' identifier)?
+ | typeName typeArguments ('.' (identifier | NEW))?
;

symbolLiteral

To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sdk
Gerrit-Branch: master
Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
Gerrit-Change-Number: 197161
Gerrit-PatchSet: 17
Gerrit-Owner: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
Gerrit-Attention: Lasse R.H. Nielsen <l...@google.com>
Gerrit-MessageType: newchange

Erik Ernst (Gerrit)

未读,
2021年7月8日 07:26:312021/7/8
收件人 rev...@dartlang.org、Lasse R.H. Nielsen、Dart CI、commi...@chromium.org

Attention is currently required from: Lasse R.H. Nielsen.

View Change

1 comment:

  • Patchset:

    • Patch Set #17:

      This grammar update makes all the constructor-tearoff feature related tests succeed.

To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sdk
Gerrit-Branch: master
Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
Gerrit-Change-Number: 197161
Gerrit-PatchSet: 17
Gerrit-Owner: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
Gerrit-Attention: Lasse R.H. Nielsen <l...@google.com>
Gerrit-Comment-Date: Thu, 08 Jul 2021 11:26:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Lasse R.H. Nielsen (Gerrit)

未读,
2021年7月8日 08:21:582021/7/8
收件人 Erik Ernst、rev...@dartlang.org、Dart CI、commi...@chromium.org

Attention is currently required from: Erik Ernst.

Patch set 17:Code-Review +1

View Change

1 comment:

  • Patchset:

    • Patch Set #17:

      CL description is no longer correct. This only covers unnamed constructor naming, not type instantiation any more.

      Otherwise LGTM

To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sdk
Gerrit-Branch: master
Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
Gerrit-Change-Number: 197161
Gerrit-PatchSet: 17
Gerrit-Owner: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
Gerrit-Attention: Erik Ernst <eer...@google.com>
Gerrit-Comment-Date: Thu, 08 Jul 2021 12:21:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Erik Ernst (Gerrit)

未读,
2021年7月8日 08:28:102021/7/8
收件人 rev...@dartlang.org、Lasse R.H. Nielsen、Dart CI、commi...@chromium.org

View Change

2 comments:

  • Patchset:

    • Patch Set #17:

      CL description is no longer correct. […]

      Thanks! Actually, the inclusion of `<typeArguments>` as a selector enables a lot of expressions, including `myFunction<int>` and `List<int>`. So in what sense does it not cover type instantiation?

    • Patch Set #17:

      (Response to comment)

To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sdk
Gerrit-Branch: master
Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
Gerrit-Change-Number: 197161
Gerrit-PatchSet: 17
Gerrit-Owner: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
Gerrit-Comment-Date: Thu, 08 Jul 2021 12:28:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Lasse R.H. Nielsen <l...@google.com>
Gerrit-MessageType: comment

Lasse R.H. Nielsen (Gerrit)

未读,
2021年7月8日 08:53:032021/7/8
收件人 Erik Ernst、rev...@dartlang.org、Dart CI、commi...@chromium.org

Attention is currently required from: Erik Ernst.

View Change

1 comment:

  • Patchset:

    • Patch Set #17:

      Thanks! Actually, the inclusion of `<typeArguments>` as a selector enables a lot of expressions, inc […]

      In the sense that I missed that one line. Very subtle! Just the way I like it!

To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sdk
Gerrit-Branch: master
Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
Gerrit-Change-Number: 197161
Gerrit-PatchSet: 17
Gerrit-Owner: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
Gerrit-Attention: Erik Ernst <eer...@google.com>
Gerrit-Comment-Date: Thu, 08 Jul 2021 12:52:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Lasse R.H. Nielsen <l...@google.com>
Comment-In-Reply-To: Erik Ernst <eer...@google.com>
Gerrit-MessageType: comment

Erik Ernst (Gerrit)

未读,
2021年7月8日 09:10:122021/7/8
收件人 rev...@dartlang.org、Lasse R.H. Nielsen、Dart CI、commi...@chromium.org

View Change

2 comments:

To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sdk
Gerrit-Branch: master
Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
Gerrit-Change-Number: 197161
Gerrit-PatchSet: 17
Gerrit-Owner: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
Gerrit-Comment-Date: Thu, 08 Jul 2021 13:10:08 +0000

Erik Ernst (Gerrit)

未读,
2021年7月8日 09:10:162021/7/8
收件人 rev...@dartlang.org、Lasse R.H. Nielsen、Dart CI、commi...@chromium.org

Patch set 17:Commit-Queue +2

View Change

    To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sdk
    Gerrit-Branch: master
    Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
    Gerrit-Change-Number: 197161
    Gerrit-PatchSet: 17
    Gerrit-Owner: Erik Ernst <eer...@google.com>
    Gerrit-Reviewer: Erik Ernst <eer...@google.com>
    Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
    Gerrit-Comment-Date: Thu, 08 Jul 2021 13:10:12 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    commit-bot@chromium.org (Gerrit)

    未读,
    2021年7月8日 09:10:492021/7/8
    收件人 Erik Ernst、rev...@dartlang.org、Lasse R.H. Nielsen、Dart CI

    commi...@chromium.org submitted this change.

    View Change

    Approvals: Lasse R.H. Nielsen: Looks good to me, approved Erik Ernst: Commit
    Adjust Dart.g to allow constructor tearoffs

    This CL updates the grammar Dart.g such that it
    supports constructor tearoffs, as well as explicit
    instantiations of generic functions and methods,
    and parameterized types as type literals.

    Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
    Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197161
    Reviewed-by: Lasse R.H. Nielsen <l...@google.com>
    Commit-Queue: Erik Ernst <eer...@google.com>

    To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sdk
    Gerrit-Branch: master
    Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
    Gerrit-Change-Number: 197161
    Gerrit-PatchSet: 18
    Gerrit-Owner: Erik Ernst <eer...@google.com>
    Gerrit-Reviewer: Erik Ernst <eer...@google.com>
    Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
    Gerrit-MessageType: merged

    Dart CI (Gerrit)

    未读,
    2021年7月8日 09:38:542021/7/8
    收件人 commi...@chromium.org、Erik Ernst、rev...@dartlang.org、Lasse R.H. Nielsen

    go/dart-cbuild result: SUCCESS

    Details: https://goto.google.com/dart-cbuild/find/6facd6dfdafa2953e8523348220d3129ea884678

    View Change

      To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: sdk
      Gerrit-Branch: master
      Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
      Gerrit-Change-Number: 197161
      Gerrit-PatchSet: 18
      Gerrit-Owner: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
      Gerrit-Comment-Date: Thu, 08 Jul 2021 13:38:50 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      Alexander Doroshko (Gerrit)

      未读,
      2021年8月16日 12:47:382021/8/16
      收件人 commi...@chromium.org、Erik Ernst、rev...@dartlang.org、Lasse R.H. Nielsen、Dart CI

      Attention is currently required from: Erik Ernst.

      View Change

      1 comment:

      • File tools/spec_parser/Dart.g:

        • Patch Set #18, Line 527: | typeName '.' NEW arguments

          Sorry for interrupting. I noticed that that both lines include [NEW]. Isn't [typeName typeArguments '.' identifier arguments] a [constructorInvocation] anymore?

      To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: sdk
      Gerrit-Branch: master
      Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
      Gerrit-Change-Number: 197161
      Gerrit-PatchSet: 18
      Gerrit-Owner: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
      Gerrit-CC: Alexander Doroshko <alexander...@jetbrains.com>
      Gerrit-Attention: Erik Ernst <eer...@google.com>
      Gerrit-Comment-Date: Mon, 16 Aug 2021 16:47:33 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      Erik Ernst (Gerrit)

      未读,
      2021年8月16日 12:59:382021/8/16
      收件人 commi...@chromium.org、rev...@dartlang.org、Alexander Doroshko、Lasse R.H. Nielsen、Dart CI

      View Change

      2 comments:

      • Patchset:

      • File tools/spec_parser/Dart.g:

        • Sorry for interrupting. I noticed that that both lines include [NEW]. […]

          No, we added `<typeArguments>` as a new alternative for `<selector>` (line 859), and this means that the old forms of `<constructorInvocation>` are now redundant.

          We can still do `C<int>.name()`, and it still means "invoke the `C.name` constructor, and pass the actual type argument `int` to it", but the syntactic structure is different (it isn't a `<constructorInvocation>`, even though it is a constructor invocation ;-).

      To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: sdk
      Gerrit-Branch: master
      Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
      Gerrit-Change-Number: 197161
      Gerrit-PatchSet: 18
      Gerrit-Owner: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
      Gerrit-CC: Alexander Doroshko <alexander...@jetbrains.com>
      Gerrit-Comment-Date: Mon, 16 Aug 2021 16:59:33 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Alexander Doroshko <alexander...@jetbrains.com>
      Gerrit-MessageType: comment

      Alexander Doroshko (Gerrit)

      未读,
      2021年8月16日 13:15:252021/8/16
      收件人 commi...@chromium.org、Erik Ernst、rev...@dartlang.org、Lasse R.H. Nielsen、Dart CI

      View Change

      1 comment:

      • File tools/spec_parser/Dart.g:

        • No, we added `<typeArguments>` as a new alternative for `<selector>` (line 859), and this means that […]

          Thanks!

      To view, visit change 197161. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: sdk
      Gerrit-Branch: master
      Gerrit-Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
      Gerrit-Change-Number: 197161
      Gerrit-PatchSet: 18
      Gerrit-Owner: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Lasse R.H. Nielsen <l...@google.com>
      Gerrit-CC: Alexander Doroshko <alexander...@jetbrains.com>
      Gerrit-Comment-Date: Mon, 16 Aug 2021 17:15:21 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Erik Ernst <eer...@google.com>
      回复全部
      回复作者
      转发
      0 个新帖子