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

Issue 8682025: Allow optional initializing formals again (Closed)

Created:
9 years ago by hausner
Modified:
9 years ago
Reviewers:
regis
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Allow optional initializing formals again After removing optional initializing formal parameters from the VM yesterday, the language team decided that they should be allowed and made usable. - The name of an optional initializing formal is the name of the field it initializes. - The parameter is only visible at the call site of the constructor, to name the parameter. - The parameter is NOT visible in the constructor's initializer list and body. class A { A([this.x = 10]); A.bad([this.x = 10]) : y = x; // Error: parameter x not in scope A.ok([this.x = 10]) { print(x); } // Refers to field x, not parameter x. var x, y; } o = new A(x: 50); // o.x == 50. o = new A(); // o.x == 10. Committed: https://code.google.com/p/dart/source/detail?r=1819

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -15 lines) Patch
M runtime/vm/parser.cc View 1 2 4 chunks +6 lines, -11 lines 0 comments Download
M tests/language/language.status View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M tests/language/src/ParameterInitializer2Test.dart View 1 chunk +1 line, -0 lines 0 comments Download
A tests/language/src/ParameterInitializer5NegativeTest.dart View 1 chunk +15 lines, -0 lines 0 comments Download
M tests/language/src/ParameterInitializerTest.dart View 2 chunks +24 lines, -4 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
hausner
9 years ago (2011-11-23 22:10:15 UTC) #1
regis
9 years ago (2011-11-23 22:25:44 UTC) #2
LGTM

Powered by Google App Engine
This is Rietveld 408576698