本文整理汇总了Java中com.intellij.lang.javascript.psi.JSNewExpression类的典型用法代码示例。如果您正苦于以下问题:Java JSNewExpression类的具体用法?Java JSNewExpression怎么用?Java JSNewExpression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JSNewExpression类属于com.intellij.lang.javascript.psi包,在下文中一共展示了JSNewExpression类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitJSNewExpression
import com.intellij.lang.javascript.psi.JSNewExpression; //导入依赖的package包/类
@Override public void visitJSNewExpression(JSNewExpression jsNewExpression) {
super.visitJSNewExpression(
jsNewExpression);
final JSExpression methodExpression;
try {
methodExpression = jsNewExpression.getMethodExpression();
} catch (Exception e) {
return; //catching an intelliJ CCE
}
if (!(methodExpression instanceof JSReferenceExpression)) {
return;
}
final JSReferenceExpression referenceExpression = (JSReferenceExpression) methodExpression;
final JSExpression qualifier = referenceExpression.getQualifier();
if (qualifier != null) {
return;
}
@NonNls final String methodName = referenceExpression.getReferencedName();
if (!"Function".equals(methodName)) {
return;
}
registerError(methodExpression);
}
示例2: invoke
import com.intellij.lang.javascript.psi.JSNewExpression; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, @NotNull PsiFile psiFile, @Nullable("is null when called from inspection") Editor editor, @NotNull PsiElement element, @NotNull PsiElement end) throws IncorrectOperationException {
PsiElement parent = element.getParent();
if (!(parent instanceof JSNewExpression)) return;
final JSExpressionCodeFragment useStrict = JSElementFactory.createExpressionCodeFragment(project, getNewExp(), parent);
PsiElement child = useStrict.getFirstChild();
parent.replace(child);
}
示例3: isLHSExpression
import com.intellij.lang.javascript.psi.JSNewExpression; //导入依赖的package包/类
public static boolean isLHSExpression(JSExpression expr)
{
if(expr instanceof JSDefinitionExpression)
{
expr = ((JSDefinitionExpression) expr).getExpression();
}
if(expr instanceof JSReferenceExpression)
{
return true;
}
if(expr instanceof JSParenthesizedExpression)
{
return isLHSExpression(((JSParenthesizedExpression) expr).getInnerExpression());
}
if(expr instanceof JSIndexedPropertyAccessExpression)
{
return true;
}
if(expr instanceof JSCallExpression)
{
return true;
}
if(expr instanceof JSNewExpression)
{
return true;
}
return false;
}
示例4: visitJSExpressionStatement
import com.intellij.lang.javascript.psi.JSNewExpression; //导入依赖的package包/类
@Override public void visitJSExpressionStatement(
@NotNull JSExpressionStatement statement) {
super.visitJSExpressionStatement(statement);
if (!(statement.getExpression()instanceof JSNewExpression)) {
return;
}
final JSNewExpression newExpression =
(JSNewExpression) statement.getExpression();
final JSExpression methodExpression =
newExpression.getMethodExpression();
if (methodExpression == null) {
return;
}
registerError(methodExpression);
}
示例5: newExpressionDefinitelyRecurses
import com.intellij.lang.javascript.psi.JSNewExpression; //导入依赖的package包/类
private static boolean newExpressionDefinitelyRecurses(JSNewExpression exp,
JSFunction method) {
final JSArgumentList argumentList = exp.getArgumentList();
if (argumentList != null) {
final JSExpression[] args = argumentList.getArguments();
for (final JSExpression arg : args) {
if (RecursionUtil.expressionDefinitelyRecurses(arg, method)) {
return true;
}
}
}
return false;
}
示例6: expressionDefinitelyRecurses
import com.intellij.lang.javascript.psi.JSNewExpression; //导入依赖的package包/类
private static boolean expressionDefinitelyRecurses(JSExpression exp,
JSFunction method) {
if (exp == null) {
return false;
}
if (exp instanceof JSNewExpression) {
return RecursionUtil.newExpressionDefinitelyRecurses(
(JSNewExpression) exp, method);
}
if (exp instanceof JSCallExpression) {
return RecursionUtil.callExpressionDefinitelyRecurses(
(JSCallExpression) exp, method);
}
if (exp instanceof JSAssignmentExpression) {
return RecursionUtil.assignmentExpressionDefinitelyRecurses(
(JSAssignmentExpression) exp, method);
}
if (exp instanceof JSArrayLiteralExpression) {
return RecursionUtil.arrayLiteralExpressionDefinitelyRecurses(
(JSArrayLiteralExpression) exp, method);
}
if (exp instanceof JSIndexedPropertyAccessExpression) {
return RecursionUtil.indexedPropertyAccessExpressionDefinitelyRecurses(
(JSIndexedPropertyAccessExpression) exp, method);
}
if (exp instanceof JSPrefixExpression) {
return RecursionUtil.prefixExpressionDefinitelyRecurses(
(JSPrefixExpression) exp, method);
}
if (exp instanceof JSPostfixExpression) {
return RecursionUtil.postfixExpressionDefinitelyRecurses(
(JSPostfixExpression) exp, method);
}
if (exp instanceof JSBinaryExpression) {
return RecursionUtil.binaryExpressionDefinitelyRecurses(
(JSBinaryExpression) exp, method);
}
if (exp instanceof JSConditionalExpression) {
return RecursionUtil.conditionalExpressionDefinitelyRecurses(
(JSConditionalExpression) exp, method);
}
if (exp instanceof JSParenthesizedExpression) {
return RecursionUtil.parenthesizedExpressionDefinitelyRecurses(
(JSParenthesizedExpression) exp, method);
}
if (exp instanceof JSReferenceExpression) {
return RecursionUtil.referenceExpressionDefinitelyRecurses(
(JSReferenceExpression) exp, method);
}
if (exp instanceof JSLiteralExpression ||
exp instanceof JSThisExpression) {
return false;
}
return false;
}