dart_eval
dart_eval copied to clipboard
Null check operator used on a null value
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.
Null check operator used on a null value