dart_eval runtime exception: RangeError (index): Invalid value: Not in inclusive range
HXiaoMing opened this issue · 1 comments
test case:
import 'package:dart_eval/dart_eval.dart';
import 'package:test/scaffolding.dart';
void main() {
group('change static value test', () {
test('change static value', () {
final program = '''
class TestA {
static int value = 11;
}
int main() {
TestA.value = 22;
return TestA.value;
}
''';
final result = eval(program, function: 'main');
print('result $result');
});
});
}
Error:
package:dart_eval/src/eval/runtime/runtime.dart 833:7 Runtime.execute
package:dart_eval/src/eval/runtime/runtime.dart 810:12 Runtime.executeLib
package:dart_eval/src/eval/eval.dart 58:26 eval
test/custom/change_static_value.dart 19:22 main..
dart_eval runtime exception: RangeError (index): Invalid value: Not in inclusive range 0..254: -1
#0 _Array.[] (dart:core-patch/array.dart:10:36)
#1 SetObjectProperty.run (package:dart_eval/src/eval/runtime/ops/objects.dart:228:33)
#2 Runtime.execute (package:dart_eval/src/eval/runtime/runtime.dart:824:12)
at main()
RUNTIME STATE
Program offset: 11
Stack sample: [L0: $22, *L1: null, L2: null, L3: null, L4: null, L5: null, L6: null, L7: null, L8: null, L9: null]
Args sample: []
Call stack: [0, -1]
TRACE:
5: PushNull ()
6: CreateClass (F7:"TestA", super L0, vLen=0))
7: Return (L1)
8: PushScope (F7:109, 'main()')
9: PushConstantInt (22)
10: BoxInt (L0)
11: SetObjectProperty (L-1.value = L0) <<< EXCEPTION
12: LoadGlobal (G0)
13: PushReturnValue ()
Fixed in v0.7.6