Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named/optional arguments with constructor shorthand leaks impl details #1012

Closed
DartBot opened this issue Jan 1, 2012 · 3 comments
Closed
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report

Comments

@DartBot
Copy link

DartBot commented Jan 1, 2012

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. http://try.dartlang.org/s/Ilsl

When using the constructor argument shorthand (this.variable) with optional/named arguments, the fact that the argument is being assigned to a private variable is leaked when the constructor is called.

In the example above, anyone who creates a new "SomeClass" object with a named parameter now knows that the argument is being assigned to a private variable (due to the "_" on the argument name).

@DartBot
Copy link
Author

DartBot commented Jan 1, 2012

This comment was originally written by [email protected]


Looking at the spec, under "Named Optional Formals", it says:
"It is a compile-time error if the name of a named optional parameter begins with an ‘_’ character."

It looks like the compiler isn't catching variable names starting with "this._".

@dgrove
Copy link
Contributor

dgrove commented Jan 2, 2012

Added Area-Dartboard, Triaged labels.

@ghost
Copy link

ghost commented Mar 16, 2012

Removed Area-Dartboard label.
Added Area-Language, Duplicate labels.
Marked as being merged into #434.

@DartBot DartBot added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report labels Mar 16, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

2 participants