diff options
author | johnvg | 2004-07-13 11:43:34 +0000 |
---|---|---|
committer | johnvg | 2004-07-13 11:43:34 +0000 |
commit | 49446d560c39d6250586710bb62a2a1e48c92e34 (patch) | |
tree | 81a23106424c8f552d47cd1357ae132e40173a5e | |
parent | remove syntax problem caused by cvs (diff) |
fix conversion of selection (pattern match in lhs of where or let)
from a constructor (not a tuple or record) on a cycle
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1502 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r-- | backendC/CleanCompilerSources/sa.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/backendC/CleanCompilerSources/sa.c b/backendC/CleanCompilerSources/sa.c index 5232383..be6ba8c 100644 --- a/backendC/CleanCompilerSources/sa.c +++ b/backendC/CleanCompilerSources/sa.c @@ -2472,26 +2472,31 @@ static Exp ConvertNode (Node node, NodeId nid) } case MatchNode: { - Exp exp; Symbol symbol; - exp = ConvertNode (node->node_arguments->arg_node, Null); - symbol=node->node_symbol; if (symbol->symb_kind==definition && symbol->symb_def->sdef_kind==CONSTRUCTOR && - symbol->symb_def->sdef_arity==1) + symbol->symb_def->sdef_arity==1) { Exp selexp; selexp = NewValueExp (selectsym[0], False, 1); - selexp->e_args[0] = exp; - exp = selexp; + if (nid) + nid->nid_exp_ = selexp; + + selexp->e_args[0] = ConvertNode (node->node_arguments->arg_node,NULL); + + return selexp; + } else { + if (nid) + nid->nid_exp_ = NULL; + + node=node->node_arguments->arg_node; + if (node->node_kind==NodeIdNode) + return ConvertNodeId (node->node_node_id); + else + return ConvertNode (node,nid); } - - if (nid) - nid->nid_exp_ = exp; - - return exp; } default: DoFatalError ("ConvertNode (SA): unknown node kind"); |