public static class CodingConventions.Proxy extends java.lang.Object implements CodingConvention
CodingConvention.AssertionFunctionSpec, CodingConvention.Bind, CodingConvention.Cache, 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(NominalTypeBuilder delegateSuperclass,
NominalTypeBuilder delegateBase,
NominalTypeBuilder delegator,
ObjectTypeI delegateProxy,
FunctionTypeI findDelegate)
In many JS libraries, the function that creates a delegate relationship
also adds properties to the delegator and delegate base.
|
void |
applySingletonGetter(NominalTypeBuilder classType,
FunctionTypeI getterType)
In many JS libraries, the function that adds a singleton getter to a class
adds properties to the class.
|
void |
applySubclassRelationship(NominalTypeBuilder parent,
NominalTypeBuilder child,
CodingConvention.SubclassType type)
In many JS libraries, the function that produces inheritance also
adds properties to the superclass and/or subclass.
|
boolean |
blockRenamingForProperty(java.lang.String name)
Check whether the property name is eligible for renaming.
|
void |
checkForCallingConventionDefinitions(Node n,
java.util.Map<java.lang.String,java.lang.String> delegateCallingConventions)
Checks for getprops that set the calling conventions on delegate methods.
|
void |
defineDelegateProxyPrototypeProperties(TypeIRegistry registry,
java.util.List<NominalTypeBuilder> delegateProxies,
java.util.Map<java.lang.String,java.lang.String> delegateCallingConventions)
Defines the delegate proxy prototype properties.
|
CodingConvention.Cache |
describeCachingCall(Node node)
Builds a
CodingConvention.Cache instance from the given call node and returns that instance, or null
if the Node does not resemble a cache utility call. |
CodingConvention.Bind |
describeFunctionBind(Node n)
A Bind instance or null.
|
CodingConvention.Bind |
describeFunctionBind(Node n,
boolean callerChecksTypes,
boolean iCheckTypes)
A Bind instance or null.
|
java.lang.String |
extractClassNameIfProvide(Node node,
Node parent)
Convenience method for determining provided dependencies amongst different
JS scripts.
|
java.lang.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).
|
java.lang.String |
getAbstractMethodName()
Function name for abstract methods.
|
java.util.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) |
java.lang.String |
getDelegateSuperclassName() |
java.lang.String |
getExportPropertyFunction()
Function name used when exporting properties.
|
java.lang.String |
getExportSymbolFunction()
Function name used when exporting symbols.
|
java.lang.String |
getGlobalObject()
Gets the name of the global object.
|
java.util.Collection<java.lang.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.
|
java.lang.String |
getPackageName(StaticSourceFile source) |
java.lang.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.
|
boolean |
hasPrivacyConvention()
Whether this CodingConvention includes a convention for what private names should look like.
|
java.util.List<java.lang.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 |
isAliasingGlobalThis(Node n)
Whether this statement is creating an alias of the global object
|
boolean |
isClassFactoryCall(Node callNode)
Checks if the given method is a call to a class factory, such a factory returns a
unique class.
|
boolean |
isConstant(java.lang.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(java.lang.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(java.lang.String name)
Should be isExported(name, true) || isExported(name, false);
|
boolean |
isExported(java.lang.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(java.lang.String name)
Checks whether a name should be considered private.
|
boolean |
isPropertyRenameFunction(java.lang.String name)
Whether this CALL function is returning the string name for a property, but allows renaming.
|
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(java.lang.String propertyName)
Returns true if passed a string referring to the superclass.
|
boolean |
isValidEnumKey(java.lang.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(java.lang.String variableName)
CodingConvention
isConstant
in interface CodingConvention
variableName
- potentially constant variable nametrue
if the name should be treated as a constant.public boolean isConstantKey(java.lang.String keyName)
CodingConvention
isConstantKey
in interface CodingConvention
public boolean isValidEnumKey(java.lang.String key)
CodingConvention
key
may be used as a key for an enum.isValidEnumKey
in interface CodingConvention
key
- the potential key to an enumtrue
if the key
may be used as an enum key,
false
otherwisepublic boolean isOptionalParameter(Node parameter)
CodingConvention
isOptionalParameter
in interface CodingConvention
parameter
- The parameter's node.true
if the parameter should be treated as an optional
parameter.public boolean isVarArgsParameter(Node parameter)
CodingConvention
isVarArgsParameter
in interface CodingConvention
parameter
- The parameter's node.true
if the parameter should be treated as a variable
length parameter.public boolean isFunctionCallThatAlwaysThrows(Node n)
CodingConvention
isFunctionCallThatAlwaysThrows
in interface CodingConvention
public boolean isExported(java.lang.String name, boolean local)
CodingConvention
isExported
in interface CodingConvention
name
- A global variable or function name.local
- true
if the name is a local variable.true
if the name should be considered exported.public final boolean isExported(java.lang.String name)
CodingConvention
isExported
in interface CodingConvention
public java.lang.String getPackageName(StaticSourceFile source)
getPackageName
in interface CodingConvention
public boolean blockRenamingForProperty(java.lang.String name)
CodingConvention
blockRenamingForProperty
in interface CodingConvention
name
- A property name.true
if the name can not be renamed.public boolean isPrivate(java.lang.String name)
CodingConvention
isPrivate
in interface CodingConvention
name
- The name of a global variable or function, or a method or
property.true
if the name should be considered private.public boolean hasPrivacyConvention()
CodingConvention
hasPrivacyConvention
in interface CodingConvention
public CodingConvention.SubclassRelationship getClassesDefinedByCall(Node callNode)
CodingConvention
getClassesDefinedByCall
in interface CodingConvention
callNode
- A CALL node.public boolean isClassFactoryCall(Node callNode)
CodingConvention
isClassFactoryCall
in interface CodingConvention
callNode
- A CALL node.public boolean isSuperClassReference(java.lang.String propertyName)
CodingConvention
isSuperClassReference
in interface CodingConvention
public boolean extractIsModuleFile(Node node, Node parent)
CodingConvention
extractIsModuleFile
in interface CodingConvention
public java.lang.String extractClassNameIfProvide(Node node, Node parent)
CodingConvention
extractClassNameIfProvide
in interface CodingConvention
public java.lang.String extractClassNameIfRequire(Node node, Node parent)
CodingConvention
extractClassNameIfRequire
in interface CodingConvention
public java.lang.String getExportPropertyFunction()
CodingConvention
getExportPropertyFunction
in interface CodingConvention
public java.lang.String getExportSymbolFunction()
CodingConvention
getExportSymbolFunction
in interface CodingConvention
public java.util.List<java.lang.String> identifyTypeDeclarationCall(Node n)
CodingConvention
identifyTypeDeclarationCall
in interface CodingConvention
public void applySubclassRelationship(NominalTypeBuilder parent, NominalTypeBuilder child, CodingConvention.SubclassType type)
CodingConvention
applySubclassRelationship
in interface CodingConvention
public java.lang.String getAbstractMethodName()
CodingConvention
getAbstractMethodName
in interface CodingConvention
public java.lang.String getSingletonGetterClassName(Node callNode)
CodingConvention
getSingletonGetterClassName
in interface CodingConvention
callNode
- A CALL node.public void applySingletonGetter(NominalTypeBuilder classType, FunctionTypeI getterType)
CodingConvention
applySingletonGetter
in interface CodingConvention
public boolean isInlinableFunction(Node n)
isInlinableFunction
in interface CodingConvention
public CodingConvention.DelegateRelationship getDelegateRelationship(Node callNode)
getDelegateRelationship
in interface CodingConvention
public void applyDelegateRelationship(NominalTypeBuilder delegateSuperclass, NominalTypeBuilder delegateBase, NominalTypeBuilder delegator, ObjectTypeI delegateProxy, FunctionTypeI findDelegate)
CodingConvention
applyDelegateRelationship
in interface CodingConvention
public java.lang.String getDelegateSuperclassName()
getDelegateSuperclassName
in interface CodingConvention
public void checkForCallingConventionDefinitions(Node n, java.util.Map<java.lang.String,java.lang.String> delegateCallingConventions)
CodingConvention
checkForCallingConventionDefinitions
in interface CodingConvention
public void defineDelegateProxyPrototypeProperties(TypeIRegistry registry, java.util.List<NominalTypeBuilder> delegateProxies, java.util.Map<java.lang.String,java.lang.String> delegateCallingConventions)
CodingConvention
defineDelegateProxyPrototypeProperties
in interface CodingConvention
delegateProxies
- List of delegate proxy types.public java.lang.String getGlobalObject()
CodingConvention
getGlobalObject
in interface CodingConvention
public boolean isAliasingGlobalThis(Node n)
CodingConvention
isAliasingGlobalThis
in interface CodingConvention
public java.util.Collection<CodingConvention.AssertionFunctionSpec> getAssertionFunctions()
CodingConvention
getAssertionFunctions
in interface CodingConvention
public CodingConvention.Bind describeFunctionBind(Node n)
CodingConvention
describeFunctionBind
in interface CodingConvention
public CodingConvention.Bind describeFunctionBind(Node n, boolean callerChecksTypes, boolean iCheckTypes)
CodingConvention
describeFunctionBind
in interface CodingConvention
callerChecksTypes
- 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 CodingConvention.Cache describeCachingCall(Node node)
CodingConvention
CodingConvention.Cache
instance from the given call node and returns that instance, or null
if the Node
does not resemble a cache utility call.
This should match calls to a cache utility method. This type of node is specially considered for side-effects since conventionally storing something on a cache object would be seen as a side-effect.
describeCachingCall
in interface CodingConvention
public boolean isPropertyTestFunction(Node call)
CodingConvention
isPropertyTestFunction
in interface CodingConvention
public boolean isPropertyRenameFunction(java.lang.String name)
CodingConvention
isPropertyRenameFunction
in interface CodingConvention
public boolean isPrototypeAlias(Node getProp)
CodingConvention
isPrototypeAlias
in interface CodingConvention
public CodingConvention.ObjectLiteralCast getObjectLiteralCast(Node callNode)
CodingConvention
getObjectLiteralCast
in interface CodingConvention
callNode
- A CALL node.public java.util.Collection<java.lang.String> getIndirectlyDeclaredProperties()
CodingConvention
getIndirectlyDeclaredProperties
in interface CodingConvention
Copyright © 2009-2018 Google. All Rights Reserved.