|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CodingConvention
CodingConvention defines a set of hooks to customize the behavior of the Compiler for a specific team/company.
Nested Class Summary | |
---|---|
static class |
CodingConvention.AssertionFunctionSpec
A function that will throw an exception when either: -One or more of its parameters evaluate to false. |
static class |
CodingConvention.Bind
Bind class |
static class |
CodingConvention.DelegateRelationship
Delegates provides a mechanism and structure for identifying where classes can call out to optional code to augment their functionality. |
static class |
CodingConvention.ObjectLiteralCast
An object literal cast provides a mechanism to cast object literals to other types without a warning. |
static class |
CodingConvention.SubclassRelationship
Record subclass relations |
static class |
CodingConvention.SubclassType
Specify the kind of inheritance |
Method Summary | |
---|---|
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 |
applySingletonGetter(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,
StaticScope<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 useTypeInfo)
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. |
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 |
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 |
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. |
Method Detail |
---|
boolean isConstant(String variableName)
variableName
- potentially constant variable name
true
if the name should be treated as a constant.boolean isConstantKey(String keyName)
boolean isValidEnumKey(String key)
key
may be used as a key for an enum.
key
- the potential key to an enum
true
if the key
may be used as an enum key,
false
otherwiseboolean isOptionalParameter(Node parameter)
parameter
- The parameter's node.
true
if the parameter should be treated as an optional
parameter.boolean isVarArgsParameter(Node parameter)
parameter
- The parameter's node.
true
if the parameter should be treated as a variable
length parameter.boolean isExported(String name, boolean local)
name
- A global variable or function name.local
- true
if the name is a local variable.
true
if the name should be considered exported.boolean isExported(String name)
boolean isPrivate(String name)
name
- The name of a global variable or function, or a method or
property.
true
if the name should be considered private.CodingConvention.SubclassRelationship getClassesDefinedByCall(Node callNode)
callNode
- A CALL node.boolean isSuperClassReference(String propertyName)
String extractClassNameIfProvide(Node node, Node parent)
String extractClassNameIfRequire(Node node, Node parent)
String getExportPropertyFunction()
String getExportSymbolFunction()
List<String> identifyTypeDeclarationCall(Node n)
void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, CodingConvention.SubclassType type)
String getAbstractMethodName()
String getSingletonGetterClassName(Node callNode)
callNode
- A CALL node.void applySingletonGetter(FunctionType functionType, FunctionType getterType, ObjectType objectType)
boolean isInlinableFunction(Node n)
CodingConvention.DelegateRelationship getDelegateRelationship(Node callNode)
void applyDelegateRelationship(ObjectType delegateSuperclass, ObjectType delegateBase, ObjectType delegator, FunctionType delegateProxy, FunctionType findDelegate)
String getDelegateSuperclassName()
void checkForCallingConventionDefiningCalls(Node n, Map<String,String> delegateCallingConventions)
void defineDelegateProxyPrototypeProperties(JSTypeRegistry registry, StaticScope<JSType> scope, List<ObjectType> delegateProxyPrototypes, Map<String,String> delegateCallingConventions)
delegateProxyPrototypes
- List of delegate proxy prototypes.String getGlobalObject()
CodingConvention.Bind describeFunctionBind(Node n)
CodingConvention.Bind describeFunctionBind(Node n, boolean useTypeInfo)
useTypeInfo
- If we believe type information is reliable enough
to use to figure out what the bind function is.boolean isPropertyTestFunction(Node call)
boolean isPrototypeAlias(Node getProp)
CodingConvention.ObjectLiteralCast getObjectLiteralCast(Node callNode)
callNode
- A CALL node.Collection<String> getIndirectlyDeclaredProperties()
Collection<CodingConvention.AssertionFunctionSpec> getAssertionFunctions()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |