mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
Fixed method calls of JS type constructors throwing errors, made it dynamic
This commit is contained in:
1 parent
dc3e25bcba
commit
e3fc9e8e4a
2 files changed
+13
-7
No files matched your search
@@ -243,6 +243,9 @@ public class TokenHoverInfo {
|
||||
if (callInfo.hasStaticAccessError()) {
|
||||
errors.add(callInfo.getErrorMessage());
|
||||
}
|
||||
if (callInfo.getErrorType() == MethodCallInfo.ErrorType.UNRESOLVED_METHOD) {
|
||||
errors.add(callInfo.getErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Show field access errors
|
||||
|
||||
+10
-7
@@ -331,13 +331,16 @@ public class MethodCallInfo {
|
||||
public void validate() {
|
||||
if (isConstructor) {
|
||||
if (resolvedMethod == null) {
|
||||
// For constructors, check if the type has any constructors at all
|
||||
if (receiverType != null && receiverType.hasConstructors()) {
|
||||
setError(ErrorType.WRONG_ARG_COUNT,
|
||||
"No constructor in '" + receiverType.getSimpleName() + "' matches " + arguments.size() + " argument(s)");
|
||||
} else {
|
||||
setError(ErrorType.UNRESOLVED_METHOD,
|
||||
"Cannot resolve constructor for '" + methodName + "'");
|
||||
// Don't report missing JS constructors as unresolved method error, since they may be created dynamically at runtime
|
||||
boolean isJSType = receiverType != null && receiverType.isJSType();
|
||||
if (!isJSType) {
|
||||
if (receiverType != null && receiverType.hasConstructors()) {
|
||||
setError(ErrorType.WRONG_ARG_COUNT,
|
||||
"No constructor in '" + receiverType.getSimpleName() + "' matches " + arguments.size() + " argument(s)");
|
||||
} else {
|
||||
setError(ErrorType.UNRESOLVED_METHOD,
|
||||
"Cannot resolve constructor for '" + methodName + "'");
|
||||
}
|
||||
}
|
||||
} else if (receiverType != null) {
|
||||
List<FieldInfo> cParams = resolvedMethod.getParameters();
|
||||
|
||||
Reference in new issue
Block a user