public final class ClosureCodingConvention extends CodingConventions.Proxy
| Modifier and Type | Class and Description |
|---|---|
static class |
ClosureCodingConvention.AssertFunctionByTypeName
A function that will throw an exception when the value is not an
instanceof the given type name, for instance "Element".
|
static class |
ClosureCodingConvention.AssertInstanceofSpec
A function that will throw an exception when if the value is not
an instanceof a specific type.
|
CodingConvention.AssertionFunctionSpec, CodingConvention.Bind, CodingConvention.DelegateRelationship, CodingConvention.ObjectLiteralCast, CodingConvention.SubclassRelationship, CodingConvention.SubclassTypenextConvention| Constructor and Description |
|---|
ClosureCodingConvention() |
ClosureCodingConvention(CodingConvention wrapped) |
| Modifier and Type | Method and Description |
|---|---|
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)
Closure's goog.inherits adds a
superClass_ property to the
subclass, and a constructor property. |
CodingConvention.Bind |
describeFunctionBind(Node n,
boolean callerChecksTypes,
boolean iCheckTypes)
A Bind instance or null.
|
String |
extractClassNameIfProvide(Node node,
Node parent)
Extracts X from goog.provide('X'), if the applied Node is goog.
|
String |
extractClassNameIfRequire(Node node,
Node parent)
Extracts X from goog.require('X'), if the applied Node is goog.
|
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.
|
String |
getExportPropertyFunction()
Use closure's implementation.
|
String |
getExportSymbolFunction()
Use closure's implementation.
|
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 |
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 |
isFunctionCallThatAlwaysThrows(Node n)
Used by CheckMissingReturn.
|
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 |
isSuperClassReference(String propertyName)
Returns true if passed a string referring to the superclass.
|
applyDelegateRelationship, checkForCallingConventionDefiningCalls, defineDelegateProxyPrototypeProperties, describeFunctionBind, getDelegateRelationship, getDelegateSuperclassName, getPackageName, isConstant, isConstantKey, isExported, isExported, isInlinableFunction, isOptionalParameter, isPrototypeAlias, isValidEnumKey, isVarArgsParameterpublic ClosureCodingConvention()
public ClosureCodingConvention(CodingConvention wrapped)
public void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, CodingConvention.SubclassType type)
superClass_ property to the
subclass, and a constructor property.applySubclassRelationship in interface CodingConventionapplySubclassRelationship in class CodingConventions.Proxypublic CodingConvention.SubclassRelationship getClassesDefinedByCall(Node callNode)
Understands several different inheritance patterns that occur in
Google code (various uses of inherits and mixin).
getClassesDefinedByCall in interface CodingConventiongetClassesDefinedByCall in class CodingConventions.ProxycallNode - A CALL node.public boolean isSuperClassReference(String propertyName)
CodingConventionisSuperClassReference in interface CodingConventionisSuperClassReference in class CodingConventions.Proxypublic boolean extractIsModuleFile(Node node, Node parent)
CodingConventionextractIsModuleFile in interface CodingConventionextractIsModuleFile in class CodingConventions.Proxypublic String extractClassNameIfProvide(Node node, Node parent)
extractClassNameIfProvide in interface CodingConventionextractClassNameIfProvide in class CodingConventions.Proxypublic String extractClassNameIfRequire(Node node, Node parent)
extractClassNameIfRequire in interface CodingConventionextractClassNameIfRequire in class CodingConventions.Proxypublic String getExportPropertyFunction()
getExportPropertyFunction in interface CodingConventiongetExportPropertyFunction in class CodingConventions.Proxypublic String getExportSymbolFunction()
getExportSymbolFunction in interface CodingConventiongetExportSymbolFunction in class CodingConventions.Proxypublic List<String> identifyTypeDeclarationCall(Node n)
CodingConventionidentifyTypeDeclarationCall in interface CodingConventionidentifyTypeDeclarationCall in class CodingConventions.Proxypublic String getAbstractMethodName()
CodingConventiongetAbstractMethodName in interface CodingConventiongetAbstractMethodName in class CodingConventions.Proxypublic String getSingletonGetterClassName(Node callNode)
CodingConventiongetSingletonGetterClassName in interface CodingConventiongetSingletonGetterClassName in class CodingConventions.ProxycallNode - A CALL node.public void applySingletonGetterOld(FunctionType functionType, FunctionType getterType, ObjectType objectType)
CodingConventionapplySingletonGetterOld in interface CodingConventionapplySingletonGetterOld in class CodingConventions.Proxypublic void applySingletonGetterNew(RawNominalType rawType, JSType getInstanceType, JSType instanceType)
applySingletonGetterNew in interface CodingConventionapplySingletonGetterNew in class CodingConventions.Proxypublic String getGlobalObject()
CodingConventiongetGlobalObject in interface CodingConventiongetGlobalObject in class CodingConventions.Proxypublic boolean isPropertyTestFunction(Node call)
CodingConventionisPropertyTestFunction in interface CodingConventionisPropertyTestFunction in class CodingConventions.Proxypublic boolean isFunctionCallThatAlwaysThrows(Node n)
CodingConventionisFunctionCallThatAlwaysThrows in interface CodingConventionisFunctionCallThatAlwaysThrows in class CodingConventions.Proxypublic CodingConvention.ObjectLiteralCast getObjectLiteralCast(Node callNode)
CodingConventiongetObjectLiteralCast in interface CodingConventiongetObjectLiteralCast in class CodingConventions.ProxycallNode - A CALL node.public boolean isPrivate(String name)
CodingConventionisPrivate in interface CodingConventionisPrivate in class CodingConventions.Proxyname - The name of a global variable or function, or a method or
property.true if the name should be considered private.public Collection<CodingConvention.AssertionFunctionSpec> getAssertionFunctions()
CodingConventiongetAssertionFunctions in interface CodingConventiongetAssertionFunctions in class CodingConventions.Proxypublic CodingConvention.Bind describeFunctionBind(Node n, boolean callerChecksTypes, boolean iCheckTypes)
CodingConventiondescribeFunctionBind in interface CodingConventiondescribeFunctionBind in class CodingConventions.ProxycallerChecksTypes - 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 Collection<String> getIndirectlyDeclaredProperties()
CodingConventiongetIndirectlyDeclaredProperties in interface CodingConventiongetIndirectlyDeclaredProperties in class CodingConventions.ProxyCopyright © 2009-2015 Google. All Rights Reserved.