/** Fold binary or unary operation, returning constant type reflecting the * operations result. Return null if fold failed due to an * arithmetic exception. * @param opcode The operation's opcode instruction (usually a byte code), * as entered by class Symtab. * @param argtypes The operation's argument types (a list of length 1 or 2). * Argument types are assumed to have non-null constValue's. */ Type fold(int opcode, List<Type> argtypes) { int argCount = argtypes.length(); if (argCount == 1) return fold1(opcode, argtypes.head); else if (argCount == 2) return fold2(opcode, argtypes.head, argtypes.tail.head); else throw new AssertionError(); }
/** Fold binary or unary operation, returning constant type reflecting the * operations result. Return null if fold failed due to an * arithmetic exception. * @param opcode The operation's opcode instruction (usually a byte code), * as entered by class Symtab. * @param argtypes The operation's argument types (a list of length 1 or 2). * Argument types are assumed to have non-null constValue's. */ Type fold(int opcode, List<Type> argtypes) { int argCount = argtypes.length(); if (argCount == 1) return fold1(opcode, argtypes.head); else if (argCount == 2) return fold2(opcode, argtypes.head, argtypes.tail.head); else throw new AssertionError(); }
/** Fold binary or unary operation, returning constant type reflecting the * operations result. Return null if fold failed due to an * arithmetic exception. * @param opcode The operation's opcode instruction (usually a byte code), * as entered by class Symtab. * @param argtypes The operation's argument types (a list of length 1 or 2). * Argument types are assumed to have non-null constValue's. */ Type fold(int opcode, List<Type> argtypes) { int argCount = argtypes.length(); if (argCount == 1) return fold1(opcode, argtypes.head); else if (argCount == 2) return fold2(opcode, argtypes.head, argtypes.tail.head); else throw new AssertionError(); }
/** Fold binary or unary operation, returning constant type reflecting the * operations result. Return null if fold failed due to an * arithmetic exception. * @param opcode The operation's opcode instruction (usually a byte code), * as entered by class Symtab. * @param argtypes The operation's argument types (a list of length 1 or 2). * Argument types are assumed to have non-null constValue's. */ Type fold(int opcode, List<Type> argtypes) { int argCount = argtypes.length(); if (argCount == 1) return fold1(opcode, argtypes.head); else if (argCount == 2) return fold2(opcode, argtypes.head, argtypes.tail.head); else throw new AssertionError(); }
tree.type = cfolder.fold1(bool_not, tree.arg.type);
Type ctype = cfolder.fold1(opc, argtype); if (ctype != null) { owntype = cfolder.coerce(ctype, owntype);
tree.type = cfolder.fold1(bool_not, tree.arg.type);
tree.type = cfolder.fold1(bool_not, tree.arg.type);
tree.type = cfolder.fold1(bool_not, tree.arg.type);
Type ctype = cfolder.fold1(opc, argtype); if (ctype != null) { owntype = cfolder.coerce(ctype, owntype);
public void visitUnary(JCUnary tree) { // Attribute arguments. Type argtype = (tree.getTag().isIncOrDecUnaryOp()) ? attribTree(tree.arg, env, varInfo) : chk.checkNonVoid(tree.arg.pos(), attribExpr(tree.arg, env)); // Find operator. Symbol operator = tree.operator = rs.resolveUnaryOperator(tree.pos(), tree.getTag(), env, argtype); Type owntype = types.createErrorType(tree.type); if (operator.kind == MTH && !argtype.isErroneous()) { owntype = (tree.getTag().isIncOrDecUnaryOp()) ? tree.arg.type : operator.type.getReturnType(); int opc = ((OperatorSymbol)operator).opcode; // If the argument is constant, fold it. if (argtype.constValue() != null) { Type ctype = cfolder.fold1(opc, argtype); if (ctype != null) { owntype = cfolder.coerce(ctype, owntype); } } } result = check(tree, owntype, VAL, resultInfo); }
Type ctype = cfolder.fold1(opc, argtype); if (ctype != null) { owntype = cfolder.coerce(ctype, owntype);
: fold1(opcode & ByteCodes.preMask, t1); } else { Object l = left.constValue();
: fold1(opcode & ByteCodes.preMask, t1); } else { Object l = left.constValue();
: fold1(opcode & ByteCodes.preMask, t1); } else { Object l = left.constValue();
: fold1(opcode & ByteCodes.preMask, t1); } else { Object l = left.constValue();