use of com.intellij.lang.javascript.psi.ecmal4.JSSuperExpression in project intellij-plugins by JetBrains.
the class ActionScriptFunctionSignatureChecker method checkConstructorCall.
@Override
public void checkConstructorCall(@NotNull JSCallExpression node, @NotNull JSClass target) {
if (node instanceof JSNewExpression || node.getMethodExpression() instanceof JSSuperExpression) {
final JSArgumentList argumentList = node.getArgumentList();
final JSExpression[] expressions = argumentList != null ? argumentList.getArguments() : JSExpression.EMPTY_ARRAY;
if (expressions.length > 0) {
final ActionScriptCreateConstructorFix fix = ActionScriptCreateConstructorFix.createIfApplicable(node);
registerProblem(node, JSBundle.message("javascript.invalid.number.of.parameters", "0"), fix != null ? new LocalQuickFix[] { fix } : LocalQuickFix.EMPTY_ARRAY);
}
} else {
reportProblemIfNotExpectedCountOfParameters(node, 1, "one");
}
}
use of com.intellij.lang.javascript.psi.ecmal4.JSSuperExpression in project intellij-plugins by JetBrains.
the class ActionScriptCreateConstructorFix method createIfApplicable.
@Nullable
public static ActionScriptCreateConstructorFix createIfApplicable(final JSCallExpression node) {
final JSClass clazz;
final JSReferenceExpression reference;
if (node instanceof JSNewExpression) {
JSExpression methodExpression = node.getMethodExpression();
if (!(methodExpression instanceof JSReferenceExpression)) {
return null;
}
PsiElement resolved = ((JSReferenceExpression) methodExpression).resolve();
if (!(resolved instanceof JSClass) || resolved instanceof XmlBackedJSClass || ((JSClass) resolved).isInterface()) {
return null;
}
clazz = (JSClass) resolved;
reference = (JSReferenceExpression) methodExpression;
} else {
JSExpression methodExpression = node.getMethodExpression();
if (!(methodExpression instanceof JSSuperExpression)) {
return null;
}
JSClass containingClass = JSResolveUtil.getClassOfContext(node);
if (containingClass == null) {
return null;
}
clazz = containingClass.getSuperClasses()[0];
if (clazz.isInterface()) {
return null;
}
reference = (JSReferenceExpression) clazz.findNameIdentifier().getPsi();
}
return new ActionScriptCreateConstructorFix(clazz, reference, node);
}
Aggregations