public string Visit(AST_ClassDef node) { SemanticType t = semantictypes[node.Id.Id]; List <CIL_ClassAttr> lattr = new List <CIL_ClassAttr>(); foreach (var item in t.GetAllAttr()) { lattr.Add(new CIL_ClassAttr(item.Id)); } List <CIL_ClassMethod> lmeth = new List <CIL_ClassMethod>(); foreach (var item in t.Father.GetAllMethods()) { if (t._find_method(item.Name) == -1) { lmeth.Add(new CIL_ClassMethod(item.Name, item.Label())); } } foreach (var item in t.Methods) { lmeth.Add(new CIL_ClassMethod(item.Name, item.Label())); } methodcontext.actual_type = semantictypes[node.Id.Id]; methodcontext.propertys_class = node.Property_list; foreach (var item in node.Method_list.Methods) { methodcontext.Reset(methodcontext.actual_type.GetMethod(item.Id.Id).Label()); methodcontext.Staments.Add(new CIL_ExceptionCond("self", "0", "error_null")); // poniendo los valores por defecto en el constructor if (item.Id.Id == "init" || (methodcontext.actual_type.Name == "Main" && item.Id.Id == "main")) { foreach (var prop in methodcontext.propertys_class.Propertys) { if (prop.exp != null) { var s = prop.exp.Visit(this); if (data.ContainsValue(s)) { // Load STR var exp2 = methodcontext.GenLocal("exp", true); methodcontext.Staments.Add(new CIL_LoadStr(s, exp2)); s = exp2; } methodcontext.Staments.Add(new CIL_SetAttr("self", prop.decl.id.Id, s, methodcontext.actual_type.Name)); } } } Visit(item); } listtypes.Add(new CIL_ClassDef(node.Id.Id, new CIL_ListNode <CIL_ClassAttr>(lattr), new CIL_ListNode <CIL_ClassMethod>(lmeth))); return(""); }