Deprecated CastExpressionResolver as ExpressionResolver API already has all this built in

This commit is contained in:
bigguy345 committed 2025-12-29 17:05:24 +02:00
1 parent c46d61b221
commit c9e50f2cde
2 files changed
+7 -8

No files matched your search

@@ -2272,13 +2272,9 @@ public class ScriptDocument {
}
// Check if expression contains operators - if so, use the full expression resolver
if (containsOperators(expr)) {
return resolveExpressionWithOperators(expr, position);
}
// Handle cast expressions: (Type)expr, ((Type)expr).method(), etc.
if (expr.startsWith("(")) {
return resolveCastOrParenthesizedExpression(expr, position);
if (containsOperators(expr) || expr.startsWith("(")) {
return resolveExpressionWithParserAPI(expr, position);
}
// Invalid expressions starting with brackets
@@ -2802,10 +2798,10 @@ public class ScriptDocument {
}
/**
* Resolve an expression that contains operators using the full expression parser.
* Resolve an expression that contains operators or casts using the full expression parser.
* This handles all Java operators with proper precedence and type promotion rules.
*/
private TypeInfo resolveExpressionWithOperators(String expr, int position) {
private TypeInfo resolveExpressionWithParserAPI(String expr, int position) {
// Create a context that bridges to ScriptDocument's existing resolution methods
ExpressionNode.TypeResolverContext context = createExpressionResolverContext(position);
@@ -11,7 +11,10 @@ import java.util.function.Function;
* - Nested casts: ((Type) expr)
* - Cast chains: ((Type) expr).method()
* - Parenthesized expressions: (expr)
*
* @Deprecated ExpressionTypeResolver API has all this built in.
*/
@Deprecated
public class CastExpressionResolver {
/**