ethanblake4 / dart_eval

Extensible Dart interpreter for Dart with full interop

Home Page:https://pub.dev/packages/dart_eval

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-Null assertion Operator not working

Noobware1 opened this issue · comments

This is the test case

String main() {
   final string = '[00:13.37] This is a chat message.';
   final regExp = RegExp(r'c\\w*');
   final match = regExp.firstMatch(string);
    return match![0]!;

Error

dart_eval runtime exception: Null check operator used on a null value
#0      $Object._equals (package:dart_eval/src/eval/shared/stdlib/core/object.dart:268:41)
#1      $Function.call (package:dart_eval/src/eval/runtime/function.dart:122:16)
#2      CheckEq.run (package:dart_eval/src/eval/runtime/ops/objects.dart:153:14)
at main()

RUNTIME STATE
=============
Program offset: 17
Stack sample: [L0: $"[00:13.37] This is a chat message.", L1: $"c\w*", L2: null, L3: Instance of '$RegExp', L4: Instance of '$RegExpMatch', L5: null, *L6: null, L7: null, L8: null, L9: null]
Args sample: []
Call stack: [0, -1]
TRACE:
11: InvokeExternal (Ex#57)
12: PushReturnValue ()
13: PushArg (L0)
14: InvokeDynamic (L3.C2)
15: PushReturnValue ()
16: PushNull ()
17: CheckEq (L4 == L5)  <<< EXCEPTION
18: PushReturnValue ()
19: LogicalNot (L6)
20: PushConstant (C3)

And I might be totally wrong here but is it because dart_eval is thinking it as a logical not operator rather than a null assertion? also if it's not to hard to fix could you tell me how to do so?