Browse Source

新增AssignmentException_login_official

SongZihuan 5 years ago
parent
commit
cf2b652d8d
5 changed files with 17 additions and 1 deletions
  1. BIN
      gwarf
  2. 1 0
      gwarf.c
  3. 14 0
      inter/cfunc.c
  4. 1 1
      inter/interpreter.c
  5. 1 0
      inter/interpreter.h

BIN
gwarf


+ 1 - 0
gwarf.c

@@ -46,6 +46,7 @@ void login(var_list *the_var){
     NameException_login_official(the_var, tmp_Exception->the_var);
     IterException_login_official(the_var, tmp_Exception->the_var);
     AssertException_login_official(the_var, tmp_Exception->the_var);
+    AssignmentException_login_official(the_var, tmp_Exception->the_var);
 }
 
 // 编译指令:cd "/home/songzihuan/文档/CProject/gwarf/" && gcc gwarf.c -lm -o gwarf && "/home/songzihuan/文档/CProject/gwarf/"gwarf

+ 14 - 0
inter/cfunc.c

@@ -415,6 +415,20 @@ class_object *IterException_login_official(var_list *the_var, var_list *father_v
     return class_tmp;
 }
 
+class_object *AssignmentException_login_official(var_list *the_var, var_list *father_var_list){
+    // 创建对象[空对象]
+    puts("----set class----");
+    GWARF_result class_value;
+    class_object *class_tmp = make_object(the_var, father_var_list);
+
+    class_value.value.type = CLASS_value;
+    class_value.value.value.class_value = class_tmp;
+
+    assignment_func("AssignmentException", class_value, the_var, 0);  // 注册class 的 位置
+    puts("----stop set class----");
+    return class_tmp;
+}
+
 class_object *gobject_login_official(var_list *the_var, GWARF_result (*paser)(func *, parameter *, var_list *, GWARF_result, var_list *), var_list *father_var_list){  // 内置对象继承的类
     // 创建对象[空对象]
     puts("----set class----");

+ 1 - 1
inter/interpreter.c

@@ -1782,7 +1782,7 @@ GWARF_result assignment_statement(statement *the_statement, var_list *the_var, v
         }
     }
     else{ 
-        the_else: value = to_error("Bad Assignment", "__AssignmentException__", the_var);
+        the_else: value = to_error("Bad Assignment", "AssignmentException", the_var);  // 赋值错误
         puts("Bad Assignment");
     }
     return value;

+ 1 - 0
inter/interpreter.h

@@ -609,6 +609,7 @@ class_object *Exception_login_official(var_list *the_var, var_list *father_var_l
 class_object *NameException_login_official(var_list *the_var, var_list *father_var_list);
 class_object *IterException_login_official(var_list *the_var, var_list *father_var_list);
 class_object *AssertException_login_official(var_list *the_var, var_list *father_var_list);
+class_object *AssignmentException_login_official(var_list *the_var, var_list *father_var_list);
 
 // 生成错误
 GWARF_result to_error(char *error_info, char *error_type, var_list *the_var);