1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 10:24:33 +01:00

[swfinterp] Intepret more multinames

This commit is contained in:
Philipp Hagemeister 2014-11-17 03:46:23 +01:00
parent 7f3e33a147
commit 4baafa229d
2 changed files with 19 additions and 0 deletions

10
test/swftests/DictCall.as Normal file
View File

@ -0,0 +1,10 @@
// input: [{"x": 1, "y": 2}]
// output: 3
package {
public class DictCall {
public static function main(d:Object):int{
return d.x + d.y;
}
}
}

View File

@ -213,6 +213,10 @@ class SWFInterpreter(object):
u30() # namespace_idx u30() # namespace_idx
name_idx = u30() name_idx = u30()
self.multinames.append(self.constant_strings[name_idx]) self.multinames.append(self.constant_strings[name_idx])
elif kind == 0x09:
name_idx = u30()
u30()
self.multinames.append(self.constant_strings[name_idx])
else: else:
self.multinames.append(_Multiname(kind)) self.multinames.append(_Multiname(kind))
for _c2 in range(MULTINAME_SIZES[kind]): for _c2 in range(MULTINAME_SIZES[kind]):
@ -557,6 +561,11 @@ class SWFInterpreter(object):
obj = stack.pop() obj = stack.pop()
assert isinstance(obj, list) assert isinstance(obj, list)
stack.append(len(obj)) stack.append(len(obj))
elif isinstance(pname, compat_str): # Member access
obj = stack.pop()
assert isinstance(obj, (dict, _ScopeDict)), \
'Accessing member on %r' % obj
stack.append(obj[pname])
else: # Assume attribute access else: # Assume attribute access
idx = stack.pop() idx = stack.pop()
assert isinstance(idx, int) assert isinstance(idx, int)