-
Notifications
You must be signed in to change notification settings - Fork 5.6k
fix(repl): use object_id for repl internal #29163
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, a few comments
cli/tools/repl/session.rs
Outdated
format!("__DENO_REPL_INTERNALS_{seconds}__") | ||
}); | ||
|
||
thread_local! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of using a thread_local
here - consider storing this object id on ReplSession
object
cli/cdp.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for changes to all of these structs? It's very surprising that something that is deserialized from JSON uses non-owned string types of Arc
. I suggest you revert these changes
Cargo.lock
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert all these changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep required changes to a minimum, there's a ton of changes that are not necessary here
cli/cdp.rs
Outdated
pub type RemoteObjectId = str; | ||
pub type OwnedRemoteObjectId = <RemoteObjectId as ToOwned>::Owned; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
cli/cdp.rs
Outdated
pub type ScriptId = str; | ||
pub type OwnedScriptId = <ScriptId as ToOwned>::Owned; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
cli/tools/jupyter/server.rs
Outdated
@@ -339,15 +335,15 @@ impl JupyterServer { | |||
// combine results of declarations and globalThis properties | |||
let mut candidates = get_expression_property_names( | |||
&mut self.repl_session_proxy, | |||
"globalThis", | |||
GLOBALTHIS_EXPRESSION, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this used for?
cli/tools/repl/session.rs
Outdated
EvaluationOutput::Error(format!("{} {:#}", colors::red("error:"), err)) | ||
} | ||
} | ||
r.unwrap_or_else(|err| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unrelated change, please revert it
close #26599
close #29121
This PR use object_id to interact with repl internal, instead of global variable (
__DENO_REPL_INTERNALS_{seconds}__
),so we don't need to hide this in completions, etc.
Also add some error handling instead of simply
unwrap
.Before this PR
After the PR
btw, the the code in #26599 still create an error, may be we need to dive into this after merging this pr.

UPDATE
deno_console
seemly usingglobalThis
forIntl
andTemporal
for prototype checks?UPDATE: Open #29165 for this