public abstract class StaticTypeCheckingSupport
extends java.lang.Object
StaticTypeCheckingVisitor
.Constructor and Description |
---|
StaticTypeCheckingSupport() |
Modifier and Type | Method and Description |
---|---|
static int |
allParametersAndArgumentsMatch(Parameter[] params,
ClassNode[] args)
Checks that arguments and parameter types match.
|
static boolean |
checkCompatibleAssignmentTypes(ClassNode left,
ClassNode right)
Returns true or false depending on whether the right classnode can be assigned to the left classnode.
|
static boolean |
checkCompatibleAssignmentTypes(ClassNode left,
ClassNode right,
Expression rightExpression) |
static java.util.List<MethodNode> |
chooseBestMethod(ClassNode receiver,
java.util.Collection<MethodNode> methods,
ClassNode... args)
Given a list of candidate methods, returns the one which best matches the argument types
|
static java.util.List<MethodNode> |
findDGMMethodsByNameAndArguments(ClassNode receiver,
java.lang.String name,
ClassNode[] args) |
static java.util.List<MethodNode> |
findDGMMethodsByNameAndArguments(ClassNode receiver,
java.lang.String name,
ClassNode[] args,
java.util.List<MethodNode> methods) |
static boolean |
implementsInterfaceOrIsSubclassOf(ClassNode type,
ClassNode superOrInterface) |
static boolean |
isAssignment(int op) |
static boolean |
isBeingCompiled(ClassNode node) |
static boolean |
isGStringOrGStringStringLUB(ClassNode node) |
static boolean |
isParameterizedWithGStringOrGStringString(ClassNode node) |
static boolean |
isParameterizedWithString(ClassNode node) |
static boolean |
isWithCall(java.lang.String name,
Expression callArguments)
Called on method call checks in order to determine if a method call corresponds to the
idiomatic o.with { ... } structure
|
static Parameter[] |
parameterizeArguments(ClassNode receiver,
MethodNode m)
Given a receiver and a method node, parameterize the method arguments using
available generic type information.
|
public static boolean isWithCall(java.lang.String name, Expression callArguments)
name
- name of the method calledcallArguments
- arguments of the methodpublic static int allParametersAndArgumentsMatch(Parameter[] params, ClassNode[] args)
params
- method parametersargs
- type argumentspublic static boolean isAssignment(int op)
public static boolean checkCompatibleAssignmentTypes(ClassNode left, ClassNode right)
left
- the class to be assigned toright
- the assignee classpublic static boolean checkCompatibleAssignmentTypes(ClassNode left, ClassNode right, Expression rightExpression)
public static boolean isBeingCompiled(ClassNode node)
public static boolean implementsInterfaceOrIsSubclassOf(ClassNode type, ClassNode superOrInterface)
public static java.util.List<MethodNode> findDGMMethodsByNameAndArguments(ClassNode receiver, java.lang.String name, ClassNode[] args)
public static java.util.List<MethodNode> findDGMMethodsByNameAndArguments(ClassNode receiver, java.lang.String name, ClassNode[] args, java.util.List<MethodNode> methods)
public static java.util.List<MethodNode> chooseBestMethod(ClassNode receiver, java.util.Collection<MethodNode> methods, ClassNode... args)
receiver
- methods
- candidate methodsargs
- argument typespublic static Parameter[] parameterizeArguments(ClassNode receiver, MethodNode m)
receiver
- the classm
- the methodpublic static boolean isGStringOrGStringStringLUB(ClassNode node)
public static boolean isParameterizedWithGStringOrGStringString(ClassNode node)
node
- the node to be testedpublic static boolean isParameterizedWithString(ClassNode node)
node
- the node to be tested