-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
In javascript, it's very important to detect what features you have access to.
In the case of js2cpp, we don't have things like a window or a document or a global (not yet, for another issue). Unfortunately the c++ compiler doesn't allow us to compile if dead code calls something that doesn't exist.
If someone writes some isomorphic code which contains a feature detection, for example:
if (typeof location !== 'undefined') { location.reload(); }
We should remove the entire condition if this feature is not present.
A new option, which lists what is defined in the global scope, should be defined. Early returns such as
if (typeof location !== 'undefined') { return; }
// use location...
should also remove the code that follows them.
Metadata
Metadata
Assignees
Labels
No labels