]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Aliases to aliases is a bad idea, revert. Added better tests to show unused aliases
authorDale Weiler <killfieldengine@gmail.com>
Wed, 6 Feb 2013 09:28:42 +0000 (09:28 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Wed, 6 Feb 2013 09:28:42 +0000 (09:28 +0000)
parser.c
tests/aliases.qc
tests/aliases.tmpl

index cf79777a2d3793b50a7efa53cbbe96d6e9209996..909732e06802fee16a5b41459eaa37ca9d3b40bc 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -5280,13 +5280,6 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
                         void           *entry = (void*)var->desc;
                         ast_expression *find  = parser_find_var(parser, var->desc);
 
-                        /* aliases to aliases are also allowed */
-                        if (!find) {
-                            char *name = NULL;
-                            if ((find = parser_find_var(parser, (const char *)(name = util_htget(parser->aliases, var->desc)))))
-                                entry = (void*)name;
-                        }
-
                         if (!find) {
                             compile_error(parser_ctx(parser), "undeclared variable `%s` for alias `%s`", var->desc, var->name);
                             return false;
index e66d525fccc0162f06c67e87437b9c4dbde67abb..0bf347b57f63b343840774a2f0db7aa505a3b305 100644 (file)
@@ -6,16 +6,29 @@ void  alias_2() {
 [[alias("alias_2")]] void  alias_2_aliased();
 [[alias("alias_1")]] float alias_1_aliased;
 
+
+// alias to an alias?
+vector alias_3;
+[[alias("alias_3")]] vector alias_3_aliased;
+
 // expected output
 // alias_2
 // 3.14
 void main() {
     alias_2_aliased();
 
+    alias_3_aliased= '1 2 3';
+
     print(
         ftos(
             alias_1_aliased
         ),
         "\n"
     );
+
+    print(
+        "x ", ftos(alias_3_aliased_x), "\n",
+        "y ", ftos(alias_3_aliased_y), "\n",
+        "z ", ftos(alias_3_aliased_z), "\n"
+    );
 }
index 185350f1160a8f4f6a093308b34a47d558c2c89a..8e414b0095d821160e0c51e51fec8ce446392f6e 100644 (file)
@@ -4,3 +4,6 @@ T: -execute
 C: -std=gmqcc
 M: alias_2
 M: 3.14
+M: x 1
+M: y 2
+M: z 3