From 67a4eecc15c22606a7e9724dc2f2a7f20c0e3045 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Mon, 21 Aug 2006 21:39:14 +0000 Subject: [PATCH] Abjectscript is just such a great language. I fixed two bugs in here that the compiler never wanted to tell me about. - I was trying to store read values into the streamer itself, referecing it as "this[ii]". This turns out to be legal, even though the class is sealed, because you can access public fields using the [] operator with a string argument. At runtime, ii == 0, it got Stringdafied to "0" and then a field called "0" was looked up on the class and oh no, it didn't exist. - Worse, I had a line that referenced "length" instead of "arr.length". There is no length defined in the class, nor is there one in the superclass. It turns out the base class Object has an undocumented constant called length that seems to always be 0. Isn't that special? git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4333 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/io/streamers/ArrayStreamer.as | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/as/com/threerings/io/streamers/ArrayStreamer.as b/src/as/com/threerings/io/streamers/ArrayStreamer.as index cb3e12e21..855b38005 100644 --- a/src/as/com/threerings/io/streamers/ArrayStreamer.as +++ b/src/as/com/threerings/io/streamers/ArrayStreamer.as @@ -133,7 +133,7 @@ public class ArrayStreamer extends Streamer } else if (_isFinal) { var mask :ArrayMask = new ArrayMask(); mask.readFrom(ins); - for (ii = 0; ii < length; ii++) { + for (ii = 0; ii < arr.length; ii++) { if (mask.isSet(ii)) { var target :Object; if (_delegate == null) { @@ -142,7 +142,7 @@ public class ArrayStreamer extends Streamer target = _delegate.createObject(ins); } ins.readBareObjectImpl(target, _delegate); - this[ii] = target; + arr[ii] = target; } }