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

Issue 1636113002: Serialize static constant field references. (Closed)

Created:
4 years, 11 months ago by scheglov
Modified:
4 years, 11 months ago
Reviewers:
Paul Berry
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+141 lines, -49 lines) Patch
M pkg/analyzer/lib/src/summary/prelink.dart View 1 chunk +19 lines, -7 lines 0 comments Download
M pkg/analyzer/lib/src/summary/resynthesize.dart View 1 chunk +1 line, -0 lines 0 comments Download
M pkg/analyzer/lib/src/summary/summarize_ast.dart View 1 chunk +13 lines, -0 lines 2 comments Download
M pkg/analyzer/lib/src/summary/summarize_const_expr.dart View 2 chunks +13 lines, -3 lines 2 comments Download
M pkg/analyzer/lib/src/summary/summarize_elements.dart View 2 chunks +16 lines, -8 lines 0 comments Download
M pkg/analyzer/test/src/summary/summary_common.dart View 3 chunks +79 lines, -31 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
scheglov
4 years, 11 months ago (2016-01-26 20:28:15 UTC) #1
Paul Berry
lgtm https://codereview.chromium.org/1636113002/diff/1/pkg/analyzer/lib/src/summary/summarize_ast.dart File pkg/analyzer/lib/src/summary/summarize_ast.dart (right): https://codereview.chromium.org/1636113002/diff/1/pkg/analyzer/lib/src/summary/summarize_ast.dart#newcode67 pkg/analyzer/lib/src/summary/summarize_ast.dart:67: throw new StateError('Unexpected target type: ${target.runtimeType}'); Add a ...
4 years, 11 months ago (2016-01-26 20:52:50 UTC) #2
scheglov
Committed patchset #1 (id:1) manually as 43621246eb5e2d5b53e8630f716194b9d3a9cf4e (presubmit successful).
4 years, 11 months ago (2016-01-26 21:01:46 UTC) #4
scheglov
4 years, 11 months ago (2016-01-26 21:02:29 UTC) #5
Message was sent while issue was closed.
https://codereview.chromium.org/1636113002/diff/1/pkg/analyzer/lib/src/summar...
File pkg/analyzer/lib/src/summary/summarize_ast.dart (right):

https://codereview.chromium.org/1636113002/diff/1/pkg/analyzer/lib/src/summar...
pkg/analyzer/lib/src/summary/summarize_ast.dart:67: throw new
StateError('Unexpected target type: ${target.runtimeType}');
On 2016/01/26 20:52:49, Paul Berry wrote:
> Add a TODO comment here.  We're going to need to be able to handle this when
it
> comes time to summarize code outside the SDK, because target might not be an
> identifier in a malformed constant.

Done.

https://codereview.chromium.org/1636113002/diff/1/pkg/analyzer/lib/src/summar...
File pkg/analyzer/lib/src/summary/summarize_const_expr.dart (right):

https://codereview.chromium.org/1636113002/diff/1/pkg/analyzer/lib/src/summar...
pkg/analyzer/lib/src/summary/summarize_const_expr.dart:97:
serialize(expr.target);
On 2016/01/26 20:52:49, Paul Berry wrote:
> There's two ambiguities with `length` that I think we need to be careful
about:
> 
> const x = a.b.length;
> const y = c.length;
> 
> Either of these could either be UnlinkedConstOperation.length, or a reference
to
> a static const field called `length`, depending on the definitions of `a`,
`b`,
> and `c`.  (`y` could also be a reference to a top level variable called
> `length`, if `c` is an import prefix).  Since we want to be able to summarize
an
> AST without consulting resolution information, we need to provisionally
resolve
> the ambiguity one way, and then fix it up during resynthesis.
> 
> If I'm reading your code right, it looks like `a.b.length` will be encoded
using
> UnlinkedConstOperation.length, but `c.length` will be encoded using
> UnlinkedConstOperation.pushReference (because it will be interpreted as a
> prefixed identifier).
> 
> Personally, I'd prefer to consistently serialize these cases using
> UnlinkedConstOperation.pushReference, because I think the fix up will be
easier
> in that direction.
> 
> If you want to just put in a TODO comment for now and return to this ambiguous
> case later, that's fine with me.

I added TODO and will fix it soon.

Powered by Google App Engine
This is Rietveld 408576698