/** * Returns true if the field is static. */ public boolean isStatic() { return isStatic(opcode); }
/** * Returns true if the field is static. */ public boolean isStatic() { return isStatic(opcode); }
@Override public void edit(FieldAccess f) throws CannotCompileException { try { if ( ! f.isStatic() ) { CtClass type = null; type = f.getField().getType(); FSTClazzInfo.FSTFieldInfo fieldInfo = clInfo.getFieldInfo(f.getFieldName(), null); if ( fieldInfo == null ) { return; } if ( f.isReader() ) { structGen.defineStructReadAccess(f, type, fieldInfo); } else if ( f.isWriter() ) { structGen.defineStructWriteAccess(f, type, fieldInfo); } } } catch (Exception e) { e.printStackTrace(); } } });
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { if (args != null && !gen.isParamListName(args)) throw new CompileError(Javac.proceedName + "() cannot take a parameter for field reading"); int stack; if (isStatic(opcode)) stack = 0; else { stack = -1; bytecode.addAload(targetVar); } if (fieldType instanceof CtPrimitiveType) stack += ((CtPrimitiveType)fieldType).getDataSize(); else ++stack; bytecode.add(opcode); bytecode.addIndex(index); bytecode.growStack(stack); gen.setType(fieldType); }
@Override public void edit(FieldAccess f) throws CannotCompileException { try { if ( ! f.isStatic() ) { CtClass type = null; type = f.getField().getType(); FSTClazzInfo.FSTFieldInfo fieldInfo = clInfo.getFieldInfo(f.getFieldName(), null); if ( fieldInfo == null ) { return; } if ( f.isReader() ) { structGen.defineStructReadAccess(f, type, fieldInfo); } else if ( f.isWriter() ) { structGen.defineStructWriteAccess(f, type, fieldInfo); } } } catch (Exception e) { e.printStackTrace(); } } });
@Override public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { if (args != null && !gen.isParamListName(args)) throw new CompileError(Javac.proceedName + "() cannot take a parameter for field reading"); int stack; if (isStatic(opcode)) stack = 0; else { stack = -1; bytecode.addAload(targetVar); } if (fieldType instanceof CtPrimitiveType) stack += ((CtPrimitiveType)fieldType).getDataSize(); else ++stack; bytecode.add(opcode); bytecode.addIndex(index); bytecode.growStack(stack); gen.setType(fieldType); }
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { if (gen.getMethodArgsLength(args) != 1) throw new CompileError(Javac.proceedName + "() cannot take more than one parameter " + "for field writing"); int stack; if (isStatic(opcode)) stack = 0; else { stack = -1; bytecode.addAload(targetVar); } gen.atMethodArgs(args, new int[1], new int[1], new String[1]); gen.doNumCast(fieldType); if (fieldType instanceof CtPrimitiveType) stack -= ((CtPrimitiveType)fieldType).getDataSize(); else --stack; bytecode.add(opcode); bytecode.addIndex(index); bytecode.growStack(stack); gen.setType(CtClass.voidType); gen.addNullIfVoid(); }
@Override public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { if (gen.getMethodArgsLength(args) != 1) throw new CompileError(Javac.proceedName + "() cannot take more than one parameter " + "for field writing"); int stack; if (isStatic(opcode)) stack = 0; else { stack = -1; bytecode.addAload(targetVar); } gen.atMethodArgs(args, new int[1], new int[1], new String[1]); gen.doNumCast(fieldType); if (fieldType instanceof CtPrimitiveType) stack -= ((CtPrimitiveType)fieldType).getDataSize(); else --stack; bytecode.add(opcode); bytecode.addIndex(index); bytecode.growStack(stack); gen.setType(CtClass.voidType); gen.addNullIfVoid(); }
storeStack(params, isStatic(), paramVar, bytecode); jc.recordLocalVariables(ca, pos);
storeStack(params, isStatic(), paramVar, bytecode); jc.recordLocalVariables(ca, pos);
/** * Returns true if the field is static. */ public boolean isStatic() { return isStatic(opcode); }
/** * Returns true if the field is static. */ public boolean isStatic() { return isStatic(opcode); }
/** * Returns true if the field is static. */ public boolean isStatic() { return isStatic(opcode); }
/** * Returns true if the field is static. */ public boolean isStatic() { return isStatic(opcode); }
/** * Returns true if the field is static. */ public boolean isStatic() { return isStatic(opcode); }
protected void replaceRead(FieldAccess fieldAccess) throws CannotCompileException { if (fieldAccess.isStatic()) { String code = " { " + " $_ = ($r)" + fieldRead(field.getName()) + "(null);" + " } " + ""; fieldAccess.replace(code); } else { String code = " { " + " $_ = ($r)" + fieldRead(field.getName()) + "($0);" + " } " + ""; fieldAccess.replace(code); } }
protected void replaceRead(FieldAccess fieldAccess) throws CannotCompileException { if (fieldAccess.isStatic()) { String code = " { " + " $_ = ($r)" + fieldRead(field.getName()) + "(null);" + " } " + ""; fieldAccess.replace(code); } else { String code = " { " + " $_ = ($r)" + fieldRead(field.getName()) + "($0);" + " } " + ""; fieldAccess.replace(code); } }
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { if (args != null && !gen.isParamListName(args)) throw new CompileError(Javac.proceedName + "() cannot take a parameter for field reading"); int stack; if (isStatic(opcode)) stack = 0; else { stack = -1; bytecode.addAload(targetVar); } if (fieldType instanceof CtPrimitiveType) stack += ((CtPrimitiveType)fieldType).getDataSize(); else ++stack; bytecode.add(opcode); bytecode.addIndex(index); bytecode.growStack(stack); gen.setType(fieldType); }
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { if (args != null && !gen.isParamListName(args)) throw new CompileError(Javac.proceedName + "() cannot take a parameter for field reading"); int stack; if (isStatic(opcode)) stack = 0; else { stack = -1; bytecode.addAload(targetVar); } if (fieldType instanceof CtPrimitiveType) stack += ((CtPrimitiveType)fieldType).getDataSize(); else ++stack; bytecode.add(opcode); bytecode.addIndex(index); bytecode.growStack(stack); gen.setType(fieldType); }
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { if (args != null && !gen.isParamListName(args)) throw new CompileError(Javac.proceedName + "() cannot take a parameter for field reading"); int stack; if (isStatic(opcode)) stack = 0; else { stack = -1; bytecode.addAload(targetVar); } if (fieldType instanceof CtPrimitiveType) stack += ((CtPrimitiveType)fieldType).getDataSize(); else ++stack; bytecode.add(opcode); bytecode.addIndex(index); bytecode.growStack(stack); gen.setType(fieldType); }