Skip to content
This repository has been archived by the owner on Jul 16, 2019. It is now read-only.

jsDump bug #5

Closed
dmajda opened this issue Mar 12, 2013 · 4 comments
Closed

jsDump bug #5

dmajda opened this issue Mar 12, 2013 · 4 comments
Labels

Comments

@dmajda
Copy link
Contributor

dmajda commented Mar 12, 2013

The following grammar entered into the online version:

start = { return { item: 'abc' }; }

produces output [] for an empty input, instead of correct { item: 'abc' }.

The following grammars don't have this problem:

start = { return { item: 0 }; }
start = { return { index: 'abc' }; }

Debugging points to a bug in the jsDump library. I need to look whether this is fixed in a newer version. If not, I need to report it/fix it.

Originally reported in the Google Group.

@reverofevil
Copy link

The problem is that jsDump is using perfectly wrong approach of sniffing object's properties, and doesn't rely on types at all. The correct solution is described here (http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/). Hotfix pushed to my fork, though we'd better look for another solution like running pegjs into js.js (https://github.com/jterrace/js.js), so that return value will be consistent, and there will be Function.prototype.toSource support in any browser (though, 200 times slowlier :).

@dmajda
Copy link
Contributor Author

dmajda commented Apr 3, 2015

According to this post this bug can be fixed by using a jsDump fork.

@dmajda
Copy link
Contributor Author

dmajda commented Nov 20, 2015

Hmm, I thought upgrading jsDump solved the problem, but it did that only for item. Dumping still misbehaves in presence of the callee property, as demonstrated by the following grammar:

start = "" { return { callee: 0 }; }

With empty input, it produces [].

@dmajda
Copy link
Contributor Author

dmajda commented Nov 20, 2015

I reported the bug at the jsDump fork the website uses and provided a PR with a fix. I’ll apply the fix locally too.

@dmajda dmajda closed this as completed in 4b519e4 Nov 20, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants