[Gd-chatter] r11113 - branches/GD_2_4/src/d2c/compiler/parser

bruce at gwydiondylan.org bruce at gwydiondylan.org
Fri Dec 29 12:29:57 CET 2006


Author: bruce
Date: Fri Dec 29 12:29:55 2006
New Revision: 11113

Modified:
   branches/GD_2_4/src/d2c/compiler/parser/macros.dylan
Log:
Bug: 7340
Fixed in d2c 2.4

Modified: branches/GD_2_4/src/d2c/compiler/parser/macros.dylan
==============================================================================
--- branches/GD_2_4/src/d2c/compiler/parser/macros.dylan	(original)
+++ branches/GD_2_4/src/d2c/compiler/parser/macros.dylan	Fri Dec 29 12:29:55 2006
@@ -212,8 +212,10 @@
 	  fix-define-rules(defmacro);
 	  <define-list-macro-definition>;
 	<function-rule> =>
+          check-macro-rule-names(defmacro);
 	  <function-macro-definition>;
 	<statement-rule> =>
+          check-macro-rule-names(defmacro);
 	  <statement-macro-definition>;
       end select;
 
@@ -231,6 +233,25 @@
   defn;
 end method make;
 
+
+// check-macro-rule-names
+
+// check-macro-rule-names -- internal
+//
+// makes sure that the first token in a function or statement macro is in
+// fact the name of the macro
+
+define method check-macro-rule-names(defmacro :: <define-macro-parse>) => ();
+  let name = defmacro.defmacro-name.token-symbol;
+  for (rule in defmacro.defmacro-main-rule-set.rule-set-rules)
+    let rule-name = rule.main-rule-name.token-symbol;
+    unless (rule-name == name)
+      compiler-fatal-error-location(defmacro,
+                                    "Macro rule name %s does not match macro name (%s).",
+                                    rule-name, name);
+    end;
+  end for;
+end method check-macro-rule-names;
 
 
 // fix-define-rules



More information about the chatter mailing list