Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(451)

Issue 2260693002: Implement parsing support for generic functions (Closed)

Created:
4 years, 4 months ago by hausner
Modified:
4 years, 4 months ago
Reviewers:
regis, siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org, regis
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Implement parsing support for generic functions Type parameters and arguments are parsed but ignored. Proper handling of the parameters will be added subsequently. The feature must be enabled with --generic-method-syntax. Compiling all of dart2js consumes about 2.2% more tokens with this change, due to the necessary lookahead to distinguish generic functions from generic types. ===== with this change ========= Number of tokens: 1056691 Source length: 5850143 characters Number of source tokens: 936226 Total tokens consumed: 3628934 <<<<< Classes parsed: 2457 Tokens consumed: 977999 Functions parsed: 49607 Tokens consumed: 2430638 ===== without this change ====== Number of tokens: 1056691 Source length: 5850143 characters Number of source tokens: 936226 Total tokens consumed: 3547765 <<<<< Classes parsed: 2457 Tokens consumed: 942536 Functions parsed: 49607 Tokens consumed: 2371357 BUG=25869 R=asiva@google.com Committed: https://github.com/dart-lang/sdk/commit/19af8524710507ff29ec077ce3e1e67e5a7e8f30

Patch Set 1 #

Patch Set 2 : Cleanup #

Total comments: 23

Patch Set 3 : Address review comments #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+322 lines, -128 lines) Patch
M runtime/vm/parser.h View 2 chunks +6 lines, -0 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 28 chunks +300 lines, -114 lines 5 comments Download
M tests/language/generic_functions_test.dart View 1 chunk +1 line, -0 lines 0 comments Download
M tests/language/generic_local_functions_test.dart View 1 chunk +1 line, -0 lines 0 comments Download
M tests/language/generic_methods_function_type_test.dart View 1 chunk +1 line, -0 lines 0 comments Download
M tests/language/generic_methods_new_test.dart View 1 chunk +1 line, -0 lines 0 comments Download
M tests/language/generic_methods_test.dart View 1 chunk +1 line, -0 lines 0 comments Download
M tests/language/generic_methods_type_expression_test.dart View 1 chunk +1 line, -0 lines 0 comments Download
M tests/language/generic_sends_test.dart View 1 chunk +1 line, -0 lines 0 comments Download
M tests/language/language.status View 1 2 chunks +9 lines, -14 lines 0 comments Download

Messages

Total messages: 13 (5 generated)
hausner
4 years, 4 months ago (2016-08-19 15:53:12 UTC) #3
siva
https://codereview.chromium.org/2260693002/diff/20001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): https://codereview.chromium.org/2260693002/diff/20001/runtime/vm/parser.cc#newcode143 runtime/vm/parser.cc:143: TokenPosition _saved_pos; Normally we have been using _ as ...
4 years, 4 months ago (2016-08-19 20:30:59 UTC) #5
hausner
PTAL. Thank you. https://codereview.chromium.org/2260693002/diff/20001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): https://codereview.chromium.org/2260693002/diff/20001/runtime/vm/parser.cc#newcode143 runtime/vm/parser.cc:143: TokenPosition _saved_pos; On 2016/08/19 20:30:58, siva ...
4 years, 4 months ago (2016-08-19 21:40:05 UTC) #6
siva
lgtm https://codereview.chromium.org/2260693002/diff/40001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): https://codereview.chromium.org/2260693002/diff/40001/runtime/vm/parser.cc#newcode51 runtime/vm/parser.cc:51: DEFINE_FLAG(bool, generic_method_syntax, false, "Enbable generic functions."); s/Enbable/Enable/
4 years, 4 months ago (2016-08-19 23:08:14 UTC) #7
hausner
Thank you. https://codereview.chromium.org/2260693002/diff/20001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): https://codereview.chromium.org/2260693002/diff/20001/runtime/vm/parser.cc#newcode8060 runtime/vm/parser.cc:8060: } On 2016/08/19 21:40:04, hausner wrote: > ...
4 years, 4 months ago (2016-08-19 23:12:01 UTC) #8
hausner
Committed patchset #3 (id:40001) manually as 19af8524710507ff29ec077ce3e1e67e5a7e8f30 (presubmit successful).
4 years, 4 months ago (2016-08-19 23:21:07 UTC) #10
Leaf
On 2016/08/19 23:21:07, hausner wrote: > Committed patchset #3 (id:40001) manually as > 19af8524710507ff29ec077ce3e1e67e5a7e8f30 (presubmit ...
4 years, 4 months ago (2016-08-20 01:15:39 UTC) #11
regis
4 years, 4 months ago (2016-08-24 14:14:02 UTC) #13
Message was sent while issue was closed.
Looks great!

DBC

https://codereview.chromium.org/2260693002/diff/40001/runtime/vm/parser.cc
File runtime/vm/parser.cc (right):

https://codereview.chromium.org/2260693002/diff/40001/runtime/vm/parser.cc#ne...
runtime/vm/parser.cc:3783: ReportError("generic type arguments not supported.");
Being picky, but instead of "generic type arguments", either "generic function"
or "type parameters" would be more accurate.

https://codereview.chromium.org/2260693002/diff/40001/runtime/vm/parser.cc#ne...
runtime/vm/parser.cc:11838: ReportError("generic type arguments not
supported.");
I would drop "generic".
Or maybe "type arguments of generic function not supported".
Or simply "generic function not supported".

https://codereview.chromium.org/2260693002/diff/40001/runtime/vm/parser.cc#ne...
runtime/vm/parser.cc:11938: ReportError("generic type arguments not
supported.");
ditto

Powered by Google App Engine
This is Rietveld 408576698