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

递归调用报错 #568

Closed
magnww opened this issue Sep 6, 2023 · 1 comment
Closed

递归调用报错 #568

magnww opened this issue Sep 6, 2023 · 1 comment

Comments

@magnww
Copy link

magnww commented Sep 6, 2023

版本:5.3.3
测试代码

    @Test
    public void testRecursion() {
        String script = """
                fn post_order(nodes) {
                    for node in nodes {
                        if (node.children != nil && !is_empty(node.children)) {
                            post_order(node.children);
                        }
                        p(node.value);
                    }
                }
                                
                let tree = seq.list(seq.map(
                    "value", 1,
                    "children", seq.list(seq.map(
                        "value", 2,
                        "children", seq.list(seq.map(
                            "value", 3))), seq.map(
                        "value", 4))));
                post_order(tree);
                """;
        AviatorEvaluator.execute(script);
    }

错误信息

3
2
4

java.lang.AssertionError
	at com.googlecode.aviator.runtime.function.LambdaFunction.newEnv(LambdaFunction.java:248)
	at com.googlecode.aviator.runtime.function.LambdaFunction.call(LambdaFunction.java:115)
	at com.googlecode.aviator.runtime.function.internal.ReducerFunction.reduce(ReducerFunction.java:137)
	at com.googlecode.aviator.runtime.function.internal.ReducerFunction.call(ReducerFunction.java:44)
	at Script_1693997427913_59.execute0(Script_1693997427913_59:8)
	at com.googlecode.aviator.ClassExpression.executeDirectly(ClassExpression.java:44)
	at com.googlecode.aviator.runtime.function.LambdaFunction.call(LambdaFunction.java:129)
	at com.googlecode.aviator.runtime.RuntimeFunctionDelegator.call(RuntimeFunctionDelegator.java:63)
	at Script_1693997427913_61.execute0(Script_1693997427913_61:4)
	at com.googlecode.aviator.ClassExpression.executeDirectly(ClassExpression.java:44)
	at com.googlecode.aviator.runtime.function.LambdaFunction.call(LambdaFunction.java:115)
	at Script_1693997427913_60.execute0(Script_1693997427913_60:5)
	at com.googlecode.aviator.ClassExpression.executeDirectly(ClassExpression.java:44)
	at com.googlecode.aviator.runtime.function.LambdaFunction.call(LambdaFunction.java:129)
	at com.googlecode.aviator.runtime.function.internal.ReducerFunction.reduce(ReducerFunction.java:65)
	at com.googlecode.aviator.runtime.function.internal.ReducerFunction.call(ReducerFunction.java:44)
	at Script_1693997427913_59.execute0(Script_1693997427913_59:8)
	at com.googlecode.aviator.ClassExpression.executeDirectly(ClassExpression.java:44)
	at com.googlecode.aviator.runtime.function.LambdaFunction.call(LambdaFunction.java:129)
	at com.googlecode.aviator.runtime.RuntimeFunctionDelegator.call(RuntimeFunctionDelegator.java:63)
	at Script_1693997427913_58.execute0(Script_1693997427913_58:17)
	at com.googlecode.aviator.ClassExpression.executeDirectly(ClassExpression.java:44)
	at com.googlecode.aviator.BaseExpression.execute(BaseExpression.java:246)
	at com.googlecode.aviator.AviatorEvaluatorInstance.execute(AviatorEvaluatorInstance.java:1670)
	at com.googlecode.aviator.AviatorEvaluatorInstance.execute(AviatorEvaluatorInstance.java:1685)
	at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:544)
	at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:565)

目前是不支持递归吗?

killme2008 added a commit that referenced this issue Oct 4, 2023
@killme2008
Copy link
Owner

jiudc pushed a commit to jiudc/aviatorscript that referenced this issue Feb 24, 2024
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

2 participants