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

CompileError: Unknown statement type FunctionDeclarationStatementImpl at unknown (file package:default/main.dart) #183

Open
HXiaoMing opened this issue Feb 23, 2024 · 0 comments

Comments

@HXiaoMing
Copy link

test case:

import 'package:dart_eval/dart_eval.dart';
import 'package:test/test.dart';

void main() {

  group('local function test', () {

    test('local function function', () {
      final program = '''
            int main() {
              int value = 1;
              
              void changeValue() {
                value = 2;
              }
              
              changeValue();
              
              return value;
            }
      ''';

      final result = eval(program, function: 'main');
      print('result $result');
    });
  });
}

Error:
package:dart_eval/src/eval/compiler/statement/statement.dart 45:5 compileStatement
package:dart_eval/src/eval/compiler/statement/block.dart 17: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 492:11 Compiler.compileSources..
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 481:15 Compiler.compileSources.
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 477: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/local_function_test.dart 23:22 main..

CompileError: Unknown statement type FunctionDeclarationStatementImpl at unknown (file package:default/main.dart)

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

1 participant