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

breaking: Remove trait This #918

Merged
merged 2 commits into from
Jul 22, 2022
Merged

breaking: Remove trait This #918

merged 2 commits into from
Jul 22, 2022

Conversation

kjvalencik
Copy link
Member

@kjvalencik kjvalencik commented Jul 12, 2022

  • Removes FunctionContext and MethodContext
  • Changes CallContext to FunctionContext
  • Update FunctionContext::this to perform a downcast like Object::get
  • Added an infallible FunctionContext::this_value to skip downcasting (similar to Object::get_value). This is useful where the type doesn't matter. E.g., passing this from the current context to another function call.

* Removes `FunctionContext` and `MethodContext`
* Changes `CallContext` to `FunctionContext`
* Update `FunctionContext::this` to perform a downcast like `Object::get`
@kjvalencik kjvalencik requested a review from dherman July 12, 2022 13:54
Copy link
Collaborator

@dherman dherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Let's just add this_value() that infallibly returns JsValue as well.

I like your decision to eliminate CallContext and retain FunctionContext for minimum disruption.

@kjvalencik kjvalencik requested a review from dherman July 22, 2022 18:54
Copy link
Collaborator

@dherman dherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kjvalencik kjvalencik merged commit e8a71b1 into main Jul 22, 2022
@kjvalencik kjvalencik deleted the kv/remove-this branch July 22, 2022 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants