shift-codegen
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "shift-codegen", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "code generator for Shift format ASTs", | ||
@@ -24,3 +24,3 @@ "author": "Shape Security Labs", | ||
"object-assign": "^2.0.0", | ||
"shift-reducer": "^1.0.2" | ||
"shift-reducer": "^1.0.3" | ||
}, | ||
@@ -33,4 +33,4 @@ "devDependencies": { | ||
"mocha": "^2.0.1", | ||
"shift-ast": "^1.0.1", | ||
"shift-parser": "^1.0.0" | ||
"shift-ast": "^1.0.3", | ||
"shift-parser": "^1.0.2" | ||
}, | ||
@@ -37,0 +37,0 @@ "keywords": [ |
@@ -28,2 +28,26 @@ Shift Code Generator | ||
## Note on IfStatements | ||
When presented with a valid structure that represents an IfStatement nested inside the consequent of an IfStatement that also has an alternate, we choose to generate code that preserves the intent of the AST rather than generate | ||
valid code that executes in an unintended manner. | ||
e.g., when generating code for an AST that *looks* like it represents this: | ||
```js | ||
if (a) | ||
if (b) foo() | ||
else bar() | ||
``` | ||
We generate the following instead: | ||
```js | ||
if (a) { | ||
if (b) foo() | ||
} else bar() | ||
``` | ||
The following parse of this code includes a BlockStatement and a Block wrapping the consequent of the outer IfStatement. This is considered optimal because the original AST is impossible to have been generated by a parse of actual JavaScript and could only occur from programmatic generation and that this resulting structure would have been the original intent. | ||
## Contributing | ||
@@ -30,0 +54,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83812
671
79
Updatedshift-reducer@^1.0.3