Mercurial > archived > louis > epitech > mq > rathaxes
diff FixScalarRefCasts @ 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FixScalarRefCasts Mon Mar 25 01:17:56 2013 +0100 @@ -0,0 +1,60 @@ +# HG changeset patch +# Parent 9fcbcd542e91d0b05c087f4c44cb26c6f4df9ddc +Add .ref and .scalar to rathaxes types + +diff --git a/rathaxes/compiler/node/rtxNodeBack.inc.cws b/rathaxes/compiler/node/rtxNodeBack.inc.cws +--- a/rathaxes/compiler/node/rtxNodeBack.inc.cws ++++ b/rathaxes/compiler/node/rtxNodeBack.inc.cws +@@ -19,7 +19,7 @@ + declare function rtxNodePlaceHolder(local_node : node); + declare function rtxNodeCall(local_node : node, theVars : node, theChunk : node, out_ref_params : reference); + declare function rtxNodeSequenceCall(local_node : node, name : node, args : node); +-declare function rtxNodeCast(local_node : node, varName : value, typeId : node); ++declare function rtxNodeCast(local_node : node, varName : value, typeId : node, sQualifier : value); + // Tool functions for the resolution/generation + declare function rtxNodeResVal_GetField(resolver_values : node, idList : node, out_ref : reference); + declare function rtxNodeResVal(local_node : node); +@@ -233,7 +233,7 @@ + return true; + } + +-function rtxNodeCast(local_node : node, varName : value, typeId : node) ++function rtxNodeCast(local_node : node, varName : value, typeId : node, sQualifier : value) + { + rtxNode(local_node); + local_node.type = "__rtx_tpl_cast__"; +@@ -244,6 +244,8 @@ + local dummy; + if (rtxNodeRType(local_node.rtype, typeId, dummy) == false) + return false; ++ if (rtxNodeRType_SetQualifier(local_node.rtype, sQualifier) == false) ++ return false; + + return true; + } +diff --git a/rathaxes/compiler/passes/back/rtxMeta.inc.cws b/rathaxes/compiler/passes/back/rtxMeta.inc.cws +--- a/rathaxes/compiler/passes/back/rtxMeta.inc.cws ++++ b/rathaxes/compiler/passes/back/rtxMeta.inc.cws +@@ -292,15 +292,20 @@ + + // Here, we allow casting a local C variable into a rathaxes type. This casts lasts for the current chunk's scope. + tpl_cast(theCast : node) ::= ++/**/ => local sQualifier = "scalar"; + "cast" ++ #continue(sError, "A cast can only be applied to a local variable (\"local.\" is expected).") + => local typeId; +- #continue(sError, "A cast can only be applied to a local variable (\"local.\" is expected).") + "local" '.' rootidentifier:varName + #continue(sError, "Expected 'as' token for a rathaxes cast.") + "as" + #continue(sError, "Expected Type name for casting type.") + rtx_scoped_identifier(typeId, false) +- #check(rtxNodeCast(theCast, varName, typeId)) ++ [ ++ "." ++ tpl_type_qualifier:sQualifier ++ ]? ++ #check(rtxNodeCast(theCast, varName, typeId, sQualifier)) + ; + + tpl_type_qualifier ::=