style:修改为 记录模式

This commit is contained in:
Luke 2025-06-25 14:22:18 +08:00
parent dbf510f4ed
commit dff64e7dbb

View File

@ -13,9 +13,12 @@ import java.util.Map;
* 正确的 IR 比较指令保证 int/long 均能正常运行
*/
public final class ComparisonUtils {
private ComparisonUtils() {}
private ComparisonUtils() {
}
/** 判断给定操作符是否为比较运算符 */
/**
* 判断给定操作符是否为比较运算符
*/
public static boolean isComparisonOperator(String op) {
// 两张表 key 完全一致只需检查一张
return IROpCodeMappings.CMP_I32.containsKey(op);
@ -38,9 +41,8 @@ public final class ComparisonUtils {
/* ------------ 内部工具 ------------ */
private static boolean isLongLiteral(ExpressionNode node) {
if (node instanceof NumberLiteralNode n) {
String v = n.value();
return v.endsWith("L") || v.endsWith("l");
if (node instanceof NumberLiteralNode(String value)) {
return value.endsWith("L") || value.endsWith("l");
}
return false; // 变量暂不处理后续可扩展符号表查询
}