@Override public void visit(InstanceOfExpr expr) { pushLocation(expr.getLocation()); try { expr.getExpr().acceptVisitor(this); expr.setExpr(resultExpr); resultExpr = expr; } finally { popLocation(); } }
@Override public void visit(InstanceOfExpr expr) { try { if (expr.getLocation() != null) { pushLocation(expr.getLocation()); writer.append(')'); if (expr.getLocation() != null) { popLocation(); expr.getExpr().acceptVisitor(this); writer.append(",").ws().append(context.typeToClsString(expr.getType())).append(")"); if (expr.getLocation() != null) { popLocation();
@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; }
@Override public void visit(InstanceOfExpr expr) { pushLocation(expr.getLocation()); try { expr.getExpr().acceptVisitor(this); expr.setExpr(resultExpr); resultExpr = expr; } finally { popLocation(); } }
@Override public void visit(InstanceOfExpr expr) { try { if (expr.getLocation() != null) { pushLocation(expr.getLocation()); expr.getExpr().acceptVisitor(this); writer.append(" instanceof ").appendClass(clsName); if (expr.getLocation() != null) { popLocation(); expr.getExpr().acceptVisitor(this); writer.append(",").ws().append(context.typeToClsString(expr.getType())).append(")"); if (expr.getLocation() != null) { popLocation();
block.setLocation(expr.getLocation());