[SCM] Lisaac compiler branch, master+stable, updated. lisaac-0.12-606-gf445725

Mildred Ki'Lya silkensedai at online.fr
Mon Mar 1 00:36:01 UTC 2010


The following commit has been merged in the master+stable branch:
commit f617c8721643ac310dfd420048373bef1d8a09d0
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date:   Sat Oct 10 00:59:33 2009 +0200

    LIP: allow redefinition of data slots

diff --git a/src/lip/lip_slot_data.li b/src/lip/lip_slot_data.li
index d52391b..0cb958e 100644
--- a/src/lip/lip_slot_data.li
+++ b/src/lip/lip_slot_data.li
@@ -47,19 +47,27 @@ Section Public
     -? {v != NULL};
   ]
   ( + result:SELF;
-    result := clone;
-    result.make p name n value v argument is_arg;
+    + s:LIP_SLOT_DATA;
+    ((!is_arg) && {s := get_data n; s != NULL}).if {
+      result ?= s;
+      ? {result != NULL};
+      (s.value.name !== v.name).if {
+        POSITION.put_error semantic text "Redefinition with incorrect type.";
+        s.position.put_position;
+        p.put_position;
+        POSITION.send_error;
+      };
+    } else {
+      result := clone;
+      result.make p name n value v argument is_arg;
+    };
     result
   );
 
   - make p:POSITION name n:STRING_CONSTANT value v:LIP_CONSTANT
   argument is_arg:BOOLEAN <-
-  ( + s:LIP_SLOT_DATA;
+  (
     position := p;
-    s := get_data n;
-    (s != NULL).if {
-      semantic_error (s.position,"Double declaration.");
-    };
     name     := n;
     value    := v;    
     (is_arg).if_false {
@@ -75,7 +83,7 @@ Section Public
   ( + new_val:LIP_CONSTANT;
     
     new_val := value.copy_of v;
-    (new_val != NULL).if {     
+    (new_val != NULL).if {
       value := new_val;            
     }    
   );
diff --git a/src/parser.li b/src/parser.li
index 27ac2af..123cd43 100644
--- a/src/parser.li
+++ b/src/parser.li
@@ -2741,14 +2741,19 @@ Section Private
       (t = NULL).if {
         syntax_error (current_position,"type is incorrect.");
       };
-      data := LIP_SLOT_DATA.create current_position name n value t argument FALSE;
-      (read_symbol (ALIAS_STR.symbol_affect_immediate)).if {
+      (! read_symbol (ALIAS_STR.symbol_affect_immediate)).if {
+        data := LIP_SLOT_DATA.create current_position name n value t argument FALSE;
+      } else {
         cst := readlip_expr_constant;
         (cst = NULL).if {
           syntax_error (current_position,"Incorrect expression.");
         };
-        data.set_value cst;
-        cst.free;
+        (cst.name !== t.name).if {
+          syntax_error (current_position,"Incorrect expression type.");
+        };
+        data := LIP_SLOT_DATA.create current_position name n value cst argument FALSE;
+        //data.set_value cst;
+        //cst.free;
       };
     }.elseif {read_character '-'} then {
       // Function.

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list