Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
36,000
boolean () { return !getText().startsWith("\"\"\""); }
isPlainString
36,001
GrStringInjection[] () { return findChildrenByClass(GrStringInjection.class); }
getInjections
36,002
String[] () { List<PsiElement> parts = findChildrenByType(GroovyElementTypes.GSTRING_CONTENT); String[] result = new String[parts.size()]; int i = 0; for (PsiElement part : parts) { result[i++] = part.getText(); } return result; }
getTextParts
36,003
GrStringContent[] () { final List<PsiElement> parts = findChildrenByType(GroovyElementTypes.GSTRING_CONTENT); return parts.toArray(new GrStringContent[0]); }
getContents
36,004
GroovyPsiElement[] () { final List<PsiElement> result = findChildrenByType(TokenSets.GSTRING_CONTENT_PARTS); return result.toArray(GroovyPsiElement.EMPTY_ARRAY); }
getAllContentParts
36,005
void (@NotNull GroovyElementVisitor visitor) { visitor.visitGStringExpression(this); }
accept
36,006
Object () { if (findChildByClass(GrStringInjection.class) != null) return null; final PsiElement fchild = getFirstChild(); if (fchild == null) return null; final PsiElement content = fchild.getNextSibling(); if (content == null || content.getNode().getElementType() != GroovyElementTypes.GSTRING_CONTENT) return null; final String text = content.getText(); StringBuilder chars = new StringBuilder(text.length()); boolean result = GrStringUtil.parseStringCharacters(text, chars, null); return result ? chars.toString() : null; }
getValue
36,007
boolean () { return false; }
isValidHost
36,008
GrStringImpl (@NotNull String text) { return this; }
updateText
36,009
boolean (@NotNull TextRange rangeInsideHost, @NotNull StringBuilder outChars) { String subText = rangeInsideHost.substring(myHost.getText()); outSourceOffsets = new int[subText.length() + 1]; final IElementType elementType = myHost.getFirstChild().getNode().getElementType(); if (GroovyTokenSets.STRING_LITERALS.contains(elementType) || elementType == GroovyTokenTypes.mGSTRING_CONTENT) { return GrStringUtil.parseStringCharacters(subText, outChars, outSourceOffsets); } else if (elementType == GroovyTokenTypes.mREGEX_LITERAL || elementType == GroovyTokenTypes.mREGEX_CONTENT) { return GrStringUtil.parseRegexCharacters(subText, outChars, outSourceOffsets, true); } else if (elementType == GroovyTokenTypes.mDOLLAR_SLASH_REGEX_LITERAL || elementType == GroovyTokenTypes.mDOLLAR_SLASH_REGEX_CONTENT) { return GrStringUtil.parseRegexCharacters(subText, outChars, outSourceOffsets, false); } else return false; }
decode
36,010
int (int offsetInDecoded, @NotNull final TextRange rangeInsideHost) { int result = offsetInDecoded < outSourceOffsets.length ? outSourceOffsets[offsetInDecoded] : -1; if (result == -1) return -1; return Math.min(result, rangeInsideHost.getLength()) + rangeInsideHost.getStartOffset(); }
getOffsetInHost
36,011
boolean () { final Object value = myHost.getValue(); return value instanceof String && ((String)value).indexOf('\n') < 0; }
isOneLine
36,012
String () { return "Relational expression"; }
toString
36,013
void (@NotNull GroovyElementVisitor visitor) { visitor.visitInstanceofExpression(this); }
accept
36,014
String () { return "Instanceof expression"; }
toString
36,015
PsiType () { return getTypeByFQName(CommonClassNames.JAVA_LANG_BOOLEAN); }
getType
36,016
GrTypeElement () { return findChildByClass(GrTypeElement.class); }
getTypeElement
36,017
PsiElement () { return findNotNullChildByType(INSTANCEOF_TOKENS); }
getOperationToken
36,018
GrExpression () { return findNotNullChildByClass(GrExpression.class); }
getOperand
36,019
GroovyReference () { return myReference; }
getReference
36,020
void (@NotNull GroovyElementVisitor visitor) { visitor.visitSafeCastExpression(this); }
accept
36,021
String () { return "Safe cast expression"; }
toString
36,022
GrTypeElement () { return findChildByClass(GrTypeElement.class); }
getCastTypeElement
36,023
GrExpression () { return findNotNullChildByClass(GrExpression.class); }
getOperand
36,024
PsiElement () { return findNotNullChildByType(GroovyTokenTypes.kAS); }
getOperationToken
36,025
void (@NotNull GroovyElementVisitor visitor) { visitor.visitCastExpression(this); }
accept
36,026
String () { return "Typecast expression"; }
toString
36,027
PsiType () { final GrTypeElement typeElement = getCastTypeElement(); return typeElement != null ? TypesUtil.boxPrimitiveType(typeElement.getType(), getManager(), getResolveScope()) : null; }
getType
36,028
GrTypeElement () { return findChildByClass(GrTypeElement.class); }
getCastTypeElement
36,029
GrExpression () { return findExpressionChild(this); }
getOperand
36,030
PsiElement () { ASTNode paren = getNode().findChildByType(GroovyTokenTypes.mLPAREN); assert paren != null; return paren.getPsi(); }
getLeftParen
36,031
PsiElement () { ASTNode paren = getNode().findChildByType(GroovyTokenTypes.mRPAREN); assert paren != null; return paren.getPsi(); }
getRightParen
36,032
void (@NotNull GroovyElementVisitor visitor) { visitor.visitBuiltinTypeClassExpression(this); }
accept
36,033
String () { return "builtin type class expression"; }
toString
36,034
PsiPrimitiveType () { return TypesUtil.getPrimitiveTypeByText(getText()); }
getPrimitiveType
36,035
String () { return "Bitwise expression"; }
toString
36,036
String () { return "Additive expression"; }
toString
36,037
GroovyMethodCallReference () { return myReference; }
getReference
36,038
String () { return "Unary expression"; }
toString
36,039
PsiType () { final GroovyCallReference reference = getReference(); final GroovyResolveResult result = reference.advancedResolve(); final PsiType operatorType = getTypeFromResult(result, reference.getArguments(), this); if (operatorType != null) { return operatorType; } final GrExpression operand = getOperand(); if (operand == null) { return null; } final PsiType operandType = operand.getType(); if (TypesUtil.isNumericType(operandType)) { return operandType; } return null; }
getOperationType
36,040
IElementType () { PsiElement opElement = getOperationToken(); ASTNode node = opElement.getNode(); assert node != null; return node.getElementType(); }
getOperationTokenType
36,041
PsiElement () { PsiElement opElement = findChildByType(TokenSets.UNARY_OP_SET); assert opElement != null; return opElement; }
getOperationToken
36,042
GrExpression () { return findExpressionChild(this); }
getOperand
36,043
void (@NotNull GroovyElementVisitor visitor) { visitor.visitUnaryExpression(this); }
accept
36,044
boolean () { return getFirstChild() instanceof GrExpression; }
isPostfix
36,045
String () { return "Multiplicative expression"; }
toString
36,046
String () { return "Power expression"; }
toString
36,047
String () { return "Shift expression"; }
toString
36,048
String () { return "RegexFindExpression"; }
toString
36,049
String () { return "Logical expression"; }
toString
36,050
PsiType (GrOperatorExpression e) { final GroovyCallReference operatorReference = Objects.requireNonNull(e.getReference()); final GroovyResolveResult resolveResult = operatorReference.advancedResolve(); return getTypeByResult(e.getLeftType(), e.getRightType(), operatorReference.getArguments(), resolveResult, e); }
fun
36,051
PsiType (PsiType leftType, PsiType rightType, List<Argument> arguments, GroovyResolveResult resolveResult, GrExpression context) { if (resolveResult.isApplicable() && !PsiUtil.isDGMMethod(resolveResult.getElement())) { return getTypeFromResult(resolveResult, arguments, context); } if (TypesUtil.isNumericType(leftType) && TypesUtil.isNumericType(rightType)) { return inferNumericType(leftType, rightType, context); } return getTypeFromResult(resolveResult, arguments, context); }
getTypeByResult
36,052
PsiType (@NotNull PsiType ltype, @NotNull PsiType rtype, PsiElement e) { return GrBinaryExpressionUtil.getDefaultNumericResultType(ltype, rtype, e); }
inferNumericType
36,053
PsiType (GrOperatorExpression expression) { return GrBinaryExpressionUtil.getTypeByFQName(CommonClassNames.JAVA_LANG_BOOLEAN, expression); }
fun
36,054
PsiType (@NotNull PsiType ltype, @NotNull PsiType rtype, PsiElement e) { if (GrBinaryExpressionUtil.isFloatOrDouble(ltype, rtype)) { return GrBinaryExpressionUtil.createDouble(e); } return GrBinaryExpressionUtil.createBigDecimal(e); }
inferNumericType
36,055
PsiType (GrOperatorExpression expression) { return GrBinaryExpressionUtil.getTypeByFQName(CommonClassNames.JAVA_LANG_INTEGER, expression); }
fun
36,056
PsiType (GrOperatorExpression expression) { return GrBinaryExpressionUtil.getTypeByFQName(GroovyCommonClassNames.JAVA_UTIL_REGEX_MATCHER, expression); }
fun
36,057
PsiType (@NotNull GrOperatorExpression e) { if (isFake(e)) return null; final Function<GrOperatorExpression, PsiType> function = MAP.get(e.getOperator()); assert function != null : e.getOperator(); return function.fun(e); }
computeType
36,058
PsiType (@NotNull PsiType ltype, @NotNull PsiType rtype, PsiElement e) { if (GrBinaryExpressionUtil.isBigDecimal(ltype, rtype)) return null; if (GrBinaryExpressionUtil.isFloatOrDouble(ltype, rtype)) return null; if (GrBinaryExpressionUtil.isLong(ltype, rtype)) return GrBinaryExpressionUtil.createLong(e); return GrBinaryExpressionUtil.createInteger(e); }
inferNumericType
36,059
PsiType (PsiType ltype, PsiType rtype, PsiElement e) { int lRank = getTypeRank(ltype); int rRank = getTypeRank(rtype); return getDefaultNumericResultType(lRank, rRank, e); }
getDefaultNumericResultType
36,060
PsiType (int lRank, int rRank, PsiElement context) { int resultRank = getResultTypeRank(lRank, rRank); String fqn = getTypeFqn(resultRank); return fqn == null ? null : createTypeByFQClassName(fqn, context); }
getDefaultNumericResultType
36,061
int (int lRank, int rRank) { for (int rank : RANKS) { if (lRank <= rank && rRank <= rank) { return rank; } } return 0; }
getResultTypeRank
36,062
PsiType (PsiElement e) { return getTypeByFQName(CommonClassNames.JAVA_LANG_DOUBLE, e); }
createDouble
36,063
PsiType (PsiElement e) { return getTypeByFQName(CommonClassNames.JAVA_LANG_LONG, e); }
createLong
36,064
PsiType (PsiElement e) { return getTypeByFQName(CommonClassNames.JAVA_LANG_INTEGER, e); }
createInteger
36,065
PsiType (PsiElement e) { return getTypeByFQName(GroovyCommonClassNames.JAVA_MATH_BIG_DECIMAL, e); }
createBigDecimal
36,066
boolean (PsiType lType, PsiType rType) { return lType.equalsToText(GroovyCommonClassNames.JAVA_MATH_BIG_DECIMAL) || rType.equalsToText(GroovyCommonClassNames.JAVA_MATH_BIG_DECIMAL); }
isBigDecimal
36,067
boolean (PsiType ltype, PsiType rtype) { return ltype.equalsToText(CommonClassNames.JAVA_LANG_DOUBLE) || rtype.equalsToText(CommonClassNames.JAVA_LANG_DOUBLE) || ltype.equalsToText(CommonClassNames.JAVA_LANG_FLOAT) || rtype.equalsToText(CommonClassNames.JAVA_LANG_FLOAT); }
isFloatOrDouble
36,068
boolean (PsiType ltype, PsiType rtype) { return ltype.equalsToText(CommonClassNames.JAVA_LANG_LONG) || rtype.equalsToText(CommonClassNames.JAVA_LANG_LONG); }
isLong
36,069
PsiType (String fqn, PsiElement e) { return createTypeByFQClassName(fqn, e); }
getTypeByFQName
36,070
PsiType (@NotNull GrMethodCall callExpression) { PsiMethod method = callExpression.resolveMethod(); if (method == null) return null; for (GroovyMethodInfo methodInfo : GroovyMethodInfo.getInfos(method)) { String returnType = methodInfo.getReturnType(); if (returnType != null) { if (methodInfo.isApplicable(method)) { return JavaPsiFacade.getElementFactory(callExpression.getProject()).createTypeFromText(returnType, callExpression); } } else { if (methodInfo.isReturnTypeCalculatorDefined()) { if (methodInfo.isApplicable(method)) { PsiType result = methodInfo.getReturnTypeCalculator().fun(callExpression, method); if (result != null) { return result; } } } } } return null; }
getType
36,071
void (@NotNull GroovyElementVisitor visitor) { visitor.visitPropertySelection(this); }
accept
36,072
String () { return "Property selection"; }
toString
36,073
GrExpression () { return findNotNullChildByClass(GrExpression.class); }
getQualifier
36,074
PsiElement () { final PsiElement last = getLastChild(); LOG.assertTrue(last != null); return last; }
getReferenceNameElement
36,075
PsiType () { return null; }
getType
36,076
String () { return "Method call"; }
toString
36,077
void (@NotNull GroovyElementVisitor visitor) { visitor.visitMethodCallExpression(this); }
accept
36,078
boolean () { return findChildByClass(GrClosableBlock.class) != null; }
hasClosureArguments
36,079
GroovyMethodCallReference () { return isRValue(this) && isIndexAccess() ? myRValueReference : null; }
getRValueReference
36,080
GroovyMethodCallReference () { return isLValue(this) && isIndexAccess() ? myLValueReference : null; }
getLValueReference
36,081
void (@NotNull GroovyElementVisitor visitor) { visitor.visitIndexProperty(this); }
accept
36,082
String () { return "Property by index"; }
toString
36,083
GrExpression () { return findNotNullChildByClass(GrExpression.class); }
getInvokedExpression
36,084
PsiElement () { return findChildByType(T_Q); }
getSafeAccessToken
36,085
GrArgumentList () { return findNotNullChildByClass(GrArgumentList.class); }
getArgumentList
36,086
PsiType () { return GroovyIndexPropertyUtil.getSimpleArrayAccessType(this); }
getNominalType
36,087
boolean () { return !isClassLiteral(this) && !isSimpleArrayAccess(this); }
isIndexAccess
36,088
PsiType () { return getType(); }
getNominalType
36,089
GrExpression (@NotNull GrExpression newExpr, boolean removeUnnecessaryParentheses) { return PsiImplUtil.replaceExpression(this, newExpr, removeUnnecessaryParentheses); }
replaceWithExpression
36,090
String () { return "groovy.transform.stc.FromString"; }
getHintName
36,091
List<PsiType[]> (@NotNull final PsiMethod method, @NotNull final PsiSubstitutor substitutor, String @NotNull [] options) { PsiElement context = createContext(method); PsiElementFactory factory = JavaPsiFacade.getElementFactory(method.getProject()); return ContainerUtil.map(options, value -> { try { PsiType original = factory.createTypeFromText("SomeUnexpectedDummyClass<" + value + ">", context); if (original instanceof PsiClassType) { PsiType[] parameters = ((PsiClassType)original).getParameters(); return ContainerUtil.map(parameters, substitutor::substitute).toArray(new PsiType[parameters.length]) ; } } catch (IncorrectOperationException e) { //do nothing. Just don't throw an exception } return new PsiType[]{PsiTypes.nullType()}; }); }
inferExpectedSignatures
36,092
PsiElement (@NotNull PsiMethod method) { return new FromStringLightElement(method); }
createContext
36,093
boolean (@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) { if (!ResolveUtil.shouldProcessClasses(processor.getHint(ElementClassHint.KEY))) return true; for (PsiTypeParameter parameter : myMethod.getTypeParameters()) { if (!ResolveUtil.processElement(processor, parameter, state)) return false; } PsiClass containingClass = myMethod.getContainingClass(); if (containingClass != null) { PsiTypeParameter[] parameters = containingClass.getTypeParameters(); for (PsiTypeParameter parameter : parameters) { if (!ResolveUtil.processElement(processor, parameter, state)) return false; } } return myFile.processDeclarations(processor, state, lastParent, place); }
processDeclarations
36,094
String () { return "fromStringLightElement"; }
toString
36,095
PsiType (GrVariable variable) { if (!(variable instanceof GrParameter)) { return null; } GrFunctionalExpression functionalExpression; int paramIndex; if (variable instanceof ClosureSyntheticParameter) { functionalExpression = ((ClosureSyntheticParameter)variable).getClosure(); paramIndex = 0; } else { PsiElement eParameterList = variable.getParent(); if (!(eParameterList instanceof GrParameterList parameterList)) return null; PsiElement eFunctionalExpression = eParameterList.getParent(); if (!(eFunctionalExpression instanceof GrFunctionalExpression)) return null; functionalExpression = (GrFunctionalExpression)eFunctionalExpression; paramIndex = parameterList.getParameterNumber((GrParameter)variable); } PsiType res = getClosureParameterType(functionalExpression, paramIndex); if (res instanceof PsiPrimitiveType) { return ((PsiPrimitiveType)res).getBoxedType(functionalExpression); } return res != null ? unwrapBound(res) : null; }
getVariableType
36,096
PsiType (@NotNull PsiType type) { if (type instanceof PsiWildcardType wildcard) { return wildcard.isSuper() ? wildcard.getBound() : type; } else { return type; } }
unwrapBound
36,097
ConversionResult (@NotNull PsiType targetType, @NotNull PsiType actualType, @NotNull Position position, @NotNull GroovyPsiElement context) { if (!TypesUtil.isClassType(targetType, GroovyCommonClassNames.GROOVY_LANG_CLOSURE) ) return null; if (!TypesUtil.isClassType(actualType, GroovyCommonClassNames.GROOVY_LANG_CLOSURE) ) return null; PsiClass lclass = ((PsiClassType)targetType).resolve(); PsiClass rclass = ((PsiClassType)actualType).resolve(); if (lclass == null || rclass == null) return null; PsiClassType.ClassResolveResult lresult = ((PsiClassType)targetType).resolveGenerics(); PsiClassType.ClassResolveResult rresult = ((PsiClassType)actualType).resolveGenerics(); if (GrGenericTypeConverter.typeParametersAgree(lclass, rclass, lresult.getSubstitutor(), rresult.getSubstitutor(), context)) return ConversionResult.OK; return null; }
isConvertible
36,098
boolean (@NotNull Position position) { return position == Position.METHOD_PARAMETER; }
isApplicableTo
36,099
String () { return "groovy.transform.stc.MapEntryOrKeyValue"; }
getHintName