2010-10-23 72 views
11

我有這個奇怪的問題,在此代碼:錯誤#1030:堆棧深度不對稱

private function initLevel():void { 
    var levelMap:Array = 
    [ 
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 
    ]; 
    for (var y:* in levelMap) { 
     for (var x:* in levelMap[y]) { 
      trace(y, x); 
      trace(levelMap[y, x]); 
     } 
    } 
} 

產生這種醜陋的怪物在Flashdevelop中:

 
typecheck Level/initLevel() 
    outer-scope = [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ flash.display::MovieClip$ Level$] 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {}() 
    0:debugfile "L:\svntest\flashgame\src;com\thom\TD;Level.as" 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {}() 
    2:debugline 66 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {}() 
    4:getlocal0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {} (Level[O]) 
    5:pushscope 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]}() 
    6:pushundefined 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (void[A]) 
    7:coerce_a 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (*[A]) 
    8:setlocal2 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]}() 
    9:pushundefined 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (void[A]) 
    10:coerce_a 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (*[A]) 
    11:setlocal3 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]}() 
    12:debug 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]}() 
    17:debug 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]}() 
    22:debugline 69 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]}() 
    24:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I]) 
    26:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I]) 
    28:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I]) 
    30:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I]) 
    32:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I]) 
    34:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I]) 
    36:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    38:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    40:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    42:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    44:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    46:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    48:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    50:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    52:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    54:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    56:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    58:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    60:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    62:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    64:newarray 20 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O]) 
    66:debugline 70 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O]) 
    68:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I]) 
    70:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I]) 
    72:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I]) 
    74:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I]) 
    76:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I]) 
    78:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I]) 
    80:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    82:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    84:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    86:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    88:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    90:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    92:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    94:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    96:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    98:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    100:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    102:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    104:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    106:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (...10: int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    108:newarray 20 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O]) 
    110:debugline 71 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O]) 
    112:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I]) 
    114:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I]) 
    116:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I]) 
    118:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I]) 
    120:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I]) 
    122:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I]) 
    124:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    126:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    128:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    130:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    132:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    134:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    136:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    138:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    140:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    142:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    144:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    146:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    148:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (...10: Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    150:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (...11: int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    152:newarray 20 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O]) 
    154:debugline 72 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O]) 
    156:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I]) 
    158:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I]) 
    160:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I]) 
    162:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I]) 
    164:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I]) 
    166:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I]) 
    168:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    170:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    172:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    174:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    176:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    178:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    180:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    182:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    184:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    186:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    188:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    190:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (...10: Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    192:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (...11: Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    194:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (...12: int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    196:newarray 20 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O]) 
    198:debugline 73 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O]) 
    200:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I]) 
    202:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I]) 
    204:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I]) 
    206:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I]) 
    208:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I]) 
    210:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I]) 
    212:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    214:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    216:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    218:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    220:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    222:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    224:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    226:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    228:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    230:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (Array[O] Array[O] Array[O] Array[O] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I] int[I]) 
    232:pushbyte 0 
         [Level[O] *[A] *[A] *[A] *[A] *[A] *[A] *[A]] {Level[O]} (...10: Array[O] 
//SIXTY THOUSAND CHAR SNIP 
    804:callproperty trace 1 
         [Level[O] Array[O] *[A] *[A] int[I] *[A] int[I] *[A]] {Level[O]} (global[O] *[A]) 
    807:pop 
         [Level[O] Array[O] *[A] *[A] int[I] *[A] int[I] *[A]] {Level[O]} (global[O]) 
------------------------------------ 
MERGE CURRENT 808:  [Level[O] Array[O] *[A] *[A] int[I] *[A] int[I] *[A]] {Level[O]} (global[O]) 
MERGE TARGET B808:  [Level[O] Array[O] *[A] *[A] int[I] *[A] int[I] *[A]] {Level[O]}() 
[Fault] exception, information=VerifyError: Error #1030: Stack depth is unbalanced. 1 != 0. 

我認爲這事做與範圍或類似的東西,但我很難過。

感謝所有幫助提前

回答

21

A我在之前的評論中說過,我認爲這是一個編譯器錯誤,基於一個簡單的事實,即編譯器生成非法字節碼,並且播放器能夠捕捉到這個格式錯誤的字節碼並相應地拋出一個VerifyError

但是,經過一番調查,我發現了一些有趣的事情。

首先,Joony的發現讓我走上了正軌。顯然,如他的代碼所示,你可以欺騙編譯器將方括號之間的內容翻譯爲屬性訪問。

所以,這樣的:

foo[foo,'length'] 

等同於:

foo["length"] 

這裏有一個問題,但我會在第二個解釋。

您也可以調用方法,像這樣:

var foo:Array = []; 
foo[foo,'push'](1); 
trace(foo); 

這將有效地推動1foo

隨着一些additionaly掛羊頭賣狗肉,你可以鏈這一切讓這個討厭的野獸:

var inner:Array  = [10]; 
var outter:Array = [1,2,inner]; 
(inner[outter, 'pop']).call(null)[inner,'push'].call(null,20); 

trace(inner); 
trace(outter); 

這相當於:

var inner:Array  = [10]; 
var outter:Array = [1,2,inner]; 
outter.pop().push(20); 

也就是說,我們從outter中彈出inner,然後將20推送給它。

我開始注意到,這裏

inner[outter, 'pop'] 

inner不被使用。

事實上,你可以把它改成:

null[outter,'pop'] 

甚至

(void)[outter,'pop'] 

,編譯器不會抱怨(既會做播放器)。我懷疑以上是有效的Actionscript(在這種情況下,編譯器應拒絕編譯它),但我不是100%確定。但是,這個未使用的對象是問題的根源。 (以下需要關於flash程序集或任何其他基於堆棧的程序集的工作原理的一些基本知識,但是我希望我可以解釋它,所以可以理解,而不會假設太多。)

我反彙編了此動作代碼生成的字節碼:

var arr:Array = [10]; 
null[arr,'length']; 

反彙編代碼:

function private::initLevel():void /* disp_id 0*/ 
{ 
    // local_count=2 max_scope=1 max_stack=3 code_len=17 
    0  getlocal0  
    1  pushscope  
    2  pushbyte  10 
    4  newarray  [1] 
    6  coerce   Array 
    8  setlocal1  
    9  pushnull   
    10 getlocal1  
    11 pushstring  "length" 
    13 getproperty  null 
    15 pop    
    16 returnvoid  
} 

讓我們一步一步來。 instr是指令的偏移量; stack_state顯示指令執行後堆棧的當前狀態; comments是不言自明)

instr stack_state    comments 
    -------------------------------------------------------------------------------------------  
    0  this     "this" is always passed in local register 0 to instance methods 
    1        "this" is added to the scope chain and popped 
    2  10      now, we have 10 on the stack  
    4  [10]     an array is created and initialized taking 1 element from the stack 
    6  [10]     this is sort of like doing [10] as Array 
    8        the array is assigned to local variable 1 
    9  null     null is pushed. That is the null in this line: 
           null[arr,'length'] 
           HERE BEGINS THE PROBLEM! 
    10 null,local1    local 1 is pushed 
    11 null,local1,"length" the string constant "length" is pushed 
    13 null,local1["length"] getproperty null is used for dynamic lookup (object["prop"]). Both operands are popped from the stack 
    15 null     in the previous step, the result of local1["lengtht"] was pushed. But we dind't use it, so it's discarded 
    16 null     here the method returns. The stack should be empty, but it's not. 
           The generated code should have popped the null pushed at #9, 
           or it shouldn't have pushed it in the first place 

的問題是,在離開方法之後,所有的對象的壓入堆棧通過該方法應該已經彈出。情況並非如此,因爲方法返回後,常量仍保留在堆棧上。換句話說,我們有一個不平衡堆棧。現在,玩家顯然不介意或不檢查。我認爲它應該,並且不應該運行這個代碼,因爲如果這個代碼變得足夠大,這可能(至少潛在地)導致堆棧溢出。現在

,如果我們改變有問題的代碼段被包括跳躍塊內(例如像一個if一個條件跳轉後達到的塊)時,播放器將拒絕與該消息的代碼:

VerifyError: Error #1030: Stack depth is unbalanced. 1 != 0. 

與OP相同。所以,似乎分支的存在觸發了對播放器中堆疊完整性的某種檢查。在這一點上,應該注意的是,Actionscript循環(任何類型的循環)在字節碼級別作爲條件跳轉實現,就像ìf一樣。所以,即使我們在下面的代碼中沒有循環(一個if產生的代碼更短,分析也更簡單),因爲它會在播放器中觸發此檢查,對於我們的目的而言,它與循環相同,正如OP所做的那樣。

在AS碼:

var dummy:int = 1; 
var arr:Array = [10]; 
if(dummy != 0) { 
    null[arr,'length']; 
} 

拆解:

function private::initLevel():void /* disp_id 0*/ 
{ 
    // local_count=3 max_scope=1 max_stack=3 code_len=27 
    0  getlocal0  
    1  pushscope  
    2  pushbyte  1 
    4  setlocal1  
    5  pushbyte  10 
    7  newarray  [1] 
    9  coerce   Array 
    11 setlocal2  
    12 getlocal1  
    13 pushbyte  0 
    15 ifeq   L1 

    19 pushnull   
    20 getlocal2  
    21 pushstring  "length" 
    23 getproperty  null 
    25 pop    

    L1: 
    26 returnvoid  
} 

一步一步:

instr stack_state    comments 
    -------------------------------------------------------------------------------------------  
    0  this     "this" is always passed in local register 0 to instance methods  
    1        "this" is added to the scope chain and popped 
    2  1      now, we have 1 on the stack  
    4        1 is popped and assigned to the local variable 1 (the dummy var in the code) 
    5  10      10 is pushed 
    7  [10]     an array is created and initialized taking 1 element from the stack 
    9  [10]     this is sort of like doing [10] as Array 
    11       the array is assigned to local variable 2 (the arr var in the code) 
    12 local1     local1 (dummy) is pushed 
    13 local1,0    0 is pushed 
    15       this instruction consumes (pops) both local1 and 0 to compare them 
           If this condition is satisfied, it jumps to the label L1 
           If it is not, it falls-through to the next instruction 
           (the same as a case label in a switch statement that does not have a break, in Actionscript code) 
    19 null     null is pushed. That is the null in this line: 
           null[arr,'length'] 
           Again, HERE BEGINS THE PROBLEM! 
    20 null,local2    local2 is pushed 
    21 null,local2,"length" the string constant "length" is pushed 
    23 null,local2["length"] getproperty null is used for dynamic lookup (object["prop"]). Both operands are popped from the stack 
    25 null     the value returned by local2["length"] is discarded 

    26 null     the method returns, but null is not properly popped from the stack! 

所以,再次,null仍然是該方法返回後在堆棧上;該堆棧是不平衡。但這一次,玩家檢查這個,發現問題,拋出一個VerifyError並中止代碼。無論如何,爲了把它包裝起來,我的結論是:編譯器在兩種情況下都會生成非法字節碼。我認爲這是一個錯誤。如果玩家能夠檢測到該代碼,該玩家會拒絕該代碼。但是,如果有問題的代碼在跳轉塊內(看起來像一個錯誤),它似乎只能檢測到它。

附錄:

Joony提到的評論說,「如果你跳那麼沒有錯誤之前立即返回」。這是真的。原因是返回之後但在返回之後的代碼是「死代碼」,所以編譯器將其從字節代碼中剝離。

所以,它不是跳躍本身,導致玩家檢查堆棧完整性。我GOOGLE了一下,發現this on the haxe site

這是一個堆棧不平衡錯誤。 這意味着 跳轉的兩個分支在返回時會導致不同的堆棧大小 。所有跳轉或代碼 導致給定位置 導致相同的堆棧大小。

這使得它更清晰。

在上面的第二個代碼示例中,這就是實際發生的情況。

如果代碼在指令15跳轉後,它直接在最後一條指令(26)上返回給調用者。 null尚未被推入,堆棧中沒有其他東西,所以我們到達這一點時堆棧大小爲0。

如果代碼沒有跳轉並且落下,null將被按下(19)並且不會彈出。所以,這條路徑將在堆棧上到達最後一條指令(26)null,這意味着堆棧大小爲1.這最後一條指令是兩個分支都返回的位置,但是在一個分支之後,堆棧大小爲0,而跟着另一個,它是1.這就是導致玩家抱怨不平衡堆棧的原因。

+0

非常有趣! – grapefrukt 2010-10-24 00:32:57

+0

優秀的職位。我也熱衷於「跳躍」的發展。如果你在跳轉之前立即返回,那麼沒有錯誤。我喜歡(inner[outter, 'pop']).call(null)[inner,'push'].call(null,20);我想知道這個奇怪的語法是從哪裏來的。也許有人可以從Adobe解釋它。 – Joony 2010-10-24 08:33:39

+0

@Joony。謝謝。關於即時回報的好處。這說得通。谷歌搜索了一下,我發現這個錯誤信息真的在haxe網站上意味着什麼。這更清楚地解釋了這個問題。我已將這添加到我的答案中。 – 2010-10-24 16:42:44

1

衛生署,我解決了它與[y][x]

不知道更換[y,x]爲什麼它沒有給出更清晰的信息我在做什麼錯。

+0

我說你已經找到了在編譯器中的錯誤,如果這是一個運行時消息。運行時檢測到非法字節碼。編譯器從非有效的動作腳本中產生該字節碼。它應該給你一個錯誤,並拒絕編譯你的代碼。 – 2010-10-23 14:58:47

+0

可能。我使用FlashDevelop和Flex SDK 4.1.0 build:16076如果我相信flex-sdk-description.xml文件。如果有人想重現這一點,可能會有用。 – 2010-10-23 15:20:01

+0

我有SKD 3.5.0.12683現在可用,但我能夠重現錯誤只是粘貼你的代碼,編譯和運行。絕對看起來像一個編譯器錯誤。 – 2010-10-23 15:59:01

1

這很時髦,我喜歡它。什麼錯誤!

levelMap[y, x] 

ý是一個對象和Xÿ的性質。

簡單的測試:

var levelMap:Array = [[0, 100], 
         [20, 21]]; 
var something:* = levelMap[levelMap[0], 1]; // 100 - The second element of the first array! 
trace(something); 
something = levelMap[levelMap[0], 'length']; // 2 
trace(something); 

一些有趣的行爲。任何人都可以解釋?

更新:

我想我們只是使用它錯了。

var a:Object = {num:0, fun:function(num:uint):void{this.num = num;}}; 
var b:Object = {num:0}; 
b[a, 'fun'](10);                                            
trace(a.num); // 
trace(b.num); // 10 

b是範圍,一個是一個對象,'樂趣'一個財產,(10)是參數。這是等於(但仍與堆棧上的額外的對象):

a.fun.call(b, 10); 

b不會被彈出堆棧的原因是因爲它的複製和重複被用於函數調用。

90:getscopeobject 1 
    stack: StackTest 
    locals: StackTest StackTest * 
92:getslot 2 
    stack: Object? (b) 
    locals: StackTest StackTest * 
94:dup 
    stack: Object? (b) Object? (Copy of b) 
    locals: StackTest StackTest * 
95:setlocal2 
    stack: Object? (b) 
    locals: StackTest StackTest Object? (Copy of b) 
96:getscopeobject 1 
    stack: Object? (b) StackTest 
    locals: StackTest StackTest Object? (Copy of b) 
98:getslot 1 
    stack: Object? (b) Object? (a) 
    locals: StackTest StackTest Object? (Copy of b) 
100:pushstring "fun" 
    stack: Object? (b) Object? (a) String ("fun") 
    locals: StackTest StackTest Object? (Copy of b) 
102:getproperty {StackTest...Object}::[] 
    stack: Object? (b) * (a.fun) 
    locals: StackTest StackTest Object? (Copy of b) 
104:getlocal2 
    stack: Object? (b) * (a.fun) Object? (Copy of b) 
    locals: StackTest StackTest Object? (Copy of b) 
105:pushbyte 10 
    stack: Object? (b) * (a.fun) Object? (Copy of b) int (10) 
    locals: StackTest StackTest Object? (Copy of b) 
107:call 1 (Call a closure. 1 is the argument count. Stack: function (a.fun), receiver (Copy of b), arg (10). The result (void) is pushed on the stack.) 
    stack: Object? (b) * (void) 
    locals: StackTest StackTest Object? (Copy of b) 
109:pop 
    stack: Object? (b) 
    locals: StackTest StackTest Object? (Copy of b) 
110:kill 2 
    stack: Object? (b) 
    locals: StackTest StackTest * 

此外,一些時髦的行爲可以使用此語法可以看出:

b[1, true, a, 'fun'](10); 

看來你可以不斷添加未使用的對象堆棧,並且只有最後2進行評估。

+0

我發現了一些關於此的事情。查看我的答案的細節。 – 2010-10-24 00:27:57

+0

優秀的研究成果!我希望我能+3。 – 2010-10-25 21:04:58

+0

嗯。有趣。所以,不知何故,這裏'b [a,'有趣'](10); ','b'被用作上下文對象?當我有一點空閒時間的時候,我會仔細研究一下。 – 2010-10-25 22:17:58

0

OMG,你很可能只是解決了幾乎殺了我的misterious問題^ _^ 我試圖從轉儲重新創建一個SWF文件:使用

`[SWF] 
    Header: 
    Version: 10 
    FileLength: 623 
    FileLengthCompressed: 454 
    FrameSize: (180,160) 
    FrameRate: 8 
    FrameCount: 10 
    Tags: 
    [69:FileAttributes] AS3: true, HasMetadata: false, UseDirectBlit: false, UseGPU: false, UseNetwork: false 
    [09:SetBackgroundColor] Color: #666666 
    [86:DefineSceneAndFrameLabelData]  Scenes:  [0] Frame: 0, Name: Scene 1 
    [83:DefineShape4] ID: 1, ShapeBounds: (-100,1100,-100,1100), EdgeBounds: (0,1000,0,1000) 
     FillStyles: 
     [1] [SWFFillStyle] Type: 0 (solid), Color: FFFF0000 
     LineStyles:`(and so on) 

as3swf(使用幾乎庫裏面本身隻字節碼),但今天(用新鮮下載的Flex SDK 4.1)所有我得到的是一個奇怪的痕跡(收到很多次):

[SWF] 
    Version: 10 
    FileLength: 21 
    FileLengthCompressed: 21 
    FrameSize: (14,14) 
    FrameRate: 50 
    FrameCount: 1 
    Tags: 

和我奇怪的事情是,它的蹤跡全局存儲ByteArray變量很可能是o在運行時唯一一句讀,但它存儲信息並沒有只是一些部分失蹤 - 幾乎每一個值改變

所以謝謝你的回答,它解釋了很多對我來說)

1

對於有人來遇到類似的錯誤,我接到了一個不尋常的深夜錯字此錯誤:

SomeClass.staticMethod[var1,var2] 

,而不是

SomeClass.staticMethod(var1,var2) 
0

上一個錯字錯過了=導致這個瘋狂的錯誤。

像:的array.var[x,y];代替array.var = [x,y];