-
-collectCC cc mod_name scope_cc us ids (local_ccs, extern_ccs, ccss)
- = ASSERT(not (noCCAttached cc))
- if (cc `ccFromThisModule` mod_name) then
- ((cc : local_ccs, extern_ccs, ccss), ())
- else -- must declare it "extern"
- ((local_ccs, cc : extern_ccs, ccss), ())
+collectCC cc
+ = MassageM $ \mod_name _scope_cc _us _ids (local_ccs, extern_ccs, ccss)
+ -> ASSERT(not (noCCAttached cc))
+ if (cc `ccFromThisModule` mod_name) then
+ ((cc : local_ccs, extern_ccs, ccss), ())
+ else -- must declare it "extern"
+ ((local_ccs, cc : extern_ccs, ccss), ())
+
+-- Version of collectCC used when we definitely want to declare this
+-- CC as local, even if its module name is not the same as the current
+-- module name (eg. the special :Main module) see bug #249, #1472,
+-- test prof001,prof002.
+collectNewCC :: CostCentre -> MassageM ()
+collectNewCC cc
+ = MassageM $ \_mod_name _scope_cc _us _ids (local_ccs, extern_ccs, ccss)
+ -> ((cc : local_ccs, extern_ccs, ccss), ())