|
|
@ -117,7 +117,7 @@ typedef struct __oop *oop; |
|
|
|
nbTabs = 0; |
|
|
|
if (tabs != null) { nbTabs = tabs; } |
|
|
|
for (i = 0; i<tabs; i++) { |
|
|
|
x.semicolon.comment.text = string(x.semicolon.comment.text) + " "; |
|
|
|
x.semicolon.comment.text = x.semicolon.comment.text + " "; |
|
|
|
} |
|
|
|
x; |
|
|
|
} |
|
|
@ -169,11 +169,11 @@ typedef struct __oop *oop; |
|
|
|
} |
|
|
|
/*********** Method function ************/ |
|
|
|
if (program.objects.function == "method") { |
|
|
|
intern(program.objects.methods, string(program.last.declarators.declarators.identifier)); |
|
|
|
intern(program.objects.methods, program.last.declarators.declarators.identifier); |
|
|
|
for (i in program.objects.class) { |
|
|
|
if (string(i) == string(program.objects.currentClassName)) intern(program.objects.class[i], string(program.last.declarators.declarators.identifier)); |
|
|
|
if (string(i) == program.objects.currentClassName) intern(program.objects.class[i], program.last.declarators.declarators.identifier); |
|
|
|
} |
|
|
|
program.last.declarators.declarators.identifier = string(program.objects.currentClassName) + "_" + string(program.last.declarators.declarators.identifier); |
|
|
|
program.last.declarators.declarators.identifier = program.objects.currentClassName + "_" + string(program.last.declarators.declarators.identifier); |
|
|
|
param = rmSemi(`declaration struct __oop *__self;); |
|
|
|
if (length(s.declarators.paramTypeL) > 0) { |
|
|
|
append(s.declarators.paramTypeL, newComma()); |
|
|
@ -184,16 +184,16 @@ typedef struct __oop *oop; |
|
|
|
} |
|
|
|
tmp = {}; |
|
|
|
// @@ problem for variable changement |
|
|
|
tmp[0] = makeln(`declaration struct @@(newId(string(program.objects.currentClassName), " ")) *self = (struct @@(newId(string(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; |
|
|
|
} |
|
|
|
/*********** Constructor function ************/ |
|
|
|
if (program.objects.function == "constructor") { |
|
|
|
rawDeclaration = makeln(`declaration class = findClass(@@(newText("\"" + string(program.objects.currentClassName) + "\"")));, 1); |
|
|
|
rawDeclaration = makeln(`declaration class = findClass(@@(newText("\"" + program.objects.currentClassName + "\"")));, 1); |
|
|
|
t = {}; |
|
|
|
append(t, treeCopy(makeln(`declaration struct @@(newId(string(program.objects.currentClassName), " ")) *self = calloc(1, sizeof *self);, 1))); |
|
|
|
append(t, treeCopy(makeln(`declaration struct @@(newId(program.objects.currentClassName, " ")) *self = calloc(1, sizeof *self);, 1))); |
|
|
|
// take the structure of self->foo |
|
|
|
lhs = treeCopy(s.compoundS.expression[0].expression.lhs); |
|
|
|
lhs.rhs = newId("class", " "); |
|
|
@ -215,7 +215,7 @@ typedef struct __oop *oop; |
|
|
|
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) " + string(i) + "_" + string(program.objects.class[i][k]); |
|
|
|
castMethod = "(method_t) " + className + "_" + linkedMethod; |
|
|
|
append(t, treeCopy(makeln(`declaration addMethod(@@(newId("_class_" + className)), @@(newId("_selector_" + linkedMethod)), @@(newId(castMethod)));, 1))); |
|
|
|
} |
|
|
|
} |
|
|
|