Closed HXiaoMing closed 8 months ago
Test case:
import 'package:dart_eval/dart_eval.dart'; import 'package:dart_eval/dart_eval_bridge.dart'; import 'package:test/test.dart'; void main() { group('static tests', () { test('static instance test', () { final program = ''' class TestClass { static TestClass instance = TestClass(); Function? _callback; void init(Function callback) { _callback = callback; } void runFunction() { _callback!('Hello'); } } void main(Function callback) { TestClass.instance.init(callback); TestClass.instance.runFunction(callback); } '''; eval(program, function: 'main', args: [ $Closure((runtime, target, args) { print(args[0]!.$value + '!'); return null; }) ]); }); }); }
Error: package:dart_eval/src/eval/runtime/runtime.dart 832: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/set_value_test.dart 34:7 main..
dart_eval runtime exception: EvalUnknownPropertyException (==)
at TestClass.runFunction() at main()
Program offset: 23 Stack sample: [L0: Instance of '$InstanceImpl', L1: Instance of '$Closure', L2: null, *L3: null, L4: null, L5: null, L6: null, L7: null, L8: null, L9: null] Args sample: [] Call stack: [0, -1, 58] TRACE: 17: Pop (1) 18: Return (L-1) 19: PushScope (F7:245, 'TestClass.runFunction()') 20: PushObjectProperty (L0.C0) 21: PushReturnValue () 22: PushNull () 23: CheckEq (L1 == L2) <<< EXCEPTION 24: PushReturnValue () 25: LogicalNot (L3) 26: PushConstant (C1)
This might be fixed in v0.7.5, please test again
Fixed in v0.7.9
Test case:
Error: package:dart_eval/src/eval/runtime/runtime.dart 832: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/set_value_test.dart 34:7 main..
dart_eval runtime exception: EvalUnknownPropertyException (==)
0 EvalFunction.$getProperty (package:dart_eval/src/eval/runtime/function.dart:29:9)
1 CheckEq.run (package:dart_eval/src/eval/runtime/ops/objects.dart:151:27)
2 Runtime.execute (package:dart_eval/src/eval/runtime/runtime.dart:823:12)
at TestClass.runFunction() at main()
RUNTIME STATE
Program offset: 23 Stack sample: [L0: Instance of '$InstanceImpl', L1: Instance of '$Closure', L2: null, *L3: null, L4: null, L5: null, L6: null, L7: null, L8: null, L9: null] Args sample: [] Call stack: [0, -1, 58] TRACE: 17: Pop (1) 18: Return (L-1) 19: PushScope (F7:245, 'TestClass.runFunction()') 20: PushObjectProperty (L0.C0) 21: PushReturnValue () 22: PushNull () 23: CheckEq (L1 == L2) <<< EXCEPTION 24: PushReturnValue () 25: LogicalNot (L3) 26: PushConstant (C1)