Commit d9da3ea7 authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur 🏢
Browse files

added Boolean to FunctionKind to mark genetared functions

parent 34dcba46
......@@ -280,7 +280,7 @@ newFunction opt_id fun_bodies local_vars arg_types result_type group_index (ci_n
, fun_type = Yes fun_type
, fun_pos = NoPos
, fun_index = NoIndex
, fun_kind = FK_Function
, fun_kind = FK_Function cFunctionGenerated
, fun_lifted = 0
, fun_info = { EmptyFunInfo & fi_group_index = group_index, fi_local_vars = local_vars }
}
......@@ -834,6 +834,7 @@ where
copy (DictionarySelection record selectors expr_ptr index_expr) cp_info
# (index_expr, cp_info) = copy index_expr cp_info
(selectors, cp_info) = copy selectors cp_info
(record, cp_info) = copy record cp_info
= (DictionarySelection record selectors expr_ptr index_expr, cp_info)
copy (ArraySelection selector expr_ptr index_expr) cp_info
# (index_expr, cp_info) = copy index_expr cp_info
......
......@@ -470,17 +470,17 @@ where
localsExpected = isNotEmpty args || isGlobalContext context
(rhs, pState) = wantRhs isRhsStartToken localsExpected pState
= case fun_kind of
FK_Function | isDclContext context
FK_Function _ | isDclContext context
-> (PD_Function pos name is_infix args rhs fun_kind, parseError "RHS" No "<type specification>" pState)
FK_Caf | isNotEmpty args
-> (PD_Function pos name is_infix [] rhs fun_kind, parseError "CAF" No "No arguments for a CAF" pState)
_ -> (PD_Function pos name is_infix args rhs fun_kind, pState)
where
token_to_fun_kind s BarToken = (FK_Function, False, s)
token_to_fun_kind s (SeqLetToken _) = (FK_Function, False, s)
token_to_fun_kind s EqualToken = (FK_Function, True, s)
token_to_fun_kind s BarToken = (FK_Function cFunctionNotGenerated, False, s)
token_to_fun_kind s (SeqLetToken _) = (FK_Function cFunctionNotGenerated, False, s)
token_to_fun_kind s EqualToken = (FK_Function cFunctionNotGenerated, True, s)
token_to_fun_kind s ColonDefinesToken = (FK_Macro, False, s)
token_to_fun_kind s DoubleArrowToken = (FK_Function, True, s)
token_to_fun_kind s DoubleArrowToken = (FK_Function cFunctionNotGenerated, True, s)
token_to_fun_kind s DefinesColonToken = (FK_Caf, False, s)
token_to_fun_kind s token = (FK_Unknown, False, parseError "RHS" (Yes token) "defines token (=, => or =:) or argument" s)
......
......@@ -313,7 +313,7 @@ transformLambda lam_ident args result
# lam_rhs = { rhs_alts = UnGuardedExpr { ewl_nodes = [], ewl_expr = result, ewl_locals = NoCollectedLocalDefs },
rhs_locals = NoCollectedLocalDefs }
lam_body = [{pb_args = args, pb_rhs = lam_rhs }]
fun_def = MakeNewFunction lam_ident (length args) lam_body FK_Function NoPrio No NoPos
fun_def = MakeNewFunction lam_ident (length args) lam_body (FK_Function cFunctionGenerated) NoPrio No NoPos
= fun_def
makeNilExpression :: *CollectAdmin -> (ParsedExpr,*CollectAdmin)
......@@ -740,7 +740,7 @@ MakeNewFunction name arity body kind prio opt_type pos
// +++ position
MakeNewParsedDef ident args rhs
:== PD_Function NoPos ident False args rhs FK_Function
:== PD_Function NoPos ident False args rhs (FK_Function cFunctionGenerated)
collectFunctionBodies :: !Ident !Int !Priority !FunKind ![ParsedDefinition] !*CollectAdmin
-> (![ParsedBody], !FunKind, ![ParsedDefinition], !*CollectAdmin)
......
......@@ -134,7 +134,9 @@ cIsNotAFunction :== False
| PD_ImportedObjects [ImportedObject]
| PD_Erroneous
:: FunKind = FK_Function | FK_Macro | FK_Caf | FK_Unknown
:: FunKind = FK_Function !Bool | FK_Macro | FK_Caf | FK_Unknown
cFunctionNotGenerated :== False
cFunctionGenerated :== True
:: ParsedSelector =
{ ps_field_name :: !Ident
......
......@@ -137,7 +137,9 @@ cIsNotAFunction :== False
| PD_ImportedObjects [ImportedObject]
| PD_Erroneous
:: FunKind = FK_Function | FK_Macro | FK_Caf | FK_Unknown
:: FunKind = FK_Function !Bool | FK_Macro | FK_Caf | FK_Unknown
cFunctionNotGenerated :== False
cFunctionGenerated :== True
:: ParsedSelector =
{ ps_field_name :: !Ident
......
......@@ -1021,7 +1021,7 @@ possibly_generate_case_function kees=:{case_info_ptr} aci=:{aci_free_vars} ro ti
, fun_type = Yes fun_type
, fun_pos = NoPos
, fun_index = fun_index
, fun_kind = FK_Function
, fun_kind = FK_Function cFunctionGenerated
, fun_lifted = undeff
, fun_info = { fi_calls = []
, fi_group_index = outer_fun_def.fun_info.fi_group_index
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment