当前位置: 首页>>代码示例>>Java>>正文


Java CompoundAssignmentTree.getVariable方法代码示例

本文整理汇总了Java中com.sun.source.tree.CompoundAssignmentTree.getVariable方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundAssignmentTree.getVariable方法的具体用法?Java CompoundAssignmentTree.getVariable怎么用?Java CompoundAssignmentTree.getVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.source.tree.CompoundAssignmentTree的用法示例。


在下文中一共展示了CompoundAssignmentTree.getVariable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitCompoundAssignment

import com.sun.source.tree.CompoundAssignmentTree; //导入方法依赖的package包/类
@Override
public Void visitCompoundAssignment(CompoundAssignmentTree node, Void p) {
    ExpressionTree var = node.getVariable();
    ExpressionTree expr = node.getExpression();
    AnnotatedTypeMirror varType = atypeFactory.getAnnotatedType(var);
    AnnotatedTypeMirror exprType = atypeFactory.getAnnotatedType(expr);

    Kind kind = node.getKind();

    if ( (kind == Kind.PLUS_ASSIGNMENT || kind == Kind.MINUS_ASSIGNMENT)) {
        if (!atypeFactory.getTypeHierarchy().isSubtype(exprType, varType)) {
            checker.report(Result.failure("compound.assignment.type.incompatible",
                    varType, exprType), node);
        }
    } else if (exprType.getAnnotation(UnknownUnits.class) == null) {
        // Only allow mul/div with unqualified units
        checker.report(Result.failure("compound.assignment.type.incompatible",
                varType, exprType), node);
    }

    return null; // super.visitCompoundAssignment(node, p);
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:23,代码来源:UnitsVisitor.java

示例2: visitCompoundAssignment

import com.sun.source.tree.CompoundAssignmentTree; //导入方法依赖的package包/类
@Override
public PurityResult visitCompoundAssignment(
        CompoundAssignmentTree node, PurityResult p) {
    ExpressionTree variable = node.getVariable();
    p = assignmentCheck(p, variable);
    PurityResult r = scan(variable, p);
    r = scan(node.getExpression(), r);
    return r;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:10,代码来源:PurityChecker.java

示例3: visitCompoundAssignment

import com.sun.source.tree.CompoundAssignmentTree; //导入方法依赖的package包/类
@Override
public Void visitCompoundAssignment(CompoundAssignmentTree node, AnnotatedTypeMirror type) {
    ExpressionTree var = node.getVariable();
    AnnotatedTypeMirror varType = getAnnotatedType(var);

    type.replaceAnnotations(varType.getAnnotations());
    return super.visitCompoundAssignment(node, type);
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:9,代码来源:UnitsAnnotatedTypeFactory.java

示例4: visitCompoundAssignment

import com.sun.source.tree.CompoundAssignmentTree; //导入方法依赖的package包/类
@Override
public PurityResult visitCompoundAssignment(CompoundAssignmentTree node, PurityResult p) {
    ExpressionTree variable = node.getVariable();
    p = assignmentCheck(p, variable);
    PurityResult r = scan(variable, p);
    r = scan(node.getExpression(), r);
    return r;
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:9,代码来源:PurityChecker.java


注:本文中的com.sun.source.tree.CompoundAssignmentTree.getVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。