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