File tree Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -384,17 +384,29 @@ toC toCMode (Binder meta root) = emitterSrc (execState (visit startingIndent roo
384
384
emitCaseMatcher :: (String , String ) -> String -> XObj -> Integer -> State EmitterState ()
385
385
emitCaseMatcher (periodOrArrow, ampersandOrNot) caseName (XObj (Sym path _) _ t) index =
386
386
let Just tt = t
387
- in appendToSrc
388
- ( addIndent indent' ++ tyToCLambdaFix tt ++ " " ++ pathToC path ++ " = "
389
- ++ ampersandOrNot
390
- ++ tempVarToAvoidClash
391
- ++ periodOrArrow
392
- ++ " u."
393
- ++ mangle caseName
394
- ++ " .member"
395
- ++ show index
396
- ++ " ;\n "
397
- )
387
+ in if tt == exprTy
388
+ then appendToSrc
389
+ ( addIndent indent' ++ tyToCLambdaFix tt ++ " " ++ pathToC path ++ " = "
390
+ ++ " *"
391
+ ++ tempVarToAvoidClash
392
+ ++ periodOrArrow
393
+ ++ " u."
394
+ ++ mangle caseName
395
+ ++ " .member"
396
+ ++ show index
397
+ ++ " ;\n "
398
+ )
399
+ else appendToSrc
400
+ ( addIndent indent' ++ tyToCLambdaFix tt ++ " " ++ pathToC path ++ " = "
401
+ ++ ampersandOrNot
402
+ ++ tempVarToAvoidClash
403
+ ++ periodOrArrow
404
+ ++ " u."
405
+ ++ mangle caseName
406
+ ++ " .member"
407
+ ++ show index
408
+ ++ " ;\n "
409
+ )
398
410
emitCaseMatcher periodOrArrow caseName (XObj (Lst (XObj (Sym (SymPath _ innerCaseName) _) _ _ : xs)) _ _) index =
399
411
zipWithM_ (\ x i -> emitCaseMatcher periodOrArrow (caseName ++ " .member" ++ show i ++ " .u." ++ removeSuffix innerCaseName) x index) xs ([0 .. ] :: [Int ])
400
412
emitCaseMatcher _ _ xobj _ =
You can’t perform that action at this time.
0 commit comments