dart-sdk/sdk
Jens Johansen 73a54a30d5 [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

Review-Url: https://codereview.chromium.org/2982843002 .
2017-08-03 08:38:29 +02:00
..
bin Remove MIPS support 2017-06-22 08:49:22 -07:00
lib [fasta] Create a 'constant helper' class which will throw on illegal 'constant' expressions 2017-08-03 08:38:29 +02:00
api_readme.md fix links in readme 2015-08-20 13:17:34 -07:00
BUILD.gn Include platform.dill files in sdk builds 2017-07-26 14:50:49 -07:00