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

Issue 261403004: In constant evaluation, properly handle redirecting factory constructors. (Closed)

Created:
6 years, 7 months ago by Paul Berry
Modified:
6 years, 7 months ago
CC:
reviews_dartlang.org, ricow1
Visibility:
Public.

Description

In constant evaluation, properly handle redirecting factory constructors. In order to unit test that this change doesn't regress the handling of "const Symbol(...)", it was necessary to expand TestTypeProvider's Symbol class to include the Symbol constructor. Note: with this fix, analyzer detected a previously unknown flaw in tests/language/switch_case_test.dart: class D didn't implement a getter for x. Test updated accordingly. This change breaks test lib/_internal/compiler/samples/jsonify/jsonify by changing analyzer's handling of bool.fromEnvironment(). I plan to address this in a future changelist. BUG=dartbug.com/17209 R=brianwilkerson@google.com, floitsch@google.com Committed: https://code.google.com/p/dart/source/detail?r=35853

Patch Set 1 #

Total comments: 3

Messages

Total messages: 6 (0 generated)
Paul Berry
6 years, 7 months ago (2014-05-06 21:00:24 UTC) #1
Brian Wilkerson
LGTM https://codereview.chromium.org/261403004/diff/1/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantVisitor.java File editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantVisitor.java (right): https://codereview.chromium.org/261403004/diff/1/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantVisitor.java#newcode299 editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantVisitor.java:299: // constructor to delegate to, we can't evaluate ...
6 years, 7 months ago (2014-05-06 21:44:31 UTC) #2
Paul Berry
Florian, does the change to tests/language/switch_case_test.dart look correct to you?
6 years, 7 months ago (2014-05-06 21:49:32 UTC) #3
floitsch
test change LGTM.
6 years, 7 months ago (2014-05-07 09:16:53 UTC) #4
Paul Berry
Committed patchset #1 manually as r35853 (presubmit successful).
6 years, 7 months ago (2014-05-07 16:27:10 UTC) #5
Paul Berry
6 years, 7 months ago (2014-05-07 17:21:42 UTC) #6
Message was sent while issue was closed.
https://codereview.chromium.org/261403004/diff/1/editor/tools/plugins/com.goo...
File
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantVisitor.java
(right):

https://codereview.chromium.org/261403004/diff/1/editor/tools/plugins/com.goo...
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantVisitor.java:299:
// constructor to delegate to, we can't evaluate the constant.
On 2014/05/06 21:44:32, Brian Wilkerson wrote:
> That's sort of true (if you add "currently"). Actually the analysis context
> should have a map from defined names to values and we should look in the map
> before defaulting to the behavior you've implemented. Then the command-line
> analyzer should support -D flags by populating the map.

Ok, I added the word "currently", and the following text:

TODO(paulberry): if the constructor is one of
{bool,int,String}.fromEnvironment(), we may be able to infer the value based on
-D flags provided to the analyzer (see dartbug.com/17234).

Powered by Google App Engine
This is Rietveld 408576698