-
Notifications
You must be signed in to change notification settings - Fork 7
/
hlltest.winxed
68 lines (58 loc) · 1.08 KB
/
hlltest.winxed
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! winxed
// hlltest.winxed
// Testing the experimental HLL feature.
// Some tricks are needed to locate the functions.
// This function is used to avoid infinite recursion in set_string_native
function newstring()
{
var s = new ['parrot': 'String'];
return s;
}
namespace foo [HLL]
{
class MyString
{
var str;
function set_string_native[vtable](string s)
{
${ say 'set' };
using static newstring;
var str = newstring();
str =: s;
self.str = str;
}
function get_string[vtable]()
{
${ say 'get' };
string s = self.str;
return s;
}
}
function bar(var s)
{
${ say 'bar <' };
string str = s;
${ say 'bar >' };
return str;
}
function createmappings()
{
var interp = getinterp();
var ms = new foo.MyString;
interp.hll_map('String', ms);
}
} // foo
function main()
{
using foo.createmappings;
using foo.bar;
createmappings();
say('Hi');
var s = new foo.MyString;
s =: 'Hello';
say(s);
var x = bar('world');
cry(': ');
say(x);
}
// End