Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add primitive promotion for method calls on GetField #1085

Merged
merged 2 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion boa/src/syntax/ast/node/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 0 additions & 1 deletion boa/src/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<K>(&self, key: K, context: &mut Context) -> Result<Self>
where
K: Into<PropertyKey>,
Expand Down