Skip to content

Commit eeb9a78

Browse files
committed
Add comments in GenWrap
1 parent e7ac592 commit eeb9a78

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/comp/GenWrap.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,7 @@ genTo pps ty mk =
11061106
fields <- mapM recurse nums
11071107
return (concat fields)
11081108
_ -> do
1109+
-- Compute the prefix and arg_names pragmas for the flattened interface field, extended according to the current prefix.
11091110
let currentPre = ifcp_renamePrefixes prefixes -- the current rename prefix
11101111
localPrefix1 = fromMaybe (getIdBaseString f) (lookupPrefixIfcPragma ciPrags)
11111112
localPrefix = joinStrings_ currentPre localPrefix1
@@ -1205,6 +1206,8 @@ genFrom pps ty var =
12051206
let qs = if (hasNoRdy || isClock || isReset || isIot)
12061207
then [] else [CQFilter meth_guard]
12071208

1209+
-- Call fromWrapField with a proxy for the field name as a type level string,
1210+
-- and the field selection from the unwrapped module.
12081211
let fnp = mkTypeProxyExpr $ TAp (cTCon idStrArg) $ cTStr (fieldPathName prefixes f) (getIdPosition f)
12091212
let e = CApply (CVar idFromWrapField) [fnp, sel binf]
12101213
return (f, e, qs)
@@ -1618,6 +1621,9 @@ mkFromBind true_ifc_ids var ft =
16181621
let meth_guard = CApply eUnpack [sel wbinf]
16191622
let qs = if (wbinf `elem` true_ifc_ids || isClock || isReset || isIot)
16201623
then [] else [CQFilter meth_guard]
1624+
1625+
-- Call fromWrapField with a proxy for the field name as a type level string,
1626+
-- and the field selection from the unwrapped module.
16211627
let fnp = mkTypeProxyExpr $ TAp (cTCon idStrArg) $ cTStr (fieldPathName prefixes f) (getIdPosition f)
16221628
let e = CApply (CVar idFromWrapField) [fnp, sel binf]
16231629
return (f, e, qs)
@@ -2195,6 +2201,8 @@ mkFieldSavePortTypeStmts v ifcId = concatMapM $ meth noPrefixes ifcId
21952201
meth newprefixes ifcIdIn (FInf (mkNumId num) [] tVec [])
21962202
concatMapM recurse nums
21972203
_ -> do
2204+
-- Compute the local prefix and result name for this field in the flattened interface
2205+
-- from the current prefixes and pragmas from the field definition.
21982206
let methodStr = getIdBaseString f
21992207
currentPre = ifcp_renamePrefixes prefixes -- the current rename prefix
22002208
localPrefix1 = fromMaybe (getIdBaseString f) (lookupPrefixIfcPragma ciPrags)
@@ -2204,6 +2212,8 @@ mkFieldSavePortTypeStmts v ifcId = concatMapM $ meth noPrefixes ifcId
22042212
Just str -> joinStrings_ currentPre str
22052213
Nothing -> joinStrings_ currentPre methodStr
22062214

2215+
-- Arguments to saveFieldPortTypes: proxies for the field name as a type level string and the field type,
2216+
-- and the values for the prefix, arg_names, and result pragmas.
22072217
let fproxy = mkTypeProxyExpr $ TAp (cTCon idStrArg) $ cTStr (fieldPathName prefixes f) (getIdPosition f)
22082218
proxy = mkTypeProxyExpr $ foldr arrow r as
22092219
prefix = stringLiteralAt noPosition localPrefix

0 commit comments

Comments
 (0)