Description[fasta] Create a 'constant helper' class which will throw on illegal 'constant' expressions
Currently kernel fails a number of test because too much is allowed to be constant.
Examples includes
const x = "hello " * 4; // yielding "hello hello hello hello "
const y = "hello".leng; // crashing the VM
The idea behing the helper class is, that fasta can generate those as for instance
var c = new _ConstantHelper();
const x = c.times("hello ", 4, () => thow yadayada);
where - upon evaluating it in for instance the VMs constant evaluator - the helper will see that "hello " is neiher an integer nor null, and thus execute the given onError function.
This is only one step towards that; it will still have to be hooked up in fasta,
and constant evaluators (e.g. in the VM, I suppose there's also one in dart2js etc)
might need to be updated to be able to execute it.
R=ahe@google.com
Committed: https://github.com/dart-lang/sdk/commit/73a54a30d566cb5eaa0b0e1ed12f3b770c91c97f
Patch Set 1 #
Messages
Total messages: 7 (3 generated)
|