Revamp private/public functions
Problem: having public as the default makes it very easy to accidentally export local function by forgetting the `private` modifier. Solution: functions are private by default and must be declared as `entrypoint`s to be exported. So `entrypoint foo() = ...` instead of `function foo() = ...`. We still accept the `private` modifier although it is redundant.
This commit is contained in:
@@ -253,7 +253,7 @@ insert_call_function(Code, Call, FunName, Args, Options) ->
|
||||
[ Code,
|
||||
"\n\n",
|
||||
lists:duplicate(Ind, " "),
|
||||
"stateful function ", Call,"() = ", FunName, "(", string:join(Args, ","), ")\n"
|
||||
"stateful entrypoint ", Call, "() = ", FunName, "(", string:join(Args, ","), ")\n"
|
||||
]).
|
||||
|
||||
-spec insert_init_function(string(), options()) -> string().
|
||||
@@ -263,7 +263,7 @@ insert_init_function(Code, Options) ->
|
||||
lists:flatten(
|
||||
[ Code,
|
||||
"\n\n",
|
||||
lists:duplicate(Ind, " "), "function init() = ()\n"
|
||||
lists:duplicate(Ind, " "), "entrypoint init() = ()\n"
|
||||
]).
|
||||
|
||||
last_contract_indent(Decls) ->
|
||||
|
||||
Reference in New Issue
Block a user