Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart_eval runtime exception: EvalUnknownPropertyException (==) #177

Closed
HXiaoMing opened this issue Feb 19, 2024 · 2 comments
Closed

dart_eval runtime exception: EvalUnknownPropertyException (==) #177

HXiaoMing opened this issue Feb 19, 2024 · 2 comments

Comments

@HXiaoMing
Copy link

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 (==)
#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)

@ethanblake4
Copy link
Owner

This might be fixed in v0.7.5, please test again

@ethanblake4
Copy link
Owner

Fixed in v0.7.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants