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:
79
79
def factorial (n : BigInt ): BigInt = {
80
80
val msg = s " factorial( $n) "
81
81
println(s " ${" " * indent}start $msg" )
82
- Logger .inline$indent += indentSetting
82
+ Logger .inline$indent_=( indent. + ( indentSetting))
83
83
val result =
84
84
if (n == 0 ) 1
85
85
else n * factorial(n - 1 )
86
- Logger .inline$indent -= indentSetting
86
+ Logger .inline$indent_=( indent. - ( indentSetting))
87
87
println(s " ${" " * indent}$msg = $result" )
88
88
result
89
89
}
90
90
```
91
91
92
92
Note, that the by-value parameter is evaluated only once, per the usual Scala
93
93
semantics, 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_= ` .
95
96
96
97
### Recursive Inline Methods
97
98
You can’t perform that action at this time.
0 commit comments