-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
templater: introduce Formatter wrapper to switch strict/lax evaluations
This allows us to propagate property evaluation error to a string property. For instance, "s.contains(x ++ y)" will be an error if "y" failed to evaluate, whereas bare "x ++ y" shouldn't. The other implementation ideas: a. add Template::into_string_property() to enable strict evaluation => it's tedious to implement it for each printable type b. pass (formatter, error_handler) arguments separately => works, but most implementors don't need error_handler argument c. pass strict=bool flag around build_*() functions => didn't tried, but it would be more complicated than this patch Because Template trait is now implementation detail of the templater, it should be okay to use a non-standard formatter wrapper.
- Loading branch information
Showing
4 changed files
with
148 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.