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

Issue 22415002: Fix access to type variables in initializer expressions (Closed)

Created:
7 years, 4 months ago by hausner
Modified:
7 years, 4 months ago
Reviewers:
regis, ahe
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fix access to type variables in initializer expressions Allow initializer expressions to capture type arguments. This used to crash because the receiver is not accessible in initializer expressions. We don't need the receiver, we just need to mark it as captured. Fixes issue 8847. R=ahe@google.com Committed: https://code.google.com/p/dart/source/detail?r=25877

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -20 lines) Patch
M runtime/vm/parser.cc View 1 1 chunk +2 lines, -7 lines 0 comments Download
M runtime/vm/scopes.h View 1 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/vm/scopes.cc View 1 2 3 chunks +25 lines, -2 lines 4 comments Download
M tests/language/language.status View 3 chunks +0 lines, -11 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
hausner
Thank you.
7 years, 4 months ago (2013-08-06 13:27:56 UTC) #1
ahe
Hi Matthias, I think you need to explain this to me in person :-) Cheers, ...
7 years, 4 months ago (2013-08-06 15:20:38 UTC) #2
hausner
Here's an updated version. The first revision had the side effect of marking some variables ...
7 years, 4 months ago (2013-08-07 11:18:27 UTC) #3
hausner
Regis, would you mind taking a look at this change to scopes and capturing the ...
7 years, 4 months ago (2013-08-07 14:26:53 UTC) #4
ahe
LGTM!
7 years, 4 months ago (2013-08-07 14:49:27 UTC) #5
hausner
Committed patchset #3 manually as r25877 (presubmit successful).
7 years, 4 months ago (2013-08-07 15:15:07 UTC) #6
regis
LGTM with 2 suggestions. https://codereview.chromium.org/22415002/diff/14001/runtime/vm/scopes.cc File runtime/vm/scopes.cc (right): https://codereview.chromium.org/22415002/diff/14001/runtime/vm/scopes.cc#newcode324 runtime/vm/scopes.cc:324: if ((var != NULL) && ...
7 years, 4 months ago (2013-08-07 18:28:26 UTC) #7
hausner
7 years, 4 months ago (2013-08-08 09:26:06 UTC) #8
Message was sent while issue was closed.
https://codereview.chromium.org/22415002/diff/14001/runtime/vm/scopes.cc
File runtime/vm/scopes.cc (right):

https://codereview.chromium.org/22415002/diff/14001/runtime/vm/scopes.cc#newc...
runtime/vm/scopes.cc:324: if ((var != NULL) && !var->is_invisible_) {
On 2013/08/07 18:28:26, regis wrote:
> As far as I understand, if a variable is marked invisible, you are not going
to
> find it in the parent scope. I guess that most of the time, there is no parent
> scope anyway, but still, it would be a bit more efficient to return
immediately:
> if (var != NULL) {
>   if (var->is_invisible_) return NULL;
>   ...

That may be a shortcut that works now, since we use the invisible flag only on
variables in the outermost scopes, as you say. But I think the optimization is
not worth the compromise in correctness (should we ever use "invisible" on other
variables).

https://codereview.chromium.org/22415002/diff/14001/runtime/vm/scopes.cc#newc...
runtime/vm/scopes.cc:345: void LocalScope::CaptureVariable(const String& name) {
On 2013/08/07 18:28:26, regis wrote:
> I would still return the captured variable or a bool, so that the caller can
> assert that the variable was found.

Ok, good point. will do in a follow-on CL.

Powered by Google App Engine
This is Rietveld 408576698