فهرست منبع

feat: test可正常使用printCode函数

SongZihuan 3 سال پیش
والد
کامیت
e35f73ee8c
4فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 1 0
      src/core/__code.h
  2. 1 1
      src/core/var.c
  3. 5 0
      test/src/byte_code.c
  4. 2 0
      test/src/syntactic.c

+ 1 - 0
src/core/__code.h

@@ -29,4 +29,5 @@ struct af_Code {  // 一个 Code 的结构体
     struct af_Code *next;
 };
 
+AFUN_CORE_NO_EXPORT void printCode(af_Code *bt);
 #endif //AFUN_BYTECODE_H_

+ 1 - 1
src/core/var.c

@@ -259,7 +259,7 @@ bool makeVarToProtectVarSpace(char *name, char p_self, char p_posterity, char p_
     return re;
 }
 
-static bool checkVarSpaceDelPermissions(af_Object *visitor, af_VarSpace *vs){
+static bool checkVarSpaceDelPermissions(af_Object *visitor, af_VarSpace *vs) {
     char p = vs->permissions[2];  // 默认外部权限
 
     if (vs->belong == NULL || (visitor != NULL && vs->belong->data == visitor->data))  // (无权限设定或ObjectData匹配) 应用自身权限

+ 5 - 0
test/src/byte_code.c

@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include "aFun.h"
+#include "../../src/core/__code.h"
 
 int main() {
     af_Code *bt1 = makeElementCode("data", ',', 0, "Unknown");
@@ -40,6 +41,10 @@ int main() {
     }
     fclose(file);
 
+    printf("out:\n");
+    printCode(bt1);
+    printf("in:\n");
+    printCode(get);
     freeAllCode(bt1);
     freeAllCode(get);
     return EXIT_SUCCESS;

+ 2 - 0
test/src/syntactic.c

@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include "aFun.h"
+#include "../../src/core/__code.h"
 
 char *str = "10 '20.32 100var\n"
             "|10||20.32|int->num\n"
@@ -41,6 +42,7 @@ void test2(void) {
 
     af_Parser *parser = makeParserByFile(path, stderr);
     af_Code *code = parserCode(parser);
+    printCode(code);
     freeParser(parser);
     freeAllCode(code);
 }