浏览代码

Update dynamicObject.mc

develop-theo
Theo Souchon 2 年前
父节点
当前提交
28c32ae2db
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. +5
    -2
      parsimonyLibrary/dynamicObject.mc

+ 5
- 2
parsimonyLibrary/dynamicObject.mc 查看文件

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

正在加载...
取消
保存