resolver: Handle method property correctly (#679)

This commit is contained in:
강동윤 2020-02-19 19:49:58 +09:00 committed by GitHub
parent 087e768810
commit f79223e98c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

View File

@ -231,6 +231,27 @@ impl Fold<ClassMethod> for Resolver<'_> {
}
}
impl Fold<MethodProp> for Resolver<'_> {
fn fold(&mut self, m: MethodProp) -> MethodProp {
let key = m.key.fold_with(self);
let function = {
let child_mark = Mark::fresh(self.mark);
// Child folder
let mut child = Resolver::new(
child_mark,
Scope::new(ScopeKind::Fn, Some(&self.current)),
None,
);
m.function.fold_with(&mut child)
};
MethodProp { key, function, ..m }
}
}
impl<'a> Fold<FnDecl> for Resolver<'a> {
fn fold(&mut self, node: FnDecl) -> FnDecl {
// We don't fold this as Hoister handles this.

View File

@ -1053,3 +1053,14 @@ identical!(
var XXX = 1;
"
);
identical!(
issue_678,
"({
foo() {
function bar() {
bar;
}
},
});"
);