Skip to content

Commit

Permalink
correctly pass the implicit scope arg to new preflight classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoav-steinberg committed Mar 24, 2024
1 parent 36e0dbf commit 9a18ad0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion libs/wingc/src/jsify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,17 @@ impl<'a> JSifier<'a> {
if let Some(scope) = obj_scope {
Some(self.jsify_expression(scope, ctx).to_string())
} else {
Some("this".to_string())
// If the current method has an implicit scope arg then use it, if not we can assume `this` is available
if ctx.visit_ctx.current_method_env().map_or(false, |e| {
let SymbolEnvKind::Function { sig, .. } = e.kind else {
panic!("Method env not a function env");
};
sig.as_function_sig().unwrap().implicit_scope_param
}) {
Some(SCOPE_PARAM.to_string())
} else {
Some("this".to_string())
}
}
} else {
None
Expand All @@ -525,6 +535,7 @@ impl<'a> JSifier<'a> {
let scope_arg = if fqn.is_none() {
scope.clone()
} else {
// TODO: i don't get this?? why is scope_arg different from scope?
match scope.clone() {
None => None,
Some(scope) => Some(if scope == "this" {
Expand Down

0 comments on commit 9a18ad0

Please sign in to comment.