Просмотр исходного кода

rm useless string()

develop-theo
Theo Souchon 2 лет назад
Родитель
Сommit
6d0c45316d
1 измененных файлов: 8 добавлений и 8 удалений
  1. +8
    -8
      parsimonyLibrary/dynamicObject.mc

+ 8
- 8
parsimonyLibrary/dynamicObject.mc Просмотреть файл

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

Загрузка…
Отмена
Сохранить