Doesn't preserve original source for a multiline expression with comments
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 363
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 3
Description
~~~~
$ cat test.js
var recast = require("./main");
var code = 'switch (toleranceMode) {\n\
case "touch":\n\
return (\n\
(y1 >= t && y1 <= b) || // Top edge touching\n\
(y2 >= t && y2 <= b) || // Bottom edge touching\n\
(y1 < t && y2 > b) // Surrounded vertically\n\
) && (\n\
(x1 >= l && x1 <= r) || // Left edge touching\n\
(x2 >= l && x2 <= r) || // Right edge touching\n\
(x1 < l && x2 > r) // Surrounded horizontally\n\
);\n\
}\n\
';
var newcode = recast.print(recast.parse(code)).code;
console.log(newcode == code);
$ nodejs test.js
false
~~~~
Contributor guide
No contributing guide indexed for this repository
Research direction
Run the reproducer in test.js with nodejs and compare the original code with recast.print(recast.parse(code)).code. Then inspect the parse and print path exposed through main; done means this multiline expression, including its comments and formatting, prints exactly as input and the comparison reports true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100