File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
docs/docs/reference/metaprogramming Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -79,19 +79,20 @@ In the `true` case the code will be rewritten to:
7979def factorial (n : BigInt ): BigInt = {
8080 val msg = s " factorial( $n) "
8181 println(s " ${" " * indent}start $msg" )
82- Logger .inline$indent += indentSetting
82+ Logger .inline$indent_=( indent. + ( indentSetting))
8383 val result =
8484 if (n == 0 ) 1
8585 else n * factorial(n - 1 )
86- Logger .inline$indent -= indentSetting
86+ Logger .inline$indent_=( indent. - ( indentSetting))
8787 println(s " ${" " * indent}$msg = $result" )
8888 result
8989}
9090```
9191
9292Note, that the by-value parameter is evaluated only once, per the usual Scala
9393semantics, by binding the value and reusing the ` msg ` through the body of
94- ` factorial ` .
94+ ` factorial ` . Also, note the special handling of setting to the private var
95+ ` indent ` by generating the setter method ` def inline$indent_= ` .
9596
9697### Recursive Inline Methods
9798
You can’t perform that action at this time.
0 commit comments