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