mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:20:38 +00:00
Try to handle int64 mode errors on literal handling
Bug: Change-Id: I55fabb8eb359dbc91b4848d25109af9344484ee5 Reviewed-on: https://dart-review.googlesource.com/32121 Reviewed-by: Jenny Messerly <jmesserly@google.com> Commit-Queue: Vijay Menon <vsm@google.com>
This commit is contained in:
parent
c67be1b896
commit
09621f6724
3 changed files with 18 additions and 9 deletions
|
@ -4730,7 +4730,10 @@ class CodeGenerator extends Object
|
|||
int _asIntInRange(Expression expr, int low, int high) {
|
||||
expr = expr.unParenthesized;
|
||||
if (expr is IntegerLiteral) {
|
||||
if (expr.value >= low && expr.value <= high) return expr.value;
|
||||
var value = expr.value;
|
||||
if (value != null && value >= low && value <= high) {
|
||||
return expr.value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -4753,7 +4756,7 @@ class CodeGenerator extends Object
|
|||
|
||||
bool _isDefinitelyNonNegative(Expression expr) {
|
||||
expr = expr.unParenthesized;
|
||||
if (expr is IntegerLiteral) {
|
||||
if (expr is IntegerLiteral && expr.value != null) {
|
||||
return expr.value >= 0;
|
||||
}
|
||||
if (_nodeIsBitwiseOperation(expr)) return true;
|
||||
|
@ -4786,7 +4789,7 @@ class CodeGenerator extends Object
|
|||
/// Determines how many bits are required to hold result of evaluation
|
||||
/// [expr]. [depth] is used to bound exploration of huge expressions.
|
||||
int bitWidth(Expression expr, int depth) {
|
||||
if (expr is IntegerLiteral) {
|
||||
if (expr is IntegerLiteral && expr.value != null) {
|
||||
return expr.value >= 0 ? expr.value.bitLength : MAX;
|
||||
}
|
||||
if (++depth > 5) return MAX;
|
||||
|
@ -5563,7 +5566,18 @@ class CodeGenerator extends Object
|
|||
}
|
||||
|
||||
@override
|
||||
visitIntegerLiteral(IntegerLiteral node) => js.number(node.value);
|
||||
visitIntegerLiteral(IntegerLiteral node) {
|
||||
// The analyzer is using int.parse and, in the the VM's new
|
||||
// 64-bit mode, it's silently failing if the Literal is out of bounds.
|
||||
// If the value is null, fall back on the string representation. This
|
||||
// is also fudging the number, but consistent with the old behavior.
|
||||
// Ideally, this is a static error.
|
||||
// TODO(vsm): Remove this hack.
|
||||
if (node.value != null) {
|
||||
return js.number(node.value);
|
||||
}
|
||||
return new JS.LiteralNumber('${node.literal}');
|
||||
}
|
||||
|
||||
@override
|
||||
visitDoubleLiteral(DoubleLiteral node) => js.number(node.value);
|
||||
|
|
|
@ -351,12 +351,9 @@ compare_to2_test: RuntimeError # Issue 30170
|
|||
date_time10_test: RuntimeError # Issue 29921
|
||||
error_stack_trace_test/nullThrown: RuntimeError # .stackTrace not present for exception caught from 'throw null;'
|
||||
hash_set_test/01: RuntimeError # Issue 29921
|
||||
int_from_environment_test: RuntimeError # Issue 31763
|
||||
int_modulo_arith_test/none: RuntimeError # Issue 29921
|
||||
int_parse_radix_test/01: RuntimeError # Issue 29921
|
||||
int_parse_radix_test/02: RuntimeError # Issue 29921
|
||||
int_parse_radix_test/badTypes: RuntimeError # Issue 31763
|
||||
int_parse_radix_test/none: RuntimeError # Issue 31763
|
||||
int_parse_with_limited_ints_test: Skip # dartdevc doesn't know about --limit-ints-to-64-bits
|
||||
integer_arith_vm_test/modPow: RuntimeError # Issue 30170
|
||||
integer_parsed_arith_vm_test: RuntimeError # Issue 29921
|
||||
|
|
|
@ -11,7 +11,6 @@ accessor_conflict_import_prefixed2_test: CompileTimeError # Issue 25626
|
|||
accessor_conflict_import_prefixed_test: CompileTimeError # Issue 25626
|
||||
accessor_conflict_import_test: CompileTimeError # Issue 25626
|
||||
additional_interface_adds_optional_args_test: CompileTimeError # Issue #30568
|
||||
arithmetic_test: RuntimeError # Issue 31763
|
||||
assertion_initializer_const_error2_test/*: Crash # Issue #27809
|
||||
assertion_initializer_const_error2_test/cc10: Pass # Issue #31319
|
||||
assertion_initializer_const_error2_test/cc11: Pass # Issue #31319
|
||||
|
@ -59,7 +58,6 @@ instantiate_tearoff_of_call_test: RuntimeError
|
|||
interface_test/00: MissingCompileTimeError
|
||||
internal_library_test/01: MissingCompileTimeError # Issue 29920
|
||||
method_override_test: CompileTimeError # Negative test
|
||||
mint_compares_test: RuntimeError # Issue 31763
|
||||
mixin_super_2_test/01: MissingCompileTimeError
|
||||
mixin_super_2_test/03: MissingCompileTimeError
|
||||
mixin_supertype_subclass_test/02: MissingCompileTimeError
|
||||
|
|
Loading…
Reference in a new issue