void test() { default_constructor(); pointer_constructor(); copy_constructor(); move_constructor(); }
match_t<DexMethod, std::tuple<> > is_default_constructor() { return { [](const DexMethod* meth) { return default_constructor(meth); } }; }
match_t<DexMethodRef, std::tuple<> > can_be_default_constructor() { return { [](const DexMethodRef* meth) { return meth->is_def() && default_constructor(static_cast<const DexMethod*>(meth)); } }; }
int sc_main( int, char** ) { cerr.precision(15); default_constructor(); assign_constructor(); default_assign(); assign(); array(); return 0; }
// Working correctly // generates code for class decln void ir_class_decln(nodeType* n) { nodeType* mod=get_operand(n,0); nodeType* class_name=get_operand(n,1); nodeType* field_list=get_operand(n,2); nodeType* body=get_operand(n,3); nodeType* first_func; // for first fun in body strcpy(curr_class_name,class_name->id.symrec->sym_name); // debugger("%s IS CURR CLASS\n",curr_class_name); debugger(".class "); fprintf(output,".class "); switch(mod->con_i.value) // print modifer info { case modPUBLIC: debugger("public "); fprintf(output,"public "); break; case modPRIVATE: debugger("private "); fprintf(output,"private "); break; case modPROTECTED: debugger("protected "); fprintf(output,"protected "); break; } // rest is basically the default class constructor which inherits the object class debugger("auto ansi beforefieldinit "); fprintf(output,"auto ansi beforefieldinit "); debugger("%s ",class_name->id.symrec->sym_name); fprintf(output,"%s ",class_name->id.symrec->sym_name); debugger("extends [mscorlib]System.Object\n"); fprintf(output,"extends [mscorlib]System.Object\n"); debugger("{\n"); fprintf(output,"{\n"); // to print field info now ir_fieldlist(field_list); // .field public type fieldname debugger("\n"); fprintf(output,"\n"); // to search for constructor method nodeType* p=body; // in general p is a fundeflist node nodeType* lc; while(p->opr.oper!=FUNC) // iterate till you get left most function { lc=get_operand(p,0); // look at left child debugger("%d is p's oper\n",p->opr.oper); p=lc; } first_func=get_operand(p,2); debugger("%d is p's oper\n",p->opr.oper); debugger("%s is name\n",first_func->id.symrec->sym_name); // get name of first child if(strcmp(curr_class_name,first_func->id.symrec->sym_name)==0) // constructor found { debugger("NON DEFAULT CONSTR FOUND\n"); // copy constr sign into class symrec so that class also has signature strcpy(class_name->id.symrec->signature,first_func->id.symrec->signature); debugger("ASSIGNED CLASS SIGNATURE %s \n",class_name->id.symrec->signature); ir_constructor(p); } else { default_constructor(); } generate(body); debugger("}\n"); fprintf(output,"}\n"); }