public static class CodingConventions.Proxy extends Object implements CodingConvention
CodingConvention.AssertionFunctionSpec, CodingConvention.Bind, CodingConvention.DelegateRelationship, CodingConvention.ObjectLiteralCast, CodingConvention.SubclassRelationship, CodingConvention.SubclassType| Modifier and Type | Field and Description |
|---|---|
protected CodingConvention |
nextConvention |
| Modifier | Constructor and Description |
|---|---|
protected |
Proxy(CodingConvention convention) |
| Modifier and Type | Method and Description |
|---|---|
void |
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 |
applySingletonGetterNew(RawNominalType rawType,
JSType getInstanceType,
JSType instanceType) |
void |
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 |
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.
|
void |
checkForCallingConventionDefiningCalls(Node n,
Map<String,String> delegateCallingConventions)
Checks for function calls that set the calling conventions on delegate
methods.
|
void |
defineDelegateProxyPrototypeProperties(JSTypeRegistry registry,
StaticTypedScope<JSType> scope,
List<ObjectType> delegateProxyPrototypes,
Map<String,String> delegateCallingConventions)
Defines the delegate proxy prototype properties.
|
CodingConvention.Bind |
describeFunctionBind(Node n)
A Bind instance or null.
|
CodingConvention.Bind |
describeFunctionBind(Node n,
boolean callerChecksTypes,
boolean iCheckTypes)
A Bind instance or null.
|
String |
extractClassNameIfProvide(Node node,
Node parent)
Convenience method for determining provided dependencies amongst different
JS scripts.
|
String |
extractClassNameIfRequire(Node node,
Node parent)
Convenience method for determining required dependencies amongst different
JS scripts.
|
boolean |
extractIsModuleFile(Node node,
Node parent)
Convenience method for determining if the node indicates the file
is a "module" file (a file whose top level symbols are not in global
scope).
|
String |
getAbstractMethodName()
Function name for abstract methods.
|
Collection<CodingConvention.AssertionFunctionSpec> |
getAssertionFunctions()
Returns the set of AssertionFunction.
|
CodingConvention.SubclassRelationship |
getClassesDefinedByCall(Node callNode)
Checks if the given method defines a subclass relationship,
and if it does, returns information on that relationship.
|
CodingConvention.DelegateRelationship |
getDelegateRelationship(Node callNode) |
String |
getDelegateSuperclassName() |
String |
getExportPropertyFunction()
Function name used when exporting properties.
|
String |
getExportSymbolFunction()
Function name used when exporting symbols.
|
String |
getGlobalObject()
Gets the name of the global object.
|
Collection<String> |
getIndirectlyDeclaredProperties()
Gets a collection of all properties that are defined indirectly on global
objects.
|
CodingConvention.ObjectLiteralCast |
getObjectLiteralCast(Node callNode)
Checks if the given method performs a object literal cast, and if it does,
returns information on the cast.
|
String |
getPackageName(StaticSourceFile source) |
String |
getSingletonGetterClassName(Node callNode)
Checks if the given method defines a singleton getter, and if it does,
returns the name of the class with the singleton getter.
|
List<String> |
identifyTypeDeclarationCall(Node n)
Checks if the given CALL node is forward-declaring any types,
and returns the name of the types if it is.
|
boolean |
isConstant(String variableName)
This checks whether a given variable name, such as a name in all-caps
should be treated as if it had the @const annotation.
|
boolean |
isConstantKey(String keyName)
This checks whether a given key of an object literal, such as a
name in all-caps should be treated as if it had the @const
annotation.
|
boolean |
isExported(String name)
Should be isExported(name, true) || isExported(name, false);
|
boolean |
isExported(String name,
boolean local)
Checks whether a global variable or function name should be treated as
exported, or externally referenceable.
|
boolean |
isFunctionCallThatAlwaysThrows(Node n)
Used by CheckMissingReturn.
|
boolean |
isInlinableFunction(Node n) |
boolean |
isOptionalParameter(Node parameter)
This checks whether a given parameter name should be treated as an
optional parameter as far as type checking or function call arg count
checking is concerned.
|
boolean |
isPrivate(String name)
Checks whether a name should be considered private.
|
boolean |
isPropertyTestFunction(Node call)
Whether this CALL function is testing for the existence of a property.
|
boolean |
isPrototypeAlias(Node getProp)
Whether this GETPROP node is an alias for an object prototype.
|
boolean |
isSuperClassReference(String propertyName)
Returns true if passed a string referring to the superclass.
|
boolean |
isValidEnumKey(String key)
This checks that a given
key may be used as a key for an enum. |
boolean |
isVarArgsParameter(Node parameter)
This checks whether a given parameter should be treated as a marker
for a variable argument list function.
|
protected final CodingConvention nextConvention
protected Proxy(CodingConvention convention)
public boolean isConstant(String variableName)
CodingConventionisConstant in interface CodingConventionvariableName - potentially constant variable nametrue if the name should be treated as a constant.public boolean isConstantKey(String keyName)
CodingConventionisConstantKey in interface CodingConventionpublic boolean isValidEnumKey(String key)
CodingConventionkey may be used as a key for an enum.isValidEnumKey in interface CodingConventionkey - the potential key to an enumtrue if the key may be used as an enum key,
false otherwisepublic boolean isOptionalParameter(Node parameter)
CodingConventionisOptionalParameter in interface CodingConventionparameter - The parameter's node.true if the parameter should be treated as an optional
parameter.public boolean isVarArgsParameter(Node parameter)
CodingConventionisVarArgsParameter in interface CodingConventionparameter - The parameter's node.true if the parameter should be treated as a variable
length parameter.public boolean isFunctionCallThatAlwaysThrows(Node n)
CodingConventionisFunctionCallThatAlwaysThrows in interface CodingConventionpublic boolean isExported(String name, boolean local)
CodingConventionisExported in interface CodingConventionname - A global variable or function name.local - true if the name is a local variable.true if the name should be considered exported.public String getPackageName(StaticSourceFile source)
getPackageName in interface CodingConventionpublic final boolean isExported(String name)
CodingConventionisExported in interface CodingConventionpublic boolean isPrivate(String name)
CodingConventionisPrivate in interface CodingConventionname - The name of a global variable or function, or a method or
property.true if the name should be considered private.public CodingConvention.SubclassRelationship getClassesDefinedByCall(Node callNode)
CodingConventiongetClassesDefinedByCall in interface CodingConventioncallNode - A CALL node.public boolean isSuperClassReference(String propertyName)
CodingConventionisSuperClassReference in interface CodingConventionpublic boolean extractIsModuleFile(Node node, Node parent)
CodingConventionextractIsModuleFile in interface CodingConventionpublic String extractClassNameIfProvide(Node node, Node parent)
CodingConventionextractClassNameIfProvide in interface CodingConventionpublic String extractClassNameIfRequire(Node node, Node parent)
CodingConventionextractClassNameIfRequire in interface CodingConventionpublic String getExportPropertyFunction()
CodingConventiongetExportPropertyFunction in interface CodingConventionpublic String getExportSymbolFunction()
CodingConventiongetExportSymbolFunction in interface CodingConventionpublic List<String> identifyTypeDeclarationCall(Node n)
CodingConventionidentifyTypeDeclarationCall in interface CodingConventionpublic void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, CodingConvention.SubclassType type)
CodingConventionapplySubclassRelationship in interface CodingConventionpublic String getAbstractMethodName()
CodingConventiongetAbstractMethodName in interface CodingConventionpublic String getSingletonGetterClassName(Node callNode)
CodingConventiongetSingletonGetterClassName in interface CodingConventioncallNode - A CALL node.public void applySingletonGetterOld(FunctionType functionType, FunctionType getterType, ObjectType objectType)
CodingConventionapplySingletonGetterOld in interface CodingConventionpublic void applySingletonGetterNew(RawNominalType rawType, JSType getInstanceType, JSType instanceType)
applySingletonGetterNew in interface CodingConventionpublic boolean isInlinableFunction(Node n)
isInlinableFunction in interface CodingConventionpublic CodingConvention.DelegateRelationship getDelegateRelationship(Node callNode)
getDelegateRelationship in interface CodingConventionpublic void applyDelegateRelationship(ObjectType delegateSuperclass, ObjectType delegateBase, ObjectType delegator, FunctionType delegateProxy, FunctionType findDelegate)
CodingConventionapplyDelegateRelationship in interface CodingConventionpublic String getDelegateSuperclassName()
getDelegateSuperclassName in interface CodingConventionpublic void checkForCallingConventionDefiningCalls(Node n, Map<String,String> delegateCallingConventions)
CodingConventioncheckForCallingConventionDefiningCalls in interface CodingConventionpublic void defineDelegateProxyPrototypeProperties(JSTypeRegistry registry, StaticTypedScope<JSType> scope, List<ObjectType> delegateProxyPrototypes, Map<String,String> delegateCallingConventions)
CodingConventiondefineDelegateProxyPrototypeProperties in interface CodingConventiondelegateProxyPrototypes - List of delegate proxy prototypes.public String getGlobalObject()
CodingConventiongetGlobalObject in interface CodingConventionpublic Collection<CodingConvention.AssertionFunctionSpec> getAssertionFunctions()
CodingConventiongetAssertionFunctions in interface CodingConventionpublic CodingConvention.Bind describeFunctionBind(Node n)
CodingConventiondescribeFunctionBind in interface CodingConventionpublic CodingConvention.Bind describeFunctionBind(Node n, boolean callerChecksTypes, boolean iCheckTypes)
CodingConventiondescribeFunctionBind in interface CodingConventioncallerChecksTypes - Trust that the caller of this method has verified
that the bound node has a function type.iCheckTypes - Check that the bound node has a function type.public boolean isPropertyTestFunction(Node call)
CodingConventionisPropertyTestFunction in interface CodingConventionpublic boolean isPrototypeAlias(Node getProp)
CodingConventionisPrototypeAlias in interface CodingConventionpublic CodingConvention.ObjectLiteralCast getObjectLiteralCast(Node callNode)
CodingConventiongetObjectLiteralCast in interface CodingConventioncallNode - A CALL node.public Collection<String> getIndirectlyDeclaredProperties()
CodingConventiongetIndirectlyDeclaredProperties in interface CodingConventionCopyright © 2009-2015 Google. All Rights Reserved.