本文整理汇总了Java中com.google.javascript.jscomp.CodingConvention.DelegateRelationship类的典型用法代码示例。如果您正苦于以下问题:Java DelegateRelationship类的具体用法?Java DelegateRelationship怎么用?Java DelegateRelationship使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DelegateRelationship类属于com.google.javascript.jscomp.CodingConvention包,在下文中一共展示了DelegateRelationship类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applyDelegateRelationship
import com.google.javascript.jscomp.CodingConvention.DelegateRelationship; //导入依赖的package包/类
/**
* Apply special properties that only apply to delegates.
*/
private void applyDelegateRelationship(
DelegateRelationship delegateRelationship) {
ObjectType delegatorObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegator));
ObjectType delegateBaseObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegateBase));
ObjectType delegateSuperObject = ObjectType.cast(
typeRegistry.getType(codingConvention.getDelegateSuperclassName()));
if (delegatorObject != null &&
delegateBaseObject != null &&
delegateSuperObject != null) {
FunctionType delegatorCtor = delegatorObject.getConstructor();
FunctionType delegateBaseCtor = delegateBaseObject.getConstructor();
FunctionType delegateSuperCtor = delegateSuperObject.getConstructor();
if (delegatorCtor != null && delegateBaseCtor != null &&
delegateSuperCtor != null) {
FunctionParamBuilder functionParamBuilder =
new FunctionParamBuilder(typeRegistry);
functionParamBuilder.addRequiredParams(
typeRegistry.getNativeType(U2U_CONSTRUCTOR_TYPE));
FunctionType findDelegate = typeRegistry.createFunctionType(
typeRegistry.createDefaultObjectUnion(delegateBaseObject),
functionParamBuilder.build());
FunctionType delegateProxy = typeRegistry.createConstructorType(
delegateBaseObject.getReferenceName() + DELEGATE_PROXY_SUFFIX,
null, null, null);
delegateProxy.setPrototypeBasedOn(delegateBaseObject);
codingConvention.applyDelegateRelationship(
delegateSuperObject, delegateBaseObject, delegatorObject,
delegateProxy, findDelegate);
delegateProxyPrototypes.add(delegateProxy.getPrototype());
}
}
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:41,代码来源:TypedScopeCreator.java
示例2: applyDelegateRelationship
import com.google.javascript.jscomp.CodingConvention.DelegateRelationship; //导入依赖的package包/类
/**
* Apply special properties that only apply to delegates.
*/
private void applyDelegateRelationship(
DelegateRelationship delegateRelationship) {
ObjectType delegatorObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegator));
ObjectType delegateBaseObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegateBase));
ObjectType delegateSuperObject = ObjectType.cast(
typeRegistry.getType(codingConvention.getDelegateSuperclassName()));
if (delegatorObject != null &&
delegateBaseObject != null &&
delegateSuperObject != null) {
FunctionType delegatorCtor = delegatorObject.getConstructor();
FunctionType delegateBaseCtor = delegateBaseObject.getConstructor();
FunctionType delegateSuperCtor = delegateSuperObject.getConstructor();
if (delegatorCtor != null && delegateBaseCtor != null &&
delegateSuperCtor != null) {
FunctionParamBuilder functionParamBuilder =
new FunctionParamBuilder(typeRegistry);
functionParamBuilder.addRequiredParams(
getNativeType(U2U_CONSTRUCTOR_TYPE));
FunctionType findDelegate = typeRegistry.createFunctionType(
typeRegistry.createDefaultObjectUnion(delegateBaseObject),
functionParamBuilder.build());
FunctionType delegateProxy = typeRegistry.createConstructorType(
delegateBaseObject.getReferenceName() + DELEGATE_PROXY_SUFFIX,
null, null, null, null);
delegateProxy.setPrototypeBasedOn(delegateBaseObject);
codingConvention.applyDelegateRelationship(
delegateSuperObject, delegateBaseObject, delegatorObject,
delegateProxy, findDelegate);
delegateProxyPrototypes.add(delegateProxy.getPrototype());
}
}
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:41,代码来源:TypedScopeCreator.java
示例3: visitCall
import com.google.javascript.jscomp.CodingConvention.DelegateRelationship; //导入依赖的package包/类
private void visitCall(Node call) {
// Check various coding conventions to see if any additional handling is needed.
SubclassRelationship relationship = convention.getClassesDefinedByCall(call);
if (relationship != null) {
applySubclassRelationship(relationship);
}
String className = convention.getSingletonGetterClassName(call);
if (className != null) {
applySingletonGetter(className);
}
DelegateRelationship delegateRelationship = convention.getDelegateRelationship(call);
if (delegateRelationship != null) {
applyDelegateRelationship(delegateRelationship);
}
}
开发者ID:google,项目名称:closure-compiler,代码行数:16,代码来源:GlobalTypeInfoCollector.java
示例4: applyDelegateRelationship
import com.google.javascript.jscomp.CodingConvention.DelegateRelationship; //导入依赖的package包/类
private void applyDelegateRelationship(DelegateRelationship rel) {
RawNominalType delegateBase = findInScope(rel.delegateBase);
RawNominalType delegator = findInScope(rel.delegator);
RawNominalType delegateSuper = findInScope(convention.getDelegateSuperclassName());
// Note: OTI also verified that getConstructor() was non-null on each of these, but since
// they're all coming from RawNominalTypes, there should be no way that can fail here.
if (delegator != null && delegateBase != null && delegateSuper != null) {
// A function that takes some constructor, and returns the corresponding delegate.
JSType findDelegate =
new FunctionTypeBuilder(getCommonTypes())
.addReqFormal(getCommonTypes().qmarkFunction())
.addRetType(JSType.join(getCommonTypes().NULL, delegateBase.getInstanceAsJSType()))
.buildType();
// Normally, types are defined during CollectNamedTypes, but here we are defining a class
// during ProcessScope. (We do add it to nominaltypesByNode with a fake defSite.)
// The late creation doesn't seem to cause an issue, but worth noting.
RawNominalType delegateProxy = RawNominalType.makeClass(
getCommonTypes(),
delegateBase.getDefSite() /* defSite */,
delegateBase.getName() + "(Proxy)" /* name */,
null /* typeParameters */,
ObjectKind.UNRESTRICTED,
false /* isAbstract */);
nominaltypesByNode.put(new Node(null), delegateProxy);
delegateProxy.addSuperClass(delegateBase.getAsNominalType());
delegateProxy.setCtorFunction(
new FunctionTypeBuilder(getCommonTypes())
.addRetType(delegateProxy.getInstanceAsJSType())
.addNominalType(delegateProxy.getInstanceAsJSType())
.buildFunction());
convention.applyDelegateRelationship(
new NominalTypeBuilderNti(delegateSuper.getAsNominalType()),
new NominalTypeBuilderNti(delegateBase.getAsNominalType()),
new NominalTypeBuilderNti(delegator.getAsNominalType()),
delegateProxy.getInstanceAsJSType(),
findDelegate);
delegateProxies.add(new NominalTypeBuilderNti(delegateProxy.getAsNominalType()));
}
}
开发者ID:google,项目名称:closure-compiler,代码行数:41,代码来源:GlobalTypeInfoCollector.java
示例5: applyDelegateRelationship
import com.google.javascript.jscomp.CodingConvention.DelegateRelationship; //导入依赖的package包/类
/**
* Apply special properties that only apply to delegates.
*/
private void applyDelegateRelationship(
DelegateRelationship delegateRelationship) {
ObjectType delegatorObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegator));
ObjectType delegateBaseObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegateBase));
ObjectType delegateSuperObject = ObjectType.cast(
typeRegistry.getType(codingConvention.getDelegateSuperclassName()));
if (delegatorObject != null &&
delegateBaseObject != null &&
delegateSuperObject != null) {
FunctionType delegatorCtor = delegatorObject.getConstructor();
FunctionType delegateBaseCtor = delegateBaseObject.getConstructor();
FunctionType delegateSuperCtor = delegateSuperObject.getConstructor();
if (delegatorCtor != null && delegateBaseCtor != null &&
delegateSuperCtor != null) {
FunctionParamBuilder functionParamBuilder =
new FunctionParamBuilder(typeRegistry);
functionParamBuilder.addRequiredParams(
getNativeType(U2U_CONSTRUCTOR_TYPE));
FunctionType findDelegate = typeRegistry.createFunctionType(
typeRegistry.createDefaultObjectUnion(delegateBaseObject),
functionParamBuilder.build());
FunctionType delegateProxy =
typeRegistry.createConstructorType(
delegateBaseObject.getReferenceName() + DELEGATE_PROXY_SUFFIX /* name */,
null /* source */,
null /* parameters */,
null /* returnType */,
null /* templateKeys */,
false /* isAbstract */);
delegateProxy.setPrototypeBasedOn(delegateBaseObject);
codingConvention.applyDelegateRelationship(
new NominalTypeBuilderOti(delegateSuperCtor, delegateSuperObject),
new NominalTypeBuilderOti(delegateBaseCtor, delegateBaseObject),
new NominalTypeBuilderOti(delegatorCtor, delegatorObject),
(ObjectType) delegateProxy.getTypeOfThis(),
findDelegate);
delegateProxyCtors.add(delegateProxy);
}
}
}
开发者ID:google,项目名称:closure-compiler,代码行数:49,代码来源:TypedScopeCreator.java
注:本文中的com.google.javascript.jscomp.CodingConvention.DelegateRelationship类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论