mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-08-18 08:19:39 +02:00
[swfinterp] Add support for void methods
This commit is contained in:
parent
a4bb83956c
commit
8d05f2c16a
22
test/swftests/PrivateVoidCall.as
Normal file
22
test/swftests/PrivateVoidCall.as
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// input: []
|
||||||
|
// output: 9
|
||||||
|
|
||||||
|
package {
|
||||||
|
public class PrivateVoidCall {
|
||||||
|
public static function main():int{
|
||||||
|
var f:OtherClass = new OtherClass();
|
||||||
|
f.func();
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OtherClass {
|
||||||
|
private function pf():void {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function func():void {
|
||||||
|
this.pf();
|
||||||
|
}
|
||||||
|
}
|
@ -504,6 +504,9 @@ class SWFInterpreter(object):
|
|||||||
raise NotImplementedError(
|
raise NotImplementedError(
|
||||||
'Unsupported property %r on %r'
|
'Unsupported property %r on %r'
|
||||||
% (mname, obj))
|
% (mname, obj))
|
||||||
|
elif opcode == 71: # returnvoid
|
||||||
|
res = None
|
||||||
|
return res
|
||||||
elif opcode == 72: # returnvalue
|
elif opcode == 72: # returnvalue
|
||||||
res = stack.pop()
|
res = stack.pop()
|
||||||
return res
|
return res
|
||||||
@ -527,6 +530,17 @@ class SWFInterpreter(object):
|
|||||||
args = list(reversed(
|
args = list(reversed(
|
||||||
[stack.pop() for _ in range(arg_count)]))
|
[stack.pop() for _ in range(arg_count)]))
|
||||||
obj = stack.pop()
|
obj = stack.pop()
|
||||||
|
if isinstance(obj, _AVMClass_Object):
|
||||||
|
func = self.extract_function(obj.avm_class, mname)
|
||||||
|
res = func(args)
|
||||||
|
assert res is None
|
||||||
|
continue
|
||||||
|
if isinstance(obj, _ScopeDict):
|
||||||
|
assert mname in obj.avm_class.method_names
|
||||||
|
func = self.extract_function(obj.avm_class, mname)
|
||||||
|
res = func(args)
|
||||||
|
assert res is None
|
||||||
|
continue
|
||||||
if mname == 'reverse':
|
if mname == 'reverse':
|
||||||
assert isinstance(obj, list)
|
assert isinstance(obj, list)
|
||||||
obj.reverse()
|
obj.reverse()
|
||||||
@ -603,7 +617,8 @@ class SWFInterpreter(object):
|
|||||||
obj = stack.pop()
|
obj = stack.pop()
|
||||||
assert isinstance(obj, (dict, _ScopeDict)), \
|
assert isinstance(obj, (dict, _ScopeDict)), \
|
||||||
'Accessing member %r on %r' % (pname, obj)
|
'Accessing member %r on %r' % (pname, obj)
|
||||||
stack.append(obj[pname])
|
res = obj.get(pname, None)
|
||||||
|
stack.append(res)
|
||||||
else: # Assume attribute access
|
else: # Assume attribute access
|
||||||
idx = stack.pop()
|
idx = stack.pop()
|
||||||
assert isinstance(idx, int)
|
assert isinstance(idx, int)
|
||||||
|
Loading…
Reference in New Issue
Block a user