Closed HXiaoMing closed 8 months ago
test case:
import 'package:dart_eval/dart_eval.dart'; import 'package:test/scaffolding.dart'; void main() { test('nullable static value', () { final program = ''' class TestA { static int? value; } int? main() { TestA.value = 22; return TestA.value; } '''; final result = eval(program, function: 'main'); print('result $result'); }); }
Error: package:dart_eval/src/eval/compiler/reference.dart 101:79 IdentifierReference.setValue package:dart_eval/src/eval/compiler/expression/assignment.dart 18:14 compileAssignmentExpression package:dart_eval/src/eval/compiler/expression/expression.dart 34:12 compileExpression package:dart_eval/src/eval/compiler/expression/expression.dart 106:12 compileExpressionAndDiscardResult package:dart_eval/src/eval/compiler/statement/statement.dart 26:15 compileStatement package:dart_eval/src/eval/compiler/statement/block.dart 19:20 compileBlock package:dart_eval/src/eval/compiler/declaration/function.dart 84:14 compileFunctionDeclaration package:dart_eval/src/eval/compiler/declaration/declaration.dart 24:5 compileDeclaration package:dart_eval/src/eval/compiler/compiler.dart 493:11 Compiler.compileSources.. dart:collection _LinkedHashMapMixin.forEach package:dart_eval/src/eval/compiler/compiler.dart 482:15 Compiler.compileSources. dart:collection _LinkedHashMapMixin.forEach package:dart_eval/src/eval/compiler/compiler.dart 478:32 Compiler.compileSources package:dart_eval/src/eval/compiler/compiler.dart 164:12 Compiler.compile package:dart_eval/src/eval/eval.dart 40:28 eval test/custom/change_static_value.dart 18:20 main.
Null check operator used on a null value
Fixed in v0.7.9
test case:
Error: package:dart_eval/src/eval/compiler/reference.dart 101:79 IdentifierReference.setValue package:dart_eval/src/eval/compiler/expression/assignment.dart 18:14 compileAssignmentExpression package:dart_eval/src/eval/compiler/expression/expression.dart 34:12 compileExpression package:dart_eval/src/eval/compiler/expression/expression.dart 106:12 compileExpressionAndDiscardResult package:dart_eval/src/eval/compiler/statement/statement.dart 26:15 compileStatement package:dart_eval/src/eval/compiler/statement/block.dart 19:20 compileBlock package:dart_eval/src/eval/compiler/declaration/function.dart 84:14 compileFunctionDeclaration package:dart_eval/src/eval/compiler/declaration/declaration.dart 24:5 compileDeclaration package:dart_eval/src/eval/compiler/compiler.dart 493:11 Compiler.compileSources..
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 482:15 Compiler.compileSources.
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 478:32 Compiler.compileSources
package:dart_eval/src/eval/compiler/compiler.dart 164:12 Compiler.compile
package:dart_eval/src/eval/eval.dart 40:28 eval
test/custom/change_static_value.dart 18:20 main.
Null check operator used on a null value