Open HXiaoMing opened 8 months ago
test case:
import 'package:dart_eval/dart_eval.dart'; import 'package:test/test.dart'; void main() { group('tests', () { late Compiler compiler; setUp(() { compiler = Compiler(); }); test('simple test', () { final program = compiler.compile({ 'example': { 'main.dart': ''' const int bbb = aaa; const int aaa = 111; int main() { return bbb; } ''' } }); final runtime = Runtime.ofProgram(program); final result = runtime.executeLib('package:example/main.dart', 'main'); print('result $result'); }); }); }
Error: package:dart_eval/src/eval/compiler/reference.dart 601:78 _declarationToVariable package:dart_eval/src/eval/compiler/reference.dart 354:12 IdentifierReference.getValue package:dart_eval/src/eval/compiler/expression/identifier.dart 13:48 compileIdentifier package:dart_eval/src/eval/compiler/expression/expression.dart 36:12 compileExpression package:dart_eval/src/eval/compiler/declaration/variable.dart 17:13 compileTopLevelVariableDeclaration package:dart_eval/src/eval/compiler/declaration/declaration.dart 32:5 compileDeclaration package:dart_eval/src/eval/compiler/compiler.dart 452:13 Compiler.compileSources.. dart:collection _LinkedHashMapMixin.forEach package:dart_eval/src/eval/compiler/compiler.dart 444:15 Compiler.compileSources. dart:collection _LinkedHashMapMixin.forEach package:dart_eval/src/eval/compiler/compiler.dart 443:32 Compiler.compileSources package:dart_eval/src/eval/compiler/compiler.dart 163:12 Compiler.compile test/static_simple.dart 13:32 main..
Null check operator used on a null value
test case:
Error: package:dart_eval/src/eval/compiler/reference.dart 601:78 _declarationToVariable package:dart_eval/src/eval/compiler/reference.dart 354:12 IdentifierReference.getValue package:dart_eval/src/eval/compiler/expression/identifier.dart 13:48 compileIdentifier package:dart_eval/src/eval/compiler/expression/expression.dart 36:12 compileExpression package:dart_eval/src/eval/compiler/declaration/variable.dart 17:13 compileTopLevelVariableDeclaration package:dart_eval/src/eval/compiler/declaration/declaration.dart 32:5 compileDeclaration package:dart_eval/src/eval/compiler/compiler.dart 452:13 Compiler.compileSources..
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 444:15 Compiler.compileSources.
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 443:32 Compiler.compileSources
package:dart_eval/src/eval/compiler/compiler.dart 163:12 Compiler.compile
test/static_simple.dart 13:32 main..
Null check operator used on a null value