Package | Description |
---|---|
com.google.javascript.jscomp |
Provides the core compiler and its public API.
|
com.google.javascript.jscomp.type |
Provides type-checking data structures and algorithms.
|
com.google.javascript.rhino.jstype |
Provides abstractions to represent types in JavaScript.
|
com.google.javascript.rhino.testing |
Modifier and Type | Field and Description |
---|---|
(package private) FunctionType |
ConformanceRules.RestrictedNameCall.Restriction.restrictedCallType |
(package private) FunctionType |
ConformanceRules.RestrictedMethodCall.Restriction.restrictedCallType |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<FunctionType,java.lang.Iterable<ObjectType>> |
DisambiguateProperties.implementedInterfaces |
Modifier and Type | Method and Description |
---|---|
(package private) FunctionType |
FunctionTypeBuilder.buildAndRegister()
Builds the function type, and puts it in the registry.
|
private FunctionType |
TypedScopeCreator.AbstractScopeBuilder.createFunctionTypeFromNodes(Node rValue,
java.lang.String name,
JSDocInfo info,
Node lvalueNode)
Creates a new function type, based on the given nodes.
|
private FunctionType |
TypedScopeCreator.AbstractScopeBuilder.findOverriddenFunction(ObjectType ownerType,
java.lang.String propName,
TemplateTypeMap typeMap)
Find the function that's being overridden on this type, if any.
|
private FunctionType |
DisambiguateProperties.getConstructor(JSType type) |
FunctionType |
SymbolTable.Symbol.getFunctionType() |
(package private) static FunctionType |
TypeValidator.getFunctionType(TypedVar v)
Utility function for getting a function type from a var.
|
private FunctionType |
FunctionTypeBuilder.getOrCreateConstructor()
Returns a constructor function either by returning it from the
registry if it exists or creating and registering a new type.
|
private FunctionType |
TypeInference.matchFunction(FunctionType expectedType,
FunctionType currentType,
boolean declared)
Take the current function type, and try to match the expected function
type.
|
Modifier and Type | Method and Description |
---|---|
private Node |
RuntimeTypeCheck.AddMarkers.addMarker(FunctionType funType,
Node nodeToInsertAfter,
ObjectType interfaceType) |
private void |
AmbiguateProperties.addRelatedInstance(FunctionType constructor,
AmbiguateProperties.JSTypeBitSet related)
Adds the instance of the given constructor, its implicit prototype and all
its related types to the given bit set.
|
void |
CodingConventions.Proxy.applyDelegateRelationship(ObjectType delegateSuperclass,
ObjectType delegateBase,
ObjectType delegator,
FunctionType delegateProxy,
FunctionType findDelegate) |
void |
CodingConventions.DefaultCodingConvention.applyDelegateRelationship(ObjectType delegateSuperclass,
ObjectType delegateBase,
ObjectType delegator,
FunctionType delegateProxy,
FunctionType findDelegate) |
void |
CodingConvention.applyDelegateRelationship(ObjectType delegateSuperclass,
ObjectType delegateBase,
ObjectType delegator,
FunctionType delegateProxy,
FunctionType findDelegate)
In many JS libraries, the function that creates a delegate relationship
also adds properties to the delegator and delegate base.
|
void |
CodingConventions.Proxy.applySingletonGetterOld(FunctionType functionType,
FunctionType getterType,
ObjectType objectType) |
void |
CodingConventions.DefaultCodingConvention.applySingletonGetterOld(FunctionType functionType,
FunctionType getterType,
ObjectType objectType) |
void |
ClosureCodingConvention.applySingletonGetterOld(FunctionType functionType,
FunctionType getterType,
ObjectType objectType) |
void |
CodingConvention.applySingletonGetterOld(FunctionType functionType,
FunctionType getterType,
ObjectType objectType)
In many JS libraries, the function that adds a singleton getter to a class
adds properties to the class.
|
void |
CodingConventions.Proxy.applySubclassRelationship(FunctionType parentCtor,
FunctionType childCtor,
CodingConvention.SubclassType type) |
void |
CodingConventions.DefaultCodingConvention.applySubclassRelationship(FunctionType parentCtor,
FunctionType childCtor,
CodingConvention.SubclassType type) |
void |
ClosureCodingConvention.applySubclassRelationship(FunctionType parentCtor,
FunctionType childCtor,
CodingConvention.SubclassType type)
Closure's goog.inherits adds a
superClass_ property to the
subclass, and a constructor property. |
void |
CodingConvention.applySubclassRelationship(FunctionType parentCtor,
FunctionType childCtor,
CodingConvention.SubclassType type)
In many JS libraries, the function that produces inheritance also
adds properties to the superclass and/or subclass.
|
private void |
TypeInference.backwardsInferenceFromCallSite(Node n,
FunctionType fnType)
We only do forward type inference.
|
java.util.Set<java.lang.String> |
GatherExternProperties.ExtractRecordTypePropertyNames.caseFunctionType(FunctionType type) |
private void |
TypeCheck.checkDeclaredPropertyInheritance(NodeTraversal t,
Node n,
FunctionType ctorType,
java.lang.String propertyName,
JSDocInfo info,
JSType propertyType)
Given a constructor type and a property name, check that the property has
the JSDoc annotation @override iff the property is declared on a
superclass.
|
(package private) void |
TypeValidator.expectAllInterfaceProperties(NodeTraversal t,
Node n,
FunctionType type)
Expect that all properties on interfaces that this type implements are
implemented and correctly typed.
|
private void |
TypedScopeCreator.AbstractScopeBuilder.finishConstructorDefinition(Node n,
java.lang.String variableName,
FunctionType fnType,
TypedScope scopeToDeclareIn,
CompilerInput input,
TypedVar newVar) |
SymbolTable.Symbol |
SymbolTable.getSymbolDeclaredBy(FunctionType fn)
Gets the symbol for the given constructor or interface.
|
SymbolTable.Symbol |
SymbolTable.getSymbolForInstancesOf(FunctionType fn)
Gets the symbol for the prototype of the given constructor or interface.
|
private static boolean |
TypeCheck.hasUnknownOrEmptySupertype(FunctionType ctor)
Given a constructor or an interface type, find out whether the unknown
type is a supertype of the current type.
|
(package private) FunctionTypeBuilder |
FunctionTypeBuilder.inferFromOverriddenFunction(FunctionType oldType,
Node paramsParent)
Infer the parameter and return types of a function from
the parameter and return types of the function it is overriding.
|
private boolean |
TypeInference.inferTemplatedTypesForCall(Node n,
FunctionType fnType)
For functions with function(this: T, ...) and T as parameters, type
inference will set the type of this on a function literal argument to the
the actual type of T.
|
private java.util.Map<TemplateType,JSType> |
TypeInference.inferTemplateTypesFromParameters(FunctionType fnType,
Node call) |
private FunctionType |
TypeInference.matchFunction(FunctionType expectedType,
FunctionType currentType,
boolean declared)
Take the current function type, and try to match the expected function
type.
|
private void |
FunctionTypeBuilder.maybeSetBaseType(FunctionType fnType) |
private NameReferenceGraph.Name |
NameReferenceGraphConstruction.Traversal.recordClassConstructorOrInterface(java.lang.String name,
FunctionType type,
Node n,
Node rhs)
Creates the name in the graph if it does not already exist.
|
private void |
DisambiguateProperties.recordInterfaces(FunctionType constructor,
JSType relatedType,
DisambiguateProperties.Property p)
Records that this property could be referenced from any interface that
this type, or any type in its superclass chain, implements.
|
private void |
NameReferenceGraphConstruction.Traversal.recordSubclassPrototypePropUse(FunctionType classType,
java.lang.String prop,
NameReferenceGraph.Reference ref)
Conservatively assumes that all subclass implementation of this property
might be called.
|
private void |
NameReferenceGraphConstruction.Traversal.recordSuperClassPrototypePropUse(FunctionType classType,
java.lang.String prop,
NameReferenceGraph.Reference ref)
Look for the super class implementation up the tree.
|
private boolean |
TypedScopeCreator.AbstractScopeBuilder.shouldUseFunctionLiteralType(FunctionType type,
JSDocInfo info,
Node lValue)
If a variable is assigned a function literal in the global scope,
make that a declared type (even if there's no doc info).
|
private void |
TypeInference.updateTypeOfParameters(Node n,
FunctionType fnType)
For functions with function parameters, type inference will set the type of
a function literal argument from the function parameter type.
|
(package private) static boolean |
ConformanceRules.ConformanceUtil.validateCall(AbstractCompiler compiler,
Node callOrNew,
FunctionType functionType,
boolean isCallInvocation)
Validate the parameters and the 'this' type, of a new or call.
|
private static boolean |
ConformanceRules.ConformanceUtil.validateParameterList(AbstractCompiler compiler,
Node callOrNew,
FunctionType functionType,
boolean isCallInvocation) |
private static boolean |
ConformanceRules.ConformanceUtil.validateThis(Node callOrNew,
FunctionType functionType,
boolean isCallInvocation) |
private void |
TypeCheck.visitParameterList(NodeTraversal t,
Node call,
FunctionType functionType)
Visits the parameters of a CALL or a NEW node.
|
Constructor and Description |
---|
Restriction(java.lang.String name,
FunctionType restrictedCallType) |
Restriction(java.lang.String type,
java.lang.String property,
FunctionType restrictedCallType) |
Modifier and Type | Method and Description |
---|---|
JSType |
ChainableReverseAbstractInterpreter.RestrictByTrueTypeOfResultVisitor.caseFunctionType(FunctionType type) |
JSType |
ChainableReverseAbstractInterpreter.RestrictByFalseTypeOfResultVisitor.caseFunctionType(FunctionType type) |
JSType |
ChainableReverseAbstractInterpreter.RestrictByOneTypeOfResultVisitor.caseFunctionType(FunctionType type) |
JSType |
SemanticReverseAbstractInterpreter.RestrictByTrueInstanceOfResultVisitor.caseFunctionType(FunctionType type) |
JSType |
SemanticReverseAbstractInterpreter.RestrictByFalseInstanceOfResultVisitor.caseFunctionType(FunctionType type) |
Modifier and Type | Class and Description |
---|---|
(package private) class |
ErrorFunctionType
This type is for built-in error constructors.
|
class |
NoObjectType
The bottom Object type, representing the subclass of all objects.
|
(package private) class |
NoResolvedType
An unresolved type that was forward declared.
|
class |
NoType
Bottom type, representing the subclass of any value or object.
|
Modifier and Type | Field and Description |
---|---|
private FunctionType |
InstanceObjectType.constructor |
private FunctionType |
PrototypeObjectType.ownerFunction |
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.Multimap<java.lang.String,FunctionType> |
JSTypeRegistry.interfaceToImplementors |
private java.util.List<FunctionType> |
FunctionType.subTypes
The types which are subtypes of this function.
|
Modifier and Type | Method and Description |
---|---|
FunctionType |
FunctionBuilder.build()
Construct a new function type.
|
FunctionType |
JSTypeRegistry.createConstructorType(java.lang.String name,
Node source,
Node parameters,
JSType returnType,
com.google.common.collect.ImmutableList<TemplateType> templateKeys)
Creates a constructor function type.
|
FunctionType |
JSTypeRegistry.createFunctionType(JSType returnType,
JSType... parameterTypes)
Creates a function type.
|
FunctionType |
JSTypeRegistry.createFunctionType(JSType returnType,
Node parameters) |
FunctionType |
JSTypeRegistry.createFunctionTypeWithNewReturnType(FunctionType existingFunctionType,
JSType returnType)
Creates a new function type based on an existing function type but
with a new return type.
|
FunctionType |
JSTypeRegistry.createFunctionTypeWithVarArgs(JSType returnType,
JSType... parameterTypes)
Creates a function type.
|
FunctionType |
JSTypeRegistry.createInterfaceType(java.lang.String name,
Node source,
com.google.common.collect.ImmutableList<TemplateType> templateKeys,
boolean struct)
Creates an interface function type.
|
private FunctionType |
JSTypeRegistry.createNativeFunctionType(JSType returnType,
Node parameters) |
private FunctionType |
JSTypeRegistry.createNativeFunctionTypeWithVarArgs(JSType returnType,
JSType... parameterTypes)
Creates a function type.
|
FunctionType |
FunctionType.forgetParameterAndReturnTypes()
Create a new constructor with the parameters and return type stripped.
|
(package private) static FunctionType |
FunctionType.forInterface(JSTypeRegistry registry,
java.lang.String name,
Node source,
TemplateTypeMap typeParameters)
Creates an instance for a function that is an interface.
|
FunctionType |
FunctionType.getBindReturnType(int argsToBind)
Get the return value of calling "bind" on this function
with the specified number of arguments.
|
private FunctionType |
FunctionType.getCallOrBindSignature(boolean isCall)
Notice that "call" and "bind" have the same argument signature,
except that all the arguments of "bind" (except the first)
are optional.
|
FunctionType |
EnumType.getConstructor() |
FunctionType |
UnknownType.getConstructor() |
FunctionType |
InstanceObjectType.getConstructor() |
FunctionType |
NoObjectType.getConstructor() |
FunctionType |
PrototypeObjectType.getConstructor() |
FunctionType |
ProxyObjectType.getConstructor() |
abstract FunctionType |
ObjectType.getConstructor()
Gets this object's constructor.
|
FunctionType |
EnumElementType.getConstructor() |
FunctionType |
JSTypeRegistry.getNativeFunctionType(JSTypeNative typeId) |
FunctionType |
PrototypeObjectType.getOwnerFunction() |
FunctionType |
ProxyObjectType.getOwnerFunction() |
FunctionType |
ObjectType.getOwnerFunction()
Gets the owner of this if it's a function prototype.
|
FunctionType |
FunctionType.getSuperClassConstructor()
Given a constructor or an interface type, get its superclass constructor
or
null if none exists. |
(package private) FunctionType |
FunctionType.supAndInfHelper(FunctionType that,
boolean leastSuper)
Computes the supremum or infimum of two functions.
|
FunctionType |
JSType.toMaybeFunctionType()
Downcasts this to a FunctionType, or returns null if this is not
a function.
|
FunctionType |
NoObjectType.toMaybeFunctionType() |
FunctionType |
ProxyObjectType.toMaybeFunctionType() |
FunctionType |
FunctionType.toMaybeFunctionType() |
static FunctionType |
JSType.toMaybeFunctionType(JSType type)
Null-safe version of toMaybeFunctionType().
|
private FunctionType |
FunctionType.tryMergeFunctionPiecewise(FunctionType other,
boolean leastSuper)
Try to get the sup/inf of two functions by looking at the
piecewise components.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<FunctionType> |
FunctionType.checkExtendsLoop()
check if there is a loop in the type extends chain
|
java.util.List<FunctionType> |
FunctionType.checkExtendsLoop(java.util.HashSet<FunctionType> cache,
java.util.List<FunctionType> path) |
java.util.Collection<FunctionType> |
JSTypeRegistry.getDirectImplementors(ObjectType interfaceInstance)
Returns a collection of types that directly implement
interfaceInstance . |
java.util.List<FunctionType> |
FunctionType.getSubTypes()
Returns a list of types that are subtypes of this type.
|
Modifier and Type | Method and Description |
---|---|
private void |
FunctionType.addSubType(FunctionType subType)
Adds a type to the list of subtypes for this type.
|
(package private) void |
FunctionType.addSubTypeIfNotPresent(FunctionType subType) |
(package private) boolean |
CanCastToVisitor.canCastToFunction(JSType thisType,
FunctionType functionType) |
T |
Visitor.caseFunctionType(FunctionType type)
Function type's case.
|
JSType |
ModificationVisitor.caseFunctionType(FunctionType type) |
T |
RelationshipVisitor.caseFunctionType(FunctionType thisType,
JSType thatType)
Function type's case.
|
java.lang.Boolean |
CanCastToVisitor.caseFunctionType(FunctionType thisType,
JSType thatType) |
(package private) boolean |
FunctionType.checkFunctionEquivalenceHelper(FunctionType that,
EquivalenceMethod eqMethod,
JSType.EqCache eqCache)
Two function types are equal if their signatures match.
|
FunctionBuilder |
FunctionBuilder.copyFromOtherFunction(FunctionType otherType)
Copies all the information from another function type.
|
FunctionType |
JSTypeRegistry.createFunctionTypeWithNewReturnType(FunctionType existingFunctionType,
JSType returnType)
Creates a new function type based on an existing function type but
with a new return type.
|
boolean |
FunctionType.explicitlyImplOrExtInterface(FunctionType interfaceType)
check whether or not this function type has implemented
the given interface
if this function is an interface, check whether or not
this interface has extended the given interface
|
boolean |
FunctionType.hasEqualCallType(FunctionType otherType) |
private boolean |
ModificationVisitor.isNativeFunctionType(FunctionType type) |
(package private) void |
JSTypeRegistry.registerTypeImplementingInterface(FunctionType type,
ObjectType interfaceInstance)
Tells the type system that
type implements interface interfaceInstance . |
(package private) void |
PrototypeObjectType.setOwnerFunction(FunctionType type) |
(package private) void |
ObjectType.setOwnerFunction(FunctionType type)
Sets the owner function.
|
(package private) FunctionType |
FunctionType.supAndInfHelper(FunctionType that,
boolean leastSuper)
Computes the supremum or infimum of two functions.
|
protected boolean |
FunctionType.treatThisTypesAsCovariant(FunctionType other,
JSType.ImplCache implicitImplCache) |
private FunctionType |
FunctionType.tryMergeFunctionPiecewise(FunctionType other,
boolean leastSuper)
Try to get the sup/inf of two functions by looking at the
piecewise components.
|
private static void |
FunctionType.updatePropertyTypeMap(FunctionType type,
java.util.Map<java.lang.String,JSType> propTypeMap,
java.util.HashSet<FunctionType> cache) |
Modifier and Type | Method and Description |
---|---|
java.util.List<FunctionType> |
FunctionType.checkExtendsLoop(java.util.HashSet<FunctionType> cache,
java.util.List<FunctionType> path) |
java.util.List<FunctionType> |
FunctionType.checkExtendsLoop(java.util.HashSet<FunctionType> cache,
java.util.List<FunctionType> path) |
private static void |
FunctionType.updatePropertyTypeMap(FunctionType type,
java.util.Map<java.lang.String,JSType> propTypeMap,
java.util.HashSet<FunctionType> cache) |
Constructor and Description |
---|
InstanceObjectType(JSTypeRegistry registry,
FunctionType constructor) |
InstanceObjectType(JSTypeRegistry registry,
FunctionType constructor,
boolean isNativeType) |
Modifier and Type | Field and Description |
---|---|
protected FunctionType |
BaseJSTypeTestCase.ARRAY_FUNCTION_TYPE |
protected FunctionType |
BaseJSTypeTestCase.FUNCTION_FUNCTION_TYPE |
protected FunctionType |
BaseJSTypeTestCase.FUNCTION_INSTANCE_TYPE |
protected FunctionType |
BaseJSTypeTestCase.OBJECT_FUNCTION_TYPE |
protected FunctionType |
BaseJSTypeTestCase.U2U_CONSTRUCTOR_TYPE |
protected FunctionType |
BaseJSTypeTestCase.U2U_FUNCTION_TYPE |