Java Code Examples for com.sun.tools.javac.code.Symbol.VarSymbol#getConstValue()

The following examples show how to use com.sun.tools.javac.code.Symbol.VarSymbol#getConstValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassWriter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/** Write field symbol, entering all references into constant pool.
 */
void writeField(VarSymbol v) {
    int flags = adjustFlags(v.flags());
    databuf.appendChar(flags);
    if (dumpFieldModifiers) {
        PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
        pw.println("FIELD  " + v.name);
        pw.println("---" + flagNames(v.flags()));
    }
    databuf.appendChar(pool.put(v.name));
    databuf.appendChar(pool.put(typeSig(v.erasure(types))));
    int acountIdx = beginAttrs();
    int acount = 0;
    if (v.getConstValue() != null) {
        int alenIdx = writeAttr(names.ConstantValue);
        databuf.appendChar(pool.put(v.getConstValue()));
        endAttr(alenIdx);
        acount++;
    }
    acount += writeMemberAttrs(v);
    endAttrs(acountIdx, acount);
}
 
Example 2
Source File: Lower.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
void visitSymbol(Symbol _sym) {
    Symbol sym = _sym;
    if (sym.kind == VAR || sym.kind == MTH) {
        if (sym != null && sym.owner != owner)
            sym = proxies.get(sym);
        if (sym != null && sym.owner == owner) {
            VarSymbol v = (VarSymbol)sym;
            if (v.getConstValue() == null) {
                addFreeVar(v);
            }
        } else {
            if (outerThisStack.head != null &&
                outerThisStack.head != _sym)
                visitSymbol(outerThisStack.head);
        }
    }
}
 
Example 3
Source File: Gen.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void visitVarDef(JCVariableDecl tree) {
    VarSymbol v = tree.sym;
    code.newLocal(v);
    if (tree.init != null) {
        checkStringConstant(tree.init.pos(), v.getConstValue());
        if (v.getConstValue() == null || varDebugInfo) {
            genExpr(tree.init, v.erasure(types)).load();
            items.makeLocalItem(v).store();
        }
    }
    checkDimension(tree.pos(), v.type);
}
 
Example 4
Source File: Gen.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void visitVarDef(JCVariableDecl tree) {
    VarSymbol v = tree.sym;
    code.newLocal(v);
    if (tree.init != null) {
        checkStringConstant(tree.init.pos(), v.getConstValue());
        if (v.getConstValue() == null || varDebugInfo) {
            genExpr(tree.init, v.erasure(types)).load();
            items.makeLocalItem(v).store();
        }
    }
    checkDimension(tree.pos(), v.type);
}
 
Example 5
Source File: Gen.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void visitVarDef(JCVariableDecl tree) {
    VarSymbol v = tree.sym;
    code.newLocal(v);
    if (tree.init != null) {
        checkStringConstant(tree.init.pos(), v.getConstValue());
        if (v.getConstValue() == null || varDebugInfo) {
            genExpr(tree.init, v.erasure(types)).load();
            items.makeLocalItem(v).store();
        }
    }
    checkDimension(tree.pos(), v.type);
}
 
Example 6
Source File: Gen.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void visitVarDef(JCVariableDecl tree) {
    VarSymbol v = tree.sym;
    code.newLocal(v);
    if (tree.init != null) {
        checkStringConstant(tree.init.pos(), v.getConstValue());
        if (v.getConstValue() == null || varDebugInfo) {
            Assert.check(letExprDepth != 0 || code.state.stacksize == 0);
            genExpr(tree.init, v.erasure(types)).load();
            items.makeLocalItem(v).store();
            Assert.check(letExprDepth != 0 || code.state.stacksize == 0);
        }
    }
    checkDimension(tree.pos(), v.type);
}
 
Example 7
Source File: Gen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void visitVarDef(JCVariableDecl tree) {
    VarSymbol v = tree.sym;
    code.newLocal(v);
    if (tree.init != null) {
        checkStringConstant(tree.init.pos(), v.getConstValue());
        if (v.getConstValue() == null || varDebugInfo) {
            genExpr(tree.init, v.erasure(types)).load();
            items.makeLocalItem(v).store();
        }
    }
    checkDimension(tree.pos(), v.type);
}
 
Example 8
Source File: Gen.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void visitVarDef(JCVariableDecl tree) {
    VarSymbol v = tree.sym;
    code.newLocal(v);
    if (tree.init != null) {
        checkStringConstant(tree.init.pos(), v.getConstValue());
        if (v.getConstValue() == null || varDebugInfo) {
            Assert.check(letExprDepth != 0 || code.state.stacksize == 0);
            genExpr(tree.init, v.erasure(types)).load();
            items.makeLocalItem(v).store();
            Assert.check(letExprDepth != 0 || code.state.stacksize == 0);
        }
    }
    checkDimension(tree.pos(), v.type);
}
 
Example 9
Source File: Gen.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void visitVarDef(JCVariableDecl tree) {
    VarSymbol v = tree.sym;
    code.newLocal(v);
    if (tree.init != null) {
        checkStringConstant(tree.init.pos(), v.getConstValue());
        if (v.getConstValue() == null || varDebugInfo) {
            genExpr(tree.init, v.erasure(types)).load();
            items.makeLocalItem(v).store();
        }
    }
    checkDimension(tree.pos(), v.type);
}
 
Example 10
Source File: Gen.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void visitVarDef(JCVariableDecl tree) {
    VarSymbol v = tree.sym;
    code.newLocal(v);
    if (tree.init != null) {
        checkStringConstant(tree.init.pos(), v.getConstValue());
        if (v.getConstValue() == null || varDebugInfo) {
            genExpr(tree.init, v.erasure(types)).load();
            items.makeLocalItem(v).store();
        }
    }
    checkDimension(tree.pos(), v.type);
}
 
Example 11
Source File: Gen.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void visitVarDef(JCVariableDecl tree) {
    VarSymbol v = tree.sym;
    code.newLocal(v);
    if (tree.init != null) {
        checkStringConstant(tree.init.pos(), v.getConstValue());
        if (v.getConstValue() == null || varDebugInfo) {
            genExpr(tree.init, v.erasure(types)).load();
            items.makeLocalItem(v).store();
        }
    }
    checkDimension(tree.pos(), v.type);
}