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

Issue 9753001: super and this in compile-time constants. (Closed)

Created:
8 years, 9 months ago by floitsch
Modified:
8 years, 9 months ago
Reviewers:
ngeoffray
CC:
reviews_dartlang.org, ahe
Base URL:
/home/flo/programming/dart2/../dart/dart@master
Visibility:
Public.

Description

super and this in compile-time constants. Committed: https://code.google.com/p/dart/source/detail?r=5918

Patch Set 1 #

Patch Set 2 : Update #

Patch Set 3 : Improvements #

Total comments: 1

Patch Set 4 : Update status file. #

Patch Set 5 : Add test. #

Patch Set 6 : Remove work-around for VM bug. #

Total comments: 20

Patch Set 7 : rebase #

Patch Set 8 : Address comments. #

Total comments: 8

Patch Set 9 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+276 lines, -146 lines) Patch
M frog/leg/compile_time_constants.dart View 1 2 3 4 5 6 7 8 9 chunks +169 lines, -132 lines 0 comments Download
M frog/leg/compiler.dart View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M samples/tests/samples/samples-leg.status View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -3 lines 0 comments Download
M tests/co19/co19-leg.status View 1 2 3 4 5 6 7 8 3 chunks +1 line, -4 lines 0 comments Download
M tests/language/language-leg.status View 1 2 3 4 5 6 7 8 2 chunks +0 lines, -3 lines 0 comments Download
A tests/language/src/CompileTimeConstantITest.dart View 1 2 3 4 5 6 7 1 chunk +105 lines, -0 lines 0 comments Download
M tests/utils/utils.status View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -3 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
ahe
https://chromiumcodereview.appspot.com/9753001/diff/4002/frog/leg/compile_time_constants.dart File frog/leg/compile_time_constants.dart (right): https://chromiumcodereview.appspot.com/9753001/diff/4002/frog/leg/compile_time_constants.dart#newcode946 frog/leg/compile_time_constants.dart:946: Function compileConstant = (x) => compiler.compileVariable(x); What is up ...
8 years, 9 months ago (2012-03-23 10:56:15 UTC) #1
floitsch
https://chromiumcodereview.appspot.com/9753001/diff/6018/frog/leg/compile_time_constants.dart File frog/leg/compile_time_constants.dart (right): https://chromiumcodereview.appspot.com/9753001/diff/6018/frog/leg/compile_time_constants.dart#newcode946 frog/leg/compile_time_constants.dart:946: Function compileArgument = evaluate; The VM has/had a bug ...
8 years, 9 months ago (2012-03-23 23:15:57 UTC) #2
ahe
DBC https://chromiumcodereview.appspot.com/9753001/diff/6018/tests/language/src/CompileTimeConstantITest.dart File tests/language/src/CompileTimeConstantITest.dart (right): https://chromiumcodereview.appspot.com/9753001/diff/6018/tests/language/src/CompileTimeConstantITest.dart#newcode33 tests/language/src/CompileTimeConstantITest.dart:33: final a1 = const A(499); How about adding ...
8 years, 9 months ago (2012-03-24 07:30:42 UTC) #3
ngeoffray
Looks good, but please consider adding this ConstructorEvaluator abstraction, I believe this will make the ...
8 years, 9 months ago (2012-03-26 07:38:30 UTC) #4
ahe
DBC https://chromiumcodereview.appspot.com/9753001/diff/6018/frog/leg/compile_time_constants.dart File frog/leg/compile_time_constants.dart (right): https://chromiumcodereview.appspot.com/9753001/diff/6018/frog/leg/compile_time_constants.dart#newcode940 frog/leg/compile_time_constants.dart:940: if (send.arguments.isEmpty() && parameters.parameterCount == 0) { On ...
8 years, 9 months ago (2012-03-26 08:03:25 UTC) #5
floitsch
PTAL. https://chromiumcodereview.appspot.com/9753001/diff/6018/frog/leg/compile_time_constants.dart File frog/leg/compile_time_constants.dart (right): https://chromiumcodereview.appspot.com/9753001/diff/6018/frog/leg/compile_time_constants.dart#newcode684 frog/leg/compile_time_constants.dart:684: CompileTimeConstantEvaluator.insideConstructor(this.constantHandler, On 2012/03/26 07:38:31, ngeoffray wrote: > Because ...
8 years, 9 months ago (2012-03-27 00:52:50 UTC) #6
ngeoffray
LGTM!! Thanks for the cleanup. https://chromiumcodereview.appspot.com/9753001/diff/7004/frog/leg/compile_time_constants.dart File frog/leg/compile_time_constants.dart (right): https://chromiumcodereview.appspot.com/9753001/diff/7004/frog/leg/compile_time_constants.dart#newcode681 frog/leg/compile_time_constants.dart:681: Map<Element, Constant> get definitions() ...
8 years, 9 months ago (2012-03-27 11:30:33 UTC) #7
floitsch
8 years, 9 months ago (2012-03-28 00:10:58 UTC) #8
https://chromiumcodereview.appspot.com/9753001/diff/7004/frog/leg/compile_tim...
File frog/leg/compile_time_constants.dart (right):

https://chromiumcodereview.appspot.com/9753001/diff/7004/frog/leg/compile_tim...
frog/leg/compile_time_constants.dart:681: Map<Element, Constant> get
definitions() => null;
On 2012/03/27 11:30:33, ngeoffray wrote:
> Please consider removing these getters, and override visitSend in
> ConstructorEvaluator. The visitSend in ConstructorEvaluator could look like:
> 
> Constant visitSend(Send send) {
>   Element element = elements[send];
>   if (!Elements.isLocal(element)) {
>     return super.visitSend(send);
>   }
>   ...
> }

I was afraid that a local could be a Prefix too. But test confirmed that this is
not the case.
done.

https://chromiumcodereview.appspot.com/9753001/diff/7004/frog/leg/compile_tim...
frog/leg/compile_time_constants.dart:929: List<Constant>
evaluateStaticSendArguments(Send send,
On 2012/03/27 11:30:33, ngeoffray wrote:
> Since this is only used by the ConstructorEvaluator, you could move it there.

It is actually used by the normal evaluator too (in visitNewExpression). I had
already moved it, but it doesn't really work, because the arguments need to be
evaluated in the context of the original expression.

https://chromiumcodereview.appspot.com/9753001/diff/7004/frog/leg/compile_tim...
frog/leg/compile_time_constants.dart:955: List<Constant> arguments =
evaluateStaticSendArguments(send, constructor);
On 2012/03/27 11:30:33, ngeoffray wrote:
> evaluateStaticSendArguments -> evaluateArgumentsToConstructor ?

Done.

https://chromiumcodereview.appspot.com/9753001/diff/7004/frog/leg/compile_tim...
frog/leg/compile_time_constants.dart:958:
evaluator.evaluateConstructorFieldValues(arguments);
On 2012/03/27 11:30:33, ngeoffray wrote:
> Instead of passing arguments, I would pass the node and let
CosntructorEvaluator
> call evaluateStaticSendArguments.

Can't do that, because there is no Send for implicit super calls to the
default-constructor.

Powered by Google App Engine
This is Rietveld 408576698