super_name = reloc_name ctx i.super_name;
iinit = i.iinit + ctx#methods }
+(* script *)
+let reloc_script ctx s =
+ {
+ init = s.init + ctx#methods;
+ script_traits = reloc_traits ctx s.script_traits
+ }
+
let link a1 a2 =
let ctx = {|
cpool = {|
classes = List.length a1.classes
|} in
{ a1 with
- cpool = link_cpool a1.cpool a2.cpool;
+ cpool = link_cpool a1.cpool a2.cpool;
method_info = link reloc_method_info ctx a1.method_info a2.method_info;
method_bodies = link reloc_method ctx a1.method_bodies a2.method_bodies;
classes = link reloc_class ctx a1.classes a2.classes;
- instances = link reloc_instance ctx a1.instances a2.instances
+ instances = link reloc_instance ctx a1.instances a2.instances;
+ scripts = link reloc_script ctx a1.scripts a2.scripts
}
-
val link : Swflib.Abc.t -> Swflib.Abc.t -> Swflib.Abc.t
[{ trait_name=1; data=SetterTrait(0,0,[]); trait_metadata=[]}]
[{ trait_name=2; data=SetterTrait(0,1,[]); trait_metadata=[]}]
[{ trait_name=1; data=SetterTrait(0,0,[]); trait_metadata=[]}]
-
end;
+ "script" >:: begin fun () ->
+ lok
+ {abc with
+ method_info=[info;info];
+ scripts=[{init=0;script_traits=[]};
+ {init=1;script_traits=[]}]}
+ {abc with
+ method_info=[info];
+ scripts=[{init=0;script_traits=[]}]}
+ end
] end +> run_test_tt_main
with _ ->
List.rev !xs
+let abc_of_swf _ = undef
+
+let read path =
+ if Filename.check_suffix path ".abc" then
+ open_in_with path (Abc.read $ Swflib.BytesIn.of_channel)
+ else if Filename.check_suffix path ".swf" then
+ abc_of_swf @@ open_in_with path Swf.read
+ else
+ failwithf "unknow suffix: %s" path ()
+
let _ =
match CmdOpt.parse_argv () with
[path], t ->