comparison rathaxes_compiler_passes_fix_ref_scalar_issues_with_chunk_parameters.patch @ 127:72b5b4a62cc5

Wip on fixing ref/scalar issues, partly fixed
author Louis Opter <louis@lse.epita.fr>
date Sun, 18 Aug 2013 15:33:24 -0700
parents
children 518d9c8ac70c
comparison
equal deleted inserted replaced
126:6e142648b2fe 127:72b5b4a62cc5
1 # HG changeset patch
2 # Parent aa64f4dc928c5e844d1a7005652d059979544239
3 rathaxes: fix ref/scalar issues with chunk parameters
4
5 diff --git a/rathaxes/compiler/passes/common/rtxResolve.inc.cws b/rathaxes/compiler/passes/common/rtxResolve.inc.cws
6 --- a/rathaxes/compiler/passes/common/rtxResolve.inc.cws
7 +++ b/rathaxes/compiler/passes/common/rtxResolve.inc.cws
8 @@ -449,22 +449,35 @@
9 }
10 else if (search_chunk == false) // This may be the rtx implementation chunk -> different way to resolve...
11 {
12 - if (rtxNode2cnormNode<src_p.type>(src_p, param_value) == false)
13 - error(RED + "Could not translate rathaxes node " + toString(src_p, true)
14 - + " to a resVal (containing one cnorm) node." + DEFAULT_COLOR);
15 - setall param_type = src_p.rtype;
16 - if (param_value.type == "__expr__" && param_value.operator != "__literal__")
17 +
18 + if (rtxNodeArgs_GetArgByName(src_resVals, src_p.val, src_arg) == true)
19 {
20 - local src_arg;
21 - local src_name = param_value.id;
22 - if (rtxNodeArgs_GetArgByName(src_resVals, src_name, src_arg))
23 - return false;
24 if (rtxNodeArg_getRType(src_arg, param_type) == false)
25 return false;
26 if (rtxNodeArg_getValue(src_arg, param_value) == false)
27 return false;
28 param_name = dst_p;
29 }
30 + else
31 + {
32 + if (rtxNode2cnormNode<src_p.type>(src_p, param_value) == false)
33 + error(RED + "Could not translate rathaxes node " + toString(src_p, true)
34 + + " to a resVal (containing one cnorm) node." + DEFAULT_COLOR);
35 +
36 + setall param_type = src_p.rtype;
37 + if (param_value.type == "__expr__" && param_value.operator != "__literal__")
38 + {
39 + local src_arg;
40 + local src_name = param_value.id;
41 + if (rtxNodeArgs_GetArgByName(src_resVals, src_name, src_arg))
42 + return false;
43 + if (rtxNodeArg_getRType(src_arg, param_type) == false)
44 + return false;
45 + if (rtxNodeArg_getValue(src_arg, param_value) == false)
46 + return false;
47 + param_name = dst_p;
48 + }
49 + }
50 }
51 else
52 {
53 @@ -529,7 +542,13 @@
54
55 // Now, resolve the loaded chunk...
56 local resVals;
57 - rtxResolve_BuildParameterResVals(resolverValues, call.args, resVals, chunkTree.tpl_params, source_tree, false);
58 + if (rtxResolve_BuildParameterResVals(resolverValues, call.args, resVals, chunkTree.tpl_params, source_tree, false) == false)
59 + {
60 + // TODO: should be an error, but will be break to many things at
61 + // this point:
62 + traceLine(RED + "[Error] Could not build front-end parameter resvals." + DEFAULT_COLOR);
63 + }
64 +
65 if (instanceChunk<chunkTree.instanceKey>(resVals, chunkTree.body, source_tree) == false)
66 {
67 increment(errcount);
68 @@ -716,6 +735,8 @@
69 }
70 else
71 {
72 + traceLine(YELLOW + "[Warning] Using variable's identifier as resolved value (high probability to be wrong): "
73 + + local_node#parent.location + DEFAULT_COLOR);
74 clearVariable(self_value);
75 cnormNode_TerminalId(self_value, varName);
76 }