Changeset 73751c0 in mainline for uspace/dist/src/sysel/demos/property.sy
- Timestamp:
- 2011-03-18T12:16:36Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b495a93
- Parents:
- 42a3a57 (diff), b64eac6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/dist/src/sysel/demos/property.sy
r42a3a57 r73751c0 33 33 prop X : int is 34 34 get is 35 Builtin.Write("Getting value of X which is ");36 Builtin.WriteLine(x);35 Console.Write("Getting value of X which is "); 36 Console.WriteLine(x); 37 37 return x; 38 38 end 39 39 40 40 set value is 41 Builtin.Write("Setting value of X to ");42 Builtin.WriteLine(value);41 Console.Write("Setting value of X to "); 42 Console.WriteLine(value); 43 43 x = value; 44 44 end 45 end 46 47 -- Test accessing property via an unqualified name 48 fun TestUnqualPropAcc() is 49 var i : int; 50 51 X = 1; 52 i = X; 53 54 Console.Write("TestUnqualPropAcc(): Got "); 55 Console.WriteLine(i); 45 56 end 46 57 … … 51 62 prop self[index : int] : int is 52 63 get is 53 Builtin.Write("Getting property with index ");54 Builtin.Write(index);55 Builtin.Write(" which is ");56 Builtin.WriteLine(iprops[index]);64 Console.Write("Getting property with index "); 65 Console.Write(index); 66 Console.Write(" which is "); 67 Console.WriteLine(iprops[index]); 57 68 58 69 return iprops[index]; … … 60 71 61 72 set value is 62 Builtin.Write("Setting property with index ");63 Builtin.Write(index);64 Builtin.Write(" to ");65 Builtin.WriteLine(value);73 Console.Write("Setting property with index "); 74 Console.Write(index); 75 Console.Write(" to "); 76 Console.WriteLine(value); 66 77 67 78 iprops[index] = value; … … 82 93 prop B : Bar is 83 94 get is 84 Builtin.WriteLine("Getting B");95 Console.WriteLine("Getting B"); 85 96 return bprop; 86 97 end 87 98 set value is 88 Builtin.WriteLine("Setting B");99 Console.WriteLine("Setting B"); 89 100 bprop = value; 90 101 end … … 110 121 i = a.X; 111 122 112 Builtin.Write("Main(): Got "); 113 Builtin.WriteLine(i); 123 Console.Write("Main(): Got "); 124 Console.WriteLine(i); 125 126 a.TestUnqualPropAcc(); 114 127 115 128 a.iprops = new int[5]; … … 121 134 i = a[1]; 122 135 123 Builtin.Write("Main(): Got ");124 Builtin.WriteLine(i);136 Console.Write("Main(): Got "); 137 Console.WriteLine(i); 125 138 126 139 -- Property field access … … 132 145 a.bprop = b; 133 146 134 Builtin.WriteLine(a.bprop.i);147 Console.WriteLine(a.bprop.i); 135 148 a.bprop.i = 2; 136 Builtin.WriteLine(a.bprop.i);149 Console.WriteLine(a.bprop.i); 137 150 end 138 151 end
Note:
See TracChangeset
for help on using the changeset viewer.