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

Issue 613303003: Rework EvaluationResultImpl class hierarchy. (Closed)

Created:
6 years, 2 months ago by Paul Berry
Modified:
6 years, 2 months ago
Reviewers:
Brian Wilkerson
CC:
reviews_dartlang.org, ricow1
Visibility:
Public.

Description

Rework EvaluationResultImpl class hierarchy. This CL changes EvaluationResultImpl from abstract to concrete, and eliminates its derived classes, ValidResult and ErrorResult. This eliminates the dichotomy between "compile time constant that computed successfully" and "compile time constant that failed to compute because of errors", so that we can keep track of errors encountered during successful evaluation of a constant (this is necessary to support checked mode compile-time errors). It also avoids the need to do double dispatch between the two derived classes in order to evaluate constants involving binary operators. We now keep track of constant evaluation errors my accumulating them into a list (which is passed as a constructor argument into ConstantVisitor). This allows ConstantVisitor to represent its intermediate values using DartObjectImpl directly, and fixes some corner cases where we were dropping or duplicating constant evaluation errors. As a result of fixing the corner cases, issue 21177 is exposed. (Previously the test "compile_time_constant10_test/none" failed to show the bug due to the error being dropped). R=brianwilkerson@google.com Committed: https://code.google.com/p/dart/source/detail?r=40856

Patch Set 1 #

Total comments: 2

Patch Set 2 : Rework to use ErrorReporter #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+871 lines, -1662 lines) Patch
M editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/constant/ConstantEvaluator.java View 1 2 chunks +9 lines, -16 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/builder/EnumMemberBuilder.java View 2 chunks +2 lines, -2 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantValueComputer.java View 1 13 chunks +60 lines, -42 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantVisitor.java View 1 14 chunks +174 lines, -168 lines 0 comments Download
D editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ErrorResult.java View 1 chunk +0 lines, -478 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/EvaluationResultImpl.java View 1 1 chunk +45 lines, -198 lines 0 comments Download
D editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ValidResult.java View 1 chunk +0 lines, -619 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/error/ErrorReporter.java View 1 1 chunk +4 lines, -0 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/hint/DeadCodeVerifier.java View 6 chunks +13 lines, -13 lines 0 comments Download
A editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/DartObjectComputer.java View 1 1 chunk +362 lines, -0 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ConstantVerifier.java View 1 14 chunks +86 lines, -69 lines 2 comments Download
M editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java View 2 chunks +1 line, -3 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/element/ElementFactory.java View 2 chunks +2 lines, -2 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/constant/ConstantValueComputerTest.java View 1 10 chunks +34 lines, -35 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/constant/ConstantVisitorTest.java View 1 7 chunks +62 lines, -17 lines 0 comments Download
M editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java View 1 1 chunk +15 lines, -0 lines 0 comments Download
M tests/language/language_analyzer.status View 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (1 generated)
Paul Berry
6 years, 2 months ago (2014-09-30 18:51:32 UTC) #2
Brian Wilkerson
https://codereview.chromium.org/613303003/diff/1/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantValueComputer.java File editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantValueComputer.java (right): https://codereview.chromium.org/613303003/diff/1/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantValueComputer.java#newcode322 editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantValueComputer.java:322: protected ConstantVisitor createConstantVisitor(ArrayList<ErrorData> errors) { I would rather have ...
6 years, 2 months ago (2014-10-01 15:38:34 UTC) #3
Paul Berry
https://codereview.chromium.org/613303003/diff/1/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantValueComputer.java File editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantValueComputer.java (right): https://codereview.chromium.org/613303003/diff/1/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantValueComputer.java#newcode322 editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ConstantValueComputer.java:322: protected ConstantVisitor createConstantVisitor(ArrayList<ErrorData> errors) { On 2014/10/01 15:38:34, Brian ...
6 years, 2 months ago (2014-10-01 20:54:31 UTC) #4
Brian Wilkerson
LGTM https://codereview.chromium.org/613303003/diff/20001/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ConstantVerifier.java File editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ConstantVerifier.java (right): https://codereview.chromium.org/613303003/diff/20001/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ConstantVerifier.java#newcode251 editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ConstantVerifier.java:251: ErrorReporter subErrorReporter = new ErrorReporter(errorListener, errorReporter.getSource()); Would it ...
6 years, 2 months ago (2014-10-01 21:14:30 UTC) #5
Paul Berry
https://codereview.chromium.org/613303003/diff/20001/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ConstantVerifier.java File editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ConstantVerifier.java (right): https://codereview.chromium.org/613303003/diff/20001/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ConstantVerifier.java#newcode251 editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ConstantVerifier.java:251: ErrorReporter subErrorReporter = new ErrorReporter(errorListener, errorReporter.getSource()); On 2014/10/01 21:14:30, ...
6 years, 2 months ago (2014-10-01 21:17:27 UTC) #6
Paul Berry
6 years, 2 months ago (2014-10-01 21:21:21 UTC) #7
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as 40856 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698