|
JavaScript Development Tools Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.wst.jsdt.core.ast.ASTVisitor
org.eclipse.wst.jsdt.core.infer.InferEngine
public class InferEngine
The default inference engine.
Clients may subclass this class but should expect some breakage by future releases.
Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Field Summary | |
---|---|
InferredType |
ArrayType
|
InferredType |
BooleanType
|
InferredType |
FunctionType
|
InferredType |
GlobalType
|
InferrenceProvider |
inferenceProvider
|
protected InferredType |
inferredGlobal
|
InferredType |
NumberType
|
InferredType |
ObjectType
|
protected int |
passNumber
|
InferredType |
StringType
|
InferredType |
VoidType
|
static org.eclipse.wst.jsdt.internal.compiler.util.HashtableOfObject |
WellKnownTypes
|
Fields inherited from interface org.eclipse.wst.jsdt.core.infer.IInferEngine |
---|
ANONYMOUS_CLASS_ID, ANONYMOUS_PREFIX |
Constructor Summary | |
---|---|
InferEngine()
|
|
InferEngine(InferOptions inferOptions)
|
Method Summary | |
---|---|
protected InferredType |
addType(char[] className)
|
protected InferredType |
addType(char[] className,
boolean isDefinition)
Create a new inferred type with the given name |
protected char[] |
changePrimitiveToObject(char[] name)
|
protected char[] |
constructTypeName(IExpression expression)
|
protected InferredType |
createAnonymousType(char[] possibleTypeName,
InferredType currentType)
|
void |
doInfer()
Requests to perform type inference on provided compilation unit. |
void |
endVisit(IAssignment assignment)
|
void |
endVisit(IFunctionDeclaration methodDeclaration)
|
void |
endVisit(IObjectLiteral literal)
|
void |
endVisit(IObjectLiteralField field)
|
void |
endVisit(IReturnStatement returnStatement)
|
InferredType |
findDefinedType(char[] className)
|
protected IFunctionDeclaration |
getDefinedFunction(IExpression expression)
Get the function referenced by the expression |
protected IAbstractFunctionDeclaration |
getFunction(IExpression expression)
Finds a Function Declaration on the context from the name represented with the expression Currently, only SNR are supported |
protected InferredType |
getInferredType2(IExpression fieldReceiver)
|
IScriptFileDeclaration |
getScriptFileDeclaration()
Get the Script file this inferrence is being done on |
protected InferredType |
getTypeOf(IExpression expression)
|
protected IAbstractVariableDeclaration |
getVariable(IExpression expression)
Finds a Var Declaration on the context from the name represented with the expression Currently, only SNR are supported |
protected boolean |
handleAttributeDeclaration(InferredAttribute attribute,
IExpression initializer)
|
protected boolean |
handleFunctionCall(IFunctionCall messageSend)
|
protected boolean |
handleFunctionCall(IFunctionCall messageSend,
org.eclipse.wst.jsdt.internal.compiler.ast.LocalDeclaration assignmentExpression)
|
protected void |
handleFunctionDeclarationArguments(IFunctionDeclaration methodDeclaration,
IJsDoc jsdoc)
|
protected boolean |
handleFunctionExpressionAssignment(IAssignment assignment)
handle the inferrencing for an assigment whose right hand side is a function expression |
protected void |
handleJSDocConstructor(InferredType type,
IFunctionDeclaration methodDeclaration,
int nameStart)
|
protected boolean |
handlePotentialType(IAssignment assignment)
|
void |
initialize()
Initializes inference engine. |
void |
initializeOptions(InferOptions options)
Overriden by client who wish to update the infer options |
protected boolean |
isFunction(IFunctionCall messageSend,
char[][] names)
|
protected boolean |
isFunction(IFunctionCall messageSend,
String string)
|
protected boolean |
isInNamedMethod()
|
protected boolean |
isKnownType(char[] possibleTypeName)
|
protected boolean |
isMatch(IExpression expr,
char[][] names,
int index)
|
protected boolean |
isPossibleClassName(char[] name)
|
protected void |
popContext()
|
protected void |
populateType(InferredType type,
IObjectLiteral objLit,
boolean isStatic)
|
protected void |
pushContext()
|
void |
setCompilationUnit(org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration scriptFileDeclaration)
Set compilation unit for processing. |
boolean |
visit(IAllocationExpression allocationExpression)
|
boolean |
visit(IAssignment assignment)
|
boolean |
visit(IFunctionCall functionCall)
|
boolean |
visit(IFunctionDeclaration methodDeclaration)
|
boolean |
visit(ILocalDeclaration localDeclaration)
|
boolean |
visit(IObjectLiteral literal)
|
boolean |
visit(IReturnStatement returnStatement)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int passNumber
public InferrenceProvider inferenceProvider
public InferredType StringType
public InferredType NumberType
public InferredType BooleanType
public InferredType FunctionType
public InferredType ArrayType
public InferredType VoidType
public InferredType ObjectType
public InferredType GlobalType
public static org.eclipse.wst.jsdt.internal.compiler.util.HashtableOfObject WellKnownTypes
protected InferredType inferredGlobal
Constructor Detail |
---|
public InferEngine(InferOptions inferOptions)
public InferEngine()
Method Detail |
---|
public void initialize()
IInferEngine
#setCompilationUnit()
to let engine prepare for next compilation unit.
initialize
in interface IInferEngine
public void setCompilationUnit(org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration scriptFileDeclaration)
IInferEngine
setCompilationUnit
in interface IInferEngine
public boolean visit(IFunctionCall functionCall)
visit
in class ASTVisitor
public boolean visit(ILocalDeclaration localDeclaration)
visit
in class ASTVisitor
public boolean visit(IAssignment assignment)
visit
in class ASTVisitor
protected InferredType getInferredType2(IExpression fieldReceiver)
protected InferredType createAnonymousType(char[] possibleTypeName, InferredType currentType)
protected boolean handleFunctionExpressionAssignment(IAssignment assignment)
the
- assignment AST node
protected boolean handlePotentialType(IAssignment assignment)
assignment
-
protected IFunctionDeclaration getDefinedFunction(IExpression expression)
expression
- AST node
protected InferredType getTypeOf(IExpression expression)
protected void populateType(InferredType type, IObjectLiteral objLit, boolean isStatic)
public void endVisit(IAssignment assignment)
endVisit
in class ASTVisitor
protected boolean handleAttributeDeclaration(InferredAttribute attribute, IExpression initializer)
protected boolean handleFunctionCall(IFunctionCall messageSend)
protected boolean handleFunctionCall(IFunctionCall messageSend, org.eclipse.wst.jsdt.internal.compiler.ast.LocalDeclaration assignmentExpression)
public void endVisit(IReturnStatement returnStatement)
endVisit
in class ASTVisitor
public boolean visit(IReturnStatement returnStatement)
visit
in class ASTVisitor
public void endVisit(IFunctionDeclaration methodDeclaration)
endVisit
in class ASTVisitor
public boolean visit(IFunctionDeclaration methodDeclaration)
visit
in class ASTVisitor
protected void handleJSDocConstructor(InferredType type, IFunctionDeclaration methodDeclaration, int nameStart)
protected void handleFunctionDeclarationArguments(IFunctionDeclaration methodDeclaration, IJsDoc jsdoc)
public boolean visit(IAllocationExpression allocationExpression)
visit
in class ASTVisitor
public void endVisit(IObjectLiteralField field)
endVisit
in class ASTVisitor
protected boolean isMatch(IExpression expr, char[][] names, int index)
protected boolean isFunction(IFunctionCall messageSend, String string)
protected boolean isFunction(IFunctionCall messageSend, char[][] names)
public void doInfer()
IInferEngine
IInferEngine.setCompilationUnit(CompilationUnitDeclaration)
doInfer
in interface IInferEngine
protected InferredType addType(char[] className)
protected InferredType addType(char[] className, boolean isDefinition)
className
- the name of the inferred typeisDefinition
- true if this unit defines the type
protected final void pushContext()
protected final void popContext()
protected final boolean isInNamedMethod()
protected IAbstractVariableDeclaration getVariable(IExpression expression)
protected IAbstractFunctionDeclaration getFunction(IExpression expression)
protected boolean isKnownType(char[] possibleTypeName)
protected final char[] constructTypeName(IExpression expression)
public boolean visit(IObjectLiteral literal)
visit
in class ASTVisitor
public void endVisit(IObjectLiteral literal)
endVisit
in class ASTVisitor
public void initializeOptions(InferOptions options)
initializeOptions
in interface IInferEngine
options
- protected boolean isPossibleClassName(char[] name)
public IScriptFileDeclaration getScriptFileDeclaration()
public InferredType findDefinedType(char[] className)
protected char[] changePrimitiveToObject(char[] name)
|
JavaScript Development Tools Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |