本文整理汇总了Java中com.google.javascript.rhino.jstype.JSType.TypePair类的典型用法代码示例。如果您正苦于以下问题:Java TypePair类的具体用法?Java TypePair怎么用?Java TypePair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypePair类属于com.google.javascript.rhino.jstype.JSType包,在下文中一共展示了TypePair类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: caseEquality
import com.google.javascript.rhino.jstype.JSType.TypePair; //导入依赖的package包/类
private FlowScope caseEquality(Node left, Node right, FlowScope blindScope,
Function<TypePair, TypePair> merging) {
// left type
JSType leftType = getTypeIfRefinable(left, blindScope);
boolean leftIsRefineable;
if (leftType != null) {
leftIsRefineable = true;
} else {
leftIsRefineable = false;
leftType = left.getJSType();
}
// right type
JSType rightType = getTypeIfRefinable(right, blindScope);
boolean rightIsRefineable;
if (rightType != null) {
rightIsRefineable = true;
} else {
rightIsRefineable = false;
rightType = right.getJSType();
}
// merged types
TypePair merged = merging.apply(new TypePair(leftType, rightType));
// creating new scope
if (merged != null &&
((leftIsRefineable && merged.typeA != null) ||
(rightIsRefineable && merged.typeB != null))) {
FlowScope informed = blindScope.createChildFlowScope();
if (leftIsRefineable && merged.typeA != null) {
declareNameInScope(informed, left, merged.typeA);
}
if (rightIsRefineable && merged.typeB != null) {
declareNameInScope(informed, right, merged.typeB);
}
return informed;
}
return blindScope;
}
开发者ID:andyjko,项目名称:feedlack,代码行数:41,代码来源:SemanticReverseAbstractInterpreter.java
示例2: testGetTypeUnderEquality
import com.google.javascript.rhino.jstype.JSType.TypePair; //导入依赖的package包/类
private void testGetTypeUnderEquality(
JSType t1, JSType t2, JSType t1Eq, JSType t2Eq) {
// creating the pairs
TypePair p12 = t1.getTypesUnderEquality(t2);
TypePair p21 = t2.getTypesUnderEquality(t1);
// t1Eq
assertEquals(t1Eq, p12.typeA);
assertEquals(t1Eq, p21.typeB);
// t2Eq
assertEquals(t2Eq, p12.typeB);
assertEquals(t2Eq, p21.typeA);
}
开发者ID:andyjko,项目名称:feedlack,代码行数:15,代码来源:JSTypeTest.java
示例3: testGetTypesUnderInequality
import com.google.javascript.rhino.jstype.JSType.TypePair; //导入依赖的package包/类
private void testGetTypesUnderInequality(
JSType t1, JSType t2, JSType t1Eq, JSType t2Eq) {
// creating the pairs
TypePair p12 = t1.getTypesUnderInequality(t2);
TypePair p21 = t2.getTypesUnderInequality(t1);
// t1Eq
assertEquals(t1Eq, p12.typeA);
assertEquals(t1Eq, p21.typeB);
// t2Eq
assertEquals(t2Eq, p12.typeB);
assertEquals(t2Eq, p21.typeA);
}
开发者ID:andyjko,项目名称:feedlack,代码行数:15,代码来源:JSTypeTest.java
示例4: testGetTypeUnderEquality
import com.google.javascript.rhino.jstype.JSType.TypePair; //导入依赖的package包/类
private void testGetTypeUnderEquality(
JSType t1, JSType t2, JSType t1Eq, JSType t2Eq) {
// creating the pairs
TypePair p12 = t1.getTypesUnderEquality(t2);
TypePair p21 = t2.getTypesUnderEquality(t1);
// t1Eq
assertTypeEquals(t1Eq, p12.typeA);
assertTypeEquals(t1Eq, p21.typeB);
// t2Eq
assertTypeEquals(t2Eq, p12.typeB);
assertTypeEquals(t2Eq, p21.typeA);
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:15,代码来源:JSTypeTest.java
示例5: testGetTypesUnderInequality
import com.google.javascript.rhino.jstype.JSType.TypePair; //导入依赖的package包/类
private void testGetTypesUnderInequality(
JSType t1, JSType t2, JSType t1Eq, JSType t2Eq) {
// creating the pairs
TypePair p12 = t1.getTypesUnderInequality(t2);
TypePair p21 = t2.getTypesUnderInequality(t1);
// t1Eq
assertTypeEquals(t1Eq, p12.typeA);
assertTypeEquals(t1Eq, p21.typeB);
// t2Eq
assertTypeEquals(t2Eq, p12.typeB);
assertTypeEquals(t2Eq, p21.typeA);
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:15,代码来源:JSTypeTest.java
示例6: apply
import com.google.javascript.rhino.jstype.JSType.TypePair; //导入依赖的package包/类
@Override
public TypePair apply(TypePair p) {
if (p.typeA == null || p.typeB == null) {
return null;
}
return p.typeA.getTypesUnderEquality(p.typeB);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:SemanticReverseAbstractInterpreter.java
示例7: caseEquality
import com.google.javascript.rhino.jstype.JSType.TypePair; //导入依赖的package包/类
private FlowScope caseEquality(Node left, Node right, FlowScope blindScope,
Function<TypePair, TypePair> merging) {
// left type
JSType leftType = getTypeIfRefinable(left, blindScope);
boolean leftIsRefineable;
if (leftType != null) {
leftIsRefineable = true;
} else {
leftIsRefineable = false;
leftType = left.getJSType();
}
// right type
JSType rightType = getTypeIfRefinable(right, blindScope);
boolean rightIsRefineable;
if (rightType != null) {
rightIsRefineable = true;
} else {
rightIsRefineable = false;
rightType = right.getJSType();
}
// merged types
TypePair merged = merging.apply(new TypePair(leftType, rightType));
// creating new scope
if (merged != null) {
return maybeRestrictTwoNames(
blindScope,
left, leftType, leftIsRefineable ? merged.typeA : null,
right, rightType, rightIsRefineable ? merged.typeB : null);
}
return blindScope;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:35,代码来源:SemanticReverseAbstractInterpreter.java
示例8: apply
import com.google.javascript.rhino.jstype.JSType.TypePair; //导入依赖的package包/类
public TypePair apply(TypePair p) {
if (p.typeA == null || p.typeB == null) {
return null;
}
return p.typeA.getTypesUnderEquality(p.typeB);
}
开发者ID:andyjko,项目名称:feedlack,代码行数:7,代码来源:SemanticReverseAbstractInterpreter.java
注:本文中的com.google.javascript.rhino.jstype.JSType.TypePair类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论