about summary refs log tree commit diff stats
path: root/html/linux/mu-init.subx.html
Commit message (Expand)AuthorAgeFilesLines
* .Kartik K. Agaram2021-07-161-7/+7
* .Kartik Agaram2021-06-261-3/+3
* .Kartik Agaram2021-06-241-3/+3
* .Kartik Agaram2021-04-211-3/+3
* .Kartik Agaram2021-03-231-0/+122
r Arne Döring <arne.doering@gmx.net> 2017-07-25 09:28:23 +0200 committer Andreas Rumpf <rumpf_a@web.de> 2017-07-25 09:28:23 +0200 Remove expr/stmt (#5857)' href='/ahoang/Nim/commit/tests/parser/toprprec.nim?h=devel&id=000b8afd26fa16684a116d9afe798ea94df9c270'>000b8afd2 ^
959e370ae ^




e80465dac ^
959e370ae ^






19fbc8a55 ^

e80465dac ^
19fbc8a55 ^

e80465dac ^
19fbc8a55 ^

959e370ae ^




19fbc8a55 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
           

                
                           
 




                                                  




                                
 






                                 

                            
                            

                          
 

                         




                     
           
discard """
  output: "done"
"""
# Test operator precedence:

template `@` (x: untyped): untyped {.immediate.} =
  `self`.x

template `@!` (x: untyped): untyped = x
template `===` (x: untyped): untyped = x

type
  TO = object
    x: int
  TA = tuple[a, b: int, obj: TO]

proc init(self: var TA): string =
  @a = 3
  === @b = 4
  @obj.x = 4
  @! === result = "abc"
  result = @b.`$`

assert 3+5*5-2 == 28- -26-28

proc `^-` (x, y: int): int =
  # now right-associative!
  result = x - y

assert 34 ^- 6 ^- 2 == 30
assert 34 - 6 - 2 == 26


var s: TA
assert init(s) == "4"

echo "done"