fix: 部分代码嵌套模式数不正确的问题
This commit is contained in:
parent
43fd1d175d
commit
237c35f0a0
@ -66,12 +66,12 @@ public class StatementBuilder {
|
||||
buildIf(ifNode);
|
||||
return;
|
||||
}
|
||||
if (stmt instanceof ExpressionStatementNode(ExpressionNode exp)) {
|
||||
if (stmt instanceof ExpressionStatementNode(ExpressionNode exp, _, _, _)) {
|
||||
// 纯表达式语句,如 foo();
|
||||
expr.build(exp);
|
||||
return;
|
||||
}
|
||||
if (stmt instanceof AssignmentNode(String var, ExpressionNode rhs)) {
|
||||
if (stmt instanceof AssignmentNode(String var, ExpressionNode rhs, _, _, _)) {
|
||||
// 赋值语句,如 a = b + 1;
|
||||
|
||||
final String type = ctx.getScope().lookupType(var);
|
||||
@ -208,7 +208,10 @@ public class StatementBuilder {
|
||||
if (cond instanceof BinaryExpressionNode(
|
||||
ExpressionNode left,
|
||||
String operator,
|
||||
ExpressionNode right
|
||||
ExpressionNode right,
|
||||
_,
|
||||
_,
|
||||
_
|
||||
)
|
||||
&& ComparisonUtils.isComparisonOperator(operator)) {
|
||||
|
||||
|
||||
@ -51,8 +51,8 @@ public class CallExpressionAnalyzer implements ExpressionAnalyzer<CallExpression
|
||||
ExpressionNode callee = call.callee();
|
||||
|
||||
// 支持模块调用形式:ModuleName.FunctionName(...)
|
||||
if (callee instanceof MemberExpressionNode(var obj, String member)
|
||||
&& obj instanceof IdentifierNode(String mod)) {
|
||||
if (callee instanceof MemberExpressionNode(var obj, String member, _, _, _)
|
||||
&& obj instanceof IdentifierNode(String mod, _, _, _)) {
|
||||
// 验证模块是否存在并已导入
|
||||
if (!ctx.getModules().containsKey(mod)
|
||||
|| (!mi.getImports().contains(mod) && !mi.getName().equals(mod))) {
|
||||
@ -65,7 +65,7 @@ public class CallExpressionAnalyzer implements ExpressionAnalyzer<CallExpression
|
||||
functionName = member;
|
||||
|
||||
// 简单函数名形式:func(...)
|
||||
} else if (callee instanceof IdentifierNode(String name)) {
|
||||
} else if (callee instanceof IdentifierNode(String name, _, _, _)) {
|
||||
functionName = name;
|
||||
|
||||
// 不支持的 callee 形式
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user