Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Drop unnecessary 3'rd argument of `erlydtl_runtime:translate/3`

  • Loading branch information...
commit 8ea79fadb4382cbf2c2e2641821dd97ddb6c9679 1 parent 68ce483
Sergey Prokhorov seriyps authored kaos committed
Showing with 8 additions and 8 deletions.
  1. +1 −1  src/erlydtl_compiler.erl
  2. +7 −7 src/erlydtl_runtime.erl
2  src/erlydtl_compiler.erl
View
@@ -1278,7 +1278,7 @@ runtime_trans_ast(ValueAst, AstInfo, TreeWalker) ->
StringLookupAst = erl_syntax:application(
erl_syntax:atom(erlydtl_runtime),
erl_syntax:atom(translate),
- [ValueAst, erl_syntax:variable("_TranslationFun"), ValueAst]), %TODO: remove 3'rd arg
+ [ValueAst, erl_syntax:variable("_TranslationFun")]),
{{StringLookupAst, AstInfo}, TreeWalker}.
compiletime_trans_ast(String, AstInfo,
14 src/erlydtl_runtime.erl
View
@@ -110,15 +110,15 @@ regroup([Item|Rest], Attribute, [[{grouper, PrevGrouper}, {list, PrevList}]|Acc]
regroup(Rest, Attribute, [[{grouper, Value}, {list, [Item]}], [{grouper, PrevGrouper}, {list, lists:reverse(PrevList)}]|Acc])
end.
--spec translate(Str, none | translate_fun(), Str) -> Str when
+-spec translate(Str, none | translate_fun()) -> Str when
Str :: string() | binary().
-translate(_, none, Default) ->
- Default;
-translate(String, TranslationFun, Default) when is_function(TranslationFun) ->
+translate(String, none) -> String;
+translate(String, TranslationFun)
+ when is_function(TranslationFun) ->
case TranslationFun(String) of
- undefined -> Default;
- <<"">> -> Default;
- "" -> Default;
+ undefined -> String;
+ <<"">> -> String;
+ "" -> String;
Str -> Str
end.
Please sign in to comment.
Something went wrong with that request. Please try again.