OILS / spec / testdata / module2 / util.ysh View on Github | oilshell.org

28 lines, 16 significant
1const __provide__ = :| MY_INTEGER log die setvar_noleak setglobal_noleak invokableObj |
2
3# should be null
4echo "caller_no_leak = $[getVar('caller_no_leak')]"
5
6const MY_INTEGER = 42
7
8proc log {
9 echo log @ARGV
10}
11
12proc die {
13 echo die @ARGV
14}
15
16setvar setvar_noleak = 'util.ysh'
17setglobal setglobal_noleak = 'util.ysh'
18
19
20proc myInvoke (; self, param) {
21 echo "sum = $[self.x + self.y + param]"
22}
23
24var methods = Object(null, {'__invoke__': myInvoke})
25
26var invokableObj = Object(methods, {x: 3, y: 4})
27
28#invokableObj (1)