Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Refactor static analysis primitives #223

Closed
guybedford opened this issue Jan 15, 2019 · 1 comment
Closed

Refactor static analysis primitives #223

guybedford opened this issue Jan 15, 2019 · 1 comment

Comments

@guybedford
Copy link
Contributor

The static analysis in the relocate loader has become quite overly-specific in terms of how it detects static require statements etc.

As a result, there are cases that will be missed due to these overly specific checks not applying to all cases.

For example:

var path;
path = require('path');
fs.readFileSync(path.resolve(__dirname, 'file.js'));

but:

var resolve;
resolve = require('path').resolve;
fs.readFileSync(resolve(__dirname, 'file.js'));

won't. While var resolve = require('path').resolve in the above will.

These inconsistencies can be fixed by refactoring these checks into common general functions that are used throughout simplifying the code and reducing the code size as well.

This would be a useful and beneficial refactoring to undertake.

@guybedford
Copy link
Contributor Author

Fixed in #234.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant