|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.javascript.jscomp.DefaultCodingConvention
com.google.javascript.jscomp.ClosureCodingConvention
public class ClosureCodingConvention
This describes the Closure-specific JavaScript coding conventions.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.google.javascript.jscomp.CodingConvention |
|---|
CodingConvention.AssertionFunctionSpec, CodingConvention.DelegateRelationship, CodingConvention.ObjectLiteralCast, CodingConvention.SubclassRelationship, CodingConvention.SubclassType |
| Constructor Summary | |
|---|---|
ClosureCodingConvention()
|
|
| Method Summary | |
|---|---|
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)
Closure's goog.inherits adds a superClass_ property to the
subclass, and a constructor property. |
String |
extractClassNameIfProvide(Node node,
Node parent)
Exctracts X from goog.provide('X'), if the applied Node is goog. |
String |
extractClassNameIfRequire(Node node,
Node parent)
Exctracts X from goog.require('X'), if the applied Node is goog. |
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. |
CodingConvention.ObjectLiteralCast |
getObjectLiteralCast(NodeTraversal t,
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. |
String |
identifyTypeDefAssign(Node n)
Checks if the given ASSIGN node is a typedef, and returns the name of the type if it is. |
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 |
isSuperClassReference(String propertyName)
Returns true if passed a string referring to the superclass. |
boolean |
isVarArgsParameter(Node parameter)
This checks whether a given parameter should be treated as a marker for a variable argument list function. |
| Methods inherited from class com.google.javascript.jscomp.DefaultCodingConvention |
|---|
applyDelegateRelationship, defineDelegateProxyPrototypeProperties, getDelegateRelationship, getDelegateSuperclassName, isConstant, isConstantKey, isExported, isExported, isValidEnumKey |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClosureCodingConvention()
| Method Detail |
|---|
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 DefaultCodingConventionpublic 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 DefaultCodingConventioncallNode - A CALL node.public boolean isSuperClassReference(String propertyName)
CodingConvention
isSuperClassReference in interface CodingConventionisSuperClassReference in class DefaultCodingConvention
public String extractClassNameIfProvide(Node node,
Node parent)
extractClassNameIfProvide in interface CodingConventionextractClassNameIfProvide in class DefaultCodingConvention
public String extractClassNameIfRequire(Node node,
Node parent)
extractClassNameIfRequire in interface CodingConventionextractClassNameIfRequire in class DefaultCodingConventionpublic String getExportPropertyFunction()
getExportPropertyFunction in interface CodingConventiongetExportPropertyFunction in class DefaultCodingConventionpublic String getExportSymbolFunction()
getExportSymbolFunction in interface CodingConventiongetExportSymbolFunction in class DefaultCodingConventionpublic List<String> identifyTypeDeclarationCall(Node n)
CodingConvention
identifyTypeDeclarationCall in interface CodingConventionidentifyTypeDeclarationCall in class DefaultCodingConventionpublic String identifyTypeDefAssign(Node n)
CodingConvention
identifyTypeDefAssign in interface CodingConventionidentifyTypeDefAssign in class DefaultCodingConventionpublic String getAbstractMethodName()
CodingConvention
getAbstractMethodName in interface CodingConventiongetAbstractMethodName in class DefaultCodingConventionpublic String getSingletonGetterClassName(Node callNode)
CodingConvention
getSingletonGetterClassName in interface CodingConventiongetSingletonGetterClassName in class DefaultCodingConventioncallNode - A CALL node.
public void applySingletonGetter(FunctionType functionType,
FunctionType getterType,
ObjectType objectType)
CodingConvention
applySingletonGetter in interface CodingConventionapplySingletonGetter in class DefaultCodingConventionpublic String getGlobalObject()
CodingConvention
getGlobalObject in interface CodingConventiongetGlobalObject in class DefaultCodingConventionpublic boolean isPropertyTestFunction(Node call)
CodingConvention
isPropertyTestFunction in interface CodingConventionisPropertyTestFunction in class DefaultCodingConvention
public CodingConvention.ObjectLiteralCast getObjectLiteralCast(NodeTraversal t,
Node callNode)
CodingConvention
getObjectLiteralCast in interface CodingConventiongetObjectLiteralCast in class DefaultCodingConventiont - The node traversal.callNode - A CALL node.public boolean isOptionalParameter(Node parameter)
CodingConvention
isOptionalParameter in interface CodingConventionisOptionalParameter in class DefaultCodingConventionparameter - The parameter's node.
true if the parameter should be treated as an optional
parameter.public boolean isVarArgsParameter(Node parameter)
CodingConvention
isVarArgsParameter in interface CodingConventionisVarArgsParameter in class DefaultCodingConventionparameter - The parameter's node.
true if the parameter should be treated as a variable
length parameter.public boolean isPrivate(String name)
CodingConvention
isPrivate in interface CodingConventionisPrivate in class DefaultCodingConventionname - 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()
CodingConvention
getAssertionFunctions in interface CodingConventiongetAssertionFunctions in class DefaultCodingConvention
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||