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

Efficient way to get all descendant statements #279

Closed
dsherret opened this issue Mar 18, 2018 · 4 comments
Closed

Efficient way to get all descendant statements #279

dsherret opened this issue Mar 18, 2018 · 4 comments

Comments

@dsherret
Copy link
Owner

dsherret commented Mar 18, 2018

Would be nice if there was an efficient .getDescendantStatements() method.

// examples of statements
const a = () => {
    const b = "";
};
const c = 5;
function d() {
    function e() {
        const f = "";
    }
}
class MyClass {
    prop = () => console.log("here"); // need these statements not in a block too
}
dsherret added a commit that referenced this issue Mar 18, 2018
Not so efficient at the moment, but good enough for now.
@dsherret
Copy link
Owner Author

dsherret commented Mar 18, 2018

This is good enough for now. Would be nice to make this more efficient in the future.

Edit: Actually, this should be good now. I'm assuming it will be faster because I'm using ts.forEachChild now which won't visit children like braces, semi-colons, etc..

dsherret added a commit that referenced this issue May 14, 2019
Not so efficient at the moment, but good enough for now.
@cancerberoSgx

This comment has been minimized.

@dsherret
Copy link
Owner Author

dsherret commented May 27, 2019

@cancerberoSgx can you open new issues for questions rather than posting in closed tasks? That question isn't related to descendant statements. I'll answer if you open up an issue. Thanks!

Edit: I opened #632.

@cancerberoSgx
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants