Wiki

root/cobra/trunk/Tests/100-basics/502-to.cobra

Revision 1198, 410 bytes (checked in by chuck, 4 years ago)

Forgot these files with the last checkin.
Last checkin notes were:
Fixed: Using typecasting (to) in an expression that initializes a class variable causes an internal error.
Added some more non-nil library fixes.
Internal: Added Compiler.boxMemberStack and .curBoxMember.

  • Property svn:eol-style set to native
Line 
1class Test
2
3    def main
4        is shared
5       
6        i as int = 5
7       
8        o as Object = i to Object  # not strictly necessary to cast, but a useful test
9
10        CobraCore.noOp(o)
11
12
13class Foo
14
15    # using `to` in an expression used to initialize a variable
16    var _x = 0 to decimal   
17    var _o = 'aoeu' to Object
18   
19    def bar
20        .takeDecimal(_x)
21        .takeObject(_o)
22   
23    def takeDecimal(d as decimal)
24        pass
25   
26    def takeObject(o as Object)
27        pass
Note: See TracBrowser for help on using the browser.