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

Issue 1050203002: Begin making copies of AST nodes for constants during resolution. (Closed)

Created:
5 years, 8 months ago by Paul Berry
Modified:
5 years, 8 months ago
CC:
reviews_dartlang.org
Target Ref:
refs/remotes/git-svn
Visibility:
Public.

Description

Begin making copies of AST nodes for constants during resolution. The resolver now copies the resolved AST's for the initializers of constant variable declarations into the element model. This is a necessary prerequisite for moving constant evaluation into the new task model, since in the new task model, the original AST nodes won't be available at constant evaluation time. Also, the resolver is now responsible for copying the resolved initializer lists for constant constructors into the element model. This was previously done at constant evaluation time, but once again in the new task model the original AST nodes won't be available at constant evaluation time. Since not all constants are guaranteed to have been evaluated at the time that the resolver makes these copies, we can no longer store the evaluationResult for an InstanceCreationExpression in its AST node (it's no longer guaranteed to get copied safely). So instead, we store the evaluationResult in an intermediate object called ConstantInstanceCreationHandle; that way the copied AST node will point to the same ConstantInstanceCreationHandle as the original AST node, so once the constant is evaluated, the resulting value will be accessible from both AST nodes. R=brianwilkerson@google.com Committed: https://code.google.com/p/dart/source/detail?r=44861

Patch Set 1 #

Total comments: 12

Patch Set 2 : Address review comments and switch to using mixins. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+194 lines, -67 lines) Patch
M pkg/analyzer/lib/src/generated/ast.dart View 1 3 chunks +25 lines, -2 lines 0 comments Download
M pkg/analyzer/lib/src/generated/constant.dart View 1 17 chunks +61 lines, -46 lines 2 comments Download
M pkg/analyzer/lib/src/generated/element.dart View 1 9 chunks +66 lines, -7 lines 0 comments Download
M pkg/analyzer/lib/src/generated/resolver.dart View 1 5 chunks +24 lines, -2 lines 0 comments Download
M pkg/analyzer/lib/src/generated/testing/element_factory.dart View 1 3 chunks +7 lines, -4 lines 0 comments Download
M pkg/analyzer/lib/src/generated/testing/test_type_provider.dart View 4 chunks +4 lines, -0 lines 0 comments Download
M pkg/analyzer/test/generated/all_the_rest_test.dart View 1 4 chunks +7 lines, -6 lines 0 comments Download

Messages

Total messages: 9 (2 generated)
Paul Berry
5 years, 8 months ago (2015-04-01 18:40:07 UTC) #2
Brian Wilkerson
LGTM https://codereview.chromium.org/1050203002/diff/1/pkg/analyzer/lib/src/generated/ast.dart File pkg/analyzer/lib/src/generated/ast.dart (right): https://codereview.chromium.org/1050203002/diff/1/pkg/analyzer/lib/src/generated/ast.dart#newcode5316 pkg/analyzer/lib/src/generated/ast.dart:5316: class ConstantInstanceCreationHandle { Do you mean "target" as ...
5 years, 8 months ago (2015-04-01 20:31:54 UTC) #3
scheglov
Just a small comment. https://codereview.chromium.org/1050203002/diff/1/pkg/analyzer/lib/src/generated/element.dart File pkg/analyzer/lib/src/generated/element.dart (right): https://codereview.chromium.org/1050203002/diff/1/pkg/analyzer/lib/src/generated/element.dart#newcode1520 pkg/analyzer/lib/src/generated/element.dart:1520: Expression get constantInitializer => _constantInitializer; ...
5 years, 8 months ago (2015-04-01 23:34:16 UTC) #5
Paul Berry
PTAL https://codereview.chromium.org/1050203002/diff/1/pkg/analyzer/lib/src/generated/ast.dart File pkg/analyzer/lib/src/generated/ast.dart (right): https://codereview.chromium.org/1050203002/diff/1/pkg/analyzer/lib/src/generated/ast.dart#newcode5316 pkg/analyzer/lib/src/generated/ast.dart:5316: class ConstantInstanceCreationHandle { On 2015/04/01 20:31:54, Brian Wilkerson ...
5 years, 8 months ago (2015-04-02 15:18:49 UTC) #6
Brian Wilkerson
LGTM https://codereview.chromium.org/1050203002/diff/20001/pkg/analyzer/lib/src/generated/constant.dart File pkg/analyzer/lib/src/generated/constant.dart (right): https://codereview.chromium.org/1050203002/diff/20001/pkg/analyzer/lib/src/generated/constant.dart#newcode340 pkg/analyzer/lib/src/generated/constant.dart:340: variableMap[(node.element as PotentiallyConstVariableElement)] = node; nit: the parens ...
5 years, 8 months ago (2015-04-02 15:58:59 UTC) #7
Paul Berry
https://codereview.chromium.org/1050203002/diff/20001/pkg/analyzer/lib/src/generated/constant.dart File pkg/analyzer/lib/src/generated/constant.dart (right): https://codereview.chromium.org/1050203002/diff/20001/pkg/analyzer/lib/src/generated/constant.dart#newcode340 pkg/analyzer/lib/src/generated/constant.dart:340: variableMap[(node.element as PotentiallyConstVariableElement)] = node; On 2015/04/02 15:58:59, Brian ...
5 years, 8 months ago (2015-04-02 16:32:06 UTC) #8
Paul Berry
5 years, 8 months ago (2015-04-02 16:36:08 UTC) #9
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as 44861 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698