int typeId = program.getTypeId(x);
if (typeId >= 0) {
JField typeIdField = program.getSpecialField("Object.typeId");
JsNameRef fieldRef = getName(typeIdField).makeRef();
fieldRef.setQualifier(globalTemp.makeRef());
JsIntegralLiteral typeIdLit = jsProgram.getIntegralLiteral(BigInteger.valueOf(typeId));
JsExpression asg = createAssignment(fieldRef, typeIdLit);
globalStmts.add(new JsExprStmt(asg));
}
}