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

Issue 18649003: Partial solution to analyze potentially constant expressions (Closed)

Created:
7 years, 5 months ago by hausner
Modified:
7 years, 5 months ago
Reviewers:
Ivan Posva
CC:
reviews_dartlang.org, ahe
Visibility:
Public.

Description

Partial solution to analyze potentially constant expressions This change adds code that detects if an expression can definitively never be constant. We use this to analyze the initializer expressions in const constructors. This check is not entirely water tight, but together with the checks in canonicalization code catches most illegal initializer expressions. The const constructor of class Symbol turns out to be illegal. The name verification check can't be part of the constructor code. R=iposva@google.com Committed: https://code.google.com/p/dart/source/detail?r=24749

Patch Set 1 #

Total comments: 8

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+101 lines, -9 lines) Patch
M runtime/lib/symbol_patch.dart View 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/ast.h View 8 chunks +9 lines, -1 line 0 comments Download
M runtime/vm/ast.cc View 1 8 chunks +82 lines, -2 lines 0 comments Download
M runtime/vm/parser.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M tests/co19/co19-runtime.status View 2 chunks +1 line, -2 lines 0 comments Download
M tests/corelib/corelib.status View 1 1 chunk +4 lines, -3 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
hausner
7 years, 5 months ago (2013-07-03 20:00:29 UTC) #1
Ivan Posva
LGTM with comments. -Ivan https://codereview.chromium.org/18649003/diff/1/runtime/vm/ast.cc File runtime/vm/ast.cc (right): https://codereview.chromium.org/18649003/diff/1/runtime/vm/ast.cc#newcode333 runtime/vm/ast.cc:333: case Token::kADD: Still legal? https://codereview.chromium.org/18649003/diff/1/runtime/vm/ast.cc#newcode345 ...
7 years, 5 months ago (2013-07-03 20:23:42 UTC) #2
hausner
Committed patchset #2 manually as r24749 (presubmit successful).
7 years, 5 months ago (2013-07-03 20:47:19 UTC) #3
hausner
7 years, 5 months ago (2013-07-03 21:20:54 UTC) #4
Message was sent while issue was closed.
https://codereview.chromium.org/18649003/diff/1/runtime/vm/ast.cc
File runtime/vm/ast.cc (right):

https://codereview.chromium.org/18649003/diff/1/runtime/vm/ast.cc#newcode333
runtime/vm/ast.cc:333: case Token::kADD:
On 2013/07/03 20:23:42, Ivan Posva wrote:
> Still legal?

Historical artifact that I should have removed with the elimination of unary
plus a couple of weeks ago. Removed.

https://codereview.chromium.org/18649003/diff/1/runtime/vm/ast.cc#newcode345
runtime/vm/ast.cc:345: return true;
On 2013/07/03 20:23:42, Ivan Posva wrote:
> Shouldn't the operand also be potentially const?

Actually, yes. Fixed.

https://codereview.chromium.org/18649003/diff/1/runtime/vm/ast.cc#newcode411
runtime/vm/ast.cc:411: return true;
On 2013/07/03 20:23:42, Ivan Posva wrote:
> Really? Thanks for the offline explanation, it would be helpful to have it
here
> as a comment. Even more helpful would be if we could somehow assert that we
are
> only accessing parameters in the context of const constructor initializer
> expressions. Not sure how to do that though.

Added comment and checked that the local variable/parameter is final.

https://codereview.chromium.org/18649003/diff/1/tests/corelib/corelib.status
File tests/corelib/corelib.status (right):

https://codereview.chromium.org/18649003/diff/1/tests/corelib/corelib.status#...
tests/corelib/corelib.status:12: symbol_test/none: fail # bug 11669
On 2013/07/03 20:23:42, Ivan Posva wrote:
> Consistent uppercase Fail and Pass here and below.

Done.

Powered by Google App Engine
This is Rietveld 408576698