From f955c4cb9fd342f4798d2b83a4010ae93c4763a7 Mon Sep 17 00:00:00 2001 From: RageKnify Date: Wed, 20 Jan 2021 01:31:12 +0000 Subject: [PATCH 1/2] Fix: Add primitive promotion for method calls --- boa/src/syntax/ast/node/call/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/boa/src/syntax/ast/node/call/mod.rs b/boa/src/syntax/ast/node/call/mod.rs index fc1dd7e1411..716994743c0 100644 --- a/boa/src/syntax/ast/node/call/mod.rs +++ b/boa/src/syntax/ast/node/call/mod.rs @@ -72,7 +72,10 @@ impl Executable for Call { ) } Node::GetField(ref get_field) => { - let obj = get_field.obj().run(context)?; + let mut obj = get_field.obj().run(context)?; + if obj.get_type() != Type::Object { + obj = Value::Object(obj.to_object(context)?); + } let field = get_field.field().run(context)?; ( obj.clone(), From 03cf4a43437581a426c4c35a87ef19e2846a6e71 Mon Sep 17 00:00:00 2001 From: RageKnify Date: Wed, 20 Jan 2021 01:35:33 +0000 Subject: [PATCH 2/2] Docs: Remove forgotten TODO related to property accessors property accessors were done in #987 --- boa/src/value/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/boa/src/value/mod.rs b/boa/src/value/mod.rs index bb26ed9dc28..5e00b90674a 100644 --- a/boa/src/value/mod.rs +++ b/boa/src/value/mod.rs @@ -446,7 +446,6 @@ impl Value { /// Resolve the property in the object and get its value, or undefined if this is not an object or the field doesn't exist /// get_field receives a Property from get_prop(). It should then return the `[[Get]]` result value if that's set, otherwise fall back to `[[Value]]` - /// TODO: this function should use the get Value if its set pub fn get_field(&self, key: K, context: &mut Context) -> Result where K: Into,