comparison FixScalarRefUnstrictBug @ 106:976a4b87803f

Fix the resolution and the e1000 sample with the new scalar ref feature
author David Pineau <dav.pineau@gmail.com>
date Mon, 25 Mar 2013 01:17:56 +0100
parents
children 3523e795bdf9
comparison
equal deleted inserted replaced
105:fb20f01ea997 106:976a4b87803f
1 # HG changeset patch
2 # Parent 3f3babe6040fc925e39353a4b36270ae100f7f6b
3 Work around an unstrict cnorm bug issue concerning the function declarations.
4
5 diff --git a/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws b/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws
6 --- a/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws
7 +++ b/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws
8 @@ -213,9 +213,65 @@
9 { rtxPH_compile<item.type>(item, compile, node_idx); }
10 }
11 }
12 - // recurse param list
13 + // recurse param list + Resolve unknown before going down.
14 if (existVariable(ctype_ref.param))
15 - { rtxPH_compile<ctype_ref.param.type>(ctype_ref.param, compile, node_idx);}
16 + {
17 + // XXX FIXME
18 + // This is a workaround for a bug involving the unstrict cnorm.
19 + // We patch-up the function's arg's types and names before checking further.
20 + local argnames;
21 + foreach param in ctype_ref.param.block
22 + {
23 + localref theType = param;
24 + localref param_ctype = theType.ctype;
25 +
26 + //First setup the iterator over the right param to retrieve name.
27 + local name_it;
28 + local it_idx = 0;
29 + createIterator(name_it, ctype_ref.param.map);
30 + while (it_idx != index(param))
31 + {
32 + next(name_it);
33 + increment(it_idx);
34 + }
35 + local theName = key(name_it);
36 +
37 + if (existVariable(param_ctype.unknown))
38 + {
39 + local placeholder_key = false;
40 + foreach token in param_ctype.unknown
41 + {
42 + local theKey = key(token);
43 + if (rtxPH_havePlaceHolder(theKey))
44 + {
45 + placeholder_key = theKey;
46 + break ;
47 + }
48 + }
49 + if (placeholder_key == false) // no token found
50 + {
51 + param_ctype.identifier = param_ctype.unknown#back;
52 + removeVariable(param_ctype.unknown);
53 + }
54 + else // placeholder found -> Set as type, use other var as name.
55 + {
56 + param_ctype.identifier = placeholder_key;
57 + removeVariable(param_ctype.unknown[placeholder_key]);
58 + local last_it;
59 + createReverseIterator(last_it, param_ctype.unknown);
60 + theName = key(last_it);
61 + removeVariable(param_ctype.unknown);
62 + insert param.name = theName;
63 + }
64 + }
65 + insert argnames[theName] = index(param);
66 + }
67 + setall ctype_ref.param.map = argnames;
68 +
69 + rtxPH_compile<ctype_ref.param.type>(ctype_ref.param, compile, node_idx);
70 + }
71 +
72 +
73 // if type is enum
74 if (existVariable(ctype_ref.enum))
75 {