private static boolean hasEnum(Method m) { boolean result = (Type.ENUM == m.getReturnType().getDetailedType()); Iterator i = m.getArgumentList().iterator(); while (!result && i.hasNext()) { Argument arg = (Argument) i.next(); result = (arg.getType().getDetailedType() == Type.ENUM); } return result; }
/** * Generate the method's argument list. * * @param writer the language writer. * @param self the String representing the method's self argument name. * @param is_interface the boolean indicating whether working with a class or an interface. * @param id the <code>SymbolID</code> of the <code>Extendable</code> whose stub source is being * written. * @param method the <code>Method</code> whose list is being output. * @param in_signature the boolean indicating whether the argument list is being generated in a * signature. * @param add_type the boolean indicating whether the argument types are to be added. * @param exc_var the variable to be used for the exception argument; NULL if no exception * argument to be generated. * @param do_return the boolean indicating whether the return type is to be added. * @param do_rarrays the boolean indicating if special raw array argument handling is needed. * @exception gov.llnl.babel.backend.CodeGenerationException this is a catch all exception. It can * be caused by I/O trouble or violations of the data type invariants. */ public static void generateArgumentList( LanguageWriterForC writer, Context context, String self, boolean is_interface, SymbolID id, Method method, boolean in_signature, boolean add_type, boolean obj_ptr, String exc_var, boolean do_return, boolean do_indices, boolean do_rarrays) throws CodeGenerationException { boolean doThrows = !exc_var.equals("") && !method.getThrows().isEmpty(); String excVar = doThrows ? exc_var : ""; Type returnType = do_return ? method.getReturnType() : null; List args = null; if (do_indices) { args = method.getArgumentListWithIndices(); } else { args = method.getArgumentListWithOutIndices(); } String m_self; if (in_signature) { if (add_type) { if (obj_ptr) { m_self = getSymbolObjectPtr(id) + " " + self; } else { m_self = getObjectName(id) + " " + self; } } else { m_self = self; } } else if (is_interface) { m_self = self + "->d_object"; } else { m_self = s_self; } generateArguments( writer, context, m_self, args, method.isStatic(), excVar, returnType, add_type, obj_ptr, do_rarrays, false); }