avm2: Implement Dxns and DxnsLate opcodes#21014
avm2: Implement Dxns and DxnsLate opcodes#21014jarca0123 wants to merge 1 commit intoruffle-rs:masterfrom
Conversation
core/src/avm2.rs
Outdated
| self.default_xml_namespace_stack | ||
| .last() | ||
| .copied() | ||
| .unwrap_or_else(|| AvmString::new_ascii_static(strings.gc(), b"")) |
There was a problem hiding this comment.
If this was working on Activation instead, you could just do istr!("") here
There was a problem hiding this comment.
You can specify the StringContext manually with istr!(strings, ""), too.
core/src/avm2.rs
Outdated
| /// Default XML namespace stack for E4X operations. | ||
| /// The last element is the current default namespace. | ||
| default_xml_namespace_stack: Vec<AvmString<'gc>>, | ||
|
|
There was a problem hiding this comment.
Why use a stack here? There's no PopDxns opcode, so a single default_xml_namespace: Option<AvmString<'gc>> on Activation would be enough.
|
Note: the AVM2 specification says that |
|
I don't think the stack is correct here; what FP does kinda resembles the stack, in that when you call a function and set dxns, when you exit from the function the callee has its previous But in reality, in FP this is more complex unfortunately, in avmplus (see The easily visible difference is that the default namespace of the function f(){
var a = <xml xmlns:a="a" xmlns:b="b"><data x="1" a:x="2" b:x="3">asdf</data></xml>;
trace(a.data.@x); // 1
var inline_f1 = function(){ trace(a.data.@x); };
default xml namespace = "a";
trace(a.data.@x); // 12
var inline_f2 = function(){ trace(a.data.@x); };
default xml namespace = "b";
trace(a.data.@x); // 13
inline_f1(); // 1
inline_f2(); // 12
create_custom_function("")(a); // 1
create_custom_function("a")(a); // 12
create_custom_function("b")(a); // 13
}
function create_custom_function(nsname){
default xml namespace = nsname;
return function(a){ trace(a.data.@x); };
};But again, I don't exactly understand how the chained MethodFrame iteration in avmplus relates to this, I don't know how to observe it. |
ff1ce9b to
a44e385
Compare
dae00c7 to
5c03419
Compare
|
Superseded by #22761 |
No description provided.