|
|
@ -184,7 +184,7 @@ typedef struct __oop *oop; |
|
|
|
} |
|
|
|
tmp = {}; |
|
|
|
// @@ problem for variable changement |
|
|
|
tmp[0] = makeln(`declaration struct @@(newId(program.objects.currentClassName, " ")) *self = (struct @@(newId(program.objects.currentClassName)) *) __self;, 1); |
|
|
|
tmp[0] = makeln(`declaration struct @@(newId(program.objects.currentClassName, " ")) *self = (struct @@(newId(program.objects.currentClassName, " ")) *) __self;, 1); |
|
|
|
s.compoundS.expression = treeCopy(fusion(tmp, s.compoundS.expression)); |
|
|
|
program.objects.function = "none"; |
|
|
|
return s; |
|
|
@ -209,12 +209,15 @@ typedef struct __oop *oop; |
|
|
|
/*********** Main function ************/ |
|
|
|
if (s.declarators != null && s.declarators.declarators != null && string(s.declarators.declarators.identifier) == "main") { |
|
|
|
t = {}; |
|
|
|
for(i in program.objects.methods) { |
|
|
|
methodName = string(program.objects.methods[i]); |
|
|
|
append(t, treeCopy(makeln(`declaration int @@(newId("_selector_" + methodName)) = findSelector(@@(newId("\"" + methodName + "\"")));, 1))); |
|
|
|
} |
|
|
|
for (i in program.objects.class) { |
|
|
|
className = string(i); // can't work other way |
|
|
|
append(t, treeCopy(makeln(`declaration int @@(newId("_class_" + className)) = findClass(@@(newId("\"" + className + "\"")));, 1))); |
|
|
|
for (k in program.objects.class[i]) { |
|
|
|
linkedMethod = string(program.objects.class[i][k]); |
|
|
|
append(t, treeCopy(makeln(`declaration int @@(newId("_selector_" + linkedMethod)) = findSelector(@@(newId("\"" + linkedMethod + "\"")));, 1))); |
|
|
|
castMethod = "(method_t) " + className + "_" + linkedMethod; |
|
|
|
append(t, treeCopy(makeln(`declaration addMethod(@@(newId("_class_" + className)), @@(newId("_selector_" + linkedMethod)), @@(newId(castMethod)));, 1))); |
|
|
|
} |
|
|
|