- maybe_tc_return
- <- typecheckExpr dflags pcs1 hst print_unqual this_module rn_expr;
- case maybe_tc_return of
- Nothing -> return (pcs1, Nothing)
- Just (pcs2, tc_expr, ty) ->
- return (pcs2, Just (print_unqual, tc_expr, ty))
- }}}
-
-hscTypeExpr
- :: DynFlags
- -> HomeSymbolTable
- -> HomeIfaceTable
- -> PersistentCompilerState -- IN: persistent compiler state
- -> Module -- Context for compiling
- -> String -- The expression
- -> IO (PersistentCompilerState, Maybe (PrintUnqualified, Type))
-hscTypeExpr dflags hst hit pcs0 this_module expr
- = do (pcs1, maybe_tc_result)
- <- hscExprFrontEnd dflags hst hit pcs0 this_module expr
- case maybe_tc_result of
- Nothing -> return (pcs1, Nothing)
- Just (print_unqual,_,ty) -> return (pcs1, Just (print_unqual,ty))
-
-hscParseExpr :: DynFlags -> String -> IO (Maybe RdrNameHsExpr)
-hscParseExpr dflags str
+ maybe_tc_return
+ <- typecheckStmt dflags pcs1 hst type_env
+ print_unqual iNTERACTIVE bound_names rn_stmt
+ ; case maybe_tc_return of {
+ Nothing -> return (pcs0, Nothing) ;
+ Just (pcs2, tc_expr, bound_ids) -> do {
+
+ -- Desugar it
+ ds_expr <- deSugarExpr dflags pcs2 hst iNTERACTIVE print_unqual tc_expr
+
+ -- Simplify it
+ ; simpl_expr <- simplifyExpr dflags pcs2 hst ds_expr
+
+ -- Tidy it (temporary, until coreSat does cloning)
+ ; tidy_expr <- tidyCoreExpr simpl_expr
+
+ -- Saturate it
+ ; sat_expr <- coreSatExpr dflags tidy_expr
+
+ -- Convert to BCOs
+ ; bcos <- coreExprToBCOs dflags sat_expr
+
+ ; let
+ -- make all the bound ids "constant" ids, now that
+ -- they're notionally top-level bindings. This is
+ -- important: otherwise when we come to compile an expression
+ -- using these ids later, the byte code generator will consider
+ -- the occurrences to be free rather than global.
+ constant_bound_ids = map constantizeId bound_ids;
+
+ constantizeId id
+ = modifyIdInfo (`setFlavourInfo` makeConstantFlavour
+ (idFlavour id)) id
+
+ ; return (pcs2, Just (constant_bound_ids, bcos))
+ }}}}}
+
+hscParseStmt :: DynFlags -> String -> IO (Maybe RdrNameStmt)
+hscParseStmt dflags str