view rathaxes_compiler_passes_correctly_resolve_chunk_args_subidentifiers.patch @ 142:cbff597d307e default tip

Wip doc
author Louis Opter <louis@lse.epita.fr>
date Sun, 09 Feb 2014 15:48:57 -0800
parents 3816844250ff
children
line wrap: on
line source

# HG changeset patch
# User David Pineau <dav.pineau@gmail.com>, Louis Opter <louis@lse.epita.fr>
# Parent 924908351b124b3fd1180f27880d36ea64e7c01c
rathaxes: correctly resolve the type of chunk arguments subidentifiers

diff --git a/rathaxes/compiler/passes/back/rtxIntrospect.inc.cws b/rathaxes/compiler/passes/back/rtxIntrospect.inc.cws
--- a/rathaxes/compiler/passes/back/rtxIntrospect.inc.cws
+++ b/rathaxes/compiler/passes/back/rtxIntrospect.inc.cws
@@ -744,17 +744,18 @@
         if (!existVariable(param.rtype))
         {
             localref theVar = param.identifiers#[0];
+            local theType;
             if (theVar.name == "local")
             {
                 ref theVar = param.identifiers#[1];
             }
-            local theType;
             if (findElement(theVar.name, theChunk.type_map))
                 ref theType = theChunk.type_map[theVar.name];
             else if (findElement(theVar.name, theChunk.variables))
                 ref theType = theChunk.variables[theVar.name].type_node;
             insert param.rtype;
-            if (getArraySize(param.identifiers) > 2)
+            if ((param.identifiers#[0].name != "local" && getArraySize(param.identifiers) > 1)
+                || getArraySize(param.identifiers) > 2)
             {
                 local subType;
                 local fieldList;
@@ -763,7 +764,8 @@
                     pushItem fieldList;
                     fieldList#back = field.name;
                 }
-                removeFirstElement(fieldList);
+                if (param.identifiers#[0].name == "local")
+                    removeFirstElement(fieldList);
                 removeFirstElement(fieldList);
                 if (rtxTypingLookup_ResolveTypeFields(theType, fieldList, theChunk, theChunk#root /* XXX dummy */, subType) == false)
                 {