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

嵌套lambda参数的bug #134

Closed
hug3id opened this issue May 23, 2019 · 4 comments
Closed

嵌套lambda参数的bug #134

hug3id opened this issue May 23, 2019 · 4 comments
Labels

Comments

@hug3id
Copy link

hug3id commented May 23, 2019

版本:4.1.2

Map<String, Object> env = new HashMap<>(2);
env.put("v", 3);
AviatorEvaluator.execute("func=lambda(v)->v+2 end;func2=lambda(v)->func(v) end;print(func(1));print(func2(1))", env);
结果输出:35

执行代码如下:
func=lambda(v)->v+2 end;
func2=lambda(v)->func(v) end;
print(func(1)); // 输出 3,正确
print(func2(1)) // 输出 5,错误,应该是3

跟踪输出如下:
[Aviator TRACE] Func : func(<Long, 1>)
[Aviator TRACE] <JavaType, 1, Long> + <Long, 2> => <Long, 3>
[Aviator TRACE] Result : 3
[Aviator TRACE] Func : print(<JavaType, 3, Long>)
[Aviator TRACE] Func : func2(<Long, 1>)
[Aviator TRACE] Func : func(<JavaType, 1, Long>)
[Aviator TRACE] <JavaType, 3, Integer> + <Long, 2> => <Long, 5>
[Aviator TRACE] Result : 5
[Aviator TRACE] Result : 5
[Aviator TRACE] Func : print(<JavaType, 5, Long>)
[Aviator TRACE] Result : null

@killme2008
Copy link
Owner

恩,这是个 bug,还是命名捕获上的问题,跟嵌套没有关系,我尽快修复下。

@killme2008 killme2008 added the bug label May 23, 2019
@hug3id hug3id changed the title 嵌套lambda捕获参数的bug 嵌套lambda参数的bug May 23, 2019
killme2008 added a commit that referenced this issue May 23, 2019
@killme2008
Copy link
Owner

已经在 #127 修复,着急可以先自己打包一个。我争取周末发下。

@hug3id
Copy link
Author

hug3id commented May 23, 2019

@killme2008 十分感谢!

@killme2008
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants