Changeset 5981
- Timestamp:
- 08/01/05 20:28:26 (3 years ago)
- svk:copy_cache_prev:
- 8131
- Files:
-
- 15 modified
-
INSTALL (modified) (2 diffs)
-
ext/Algorithm-TokenBucket/t/test.t (modified) (1 diff)
-
perl5/PIL2JS/README (modified) (2 diffs)
-
perl5/PIL2JS/lib/PIL/Nodes.pm (modified) (5 diffs)
-
perl5/PIL2JS/lib6/Prelude/JS.pm (modified) (4 diffs)
-
perl5/PIL2JS/lib6/Prelude/JS/Array.pm (modified) (10 diffs)
-
perl5/PIL2JS/lib6/Prelude/JS/Bool.pm (modified) (1 diff)
-
perl5/PIL2JS/lib6/Prelude/JS/Code.pm (modified) (1 diff)
-
perl5/PIL2JS/lib6/Prelude/JS/ControlFlow.pm (modified) (1 diff)
-
perl5/PIL2JS/lib6/Prelude/JS/Hash.pm (modified) (3 diffs)
-
perl5/PIL2JS/lib6/Prelude/JS/Keyed.pm (modified) (6 diffs)
-
perl5/PIL2JS/lib6/Prelude/JS/Pair.pm (modified) (2 diffs)
-
perl5/PIL2JS/lib6/Prelude/JS/Ref.pm (modified) (3 diffs)
-
perl5/PIL2JS/libjs/PIL2JS.js (modified) (31 diffs)
-
perl5/PIL2JS/pil2js.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
INSTALL
r5978 r5981 146 146 may also need to switch to GCC 3.3 to compile Pugs for now. 147 147 148 Note that objects compiled with gcc 4.0 can't be linked with gcc 3.3 objects. This means that if you're embedding a parrot you've built with gcc 4.0, pugs will fail during linking with errors like: 148 Note that objects compiled with GCC 4.0 can't be linked with GCC 3.3 objects. 149 This means that if you're embedding a Parrot you've built with GCC 4.0, Pugs 150 will fail during linking with errors like: 149 151 150 152 ld: Undefined symbols: … … 155 157 _printf$LDBLStub 156 158 157 Try building a new parrot with gcc 3.3, then compile Pugs again.159 Try building a new Parrot with gcc 3.3, then compile Pugs again. 158 160 159 161 CAVEATS FOR x86_64 MACHINES -
ext/Algorithm-TokenBucket/t/test.t
r3580 r5981 19 19 $bucket<count>(1); 20 20 $bucket<count>(1); 21 #skip "skipping test depending on accurate time()";22 ok !$bucket<conform>(1), 'even 1 conforms no more';21 skip "skipping test depending on accurate time() and low system load"; 22 #ok !$bucket<conform>(1), 'even 1 conforms no more'; -
perl5/PIL2JS/README
r5852 r5981 79 79 had to create a proxying object, as Perl requires support for C<is rw> and C<is 80 80 copy>. C<new PIL2JS.Box(value)> returns an object supporting the methods 81 C<. GET()> (returns C<value>), C<.STORE(new_value)> (set to new value),81 C<.FETCH()> (returns C<value>), C<.STORE(new_value)> (set to new value), 82 82 C<.clone()>, and C<.toNative()> (return value as native object). 83 83 … … 91 91 92 92 Assignment is, thanks to the container type C<PIL2JS.Box>, simple: 93 C<dest.STORE(source)> (C<.STORE> calls C<source. GET()> then and return93 C<dest.STORE(source)> (C<.STORE> calls C<source.FETCH()> then and return 94 94 C<source>.) 95 95 -
perl5/PIL2JS/lib/PIL/Nodes.pm
r5965 r5981 73 73 my $name = $_->[0]; 74 74 $name =~ /^(?:__init_|__export_)/ 75 ? sprintf("%s. GET()([PIL2JS.Context.Void]);", PIL::Nodes::name_mangle $name)75 ? sprintf("%s.FETCH()([PIL2JS.Context.Void]);", PIL::Nodes::name_mangle $name) 76 76 : (); 77 77 } @{ $self->{"pilGlob" } }) . … … 202 202 $js =~ s/\n$//; 203 203 if($IN_SUBLIKE >= PIL::Nodes::SUBROUTINE) { 204 return "$pos;\n_26main_3a_3areturn. GET()([PIL2JS.Context.ItemAny, $js]);";204 return "$pos;\n_26main_3a_3areturn.FETCH()([PIL2JS.Context.ItemAny, $js]);"; 205 205 } elsif($IN_SUBLIKE >= PIL::Nodes::SUBBLOCK) { 206 return "$pos;\n_26main_3a_3aleave. GET()([PIL2JS.Context.ItemAny, $js]);";206 return "$pos;\n_26main_3a_3aleave.FETCH()([PIL2JS.Context.ItemAny, $js]);"; 207 207 } else { 208 208 return "$pos;\nreturn($js);"; … … 272 272 273 273 return "" unless $IN_SUBLIKE; 274 return "_26main_3a_3areturn. GET()([PIL2JS.Context.ItemAny, new PIL2JS.Box.Constant(undefined)]);"274 return "_26main_3a_3areturn.FETCH()([PIL2JS.Context.ItemAny, new PIL2JS.Box.Constant(undefined)]);" 275 275 if $IN_SUBLIKE >= PIL::Nodes::SUBROUTINE; 276 return "_26main_3a_3aleave. GET()([PIL2JS.Context.ItemAny, new PIL2JS.Box.Constant(undefined)]);"276 return "_26main_3a_3aleave.FETCH()([PIL2JS.Context.ItemAny, new PIL2JS.Box.Constant(undefined)]);" 277 277 if $IN_SUBLIKE >= PIL::Nodes::SUBBLOCK; 278 278 return "return(new PIL2JS.Box.Constant(undefined));" … … 382 382 } else { 383 383 return "new PIL2JS.Box.Constant($sub(\n$arg\n))" if $native; 384 return "$sub. GET()([\n$cxt,\n$arg\n])" if defined $native;384 return "$sub.FETCH()([\n$cxt,\n$arg\n])" if defined $native; 385 385 return sprintf "PIL2JS.call(undefined, %s, [\n%s,\n%s\n])", $sub, $cxt, $arg; 386 386 } … … 623 623 if($self->[0] =~ /^&\*END_\d+/) { 624 624 $js .= sprintf 625 "_40main_3a_3a_2aEND. GET().push(%s);\n",625 "_40main_3a_3a_2aEND.FETCH().push(%s);\n", 626 626 PIL::Nodes::name_mangle $self->[0]; 627 627 } -
perl5/PIL2JS/lib6/Prelude/JS.pm
r5965 r5981 11 11 12 12 # new PIL2JS.Box(...) boxes a value. That is, it is packed in an Object with 13 # the property . GET() holding the original value. This is necessary to emulate14 # pass by ref (needed for is rw and is ref).13 # the property .FETCH() holding the original value. This is necessary to 14 # emulate pass by ref (needed for is rw and is ref). 15 15 16 16 use Prelude::JS::Code; … … 39 39 return new PIL2JS.Box.Constant(args[0].uid == args[1].uid); 40 40 } else if(!args[0].uid && !args[1].uid) { 41 return new PIL2JS.Box.Constant(args[0]. GET() == args[1].GET());41 return new PIL2JS.Box.Constant(args[0].FETCH() == args[1].FETCH()); 42 42 } else { 43 43 return new PIL2JS.Box.Constant(false); … … 75 75 // We\'ve to [].concat here so we don\'t set .flatten_me of caller\'s 76 76 // original array. 77 var array = [].concat(args[1]. GET());77 var array = [].concat(args[1].FETCH()); 78 78 array.flatten_me = true; 79 79 var ret = new PIL2JS.Box.Constant(array); … … 102 102 sub infix:<~>(Str $__a, Str $__b) is primitive { 103 103 JS::inline('new PIL2JS.Box.Constant(function (args) { 104 var a = args[1]. GET(), b = args[2].GET();104 var a = args[1].FETCH(), b = args[2].FETCH(); 105 105 return new PIL2JS.Box.Constant(String(a) + String(b)); 106 106 })')(~$__a, ~$__b); -
perl5/PIL2JS/lib6/Prelude/JS/Array.pm
r5940 r5981 3 3 method JS::Root::shift(@self:) { 4 4 JS::inline('new PIL2JS.Box.Constant(function (args) { 5 var array = args[1]. GET();5 var array = args[1].FETCH(); 6 6 var ret = array.shift(); 7 7 return ret == undefined ? new PIL2JS.Box.Constant(undefined) : ret; … … 11 11 method JS::Root::pop(@self:) { 12 12 JS::inline('new PIL2JS.Box.Constant(function (args) { 13 var array = args[1]. GET();13 var array = args[1].FETCH(); 14 14 var ret = array.pop(); 15 15 return ret == undefined ? new PIL2JS.Box.Constant(undefined) : ret; … … 19 19 method JS::Root::unshift(@self: *@things) { 20 20 JS::inline('new PIL2JS.Box.Constant(function (args) { 21 var array = args[1]. GET(), add = args[2].GET();21 var array = args[1].FETCH(), add = args[2].FETCH(); 22 22 for(var i = add.length - 1; i >= 0; i--) { 23 array.unshift(new PIL2JS.Box(add[i]. GET()));23 array.unshift(new PIL2JS.Box(add[i].FETCH())); 24 24 } 25 25 return new PIL2JS.Box.Constant(array.length); … … 29 29 method JS::Root::push(@self: *@things) { 30 30 JS::inline('new PIL2JS.Box.Constant(function (args) { 31 var array = args[1]. GET(), add = args[2].GET();31 var array = args[1].FETCH(), add = args[2].FETCH(); 32 32 for(var i = 0; i < add.length; i++) { 33 array.push(new PIL2JS.Box(add[i]. GET()));33 array.push(new PIL2JS.Box(add[i].FETCH())); 34 34 } 35 35 return new PIL2JS.Box.Constant(array.length); … … 97 97 JS::inline('new PIL2JS.Box.Constant(function (args) { 98 98 // [].concat(...): Defeat modifying of the original array. 99 var array = [].concat(args[1]. GET()), cmp = args[2].GET();99 var array = [].concat(args[1].FETCH()), cmp = args[2].FETCH(); 100 100 var jscmp = function (a, b) { 101 101 return cmp([PIL2JS.Context.ItemAny, a, b]).toNative(); … … 182 182 JS::inline('new PIL2JS.Box.Constant(function (args) { 183 183 var cxt = args.shift(); 184 var iarr = args[0]. GET();184 var iarr = args[0].FETCH(); 185 185 186 186 var array = []; … … 188 188 // The extra new PIL2JS.Box is necessary to make the contents of arrays 189 189 // readwrite, i.e. my @a = (0,1,2); @a[1] = ... should work. 190 array[i] = new PIL2JS.Box(iarr[i]. GET());190 array[i] = new PIL2JS.Box(iarr[i].FETCH()); 191 191 } 192 192 … … 203 203 // my ($a, undef, $b) = (3,4,5); 204 204 // work. 205 iarr[i]. constant && iarr[i].GET() == undefined205 iarr[i].isConstant && iarr[i].FETCH() == undefined 206 206 ? new PIL2JS.Box(undefined) 207 207 : iarr[i] … … 209 209 } 210 210 211 var arr = new PIL2JS.Box([]).STORE(n). GET();211 var arr = new PIL2JS.Box([]).STORE(n).FETCH(); 212 212 for(var i = 0; i < arr.length; i++) { 213 213 if(marray[i]) marray[i].STORE(arr[i]); … … 236 236 JS::inline('new PIL2JS.Box.Constant(function (args) { 237 237 var cxt = args.shift(); 238 var array = args[0]. GET();238 var array = args[0].FETCH(); 239 239 var idx = Number(args[1].toNative()); 240 240 241 // Relay . GETand .STORE to array[idx].241 // Relay .FETCH and .STORE to array[idx]. 242 242 var ret = new PIL2JS.Box.Proxy( 243 243 function () { 244 244 var ret = array[idx]; 245 return ret == undefined ? undefined : ret. GET();245 return ret == undefined ? undefined : ret.FETCH(); 246 246 }, 247 247 function (n) { -
perl5/PIL2JS/lib6/Prelude/JS/Bool.pm
r5964 r5981 12 12 sub prefix:<?>($a) is primitive { 13 13 JS::inline('new PIL2JS.Box.Constant(function (args) { 14 var a = args[1]. GET();14 var a = args[1].FETCH(); 15 15 if(a instanceof PIL2JS.Ref && a.autoderef) { 16 if(a.referencee. GET() instanceof Array) {17 return new PIL2JS.Box.Constant(a.referencee. GET().length > 0);18 } else if(a.referencee. GET() instanceof PIL2JS.Hash) {19 return new PIL2JS.Box.Constant(a.referencee. GET().pairs().length > 0);16 if(a.referencee.FETCH() instanceof Array) { 17 return new PIL2JS.Box.Constant(a.referencee.FETCH().length > 0); 18 } else if(a.referencee.FETCH() instanceof PIL2JS.Hash) { 19 return new PIL2JS.Box.Constant(a.referencee.FETCH().pairs().length > 0); 20 20 } else { 21 return _26main_3a_3aprefix_3a_3f. GET()([PIL2JS.Context.ItemAny, a.referencee]);21 return _26main_3a_3aprefix_3a_3f.FETCH()([PIL2JS.Context.ItemAny, a.referencee]); 22 22 } 23 23 } else if(a instanceof PIL2JS.Ref) { -
perl5/PIL2JS/lib6/Prelude/JS/Code.pm
r5733 r5981 1 1 method JS::Root::arity(Code $self:) { 2 2 JS::inline('new PIL2JS.Box.Constant(function (args) { 3 return new PIL2JS.Box.Constant(args[1]. GET().pil2js_arity);3 return new PIL2JS.Box.Constant(args[1].FETCH().pil2js_arity); 4 4 })')($self); 5 5 } -
perl5/PIL2JS/lib6/Prelude/JS/ControlFlow.pm
r5940 r5981 88 88 var cxt = args[0], code = args[1]; 89 89 var ret = new PIL2JS.Box.Constant(undefined); 90 try { ret = code. GET()([PIL2JS.Context.ItemAny]) } catch(err) {90 try { ret = code.FETCH()([PIL2JS.Context.ItemAny]) } catch(err) { 91 91 if(err instanceof PIL2JS.ControlException.ret) { 92 92 throw err; -
perl5/PIL2JS/lib6/Prelude/JS/Hash.pm
r5965 r5981 3 3 JS::inline('new PIL2JS.Box.Constant(function (args) { 4 4 var cxt = args.shift(); 5 var pairs = args[0]. GET();5 var pairs = args[0].FETCH(); 6 6 var hash = new PIL2JS.Hash(); 7 7 8 8 for(var i = 0; i < pairs.length; i++) { 9 var pair = pairs[i]. GET();9 var pair = pairs[i].FETCH(); 10 10 11 11 // my %hash = ("a", 1, "b", 2); … … 27 27 hash.add_pair(new PIL2JS.Pair( 28 28 new PIL2JS.Box.ReadOnly(pair.key), 29 new PIL2JS.Box(pair.value. GET())29 new PIL2JS.Box(pair.value.FETCH()) 30 30 )); 31 31 } … … 42 42 JS::inline('new PIL2JS.Box.Constant(function (args) { 43 43 var cxt = args.shift(); 44 var hash = args[0]. GET();44 var hash = args[0].FETCH(); 45 45 var key = args[1]; 46 46 47 // Relay . GETand .STORE to hash.entries[key].47 // Relay .FETCH and .STORE to hash.entries[key]. 48 48 var ret = new PIL2JS.Box.Proxy( 49 49 function () { 50 50 var ret = hash.get_value(key); 51 return ret == undefined ? undefined : ret. GET();51 return ret == undefined ? undefined : ret.FETCH(); 52 52 }, 53 53 function (n) { -
perl5/PIL2JS/lib6/Prelude/JS/Keyed.pm
r5940 r5981 3 3 if $self.isa("Hash") { 4 4 JS::inline('new PIL2JS.Box.Constant(function (args) { 5 var hash = args[1]. GET(), key = args[2];5 var hash = args[1].FETCH(), key = args[2]; 6 6 return new PIL2JS.Box.Constant(hash.exists(key)); 7 7 })')(%$self, $idx); … … 10 10 } elsif $self.isa("Array") { 11 11 JS::inline('new PIL2JS.Box.Constant(function (args) { 12 var array = args[1]. GET(), idx = Number(args[2].toNative());12 var array = args[1].FETCH(), idx = Number(args[2].toNative()); 13 13 return new PIL2JS.Box.Constant( 14 14 array[idx >= 0 ? idx : array.length + idx] != undefined … … 23 23 if $self.isa("Hash") { 24 24 JS::inline('new PIL2JS.Box.Constant(function (args) { 25 var hash = args[1]. GET(), keys = args[2].GET();25 var hash = args[1].FETCH(), keys = args[2].FETCH(); 26 26 var ret = []; 27 27 for(var i = 0; i < keys.length; i++) { … … 33 33 } elsif $self.isa("Array") { 34 34 JS::inline('new PIL2JS.Box.Constant(function (args) { 35 var array = args[1]. GET(), idxs = args[2].toNative();35 var array = args[1].FETCH(), idxs = args[2].toNative(); 36 36 var ret = []; 37 37 for(var i = 0; i < idxs.length; i++) { … … 51 51 if $self.isa("Hash") { 52 52 JS::inline('new PIL2JS.Box.Constant(function (args) { 53 var hash = args[1]. GET();53 var hash = args[1].FETCH(); 54 54 var keys = hash.keys(); 55 55 return new PIL2JS.Box.Constant(keys); … … 59 59 } elsif $self.isa("Array") { 60 60 JS::inline('new PIL2JS.Box.Constant(function (args) { 61 var array = args[1]. GET();61 var array = args[1].FETCH(); 62 62 var ret = []; 63 63 for(var i = 0; i < array.length; i++) { -
perl5/PIL2JS/lib6/Prelude/JS/Pair.pm
r5965 r5981 3 3 4 4 JS::inline('new PIL2JS.Box.Constant(function (args) { 5 return args[1]. GET().key;5 return args[1].FETCH().key; 6 6 })')($self); 7 7 } … … 11 11 12 12 JS::inline('new PIL2JS.Box.Constant(function (args) { 13 return args[1]. GET().value;13 return args[1].FETCH().value; 14 14 })')($self); 15 15 } -
perl5/PIL2JS/lib6/Prelude/JS/Ref.pm
r5932 r5981 1 1 sub PIL2JS::Internals::generic_deref($thing) is primitive is rw { 2 2 JS::inline('new PIL2JS.Box.Constant(function (args) { 3 var thing = args[1]. GET();3 var thing = args[1].FETCH(); 4 4 if(!(thing instanceof PIL2JS.Ref)) { 5 5 PIL2JS.die("Can\'t use \"" + thing + "\" as a generic reference!"); 6 6 } 7 7 8 // Relay . GETand .STORE to the referencee.8 // Relay .FETCH and .STORE to the referencee. 9 9 var ret = new PIL2JS.Box.Proxy( 10 function () { return thing.referencee. GET() },10 function () { return thing.referencee.FETCH() }, 11 11 function (n) { 12 12 thing.referencee.STORE(n); … … 22 22 sub PIL2JS::Internals::autoderef(Ref $ref) returns Bool is primitive { 23 23 JS::inline('new PIL2JS.Box.Constant(function (args) { 24 var thing = args[1]. GET();24 var thing = args[1].FETCH(); 25 25 26 26 if(!(thing instanceof PIL2JS.Ref)) { … … 34 34 method tied(Ref $self:) returns Ref { 35 35 JS::inline('new PIL2JS.Box.Constant(function (args) { 36 var ref = args[1]. GET();36 var ref = args[1].FETCH(); 37 37 38 38 if(!(ref instanceof PIL2JS.Ref)) { -
perl5/PIL2JS/libjs/PIL2JS.js
r5965 r5981 68 68 PIL2JS.Ref = function (referencee) { 69 69 this.referencee = referencee; 70 this.autoderef = referencee. GET() instanceof Array71 || referencee. GET() instanceof PIL2JS.Hash;70 this.autoderef = referencee.FETCH() instanceof Array 71 || referencee.FETCH() instanceof PIL2JS.Hash; 72 72 // || referencee instanceof PIL2JS.OwnObject, see 73 73 // http://www.nntp.perl.org/group/perl.perl6.language/22532. … … 78 78 // This is necessary to emulate pass by ref, needed for is rw and is ref. 79 79 // See section "DESIGN" in README. 80 // GET:: SomeNativeType80 // FETCH :: SomeNativeType 81 81 // STORE :: SomeBox -> TheSameBox 82 82 // BINDTO :: SomeBox -> TheSameBox … … 84 84 // and rebound. 85 85 PIL2JS.Box = function (value) { 86 this. GET= function () { return value };86 this.FETCH = function () { return value }; 87 87 this.STORE = function (n) { 88 var new_val = n. GET();88 var new_val = n.FETCH(); 89 89 var my_ctype = this.container_type; 90 90 var new_ctype = n.container_type; … … 96 96 new_ctype == PIL2JS.ContainerType.Scalar 97 97 ) { 98 new_val = _26main_3a_3ainfix_3a_2c. GET()([PIL2JS.Context.SlurpyAny, n]).GET();98 new_val = _26main_3a_3ainfix_3a_2c.FETCH()([PIL2JS.Context.SlurpyAny, n]).FETCH(); 99 99 // my @a = %h 100 100 } else if( … … 107 107 } 108 108 new_val = 109 _26main_3a_3ainfix_3a_2c. GET()([PIL2JS.Context.SlurpyAny].concat(pairs)).GET();109 _26main_3a_3ainfix_3a_2c.FETCH()([PIL2JS.Context.SlurpyAny].concat(pairs)).FETCH(); 110 110 // my @a = @b (copy @b, don't bind) 111 111 } else if( … … 114 114 ) { 115 115 new_val = 116 _26main_3a_3ainfix_3a_2c. GET()([PIL2JS.Context.SlurpyAny].concat(new_val)).GET();116 _26main_3a_3ainfix_3a_2c.FETCH()([PIL2JS.Context.SlurpyAny].concat(new_val)).FETCH(); 117 117 118 118 // my %a = (a => 1, b => 2) (or generally my %a = @a) --> my %a = hash(a => 1, b => 2) … … 120 120 my_ctype == PIL2JS.ContainerType.Hash && 121 121 new_ctype == PIL2JS.ContainerType.Array) { 122 new_val = _26main_3a_3ahash. GET()([PIL2JS.Context.SlurpyAny, n]).GET();122 new_val = _26main_3a_3ahash.FETCH()([PIL2JS.Context.SlurpyAny, n]).FETCH(); 123 123 // my %a = %b (copy %b, don't bind) 124 124 } else if( … … 132 132 // &hash takes care of the copying. 133 133 new_val = 134 _26main_3a_3ahash. GET()([PIL2JS.Context.SlurpyAny].concat(pairs)).GET();134 _26main_3a_3ahash.FETCH()([PIL2JS.Context.SlurpyAny].concat(pairs)).FETCH(); 135 135 // my %a = (a => 1) or my %a = 10 136 136 } else if( … … 138 138 new_ctype == PIL2JS.ContainerType.Scalar 139 139 ) { 140 new_val = _26main_3a_3ahash. GET()([PIL2JS.Context.SlurpyAny, n]).GET();140 new_val = _26main_3a_3ahash.FETCH()([PIL2JS.Context.SlurpyAny, n]).FETCH(); 141 141 142 142 // my $scalar = @array or my $scalar = %hash (should auto-ref) … … 146 146 ) { 147 147 new_val = 148 _26main_3a_3aprefix_3a_5c. GET()([PIL2JS.Context.ItemAny, n]).GET();148 _26main_3a_3aprefix_3a_5c.FETCH()([PIL2JS.Context.ItemAny, n]).FETCH(); 149 149 } 150 150 … … 160 160 if( 161 161 (this.uid != undefined && other.uid != undefined && this.uid == other.uid) || 162 (this.uid == undefined && other.uid == undefined && this. GET() == other.GET())162 (this.uid == undefined && other.uid == undefined && this.FETCH() == other.FETCH()) 163 163 ) { 164 164 PIL2JS.die("Binding would create a bind cycle!"); 165 165 } 166 166 167 var get = other.GET,my_ctype = this.container_type,167 var fetch = other.FETCH, my_ctype = this.container_type, 168 168 store = other.STORE, other_ctype = other.container_type; 169 169 170 170 // No problem: $foo := $bar, @foo := @bar, %foo := %bar 171 171 if(my_ctype == other_ctype) { 172 this.GET = get; 173 this.STORE = function (n) { store(n); return this }; 174 this.uid = other.uid; 172 this.FETCH = fetch; 173 this.STORE = function (n) { store(n); return this }; 174 this.uid = other.uid; 175 this.isConstant = other.isConstant; 175 176 // Problematic: $foo := @array, $foo := %hash 176 177 // See http://www.nntp.perl.org/group/perl.perl6.language/22541: … … 183 184 // Hey, who said anything about consistency? :-) 184 185 } else if(my_ctype == PIL2JS.ContainerType.Scalar) { 185 var val = get(); 186 this.GET = function () { return new PIL2JS.Ref(new PIL2JS.Box.Constant(val)) }; 187 this.STORE = function (n) { val = n.GET(); return this }; 188 this.uid = other.uid; 186 var val = fetch(); 187 this.FETCH = function () { return new PIL2JS.Ref(new PIL2JS.Box.Constant(val)) }; 188 this.STORE = function (n) { val = n.FETCH(); return this }; 189 this.uid = other.uid; 190 this.isConstant = other.isConstant; 189 191 } else if(my_ctype == PIL2JS.ContainerType.Array && other_ctype == PIL2JS.ContainerType.Scalar) { 190 var other_val = get();191 if(other_val instanceof PIL2JS.Ref && other_val.referencee. GET() instanceof Array) {192 var other_val = fetch(); 193 if(other_val instanceof PIL2JS.Ref && other_val.referencee.FETCH() instanceof Array) { 192 194 // Ok. 193 var other_box = other_val.referencee; 194 this.GET = other_box.GET; 195 this.STORE = other_box.STORE; 196 this.uid = other.uid; 195 var other_box = other_val.referencee; 196 this.FETCH = other_box.FETCH; 197 this.STORE = other_box.STORE; 198 this.uid = other.uid; 199 this.isConstant = other.isConstant; 197 200 } else { 198 PIL2JS.die("Can't use object of type \"" + _26main_3a_3aref. GET()([PIL2JS.Context.ItemAny, other]).toNative() + "\" as an array or array reference!");201 PIL2JS.die("Can't use object of type \"" + _26main_3a_3aref.FETCH()([PIL2JS.Context.ItemAny, other]).toNative() + "\" as an array or array reference!"); 199 202 } 200 203 } else if(my_ctype == PIL2JS.ContainerType.Hash && other_ctype == PIL2JS.ContainerType.Scalar) { 201 var other_val = get();202 if(other_val instanceof PIL2JS.Ref && other_val.referencee. GET() instanceof PIL2JS.Hash) {204 var other_val = fetch(); 205 if(other_val instanceof PIL2JS.Ref && other_val.referencee.FETCH() instanceof PIL2JS.Hash) { 203 206 // Ok. 204 var other_box = other_val.referencee; 205 this.GET = other_box.GET; 206 this.STORE = other_box.STORE; 207 this.uid = other.uid; 207
