-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Out-of-order statements… are out-of-order. #21
Comments
Whoops. My understanding of var a = 1;
export default a;
a = 2; ...would maintain the same order, since (due to the fact that var a = 1;
var _a = a;
a = 2; It's a bit of a nuisance edge case (and rare, as far as I can see) but specs are specs. Ordinarily statements preserve the correct order naturally, but
Far from it - being able to catch these things at this stage of the library's development is absolutely invaluable. I apologize for breaking your builds! Am working on a solution for this issue. |
Okay, I've come up with what seems like a more appropriate solution - we have some special logic for dealing with cases like the above. Rather than attempting to reorder statements at a bundle level, the expansion of |
Thanks. Looks good! |
I’m seeing a problem in d3-color where statements are output out-of-order, and so the code crashes. For example:
Notice that
__prototype
is defined after the assignment, and so the code throws a TypeError: Cannot set property 'rgb' of undefined.The recent statements.sort in c0a7640 for 0.7.3 may be the cause. This looked suspicious:
Forgive my lack of familiarity with the code, but I am unsure what you are trying to achieve by returning -1, here. That would mean to always put
a
beforeb
, and this logic is nondeterministic and potentially contradictory since you don’t control the underlying sort algorithm and which elements are being compared.If you don’t care about the relative order of two statements in different modules, you might instead return zero or NaN (and perhaps rely on a stable sorting algorithm). Or, perhaps just define an arbitrary order of modules, such as by id, and compare those before comparing by index.
Anyway, that’s just my wild guess from looking at the commits since 0.7.2. I apologize if this is a distraction.
The text was updated successfully, but these errors were encountered: