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

Issue 9290065: Simplify parsing of 'new' operator. (Closed)

Created:
8 years, 11 months ago by regis
Modified:
8 years, 11 months ago
Reviewers:
srdjan, hausner
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Simplify parsing of 'new' operator. Fix checking of default factory type parameters (add new tests). Start cleanup of class resolution code in parser and finalizer. Committed: https://code.google.com/p/dart/source/detail?r=3632

Patch Set 1 #

Total comments: 10

Patch Set 2 : Simplify parsing of 'new' operator #

Unified diffs Side-by-side diffs Delta from patch set Stats (+270 lines, -149 lines) Patch
M runtime/vm/class_finalizer.cc View 1 2 chunks +61 lines, -29 lines 0 comments Download
M runtime/vm/parser.h View 1 1 chunk +4 lines, -3 lines 0 comments Download
M runtime/vm/parser.cc View 1 13 chunks +141 lines, -113 lines 0 comments Download
A tests/language/src/Factory2NegativeTest.dart View 1 chunk +19 lines, -0 lines 0 comments Download
A tests/language/src/Factory3NegativeTest.dart View 1 chunk +22 lines, -0 lines 0 comments Download
A tests/language/src/Factory4Test.dart View 1 chunk +19 lines, -0 lines 0 comments Download
M tests/language/src/FactoryNegativeTest.dart View 1 1 chunk +2 lines, -2 lines 0 comments Download
M tests/language/src/FunctionTypeAliasTest.dart View 1 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
regis
8 years, 11 months ago (2012-01-26 22:35:36 UTC) #1
srdjan
DBC https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.h File runtime/vm/parser.h (right): https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.h#newcode227 runtime/vm/parser.h:227: TypeResolution type_resolution); IMO, it looks better to have ...
8 years, 11 months ago (2012-01-26 22:52:02 UTC) #2
hausner
LGTM, with one question about visibility/scope of type parameters (see below). https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.cc File runtime/vm/parser.cc (right): ...
8 years, 11 months ago (2012-01-26 23:04:29 UTC) #3
regis
8 years, 11 months ago (2012-01-26 23:45:17 UTC) #4
Thanks both!

https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.cc
File runtime/vm/parser.cc (right):

https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.cc#ne...
runtime/vm/parser.cc:1923: // shadowed by a type parameter in scope.
On 2012/01/26 23:04:29, hausner wrote:
> Are type parameters always "in scope" when we parse qualified identifiers? I
> thought it was more complicated, e.g. type parameters not being in scope when
> parsing a static function in a class.

Correct. When type parameters are not in scope, TypeParametersScopeClass()
returns null.

https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.cc#ne...
runtime/vm/parser.cc:6647: // This was already checked by ParseQualIdent, unless
is_top_level_.
On 2012/01/26 23:04:29, hausner wrote:
> It's not immediately clear what "This" in the comment above refers to. I
presume
> it refers to looking up whether the name is a type parameter.

Correct. I made it clearer by merging both comments.

https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.cc#ne...
runtime/vm/parser.cc:6652: ErrorMsg(type_pos,
On 2012/01/26 23:04:29, hausner wrote:
> Same comment as bove: type parameters are not visible everywhere, I think.

This is taken care of by TypeParametersScopeClass() returning null if not in
scope.

https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.cc#ne...
runtime/vm/parser.cc:7110: // the parsed type.
On 2012/01/26 23:04:29, hausner wrote:
> I would switch the two parts of the sentence around for better readability:
"The
> constructor class ...., unless the parsed type is ... (checked below)."

Done.

https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.h
File runtime/vm/parser.h (right):

https://chromiumcodereview.appspot.com/9290065/diff/1/runtime/vm/parser.h#new...
runtime/vm/parser.h:227: TypeResolution type_resolution);
On 2012/01/26 22:52:03, srdjan wrote:
> IMO, it looks better to have the result 'type' at the end of the argument
list.

Done.

Powered by Google App Engine
This is Rietveld 408576698