@Override public void visit(InstanceOfExpr expr) { try { output.writeByte(22); writeExpr(expr.getExpr()); output.writeInt(symbolTable.lookup(expr.getType().toString())); } catch (IOException e) { throw new IOExceptionWrapper(e); } }
@Override public void visit(InstanceOfExpr expr) { super.visit(expr); visitType(expr.getType()); if (expr.getType() instanceof ValueType.Object) { String clsName = ((ValueType.Object) expr.getType()).getClassName(); ClassReader cls = classSource.get(clsName); if (cls == null || cls.hasModifier(ElementModifier.INTERFACE)) { consumer.consumeFunction("$rt_isInstance"); } } else { consumer.consumeFunction("$rt_isInstance"); } } }
@Override public void visit(InstanceOfExpr expr) { writer.print("instanceof("); expr.getExpr().acceptVisitor(this); writer.print(", ").print(names.forSupertypeFunction(expr.getType())).print(")"); }
@Override public void visit(InstanceOfExpr expr) { classGenerator.getClassPointer(expr.getType()); accept(expr.getExpr()); WasmBlock block = new WasmBlock(false); block.setType(WasmType.INT32); block.setLocation(expr.getLocation()); WasmLocal objectVar = getTemporary(WasmType.INT32); block.getBody().add(new WasmSetLocal(objectVar, result)); WasmBranch ifNull = new WasmBranch(new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.EQ, new WasmGetLocal(objectVar), new WasmInt32Constant(0)), block); ifNull.setResult(new WasmInt32Constant(0)); block.getBody().add(new WasmDrop(ifNull)); WasmCall supertypeCall = new WasmCall(context.names.forSupertypeFunction(expr.getType())); WasmExpression classRef = new WasmLoadInt32(4, result, WasmInt32Subtype.INT32); classRef = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHL, classRef, new WasmInt32Constant(3)); supertypeCall.getArguments().add(classRef); block.getBody().add(supertypeCall); result = block; }
pushLocation(expr.getLocation()); if (expr.getType() instanceof ValueType.Object) { String clsName = ((ValueType.Object) expr.getType()).getClassName(); ClassReader cls = classSource.get(clsName); if (cls != null && !cls.hasModifier(ElementModifier.INTERFACE)) { precedence = Precedence.min(); expr.getExpr().acceptVisitor(this); writer.append(",").ws().append(context.typeToClsString(expr.getType())).append(")"); if (expr.getLocation() != null) { popLocation();
@Override public void visit(InstanceOfExpr expr) { try { output.writeByte(22); writeExpr(expr.getExpr()); output.writeInt(symbolTable.lookup(expr.getType().toString())); } catch (IOException e) { throw new IOExceptionWrapper(e); } }
@Override public void visit(InstanceOfExpr expr) { super.visit(expr); visitType(expr.getType()); if (expr.getType() instanceof ValueType.Object) { String clsName = ((ValueType.Object) expr.getType()).getClassName(); ClassReader cls = classSource.get(clsName); if (cls == null || cls.hasModifier(ElementModifier.INTERFACE)) { consumer.consumeFunction("$rt_isInstance"); } } else { consumer.consumeFunction("$rt_isInstance"); } } }
accept(expr.getExpr()); if (expr.getType() instanceof ValueType.Object) { ValueType.Object cls = (ValueType.Object) expr.getType(); List<TagRegistry.Range> ranges = context.getTagRegistry().getRanges(cls.getClassName()); ranges.sort(Comparator.comparingInt(range -> range.lower)); } else if (expr.getType() instanceof ValueType.Array) { throw new UnsupportedOperationException(); } else {
pushLocation(expr.getLocation()); if (expr.getType() instanceof ValueType.Object) { String clsName = ((ValueType.Object) expr.getType()).getClassName(); ClassReader cls = classSource.get(clsName); if (cls != null && !cls.hasModifier(ElementModifier.INTERFACE)) { precedence = Precedence.min(); expr.getExpr().acceptVisitor(this); writer.append(",").ws().append(context.typeToClsString(expr.getType())).append(")"); if (expr.getLocation() != null) { popLocation();