Comments (10)
Nice catch. So the AST is too permissive. Maybe @dherman would be interested in modifying the mozilla parser API so that this impossible construct cannot be represented.
from escodegen.
Thanks.
#36 is related issue.
I think creating another project, something like esverify
to verify AST is valid form (check node stat and types) and escodegen assumes that given AST is valid is good.
What do you think about this?
from escodegen.
Yes, #36 is related. I'm not sure about the esverify
project, as that would make the input format for escodegen
a moving target. It'd be ideal if we could structure the parser API in such a way that it allows nothing but valid constructs. Unfortunately, I don't think Mozilla will be too flexible there.
I'd be interested in what @dherman thinks.
from escodegen.
I'm not sure about the esverify project
Oops, sorry for misleading. This is an example of new project name, not existing project.
I'd be interested in what @dherman thinks.
Yes, me too.
from escodegen.
Oops, sorry for misleading.
No, no. I think there was a miscommunication. What I'm not sure about is whether it is a good idea.
Also, @ariya may want to be involved in this.
from escodegen.
miscommunication.
Oops, I misunderstood.
from escodegen.
I'm fine either way. If the AST format permits something non-sensible, the consuming tool should understand that case. IMO it's not worth the effort to produce a format which is guaranteed to be associated with a valid syntax.
from escodegen.
Similarly, a TryStatement
with an empty handlers
list and a null
finalizer
property is a valid parser API construct, yet cannot be represented in JS syntax.
from escodegen.
Same goes for a BlockStatement
whose first statement is an ExpressionStatement
whose expression is a Literal
whose value is a string. These will be parsed as DirectiveStatement
s, not strings.
from escodegen.
Also, to guarantee that parse(generate(tree)) == tree
, we need to check that only valid operators are allowed in BinaryExpression
s and LogicalExpression
s.
from escodegen.
Related Issues (20)
- GBK chaodedracters are automatically encoded HOT 1
- Should be using the directive estree field
- Failes on Line & Block comments
- Support static class fields HOT 5
- Update Node versions in .travis.yml?
- Invalid code is generated with a MemberExpression against an ObjectExpression.
- Can you publish a new version to NPM that includes the latest nullish coalescing operator precedence ??
- Potential Security Vulnerability HOT 9
- Online demo doesn't return the emoji back HOT 3
- {format:{json:true}} option, generate json key without quotes
- Security issue with statement expression parser for identifiers HOT 2
- Update source-map as it's current version 0.6.1 is marked as EOL HOT 1
- `require` of _package.json_ complicates bundling
- Outdated dependency security vulnerability HOT 6
- CVE in 1.14.3 => optionator 0.8.x => word-wrap HOT 1
- word-wrap vulnerable to Regular Expression Denial of Service HOT 4
- "NewExpression" generated without arguments HOT 2
- escodegen expects value in Property key:value pair to have a type; crashes on null
- EcmaVersion 7: Unary minus and exponentiation not working HOT 1
- Attaching inline comments breaks up lines
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from escodegen.