public class SemanticUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SemanticUtils.MultiDefinitionType
Enum that describes different kinds of multiple definitions
|
Modifier and Type | Field and Description |
---|---|
static boolean |
ALLOW_UNKNOWN_INODE
Manifest constant, getDefinitionOfUnderlyingType tolerates unknown tree shapes if this is passed
|
static boolean |
ASSERT_ON_UNKNOWN_INODE
Manifest constant, getDefinitionOfUnderlyingType asserts if this is passed
|
Constructor and Description |
---|
SemanticUtils(ICompilerProject project)
Construct a new SemanticUtils object.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
canNestedFunctionBeHoisted(IASNode iNode)
Check if a nested function can have it's init instructions hoisted to the top of the
function it is contained in.
|
static void |
checkReturnValueHasNoTypeDeclaration(LexicalScope scope,
IFunctionNode node,
IFunctionDefinition func)
Checks that a given function definition has a return type, and logs a problem if not
|
static void |
checkScopedToDefaultNamespaceProblem(LexicalScope scope,
BaseDefinitionNode node,
IDefinition definition,
String className)
Check for identifiers that don't have a namespace quailifier.
|
static Nsset |
convertSetINamespaceToNsset(Set<INamespaceDefinition> namespaceSet)
Convert a set of INamespaceDefinition objects into a Nsset.
|
static ICompilerProblem |
createDeprecationProblem(IDefinition definition,
IASNode site)
Uses the
[Deprecated] metadata of the specified definition
to create one of five different deprecation problems, depending on
the presence of message , since , and
replacement attributes in the metadata. |
boolean |
definitionCanBeAnalyzed(Binding binding)
Is this Binding's definition statically analyzable?
|
static boolean |
definitionCanBeAnalyzed(Binding binding,
ICompilerProject project)
Is this Binding's definition statically analyzable?
|
static IDefinition |
findMemberByName(IASNode iNode,
String member_name,
boolean match_static_to_static,
ICompilerProject project)
Find a member definition, given its name.
|
static IDefinition |
findMemberByName(IASScope scope,
String member_name,
boolean match_static_to_static,
boolean is_static_reference,
ICompilerProject project)
Search a scope and its enclosing scopes for a member whose name is known.
|
static List<IDefinition> |
findPotentialFunctionConflicts(ICompilerProject project,
IFunctionDefinition funcDef)
Find potential conflict for a FunctionDefinition.
|
static IDefinition |
findProperty(ASScope scope,
String member_name,
ICompilerProject project,
boolean lookForStatics)
Find a qualified property by name in a scope.
|
static IDefinition |
findPropertyQualified(ASScope scope,
IDefinition member_def,
ICompilerProject project)
Find a qualified property in a scope.
|
IDefinition |
findPropertyQualified(IDefinition member_def)
Find a property in a defintion's containing scope.
|
static IDefinition |
findPropertyQualified(IDefinition member_def,
ICompilerProject project)
Find a property in a defintion's containing scope.
|
IDefinition |
findPropertyQualified(IScopedDefinition enclosing_def,
IDefinition member_def)
Find a property in a (presumably) enclosing defintion's scope.
|
static IDefinition |
findPropertyQualified(IScopedDefinition enclosing_def,
IDefinition member_def,
ICompilerProject project)
Find a property in a (presumably) enclosing defintion's scope.
|
static boolean |
functionMustReturnValue(IASNode iNode,
ICompilerProject project)
Does the subject function require a non-void return value?
|
Name |
getAETName(IDefinition def)
Downcast an IDefinition and get an AET name from it.
|
static Name |
getAETName(IDefinition def,
ICompilerProject project)
Downcast an IDefinition and get an AET name from it.
|
static ASScope |
getASScope(IASNode iNode)
Get the given node's containing scope.
|
IDefinition |
getBaseClassDefinition(IASNode iNode)
Fetch the definiton of the given node's
class' base class.
|
static IDefinition |
getBaseClassDefinition(IASNode iNode,
ICompilerProject project)
Fetch the definition of the given node's
class' base class.
|
static ExpressionNodeBase |
getBaseNode(Binding binding)
Get an ExpressionNodeBase's base node.
|
static Boolean |
getBooleanContent(IASNode iNode) |
IDefinition |
getBuiltinType(IASLanguageConstants.BuiltinType builtin)
Fetch a builtin type.
|
static IDefinition |
getBuiltinType(IASLanguageConstants.BuiltinType builtin,
ICompilerProject project)
Fetch a builtin type.
|
static int |
getChildCount(IASNode node)
Get the child count for nodes whose
CodeModel-centric child count isn't
reliable.
|
ASScope |
getClassScope(IASNode iNode)
Get the ASScope of the class that contains an inode.
|
static ASScope |
getClassScope(IASNode iNode,
ICompilerProject project)
Get the ASScope of the class that contains an inode.
|
IDefinition |
getDefinition(IASNode iNode)
Get the definition associated with a IASNode.
|
static IDefinition |
getDefinition(IASNode iNode,
ICompilerProject project)
Get the definition associated with a IASNode.
|
IDefinition |
getDefinitionOfUnderlyingType(IASNode iNode,
boolean allow_unknown_iNode)
Get the definition of the explicit or implicit type underlying
an iNode's reference(s).
|
static IDefinition |
getDefinitionOfUnderlyingType(IASNode iNode,
boolean allow_unknown_iNode,
ICompilerProject project)
Get the definition of the explicit or implicit type underlying
an iNode's reference(s).
|
static String |
getDiagnosticString(IASNode iNode)
Get an abstract string description of a node, suitable for a diagnostic.
|
static Double |
getDoubleContent(IASNode iNode) |
String |
getEnclosingClassName(IASNode iNode)
Get the name of the class enclosing an instance function in which
some problematic construct resides.
|
static String |
getEnclosingClassName(IASNode iNode,
ICompilerProject project)
Get the name of the class enclosing an instance function in which
some problematic construct resides.
|
FunctionDefinition |
getEnclosingFunctionDefinition(IASNode iNode)
Find the definition of the function that encloses the given node, if any.
|
static FunctionDefinition |
getEnclosingFunctionDefinition(IASNode iNode,
ICompilerProject project)
Find the definition of the function that encloses the given node, if any.
|
static String |
getFileName(IASNode iNode)
Helper method to get the file path from an IASNode
|
static FunctionDefinition |
getFunctionDefinition(IASNode iNode)
Locate a FunctionDefinition that encloses the given i-node.
|
static IASNode |
getFunctionProblemNode(IFunctionNode iNode)
Helper method to get the node to report a problem with a Function.
|
static String |
getIdentifierContent(IASNode iNode) |
static Integer |
getIntegerContent(IASNode iNode) |
static SemanticUtils.MultiDefinitionType |
getMultiDefinitionType(IDefinition def,
ICompilerProject project)
Is the given multiply defined, or ambiguous?
|
static IMXMLEventSpecifierNode |
getMXMLEventSpecifierContent(IASNode iNode) |
static INamespaceDefinition |
getNamespaceInClassContext(IDefinition def,
ICompilerProject project)
Resolve a definition's namespace, and if its parent is a class, normalize
that namespace against the parent class' superclass' protected namespace.
|
static IASNode |
getNthChild(IASNode node,
int index)
Get the Nth child of a node per the BURM's semantics.
|
static Nsset |
getOpenNamespaces(IASNode iNode,
ICompilerProject project)
Get the set of open namespaces for the given node.
|
static Nsset |
getOpenNamespacesForSuper(IASNode iNode,
ICompilerProject project,
IDefinition superDef)
Get the set of open namespaces for the given node,
as appropriate for
super[...] |
static IDefinition |
getParameterContent(IASNode iNode) |
IASNode |
getPotentiallyParameterizedType(IASNode iNode)
Fetch the most appropriate part of a type name for diagnostics.
|
static Collection<IDefinition> |
getPropertiesByNameForMemberAccess(IASScope scope,
String member_name,
ICompilerProject project)
Fetch the collection of definitions in the given scope or its underlying scopes
that match the given name.
|
static IDefinition |
getPropertyQualified(ASScope scope,
IDefinition member_def,
ICompilerProject project)
Get a qualified property in a scope - this will look for properties with the same qualified name as member_def
in the scope passed in.
|
static IDefinition |
getPropertyQualified(ASScope scope,
INamespaceDefinition namespace,
String baseName,
ICompilerProject project)
Get a qualified property in a scope, given the namespace and base name to search for.
|
static IDefinition |
getPropertyQualified(IScopedDefinition enclosing_def,
IDefinition member_def,
ICompilerProject project) |
static String |
getStringLiteralContent(IASNode iNode) |
static ASScope |
getSuperClassScope(ICompilerProject project,
IDefinition member_def)
Get the super class scope for the definition passed in.
|
String |
getTypeOfBase(IASNode node)
Get the type of a node's base expression as a string.
|
static String |
getTypeOfBase(IASNode node,
ICompilerProject project)
Get the type of a node's base expression as a string.
|
String |
getTypeOfStem(IASNode node)
Get the type of an expression's stem.
|
static String |
getTypeOfStem(IASNode iNode,
ICompilerProject project)
Get the type of an expression's stem.
|
static Long |
getUintContent(IASNode iNode) |
boolean |
hasBaseClassDefinition(IASNode iNode)
Is the given node in a class with a base class definition?
|
static boolean |
hasBaseClassDefinition(IASNode iNode,
ICompilerProject project)
Is the given node in a class with a base class definition?
|
static boolean |
hasBaseNode(Binding binding)
Does this binding have a base node?
|
static boolean |
hasDeprecatedAncestor(IASNode node)
Determines whether the specified node has an ancestor
which is a definition node with
[Deprecated] metadata. |
boolean |
hasDynamicBase(Binding binding)
Check an ExpressionNodeBase's base expression (if any)
to determine if it's a dynamic expression, which
means we don't know much about its definition.
|
static boolean |
hasDynamicBase(Binding binding,
ICompilerProject project)
Check an ExpressionNodeBase's base expression (if any)
to determine if it's a dynamic expression, which
means we don't know much about its definition.
|
static boolean |
hasExplicitStem(IASNode iNode)
Does the given node have an explicit stem reference, e.g., foo.bar?
|
boolean |
hasUnderlyingType(IASNode iNode)
Does the given inode have an underlying type that could
resolve its references?
|
static boolean |
hasUnderlyingType(IASNode iNode,
ICompilerProject project)
Does the given inode have an underlying type that could
resolve its references?
|
static boolean |
isAmbiguousReference(Binding b)
Determine if a given binding is ambiguous
|
static boolean |
isArgumentsReference(Binding b)
Is the binding a potential reference to
the 'arguments' object
|
boolean |
isBuiltin(IDefinition def,
IASLanguageConstants.BuiltinType builtin)
Determine if an IDefinition is a specific builtin type.
|
static boolean |
isBuiltin(IDefinition def,
IASLanguageConstants.BuiltinType builtin,
ICompilerProject project)
Determine if an IDefinition is a specific builtin type.
|
boolean |
isConst(IASNode iNode)
Is the given definition const?
|
static boolean |
isConst(IASNode iNode,
ICompilerProject project)
Is the given definition const?
|
static boolean |
isConstDefinition(IDefinition def)
Is the given definition a constant?
|
static int |
isDottedName(IASNode n)
Explore a MemberAccessNode and decide if
its stem is a referenceto a package.
|
static boolean |
isE4XWildcardProperty(IdentifierNode node)
Check if
node is in an E4X filter expression. |
static boolean |
isGetterSetterPair(IDefinition def0,
IDefinition def1,
ICompilerProject project)
Determines if a pair of definitions consists of a matched getter/setter pair.
|
static boolean |
isGetterSetterPair(List<IDefinition> defs,
ICompilerProject project)
Determines if a list of definitions consists of a matched getter/setter pair.
|
static boolean |
isImplicitContainer(IASNode iNode)
Is this container an implicit container?
|
boolean |
isInaccessible(ASScope containingScope,
Binding b)
Is the given Binding inaccessible, i.e., known to
an underlying type scope but not defined here
due to access restrictions?
|
boolean |
isInaccessible(IASNode iNode,
Binding member)
Is the given binding an inaccessible reference?
|
static boolean |
isInaccessible(IASNode iNode,
Binding member,
ICompilerProject project)
Is the given binding an inaccessible reference?
|
static boolean |
isInConstructor(IASNode iNode)
Is the given node in a constructor?
|
static boolean |
isInFilter(IASNode iNode)
Is the given node in a filter expression?
|
static boolean |
isInFunction(IASNode iNode)
Is this node enclosed in a function definition?
|
boolean |
isInInstanceFunction(IASNode iNode)
Is the given inode in an instance function?
|
static boolean |
isInInstanceFunction(IASNode iNode,
ICompilerProject project)
Is the given inode in an instance function?
|
boolean |
isInstanceOf(IDefinition maybe_derived,
IDefinition maybe_base)
Determine if one IDefinition is a subclass of another.
|
static boolean |
isInstanceOf(IDefinition maybe_derived,
IDefinition maybe_base,
ICompilerProject project)
Determine if one IDefinition is a subclass of another.
|
static boolean |
isInStaticClassFunction(IASNode iNode,
ICompilerProject project)
Is the given inode in a static function?
|
static boolean |
isInVariableDeclaration(IASNode iNode)
Is the given i-node inside a variable declaration?
|
static boolean |
isInWith(IASNode iNode)
Is the given node in a with scope?
|
static boolean |
isMemberDefinition(IDefinition def)
Is this definition a member of a class?
|
static boolean |
isMethodBinding(IDefinition def)
Is the definition going to be a method binding in the ABC?
|
static boolean |
isNestedClassProperty(IASNode iNode,
VariableDefinition def)
Is this node declaring a property in a class, but also nested inside
another statement.
|
boolean |
isNumericType(IDefinition def) |
static boolean |
isNumericType(IDefinition def,
ICompilerProject project) |
static boolean |
isNumericTypeOrBoolean(IDefinition def,
ICompilerProject project) |
static boolean |
isPackageDefinition(IDefinition def)
Is this definition a member of a package?
|
boolean |
isReadOnlyDefinition(IDefinition def)
Is this definition read-only?
|
static boolean |
isRefToClassBeingInited(IdentifierNode id,
IDefinition def)
Helper method to determine if an IdentifierNode refers to the Class it is contained
in from a context where we are generating code that may be run during the cinit method.
|
static int |
isSuperThisForFieldAccess(IASNode n)
Check if the node is for
super(this) but not
super(this).call() . |
static boolean |
isThisKeyword(IASNode iNode)
Does this node represent the "this" keyword?
|
static boolean |
isType(IDefinition d)
Determine if a given IDefinition is the definition of a type (class or interface)
|
static boolean |
isUnprotectedAssignmentInConditional(IASNode node)
Decide if an assignment node is in a context that merits a warning.
|
static boolean |
isValidImplicitOpAssignment(IDefinition lhsType,
IDefinition rhsType,
int opcode,
ICompilerProject project,
boolean compareNormalized)
Check that implicit conversion done as part of an op= style assignment is valid.
|
static boolean |
isValidImport(IImportNode importNode,
ICompilerProject project,
boolean inInvisibleCompilationUnit) |
static boolean |
isValidTypeConversion(IDefinition expected,
IDefinition actual,
ICompilerProject project,
boolean normalizeDefinitions)
Check that a implicit conversion from actual to expected type is valid.
|
boolean |
isWriteOnlyDefinition(IDefinition def)
Is this definition write-only?
|
IDefinition |
numberType()
Get the current number type.
|
static IDefinition |
numberType(ICompilerProject project)
Get the current number type.
|
int |
qualifierIsCompileTimeConstant(IASNode iNode)
Get the definition associated with a node's qualifier
and decide if the qualifier is a compile-time constant.
|
static int |
qualifierIsCompileTimeConstant(IASNode iNode,
ICompilerProject project)
Get the definition associated with a node's qualifier
and decide if the qualifier is a compile-time constant.
|
int |
qualifierIsInterface(IASNode iNode)
Get the definition associated with a node's qualifier
and decide if the qualifier is an interface name.
|
static int |
qualifierIsInterface(IASNode iNode,
ICompilerProject project)
Get the definition associated with a node's qualifier
and decide if the qualifier is an interface name.
|
static ClassDefinition |
resolveBaseClass(ICommonClassNode classNode,
ClassDefinition classDefinition,
ICompilerProject project,
Collection<ICompilerProblem> problems)
This is similar to the
resolveBaseClass() method of IClassDefinition ,
except it reports problems if the base class doesn't exist,
if it isn't actually a class, or if it is final;
it also returns the class definition for Object in these error cases. |
IDefinition |
resolveCorrespondingAccessor(IDefinition def)
Given the definition of a getter or setter, resolve its
corresponding accessor (e.g., the setter for a getter).
|
static IDefinition |
resolveCorrespondingAccessor(IDefinition def,
ICompilerProject project)
Given the definition of a getter or setter, resolve its
corresponding accessor (e.g., the setter for a getter).
|
static ITypeDefinition |
resolveRHSTypeOfAssignment(ICompilerProject project,
IASNode iNode)
Calculate the type of the RHS of an assignment.
|
IDefinition |
resolveType(IASNode iNode) |
static IDefinition |
resolveType(IASNode iNode,
ICompilerProject project) |
static IDefinition |
resolveUnaryExprType(IASNode iNode,
ICompilerProject project)
Resolve the type of the underlying expression in a UnaryOperatorNode.
|
Object |
transformNameToConstantValue(IASNode iNode)
Transform a leaf AST into a compile-time constant;
note that more complex constant folding is done by
a series of rules in the BURM.
|
static Object |
transformNameToConstantValue(IASNode iNode,
ICompilerProject project)
Transform a leaf AST into a compile-time constant;
note that more complex constant folding is done by
a series of rules in the BURM.
|
public static final boolean ASSERT_ON_UNKNOWN_INODE
public static final boolean ALLOW_UNKNOWN_INODE
public SemanticUtils(ICompilerProject project)
project
- - an ICompilerProject for the current project.public static int isSuperThisForFieldAccess(IASNode n)
super(this)
but not
super(this).call()
. The incoming tree shape is:
MemberAccessExpressionID(FunctionCallID(SuperID(void), ContainerID(IdentifierID(void))), qname)
super(this)
;
Integer.MAX_VALUE
otherwise.public static boolean isValidImplicitOpAssignment(IDefinition lhsType, IDefinition rhsType, int opcode, ICompilerProject project, boolean compareNormalized)
lhsType
- - the type of the lvalue (and one operand of the implicit binary operator).rhsType
- - the type of the result of the implicit binary operation.opcode
- - the operator of the implicit binary operator.project
- an ICompilerProject for the current project.public static boolean isValidTypeConversion(IDefinition expected, IDefinition actual, ICompilerProject project, boolean normalizeDefinitions)
expected
- the expected type.actual
- the actual type.project
- an ICompilerProject for the current project.normalizeDefinitions
- If true, we'll try normalizing both
IDefinition
s before returning false. See the java doc for
normalizeDefinition(IDefinition, ICompilerProject)
for more info.public static IASNode getFunctionProblemNode(IFunctionNode iNode)
public static boolean isRefToClassBeingInited(IdentifierNode id, IDefinition def)
id
- the identifier node that we are resolvingdef
- the definition the identifier node resolved topublic static boolean isBuiltin(IDefinition def, IASLanguageConstants.BuiltinType builtin, ICompilerProject project)
def
- - the IDefinition of interest.builtin
- - the builtin type.project
- - an ICompilerProject for the current project.public static List<IDefinition> findPotentialFunctionConflicts(ICompilerProject project, IFunctionDefinition funcDef)
project
- The project to resolve things infuncDef
- The function definition to find potential conlicts forpublic static boolean isArgumentsReference(Binding b)
b
- the Binding to checkpublic boolean isBuiltin(IDefinition def, IASLanguageConstants.BuiltinType builtin)
def
- - the IDefinition of interest.builtin
- - the builtin type.public static boolean isNumericType(IDefinition def, ICompilerProject project)
def
- - the IDefinition of interest.project
- - an ICompilerProject for the current project.public static boolean isNumericTypeOrBoolean(IDefinition def, ICompilerProject project)
def
- - the IDefinition of interest.project
- - an ICompilerProject for the current project.public boolean isNumericType(IDefinition def)
def
- - the IDefinition of interest.isNumericType(IDefinition, ICompilerProject)
public static boolean isInstanceOf(IDefinition maybe_derived, IDefinition maybe_base, ICompilerProject project)
maybe_derived
- The first definition.maybe_base
- The second definition.project
- - an ICompilerProject for the current project.public boolean isInstanceOf(IDefinition maybe_derived, IDefinition maybe_base)
maybe_derived
- The first definition.maybe_base
- The second definition.isInstanceOf(IDefinition, IDefinition, ICompilerProject)
public static IDefinition getBuiltinType(IASLanguageConstants.BuiltinType builtin, ICompilerProject project)
builtin
- - the BuiltinType identifier of the type.project
- - an ICompilerProject for the current project.public IDefinition getBuiltinType(IASLanguageConstants.BuiltinType builtin)
builtin
- - the BuiltinType identifier of the type.public static IDefinition numberType(ICompilerProject project)
project
- - an ICompilerProject for the current project.public IDefinition numberType()
numberType(ICompilerProject)
public static IDefinition resolveCorrespondingAccessor(IDefinition def, ICompilerProject project)
def
- - the definition of interest.project
- - an ICompilerProject for the current project.IllegalArgumentException
- if the definition is
not for a getter or setter.public IDefinition resolveCorrespondingAccessor(IDefinition def)
def
- - the definition of interest.IllegalArgumentException
- if the definition is
not for a getter or setter.resolveCorrespondingAccessor(IDefinition, ICompilerProject)
public static boolean isInWith(IASNode iNode)
iNode
- - the node of interest.public static boolean isInFilter(IASNode iNode)
iNode
- - the node of interest.public static boolean canNestedFunctionBeHoisted(IASNode iNode)
iNode
- The node to checkpublic static boolean isMemberDefinition(IDefinition def)
def
- - the definition of interest.public static boolean isPackageDefinition(IDefinition def)
def
- - the definition of interest.public static boolean isMethodBinding(IDefinition def)
def
- - the definition of interest.public boolean isReadOnlyDefinition(IDefinition def)
def
- - the definition of interest.public static boolean definitionCanBeAnalyzed(Binding binding, ICompilerProject project)
binding
- - the Binding of interest.project
- - an ICompilerProject for the current project.public boolean definitionCanBeAnalyzed(Binding binding)
binding
- - the Binding of interest.definitionCanBeAnalyzed(Binding, ICompilerProject)
public boolean isWriteOnlyDefinition(IDefinition def)
def
- - the definition of interest.public static boolean hasDynamicBase(Binding binding, ICompilerProject project)
binding
- - the binding whose base node is to be checked.project
- - an ICompilerProject for the current project.public boolean hasDynamicBase(Binding binding)
binding
- - the binding whose base node is to be checked.hasDynamicBase(Binding, ICompilerProject)
public static ExpressionNodeBase getBaseNode(Binding binding)
public IDefinition getDefinition(IASNode iNode)
iNode
- - the node whose definition is desired.public static IDefinition getDefinition(IASNode iNode, ICompilerProject project)
iNode
- - the node whose definition is desired.project
- - an ICompilerProject for the current project.public static IDefinition resolveType(IASNode iNode, ICompilerProject project)
public IDefinition resolveType(IASNode iNode)
public static IDefinition resolveUnaryExprType(IASNode iNode, ICompilerProject project)
iNode
- The UnaryOperatorNode you want the underlying type forproject
- - an ICompilerProject for the current project.public String getTypeOfBase(IASNode node)
node
- the node whose base's type is desired.public static String getTypeOfBase(IASNode node, ICompilerProject project)
node
- the node whose base's type is desired.project
- an ICompilerProject for the current project.public static String getTypeOfStem(IASNode iNode, ICompilerProject project)
iNode
- - the node of interest.project
- - an ICompilerProject for the current project.public String getTypeOfStem(IASNode node)
node
- - the node of interest.getTypeOfStem(IASNode, ICompilerProject)
public static IDefinition getDefinitionOfUnderlyingType(IASNode iNode, boolean allow_unknown_iNode, ICompilerProject project)
iNode
- - the inode of interest.allow_unknown_iNode
- - tolerate a node type that doesn't
have a procedure for extracting its underlying scope.project
- - an ICompilerProject for the current project.public IDefinition getDefinitionOfUnderlyingType(IASNode iNode, boolean allow_unknown_iNode)
iNode
- - the inode of interest.allow_unknown_iNode
- - tolerate a node type that doesn't
have a procedure for extracting its underlying scope.getDefinitionOfUnderlyingType(IASNode, boolean, ICompilerProject)
public static boolean hasUnderlyingType(IASNode iNode, ICompilerProject project)
iNode
- - the inode of interest.project
- - an ICompilerProject for the current project.public boolean hasUnderlyingType(IASNode iNode)
iNode
- - the inode of interest.hasUnderlyingType(IASNode, ICompilerProject)
public static boolean hasExplicitStem(IASNode iNode)
iNode
- - the node of interest.which checks for explicit or implicit contexts for resolution.
public static boolean hasBaseNode(Binding binding)
binding
- - the Binding of interest.public static boolean isInFunction(IASNode iNode)
iNode
- - the node of interest.public static boolean isNestedClassProperty(IASNode iNode, VariableDefinition def)
iNode
- the nodedef
- thepublic static boolean isImplicitContainer(IASNode iNode)
iNode
- - the container of interest.public static SemanticUtils.MultiDefinitionType getMultiDefinitionType(IDefinition def, ICompilerProject project)
def
- - the definition of interest.project
- - the active compiler project.public static boolean isAmbiguousReference(Binding b)
b
- the binding to checkpublic static boolean isThisKeyword(IASNode iNode)
iNode
- - the node of interest.public boolean hasBaseClassDefinition(IASNode iNode)
iNode
- - the node of interest.hasBaseClassDefinition(IASNode, ICompilerProject)
public static boolean hasBaseClassDefinition(IASNode iNode, ICompilerProject project)
iNode
- - the node of interest.project
- - the active compiler project.public static IDefinition getBaseClassDefinition(IASNode iNode, ICompilerProject project)
iNode
- - the node of interest.project
- - an ICompilerProject for the current project.public static INamespaceDefinition getNamespaceInClassContext(IDefinition def, ICompilerProject project)
def
- - the definition of interest.project
- - an ICompilerProject for the current project.public static ASScope getSuperClassScope(ICompilerProject project, IDefinition member_def)
project
- The project to resolve references inmember_def
- The member to find a super class forpublic static IDefinition findMemberByName(IASNode iNode, String member_name, boolean match_static_to_static, ICompilerProject project)
iNode
- - the node that forms the reference.
Should be a MemberAccessExpressionNode to get any useful result.member_name
- - the name of the member of interest.match_static_to_static
- - when true, only accept definitionspublic static ASScope getClassScope(IASNode iNode, ICompilerProject project)
iNode
- - the inode of interest.project
- - an ICompilerProject for the current project.public ASScope getClassScope(IASNode iNode)
iNode
- - the inode of interest.getClassScope(IASNode, ICompilerProject)
public static IDefinition findMemberByName(IASScope scope, String member_name, boolean match_static_to_static, boolean is_static_reference, ICompilerProject project)
scope
- - the innermost scope to search.member_name
- - the (string) name of interest.match_static_to_static
- - if set, then only return static definitions if is_static_reference is set.is_static_reference
- - caller sets this if the reference occurs in a context that is known to be static.project
- - an ICompilerProject for the current project.public static boolean isInaccessible(IASNode iNode, Binding member, ICompilerProject project)
iNode
- - the iNode that anchors the reference.member
- - the Binding.project
- - an ICompilerProject for the current project.public boolean isInaccessible(IASNode iNode, Binding member)
iNode
- - the iNode that anchors the reference.member
- - the Binding.isInaccessible(IASNode, Binding, ICompilerProject)
public IDefinition getBaseClassDefinition(IASNode iNode)
iNode
- - the node of interest.getBaseClassDefinition(IASNode, ICompilerProject)
public static IDefinition findPropertyQualified(IDefinition member_def, ICompilerProject project)
member_def
- - the definition of interest.project
- - the active compiler project.public IDefinition findPropertyQualified(IDefinition member_def)
member_def
- - the definition of interest.findPropertyQualified(IDefinition, ICompilerProject)
public static IDefinition findPropertyQualified(IScopedDefinition enclosing_def, IDefinition member_def, ICompilerProject project)
enclosing_def
- - the definition to query.member_def
- - the prototype definition of the member desired.project
- - the active compiler project.public static IDefinition getPropertyQualified(IScopedDefinition enclosing_def, IDefinition member_def, ICompilerProject project)
public IDefinition findPropertyQualified(IScopedDefinition enclosing_def, IDefinition member_def)
enclosing_def
- - the definition to query.member_def
- - the prototype definition of the member desired.findPropertyQualified(IScopedDefinition, IDefinition, ICompilerProject)
public static IDefinition findPropertyQualified(ASScope scope, IDefinition member_def, ICompilerProject project)
scope
- - the scope to query.member_def
- - the prototype definition of the member desired.project
- - the active compiler project.public static IDefinition getPropertyQualified(ASScope scope, IDefinition member_def, ICompilerProject project)
scope
- the scope to look for the property inmember_def
- the prototype definition of the member desiredproject
- the active compiler projectpublic static IDefinition getPropertyQualified(ASScope scope, INamespaceDefinition namespace, String baseName, ICompilerProject project)
scope
- the scope to look for the property innamespace
- the namespace of the member desiredbaseName
- the base name of the member desiredproject
- the active compiler projectpublic static IDefinition findProperty(ASScope scope, String member_name, ICompilerProject project, boolean lookForStatics)
scope
- - the scope to query.member_name
- - the name of the desired member.project
- - the active compiler project.public static FunctionDefinition getEnclosingFunctionDefinition(IASNode iNode, ICompilerProject project)
iNode
- - the inode of interest.project
- - an ICompilerProject for the current project.public FunctionDefinition getEnclosingFunctionDefinition(IASNode iNode)
iNode
- - the inode of interest.getEnclosingFunctionDefinition(IASNode, ICompilerProject)
public static boolean isInInstanceFunction(IASNode iNode, ICompilerProject project)
iNode
- - the inode of interest.project
- - an ICompilerProject for the current project.public boolean isInInstanceFunction(IASNode iNode)
iNode
- - the inode of interest.isInInstanceFunction(IASNode, ICompilerProject)
public static boolean isInStaticClassFunction(IASNode iNode, ICompilerProject project)
iNode
- - the inode of interest.project
- - an ICompilerProject for the current project.public boolean isInaccessible(ASScope containingScope, Binding b)
containingScope
- - the innermost underlying type scope.b
- - the Binding of interest
=public static String getEnclosingClassName(IASNode iNode, ICompilerProject project)
iNode
- - the problematic construct.project
- - an ICompilerProject for the current project.public String getEnclosingClassName(IASNode iNode)
iNode
- - the problematic construct.getEnclosingClassName(IASNode, ICompilerProject)
public static Collection<IDefinition> getPropertiesByNameForMemberAccess(IASScope scope, String member_name, ICompilerProject project)
scope
- - the innermost scope to search.member_name
- - the (string) name of interest.project
- - an ICompilerProject for the current project.public static String getDiagnosticString(IASNode iNode)
public static Nsset getOpenNamespaces(IASNode iNode, ICompilerProject project)
iNode
- - the node of interest.project
- - an ICompilerProject for the current project.public static Nsset getOpenNamespacesForSuper(IASNode iNode, ICompilerProject project, IDefinition superDef)
super[...]
access.iNode
- - the node of interest.project
- - an ICompilerProject for the current project.public static Nsset convertSetINamespaceToNsset(Set<INamespaceDefinition> namespaceSet)
namespaceSet
- - the set of INamespaceDefinition objects.public static ASScope getASScope(IASNode iNode)
iNode
- - the node of interest.public static boolean isConst(IASNode iNode, ICompilerProject project)
iNode
- - the root of the definition.project
- - an ICompilerProject for the current project.public boolean isConst(IASNode iNode)
iNode
- - the root of the definition.isConst(IASNode iNode, ICompilerProject cache)
public static boolean isConstDefinition(IDefinition def)
def
- - the definition of interest.public static boolean isInConstructor(IASNode iNode)
iNode
- - the i-node of interest.public static boolean isInVariableDeclaration(IASNode iNode)
iNode
- - the i-node of interest.public IASNode getPotentiallyParameterizedType(IASNode iNode)
public static IASNode getNthChild(IASNode node, int index)
public static int getChildCount(IASNode node)
public static IDefinition getParameterContent(IASNode iNode)
iNode
- - the parameter node.public static String getStringLiteralContent(IASNode iNode)
iNode
- - the literal node.public static Long getUintContent(IASNode iNode)
iNode
- - the literal node.public static Double getDoubleContent(IASNode iNode)
iNode
- - the literal node.public static Boolean getBooleanContent(IASNode iNode)
iNode
- - the literal node.public static String getIdentifierContent(IASNode iNode)
iNode
- - the IIdentifier node.public static Integer getIntegerContent(IASNode iNode)
iNode
- - the literal node.public static IMXMLEventSpecifierNode getMXMLEventSpecifierContent(IASNode iNode)
iNode
- - the MXMLEventSpecifierNode node.public static int isDottedName(IASNode n)
public static int qualifierIsCompileTimeConstant(IASNode iNode, ICompilerProject project)
iNode
- - the node to check.public int qualifierIsCompileTimeConstant(IASNode iNode)
iNode
- - the node to check.qualifierIsCompileTimeConstant(IASNode, ICompilerProject)
public static int qualifierIsInterface(IASNode iNode, ICompilerProject project)
iNode
- - the node to check.public int qualifierIsInterface(IASNode iNode)
iNode
- - the node to check.qualifierIsInterface(IASNode, ICompilerProject)
public static Object transformNameToConstantValue(IASNode iNode, ICompilerProject project)
iNode
- - the i-node of interest.project
- - an ICompilerProject for the current project.public Object transformNameToConstantValue(IASNode iNode)
iNode
- - the i-node of interest.transformNameToConstantValue(IASNode, ICompilerProject)
public static void checkScopedToDefaultNamespaceProblem(LexicalScope scope, BaseDefinitionNode node, IDefinition definition, String className)
scope
- is the scope where problems will be addednode
- is the definition node for the defintion we are checkingdefinition
- is the dfintion we are checkingclassName
- is the class in which the identifier lives, or null if not in a class. Used for error reportingpublic static void checkReturnValueHasNoTypeDeclaration(LexicalScope scope, IFunctionNode node, IFunctionDefinition func)
scope
- is the scope where problems are to be loggednode
- is the function node that is being checked (used for location reporting(func
- is the definition of the function to be checked.public static boolean isGetterSetterPair(List<IDefinition> defs, ICompilerProject project)
defs
- The list of definitions to analyze.project
- The context in which they are analyzed.true
if the definitions are a getter/setter pair.public static boolean isGetterSetterPair(IDefinition def0, IDefinition def1, ICompilerProject project)
def0
- The first definitions to analyze.def1
- The first definitions to analyze.project
- The context in which they are analyzed.true
if the definitions are a getter/setter pair.public static ClassDefinition resolveBaseClass(ICommonClassNode classNode, ClassDefinition classDefinition, ICompilerProject project, Collection<ICompilerProblem> problems)
resolveBaseClass()
method of IClassDefinition
,
except it reports problems if the base class doesn't exist,
if it isn't actually a class, or if it is final;
it also returns the class definition for Object
in these error cases.public static boolean isValidImport(IImportNode importNode, ICompilerProject project, boolean inInvisibleCompilationUnit)
public static boolean isType(IDefinition d)
d
- the definition to checkpublic static boolean isE4XWildcardProperty(IdentifierNode node)
node
is in an E4X filter expression.node
- AST node to be checked.public static boolean isUnprotectedAssignmentInConditional(IASNode node)
public static Name getAETName(IDefinition def, ICompilerProject project)
def
- - the definition.project
- - the active project.public Name getAETName(IDefinition def)
def
- - the definition.to which this delegates.
public static boolean hasDeprecatedAncestor(IASNode node)
[Deprecated]
metadata.
The node itself is not checked for such metadata.
node
- The node whose ancestors should be checked.true
if an ancestor is deprecated.public static ICompilerProblem createDeprecationProblem(IDefinition definition, IASNode site)
[Deprecated]
metadata of the specified definition
to create one of five different deprecation problems, depending on
the presence of message
, since
, and
replacement
attributes in the metadata.definition
- A deprecated definition.site
- The node referring to the deprecated definition,
which determines the problem location.ICompilerProblem
.public static FunctionDefinition getFunctionDefinition(IASNode iNode)
iNode
- - the i-node of interest.public static boolean functionMustReturnValue(IASNode iNode, ICompilerProject project)
iNode
- - an AST node in (or at the border of) the function.public static ITypeDefinition resolveRHSTypeOfAssignment(ICompilerProject project, IASNode iNode)
project
- the active projectiNode
- the node representing the assignmentCopyright © 2016 The Apache Software Foundation. All rights reserved.