Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f845633cc1 | ||
|
|
72c9b1d6c9 | ||
|
|
edd3363e48 | ||
|
|
114b5ef9ec | ||
|
|
2f4e0c3361 | ||
|
|
3ee51dae1a | ||
|
|
20263c1151 | ||
|
|
eaac564f11 | ||
|
|
63a47ef7bb | ||
|
|
6963cc1e40 | ||
|
|
5eb2462e29 | ||
|
|
9e285cdc20 | ||
|
|
01ade47af9 | ||
|
|
b1fe449b0d | ||
|
|
2b458ec2d4 | ||
|
|
d5f47f4f4d | ||
|
|
d4deb18975 | ||
|
|
5a794db73b | ||
|
|
dc131f05a8 | ||
|
|
1d4f79790a | ||
|
|
6bcbaf6df1 | ||
|
|
bc199ef0c9 | ||
|
|
f5fed99c81 | ||
|
|
66a6d3cffe | ||
|
|
39227486a6 | ||
|
|
caafa31df1 | ||
|
|
4c41c904f5 | ||
|
|
0917a6a5b1 | ||
|
|
349eba33ce | ||
|
|
8ff21b407d |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,3 +1,13 @@
|
||||
# 1.12.9
|
||||
|
||||
* Escape unicode characters when generating string `Literal`s.
|
||||
* Fix semicolons being output for statements in `ExportDeclaration`.
|
||||
* Fix `WithStatement` missing parenthesis.
|
||||
|
||||
# 1.12.8
|
||||
|
||||
* Temporarily forbid `AssignmentExpression` destructuring outside of `ExpressionStatement`.
|
||||
|
||||
# 1.12.7
|
||||
|
||||
* Update to latest `acorn-6to5`.
|
||||
|
||||
31
CONTRIBUTING.md
Normal file
31
CONTRIBUTING.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Contributing
|
||||
|
||||
* **General**
|
||||
* No ES6 syntax features or methods, exclusively ES5.
|
||||
* Max of five arguments for functions
|
||||
* Max depth of four nested blocks
|
||||
* 2-spaced soft tabs
|
||||
* **Naming**
|
||||
* CamelCase all class names
|
||||
* camelBack all variable names
|
||||
* **Spacing**
|
||||
* 80 character line max
|
||||
* Spaces after all keywords
|
||||
* Spaces before all left curly braces
|
||||
* **Comments**
|
||||
* Use JSDoc-style comments for methods
|
||||
* Single-line comments for ambiguous code
|
||||
* **Quotes**
|
||||
* Always use double quotes
|
||||
* Only use single quotes when the string contains a double quote
|
||||
* **Declaration**
|
||||
* No unused variables
|
||||
* No pollution of global variables and prototypes
|
||||
|
||||
## Testing
|
||||
|
||||
$ make test
|
||||
|
||||
## Linting
|
||||
|
||||
$ make lint
|
||||
@@ -24,6 +24,6 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||
**6to5** turns ES6 code into vanilla ES5, so you can use ES6 features **today.**
|
||||
**6to5** turns ES6+ code into vanilla ES5, so you can use next generation features **today.**
|
||||
|
||||
For more information view the [documentation](https://6to5.github.io).
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
A browser version of 6to5 is available from `browser.js` inside the 6to5
|
||||
directory in an npm release.
|
||||
|
||||
## API
|
||||
|
||||
```javascript
|
||||
to5.transform("class Test {}").code;
|
||||
```
|
||||
|
||||
## Scripts
|
||||
|
||||
While it's not recommended for serious use, when the browser version is included
|
||||
@@ -47,3 +41,21 @@ To test 6to5 in your browser run:
|
||||
$ make test-browser
|
||||
|
||||
And open `test/browser.html` in your browser if it doesn't open automatically.
|
||||
|
||||
## API
|
||||
|
||||
### to5.transform(code, [opts])
|
||||
|
||||
See [options](usage.md#options) for additional documentation.
|
||||
|
||||
```javascript
|
||||
to5.transform("class Test {}").code;
|
||||
```
|
||||
|
||||
### to5.run(code, [opts])
|
||||
|
||||
See [options](usage.md#options) for additional documentation.
|
||||
|
||||
```javascript
|
||||
to5.run("class Test {}");
|
||||
```
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# Caveats
|
||||
|
||||
## Async/Generators
|
||||
|
||||
The [regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js)
|
||||
and an [ES6 polyfill](polyfill.md) are required in order for generators to work.
|
||||
|
||||
## Classes
|
||||
|
||||
Built-in classes such as `Date`, `Array` and `DOM` cannot be subclassed due to
|
||||
@@ -32,11 +37,6 @@ A polyfill is required for for-of functionality that implements `Symbol` and
|
||||
adds `prototype[Symbol.iterator]` behaviour to built-ins. Using the polyfills
|
||||
specified in [polyfill](polyfill.md) suffices.
|
||||
|
||||
## Generators
|
||||
|
||||
The [regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js)
|
||||
and an [ES6 polyfill](polyfill.md) are required in order for generators to work.
|
||||
|
||||
## Spread
|
||||
|
||||
An [ES6 polyfill](polyfill.md) is required in order for spread to work. More
|
||||
|
||||
@@ -64,7 +64,7 @@ better suited if you'd like a full ES6 environment with polyfills and all.
|
||||
| Browser support | ✓ | ✓ | ✓ | | | |
|
||||
| Array comprehension | ✓ | ✓ | | | ✓ | |
|
||||
| Arrow functions | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| Async functions | ✓ | | ✓ | | | |
|
||||
| Async functions | ✓ | ✓ | ✓ | | | |
|
||||
| Classes | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| Computed property names | ✓ | ✓ | ✓ | ✓ | ✓ | |
|
||||
| Constants | ✓ | ✓ | | | ✓ | |
|
||||
|
||||
114
doc/features.md
114
doc/features.md
@@ -3,7 +3,32 @@
|
||||
## Array comprehension
|
||||
|
||||
```javascript
|
||||
[for (i of [1, 2, 3]) i * i]; // [1, 4, 9]
|
||||
var results = [for (c of customers) if (c.city == "Seattle") { name: c.name, age: c.age }]
|
||||
```
|
||||
|
||||
## Arrow functions
|
||||
|
||||
```javascript
|
||||
// Expression bodies
|
||||
var odds = evens.map(v => v + 1);
|
||||
var nums = evens.map((v, i) => v + i);
|
||||
|
||||
// Statement bodies
|
||||
nums.forEach(v => {
|
||||
if (v % 5 === 0)
|
||||
fives.push(v);
|
||||
});
|
||||
|
||||
// Lexical this
|
||||
var bob = {
|
||||
_name: "Bob",
|
||||
_friends: [],
|
||||
printFriends() {
|
||||
this._friends.forEach(f => {
|
||||
console.log(this._name + " knows " + f);
|
||||
});
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Async functions
|
||||
@@ -16,31 +41,27 @@ async function chainAnimationsAsync(elem, animations) {
|
||||
}
|
||||
```
|
||||
|
||||
## Arrow functions
|
||||
|
||||
```javascript
|
||||
arr.map(x => x * x);
|
||||
```
|
||||
|
||||
## Let scoping
|
||||
|
||||
```javascript
|
||||
for (let i in arr) {
|
||||
let v = arr[i];
|
||||
}
|
||||
```
|
||||
|
||||
## Classes
|
||||
|
||||
```javascript
|
||||
class Foo extends Bar {
|
||||
constructor() { }
|
||||
class SkinnedMesh extends THREE.Mesh {
|
||||
constructor(geometry, materials) {
|
||||
super(geometry, materials);
|
||||
|
||||
foo() { }
|
||||
this.idMatrix = SkinnedMesh.defaultMatrix();
|
||||
this.bones = [];
|
||||
this.boneMatrices = [];
|
||||
//...
|
||||
}
|
||||
|
||||
get bar() { }
|
||||
update(camera) {
|
||||
//...
|
||||
super.update();
|
||||
}
|
||||
|
||||
set bar() { }
|
||||
static defaultMatrix() {
|
||||
return new THREE.Matrix4();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -70,16 +91,35 @@ var MULTIPLIER; // error
|
||||
## Default parameters
|
||||
|
||||
```javascript
|
||||
function foo(bar = "foo") {
|
||||
return bar + "bar";
|
||||
function f(x, y = 12) {
|
||||
// y is 12 if not passed (or passed as undefined)
|
||||
return x + y;
|
||||
}
|
||||
f(3) == 15
|
||||
```
|
||||
|
||||
## Destructuring
|
||||
|
||||
```javascript
|
||||
var [a, [b], c, d] = ["hello", [", ", "junk"], ["world"]];
|
||||
console.log(a + b + c); // hello, world
|
||||
// list matching
|
||||
var [a, , b] = [1,2,3];
|
||||
|
||||
// object matching
|
||||
var { op: a, lhs: { op: b }, rhs: c } = getASTNode();
|
||||
|
||||
// object matching shorthand
|
||||
// binds `op`, `lhs` and `rhs` in scope
|
||||
var { op, lhs, rhs } = getASTNode();
|
||||
|
||||
// Can be used in parameter position
|
||||
function g({ name: x }) {
|
||||
console.log(x);
|
||||
}
|
||||
g({ name: 5 });
|
||||
|
||||
// Fail-soft destructuring
|
||||
var [a] = [];
|
||||
a === undefined;
|
||||
```
|
||||
|
||||
## For-of
|
||||
@@ -100,6 +140,14 @@ for (var i of [1, 2, 3]) {
|
||||
```javascript
|
||||
```
|
||||
|
||||
## Let scoping
|
||||
|
||||
```javascript
|
||||
for (let i in arr) {
|
||||
let v = arr[i];
|
||||
}
|
||||
```
|
||||
|
||||
## Modules
|
||||
|
||||
```javascript
|
||||
@@ -141,23 +189,21 @@ function f(x, y) {
|
||||
## Rest parameters
|
||||
|
||||
```javascript
|
||||
function printList(name, ...items) {
|
||||
console.log("list %s has the following items", name);
|
||||
items.forEach(function (item) {
|
||||
console.log(item);
|
||||
});
|
||||
function f(x, ...y) {
|
||||
// y is an Array
|
||||
return x * y.length;
|
||||
}
|
||||
f(3, "hello", true) == 6
|
||||
```
|
||||
|
||||
## Spread
|
||||
|
||||
```javascript
|
||||
function add(x, y) {
|
||||
return x + y;
|
||||
function f(x, y, z) {
|
||||
return x + y + z;
|
||||
}
|
||||
|
||||
var numbers = [5, 10];
|
||||
add(...numbers); // 15
|
||||
// Pass each elem of array as argument
|
||||
f(...[1,2,3]) == 6
|
||||
```
|
||||
|
||||
## Template literals
|
||||
|
||||
20
doc/index.md
20
doc/index.md
@@ -1,4 +1,4 @@
|
||||
**6to5** turns ES6 code into vanilla ES5, so you can use ES6 features **today.**
|
||||
**6to5** turns ES6+ code into vanilla ES5, so you can use next generation features **today.**
|
||||
|
||||
- **Readable** - formatting is retained if possible so your generated code is as similar as possible.
|
||||
- **Extensible** - with a large range of [plugins](plugins.md) and **browser support**.
|
||||
@@ -11,6 +11,24 @@ It's as easy as:
|
||||
|
||||
$ npm install -g 6to5
|
||||
|
||||
## Usage
|
||||
|
||||
Once you've installed 6to5, there are multiple paths you can take depending on
|
||||
how you want to use it.
|
||||
|
||||
6to5 will simply compile your ES6+ script to ES5 if you pass it as an argument
|
||||
to the command-line tool `6to5`:
|
||||
|
||||
$ 6to5 script.js
|
||||
|
||||
If you have a file written using ES6+ and you just want to run it, `6to5-node`
|
||||
has you covered:
|
||||
|
||||
$ 6to5-node script.js
|
||||
|
||||
And it doesn't end here! To see all the ways you can use 6to5, check out the
|
||||
[Usage](http://6to5.github.io/usage.html) page.
|
||||
|
||||
## [Features](features.md)
|
||||
|
||||
- [Array comprehension](features.md#array-comprehension)
|
||||
|
||||
14
doc/usage.md
14
doc/usage.md
@@ -50,16 +50,28 @@ Compile and run `test.js`.
|
||||
|
||||
```javascript
|
||||
var to5 = require("6to5");
|
||||
```
|
||||
|
||||
### to5.transform(code, [opts]);
|
||||
|
||||
```javascript
|
||||
var result = to5.transform("code();", options);
|
||||
result.code;
|
||||
result.map;
|
||||
result.ast;
|
||||
```
|
||||
|
||||
### to5.transformFileSync(filename, [opts])
|
||||
|
||||
```javascript
|
||||
to5.transformFileSync("filename.js", options).code;
|
||||
```
|
||||
|
||||
### to5.transformFile(filename, [opts], callback)
|
||||
|
||||
```javascript
|
||||
to5.transformFile("filename.js", options, function (err, result) {
|
||||
|
||||
result.code;
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@@ -2,13 +2,6 @@ var transform = module.exports = require("./transformation/transform");
|
||||
|
||||
transform.transform = transform;
|
||||
|
||||
transform.eval = function (code, opts) {
|
||||
opts = opts || {};
|
||||
opts.filename = opts.filename || "eval";
|
||||
opts.sourceMap = "inline";
|
||||
return eval(transform(code, opts).code);
|
||||
};
|
||||
|
||||
transform.run = function (code, opts) {
|
||||
opts = opts || {};
|
||||
opts.sourceMap = "inline";
|
||||
|
||||
@@ -30,3 +30,11 @@ exports.ClassBody = function (node, print) {
|
||||
this.rightBrace();
|
||||
}
|
||||
};
|
||||
|
||||
exports.MethodDefinition = function (node, print) {
|
||||
if (node.static) {
|
||||
this.push("static ");
|
||||
}
|
||||
|
||||
this._method(node, print);
|
||||
};
|
||||
|
||||
@@ -74,5 +74,5 @@ exports.XJSClosingElement = function (node, print) {
|
||||
};
|
||||
|
||||
exports.XJSEmptyExpression = function () {
|
||||
this.push("null");
|
||||
|
||||
};
|
||||
|
||||
@@ -41,6 +41,8 @@ exports._method = function (node, print) {
|
||||
this.push(kind + " ");
|
||||
}
|
||||
|
||||
if (value.async) this.push("async ");
|
||||
|
||||
if (node.computed) {
|
||||
this.push("[");
|
||||
print(key);
|
||||
@@ -54,16 +56,9 @@ exports._method = function (node, print) {
|
||||
print(value.body);
|
||||
};
|
||||
|
||||
exports.MethodDefinition = function (node, print) {
|
||||
if (node.static) {
|
||||
this.push("static ");
|
||||
}
|
||||
|
||||
this._method(node, print);
|
||||
};
|
||||
|
||||
exports.FunctionDeclaration =
|
||||
exports.FunctionExpression = function (node, print) {
|
||||
if (node.async) this.push("async ");
|
||||
this.push("function");
|
||||
if (node.generator) this.push("*");
|
||||
this.space();
|
||||
@@ -74,6 +69,8 @@ exports.FunctionExpression = function (node, print) {
|
||||
};
|
||||
|
||||
exports.ArrowFunctionExpression = function (node, print) {
|
||||
if (node.async) this.push("async ");
|
||||
|
||||
if (node.params.length === 1 && !node.defaults.length && !node.rest && t.isIdentifier(node.params[0])) {
|
||||
print(node.params[0]);
|
||||
} else {
|
||||
|
||||
@@ -25,9 +25,10 @@ exports.ExportDeclaration = function (node, print) {
|
||||
|
||||
if (node.declaration) {
|
||||
print(node.declaration);
|
||||
if (t.isStatement(node.declaration)) return;
|
||||
} else {
|
||||
if (specifiers.length === 1 && t.isExportBatchSpecifier(specifiers[0])) {
|
||||
this.push("*");
|
||||
print(specifiers[0]);
|
||||
} else {
|
||||
this.push("{");
|
||||
if (specifiers.length) {
|
||||
|
||||
@@ -4,6 +4,7 @@ exports.WithStatement = function (node, print) {
|
||||
this.keyword("with");
|
||||
this.push("(");
|
||||
print(node.object);
|
||||
this.push(")");
|
||||
print.block(node.body);
|
||||
};
|
||||
|
||||
@@ -134,15 +135,6 @@ exports.SwitchStatement = function (node, print) {
|
||||
this.push(") {");
|
||||
print.sequence(node.cases, { indent: true });
|
||||
this.push("}");
|
||||
|
||||
//if (node.cases.length) {
|
||||
// this.newline();
|
||||
// print.sequence(node.cases, { indent: true });
|
||||
// this.newline();
|
||||
// this.rightBrace();
|
||||
//} else {
|
||||
// this.push("}");
|
||||
//}
|
||||
};
|
||||
|
||||
exports.SwitchCase = function (node, print) {
|
||||
@@ -154,13 +146,8 @@ exports.SwitchCase = function (node, print) {
|
||||
this.push("default:");
|
||||
}
|
||||
|
||||
if (node.consequent.length === 1) {
|
||||
this.space();
|
||||
print(node.consequent[0]);
|
||||
} else if (node.consequent.length > 1) {
|
||||
this.newline();
|
||||
print.sequence(node.consequent, { indent: true });
|
||||
}
|
||||
this.space();
|
||||
print.sequence(node.consequent, { indent: true });
|
||||
};
|
||||
|
||||
exports.DebuggerStatement = function () {
|
||||
|
||||
@@ -74,13 +74,20 @@ exports.Literal = function (node) {
|
||||
var val = node.value;
|
||||
var type = typeof val;
|
||||
|
||||
if (type === "boolean" || type === "number" || type === "string") {
|
||||
if (type === "string") {
|
||||
val = JSON.stringify(val);
|
||||
|
||||
// escape unicode characters
|
||||
val = val.replace(/[\u007f-\uffff]/g, function(c) {
|
||||
return "\\u" + ("0000" + c.charCodeAt(0).toString(16)).slice(-4);
|
||||
});
|
||||
|
||||
this.push(val);
|
||||
} else if (type === "boolean" || type === "number") {
|
||||
this.push(JSON.stringify(val));
|
||||
} else if (node.regex) {
|
||||
this.push("/" + node.regex.pattern + "/" + node.regex.flags);
|
||||
} else if (val === null) {
|
||||
this.push("null");
|
||||
} else if (node.raw) {
|
||||
this.push(node.raw);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,17 +24,14 @@ function Node(node, parent) {
|
||||
}
|
||||
|
||||
Node.prototype.isUserWhitespacable = function () {
|
||||
//var parent = this.parent;
|
||||
var parent = this.parent;
|
||||
var node = this.node;
|
||||
|
||||
if (t.isUserWhitespacable(node)) {
|
||||
if (t.isUserWhitespacable(node) ||
|
||||
t.isSequenceExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//if (t.isArrayExpression(parent)) {
|
||||
// return true;
|
||||
//}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -146,6 +146,12 @@ exports.ExpressionStatement = function (node, parent, file, scope) {
|
||||
return nodes;
|
||||
};
|
||||
|
||||
exports.AssignmentExpression = function (node, parent, file) {
|
||||
if (parent.type === "ExpressionStatement") return;
|
||||
if (!t.isPattern(node.left)) return;
|
||||
throw file.errorWithNode(node, "AssignmentExpression destructuring outside of a ExpressionStatement is forbidden due to current 6to5 limitations");
|
||||
};
|
||||
|
||||
exports.VariableDeclaration = function (node, parent, file, scope) {
|
||||
if (t.isForInStatement(parent) || t.isForOfStatement(parent)) return;
|
||||
|
||||
|
||||
@@ -5,17 +5,17 @@ exports.ForOfStatement = function (node, parent, file, scope) {
|
||||
var left = node.left;
|
||||
var declar;
|
||||
|
||||
var stepKey = t.identifier(file.generateUid("step", scope));
|
||||
var stepValueId = t.memberExpression(stepKey, t.identifier("value"));
|
||||
var stepKey = t.identifier(file.generateUid("step", scope));
|
||||
var stepValue = t.memberExpression(stepKey, t.identifier("value"));
|
||||
|
||||
if (t.isIdentifier(left)) {
|
||||
declar = t.expressionStatement(t.assignmentExpression("=", left, stepValueId));
|
||||
declar = t.expressionStatement(t.assignmentExpression("=", left, stepValue));
|
||||
} else if (t.isVariableDeclaration(left)) {
|
||||
declar = t.variableDeclaration(left.kind, [
|
||||
t.variableDeclarator(left.declarations[0].id, stepValueId)
|
||||
t.variableDeclarator(left.declarations[0].id, stepValue)
|
||||
]);
|
||||
} else {
|
||||
return;
|
||||
throw file.errorWithNode(left, "Unknown node type " + left.type + " in ForOfStatement");
|
||||
}
|
||||
|
||||
var node2 = util.template("for-of", {
|
||||
|
||||
@@ -132,7 +132,7 @@ LetScoping.prototype.run = function () {
|
||||
|
||||
/**
|
||||
* There are no let references accessed within a closure so we can just traverse
|
||||
* through this block and replace all references that exist in a high scope to
|
||||
* through this block and replace all references that exist in a higher scope to
|
||||
* their uids.
|
||||
*/
|
||||
|
||||
@@ -211,7 +211,8 @@ LetScoping.prototype.getInfo = function () {
|
||||
/**
|
||||
* If we're inside of a `For*Statement` then traverse it and check if it has one
|
||||
* of the following node types `ReturnStatement`, `BreakStatement`,
|
||||
* `ContinueStatement` and replace it with a return value we can track later on.
|
||||
* `ContinueStatement` and replace it with a return value that we can track
|
||||
* later on.
|
||||
*
|
||||
* @returns {Object}
|
||||
*/
|
||||
@@ -251,7 +252,7 @@ LetScoping.prototype.checkFor = function () {
|
||||
|
||||
/**
|
||||
* Hoist all var declarations in this block to before it so they retain scope
|
||||
* once we wrap everything is in a closure.
|
||||
* once we wrap everything in a closure.
|
||||
*/
|
||||
|
||||
LetScoping.prototype.hoistVarDeclarations = function () {
|
||||
|
||||
@@ -42,5 +42,6 @@
|
||||
"ObjectPattern": ["Pattern"],
|
||||
"ArrayPattern": ["Pattern"],
|
||||
|
||||
"Property": ["UserWhitespacable"]
|
||||
"Property": ["UserWhitespacable"],
|
||||
"XJSElement": ["UserWhitespacable"]
|
||||
}
|
||||
|
||||
@@ -106,6 +106,10 @@ t.ensureBlock = function (node) {
|
||||
};
|
||||
|
||||
t.toStatement = function (node, ignore) {
|
||||
if (t.isStatement(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
var mustHaveId = false;
|
||||
var newType;
|
||||
|
||||
@@ -115,8 +119,6 @@ t.toStatement = function (node, ignore) {
|
||||
} else if (t.isFunction(node)) {
|
||||
mustHaveId = true;
|
||||
newType = "FunctionDeclaration";
|
||||
} else if (t.isStatement(node)) {
|
||||
newType = node.type;
|
||||
}
|
||||
|
||||
if (mustHaveId && !node.id) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "1.12.7",
|
||||
"version": "1.12.9",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://github.com/6to5/6to5",
|
||||
"repository": {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
var multiples = [for (num of nums) num * num];
|
||||
var multiples = [for (num of nums) for (num2 of nums) num * num];
|
||||
var multiples = [for (num of nums) if (num > 5) num * num];
|
||||
@@ -1,3 +0,0 @@
|
||||
var multiples = [for (num of nums) num * num];
|
||||
var multiples = [for (num of nums) for (num2 of nums) num * num];
|
||||
var multiples = [for (num of nums) if (num > 5) num * num];
|
||||
@@ -1 +0,0 @@
|
||||
var foo = [1, 2, 3];
|
||||
@@ -1 +0,0 @@
|
||||
var foo = [1, 2, 3];
|
||||
@@ -1,17 +0,0 @@
|
||||
var foo = `i
|
||||
am a multiline string`;
|
||||
|
||||
var foo = `i am also
|
||||
a multiline string
|
||||
foobar`;
|
||||
|
||||
var foo = `im a single line string`;
|
||||
|
||||
var foo = tagit`i
|
||||
am a multiline string`;
|
||||
|
||||
var foo = tagit`i am also
|
||||
a multiline string
|
||||
foobar`;
|
||||
|
||||
var foo = tagit`im a single line string`;
|
||||
@@ -1,17 +0,0 @@
|
||||
var foo = `i
|
||||
am a multiline string`;
|
||||
|
||||
var foo = `i am also
|
||||
a multiline string
|
||||
foobar`;
|
||||
|
||||
var foo = `im a single line string`;
|
||||
|
||||
var foo = tagit`i
|
||||
am a multiline string`;
|
||||
|
||||
var foo = tagit`i am also
|
||||
a multiline string
|
||||
foobar`;
|
||||
|
||||
var foo = tagit`im a single line string`;
|
||||
@@ -4,6 +4,6 @@ export { a as b, c as d } from "hello";
|
||||
export { a as b, c as d };
|
||||
export {};
|
||||
export default i = 20;
|
||||
export function test() {};
|
||||
export function test() {}
|
||||
export var i = 20;
|
||||
export let i = 42;
|
||||
|
||||
5
test/fixtures/generation/types/ArrayExpression-ArrayPattern/actual.js
vendored
Normal file
5
test/fixtures/generation/types/ArrayExpression-ArrayPattern/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
[a, b, c];
|
||||
[[], [b, c], []];
|
||||
[a,, b,];
|
||||
[a,,,, b];
|
||||
[a, b,, c];
|
||||
5
test/fixtures/generation/types/ArrayExpression-ArrayPattern/expected.js
vendored
Normal file
5
test/fixtures/generation/types/ArrayExpression-ArrayPattern/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
[a, b, c];
|
||||
[[], [b, c], []];
|
||||
[a,, b];
|
||||
[a,,,, b];
|
||||
[a, b,, c];
|
||||
4
test/fixtures/generation/types/ArrowFunctionExpression/actual.js
vendored
Normal file
4
test/fixtures/generation/types/ArrowFunctionExpression/actual.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var foo = x => x * x;
|
||||
var foo = (a, b) => a * b;
|
||||
var foo = async x => x * x;
|
||||
var foo = async (a, b) => a * b;
|
||||
4
test/fixtures/generation/types/ArrowFunctionExpression/expected.js
vendored
Normal file
4
test/fixtures/generation/types/ArrowFunctionExpression/expected.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var foo = x => x * x;
|
||||
var foo = (a, b) => a * b;
|
||||
var foo = async x => x * x;
|
||||
var foo = async (a, b) => a * b;
|
||||
@@ -0,0 +1,3 @@
|
||||
foo === bar;
|
||||
foo + bar;
|
||||
foo = bar;
|
||||
@@ -0,0 +1,3 @@
|
||||
foo === bar;
|
||||
foo + bar;
|
||||
foo = bar;
|
||||
7
test/fixtures/generation/types/AwaitExpression/actual.js
vendored
Normal file
7
test/fixtures/generation/types/AwaitExpression/actual.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
async function foo() {
|
||||
await bar();
|
||||
}
|
||||
|
||||
async function bar() {
|
||||
await* foo();
|
||||
}
|
||||
7
test/fixtures/generation/types/AwaitExpression/expected.js
vendored
Normal file
7
test/fixtures/generation/types/AwaitExpression/expected.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
async function foo() {
|
||||
await bar();
|
||||
}
|
||||
|
||||
async function bar() {
|
||||
await* foo();
|
||||
}
|
||||
5
test/fixtures/generation/types/BlockStatement/actual.js
vendored
Normal file
5
test/fixtures/generation/types/BlockStatement/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{}
|
||||
|
||||
{
|
||||
foo();
|
||||
}
|
||||
5
test/fixtures/generation/types/BlockStatement/expected.js
vendored
Normal file
5
test/fixtures/generation/types/BlockStatement/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{}
|
||||
|
||||
{
|
||||
foo();
|
||||
}
|
||||
7
test/fixtures/generation/types/BreakStatement/actual.js
vendored
Normal file
7
test/fixtures/generation/types/BreakStatement/actual.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
for (var i in foo) {
|
||||
break;
|
||||
}
|
||||
|
||||
foo: for (var i in foo) {
|
||||
break foo;
|
||||
}
|
||||
7
test/fixtures/generation/types/BreakStatement/expected.js
vendored
Normal file
7
test/fixtures/generation/types/BreakStatement/expected.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
for (var i in foo) {
|
||||
break;
|
||||
}
|
||||
|
||||
foo: for (var i in foo) {
|
||||
break foo;
|
||||
}
|
||||
5
test/fixtures/generation/types/CallExpression/actual.js
vendored
Normal file
5
test/fixtures/generation/types/CallExpression/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
foo();
|
||||
foo("foo");
|
||||
foo("foo", "bar");
|
||||
foo(bar());
|
||||
foo(bar("test"));
|
||||
5
test/fixtures/generation/types/CallExpression/expected.js
vendored
Normal file
5
test/fixtures/generation/types/CallExpression/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
foo();
|
||||
foo("foo");
|
||||
foo("foo", "bar");
|
||||
foo(bar());
|
||||
foo(bar("test"));
|
||||
13
test/fixtures/generation/types/ClassBody-MethodDefinition/actual.js
vendored
Normal file
13
test/fixtures/generation/types/ClassBody-MethodDefinition/actual.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
class Foo {
|
||||
async foo() {}
|
||||
foo() {}
|
||||
["foo"]() {}
|
||||
get foo() {}
|
||||
set foo() {}
|
||||
|
||||
static async foo() {}
|
||||
static foo() {}
|
||||
static ["foo"]() {}
|
||||
static get foo() {}
|
||||
static set foo() {}
|
||||
}
|
||||
13
test/fixtures/generation/types/ClassBody-MethodDefinition/expected.js
vendored
Normal file
13
test/fixtures/generation/types/ClassBody-MethodDefinition/expected.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
class Foo {
|
||||
async foo() {}
|
||||
foo() {}
|
||||
["foo"]() {}
|
||||
get foo() {}
|
||||
set foo() {}
|
||||
|
||||
static async foo() {}
|
||||
static foo() {}
|
||||
static ["foo"]() {}
|
||||
static get foo() {}
|
||||
static set foo() {}
|
||||
}
|
||||
2
test/fixtures/generation/types/ClassDeclaration/actual.js
vendored
Normal file
2
test/fixtures/generation/types/ClassDeclaration/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
var foo = class Foo {};
|
||||
var foo = class Foo extends Bar {};
|
||||
2
test/fixtures/generation/types/ClassDeclaration/expected.js
vendored
Normal file
2
test/fixtures/generation/types/ClassDeclaration/expected.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
var foo = class Foo {};
|
||||
var foo = class Foo extends Bar {};
|
||||
2
test/fixtures/generation/types/ClassExpression/actual.js
vendored
Normal file
2
test/fixtures/generation/types/ClassExpression/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
class Foo {}
|
||||
class Foo extends Bar {}
|
||||
2
test/fixtures/generation/types/ClassExpression/expected.js
vendored
Normal file
2
test/fixtures/generation/types/ClassExpression/expected.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
class Foo {}
|
||||
class Foo extends Bar {}
|
||||
9
test/fixtures/generation/types/ComprehensionBlock-ComprehensionExpression/actual.js
vendored
Normal file
9
test/fixtures/generation/types/ComprehensionBlock-ComprehensionExpression/actual.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
[for (x of nums) x * x];
|
||||
[for (x of nums) if (x > 2) x * x];
|
||||
[for (nums of nums2) for (x of nums) x * x];
|
||||
[for (nums of nums2) for (x of nums) if (x > 2) x * x];
|
||||
|
||||
(for (x of nums) x * x);
|
||||
(for (x of nums) if (x > 2) x * x);
|
||||
(for (nums of nums2) for (x of nums) x * x);
|
||||
(for (nums of nums2) for (x of nums) if (x > 2) x * x);
|
||||
9
test/fixtures/generation/types/ComprehensionBlock-ComprehensionExpression/expected.js
vendored
Normal file
9
test/fixtures/generation/types/ComprehensionBlock-ComprehensionExpression/expected.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
[for (x of nums) x * x];
|
||||
[for (x of nums) if (x > 2) x * x];
|
||||
[for (nums of nums2) for (x of nums) x * x];
|
||||
[for (nums of nums2) for (x of nums) if (x > 2) x * x];
|
||||
|
||||
(for (x of nums) x * x);
|
||||
(for (x of nums) if (x > 2) x * x);
|
||||
(for (nums of nums2) for (x of nums) x * x);
|
||||
(for (nums of nums2) for (x of nums) if (x > 2) x * x);
|
||||
1
test/fixtures/generation/types/ConditionalExpression/actual.js
vendored
Normal file
1
test/fixtures/generation/types/ConditionalExpression/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo ? foo : bar;
|
||||
1
test/fixtures/generation/types/ConditionalExpression/expected.js
vendored
Normal file
1
test/fixtures/generation/types/ConditionalExpression/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo ? foo : bar;
|
||||
7
test/fixtures/generation/types/ContinueStatement/actual.js
vendored
Normal file
7
test/fixtures/generation/types/ContinueStatement/actual.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
for (var i in foo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foo: for (var i in foo) {
|
||||
continue foo;
|
||||
}
|
||||
7
test/fixtures/generation/types/ContinueStatement/expected.js
vendored
Normal file
7
test/fixtures/generation/types/ContinueStatement/expected.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
for (var i in foo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foo: for (var i in foo) {
|
||||
continue foo;
|
||||
}
|
||||
1
test/fixtures/generation/types/DebuggerStatement/actual.js
vendored
Normal file
1
test/fixtures/generation/types/DebuggerStatement/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
debugger;
|
||||
1
test/fixtures/generation/types/DebuggerStatement/expected.js
vendored
Normal file
1
test/fixtures/generation/types/DebuggerStatement/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
debugger;
|
||||
5
test/fixtures/generation/types/DoWhileStatement/actual.js
vendored
Normal file
5
test/fixtures/generation/types/DoWhileStatement/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
do {
|
||||
test();
|
||||
} while (true);
|
||||
|
||||
do {} while (true);
|
||||
5
test/fixtures/generation/types/DoWhileStatement/expected.js
vendored
Normal file
5
test/fixtures/generation/types/DoWhileStatement/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
do {
|
||||
test();
|
||||
} while (true);
|
||||
|
||||
do {} while (true);
|
||||
1
test/fixtures/generation/types/EmptyStatement/actual.js
vendored
Normal file
1
test/fixtures/generation/types/EmptyStatement/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
1
test/fixtures/generation/types/EmptyStatement/expected.js
vendored
Normal file
1
test/fixtures/generation/types/EmptyStatement/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
27
test/fixtures/generation/types/ExportDeclaration-ExportSpecifier-ExportBatchSpecifier/actual.js
vendored
Normal file
27
test/fixtures/generation/types/ExportDeclaration-ExportSpecifier-ExportBatchSpecifier/actual.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export default 42;
|
||||
export default {};
|
||||
export default [];
|
||||
export default foo;
|
||||
export default function () {};
|
||||
export default class {};
|
||||
export default function foo() {};
|
||||
export default class Foo {};
|
||||
export * from "foo";
|
||||
export { foo } from "foo";
|
||||
export { foo, bar } from "foo";
|
||||
export { foo as bar } from "foo";
|
||||
export { foo as default } from "foo";
|
||||
export { foo as default, bar } from "foo";
|
||||
export { foo };
|
||||
export { foo, bar };
|
||||
export { foo as bar };
|
||||
export { foo as default };
|
||||
export { foo as default, bar };
|
||||
export var foo = 1;
|
||||
export var foo2 = function () {};
|
||||
export var foo3;
|
||||
export let foo4 = 2;
|
||||
export let foo5;
|
||||
export const foo6 = 3;
|
||||
export function foo7() {}
|
||||
export class foo8 {}
|
||||
@@ -0,0 +1,27 @@
|
||||
export default 42;
|
||||
export default {};
|
||||
export default [];
|
||||
export default foo;
|
||||
export default function () {};
|
||||
export default class {};
|
||||
export default function foo() {};
|
||||
export default class Foo {};
|
||||
export * from "foo";
|
||||
export { foo } from "foo";
|
||||
export { foo, bar } from "foo";
|
||||
export { foo as bar } from "foo";
|
||||
export { foo as default } from "foo";
|
||||
export { foo as default, bar } from "foo";
|
||||
export { foo };
|
||||
export { foo, bar };
|
||||
export { foo as bar };
|
||||
export { foo as default };
|
||||
export { foo as default, bar };
|
||||
export var foo = 1;
|
||||
export var foo2 = function () {};
|
||||
export var foo3;
|
||||
export let foo4 = 2;
|
||||
export let foo5;
|
||||
export const foo6 = 3;
|
||||
export function foo7() {}
|
||||
export class foo8 {}
|
||||
5
test/fixtures/generation/types/ForInStatement/actual.js
vendored
Normal file
5
test/fixtures/generation/types/ForInStatement/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
for (var i in nums) {}
|
||||
|
||||
for (var i in nums) {
|
||||
nums[i] = nums[i] * nums[i];
|
||||
}
|
||||
5
test/fixtures/generation/types/ForInStatement/expected.js
vendored
Normal file
5
test/fixtures/generation/types/ForInStatement/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
for (var i in nums) {}
|
||||
|
||||
for (var i in nums) {
|
||||
nums[i] = nums[i] * nums[i];
|
||||
}
|
||||
5
test/fixtures/generation/types/ForOfStatement/actual.js
vendored
Normal file
5
test/fixtures/generation/types/ForOfStatement/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
for (var x of nums) {}
|
||||
|
||||
for (var x of nums) {
|
||||
console.log(x * x);
|
||||
}
|
||||
5
test/fixtures/generation/types/ForOfStatement/expected.js
vendored
Normal file
5
test/fixtures/generation/types/ForOfStatement/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
for (var x of nums) {}
|
||||
|
||||
for (var x of nums) {
|
||||
console.log(x * x);
|
||||
}
|
||||
3
test/fixtures/generation/types/ForStatement/actual.js
vendored
Normal file
3
test/fixtures/generation/types/ForStatement/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
for (var i = 0;;) {}
|
||||
for (var i = 0; i < 5;) {}
|
||||
for (var i = 0; i < 5; i++) {}
|
||||
3
test/fixtures/generation/types/ForStatement/expected.js
vendored
Normal file
3
test/fixtures/generation/types/ForStatement/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
for (var i = 0;;) {}
|
||||
for (var i = 0; i < 5;) {}
|
||||
for (var i = 0; i < 5; i++) {}
|
||||
23
test/fixtures/generation/types/FunctionDeclaration-FunctionExpression/actual.js
vendored
Normal file
23
test/fixtures/generation/types/FunctionDeclaration-FunctionExpression/actual.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
function foo(bar = "bar") {}
|
||||
|
||||
function foo(bar = "bar", ...items) {}
|
||||
|
||||
function foo(...items) {}
|
||||
|
||||
function* foo() {}
|
||||
|
||||
function foo() {}
|
||||
|
||||
async function foo() {}
|
||||
|
||||
var foo = function* foo() {};
|
||||
|
||||
var foo = function foo() {};
|
||||
|
||||
var foo = async function foo() {};
|
||||
|
||||
var foo = function* () {};
|
||||
|
||||
var foo = function () {};
|
||||
|
||||
var foo = async function () {};
|
||||
23
test/fixtures/generation/types/FunctionDeclaration-FunctionExpression/expected.js
vendored
Normal file
23
test/fixtures/generation/types/FunctionDeclaration-FunctionExpression/expected.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
function foo(bar = "bar") {}
|
||||
|
||||
function foo(bar = "bar", ...items) {}
|
||||
|
||||
function foo(...items) {}
|
||||
|
||||
function* foo() {}
|
||||
|
||||
function foo() {}
|
||||
|
||||
async function foo() {}
|
||||
|
||||
var foo = function* foo() {};
|
||||
|
||||
var foo = function foo() {};
|
||||
|
||||
var foo = async function foo() {};
|
||||
|
||||
var foo = function* () {};
|
||||
|
||||
var foo = function () {};
|
||||
|
||||
var foo = async function () {};
|
||||
2
test/fixtures/generation/types/Identifier/actual.js
vendored
Normal file
2
test/fixtures/generation/types/Identifier/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
foo;
|
||||
undefined;
|
||||
2
test/fixtures/generation/types/Identifier/expected.js
vendored
Normal file
2
test/fixtures/generation/types/Identifier/expected.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
foo;
|
||||
undefined;
|
||||
25
test/fixtures/generation/types/IfStatement/actual.js
vendored
Normal file
25
test/fixtures/generation/types/IfStatement/actual.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
if (foo) foobar();
|
||||
|
||||
if (foo) {
|
||||
foobar();
|
||||
}
|
||||
|
||||
if (foo) {}
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else bar();
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else if (bar) {
|
||||
foobar();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
25
test/fixtures/generation/types/IfStatement/expected.js
vendored
Normal file
25
test/fixtures/generation/types/IfStatement/expected.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
if (foo) foobar();
|
||||
|
||||
if (foo) {
|
||||
foobar();
|
||||
}
|
||||
|
||||
if (foo) {}
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else bar();
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else if (bar) {
|
||||
foobar();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import "foo";
|
||||
import foo from "foo";
|
||||
import { default as foo } from "foo";
|
||||
import * as foo from "foo";
|
||||
import foo, { baz as xyz } from "foo";
|
||||
import { bar } from "foo";
|
||||
import { bar, baz } from "foo";
|
||||
import { bar as baz } from "foo";
|
||||
import { bar as baz, xyz } from "foo";
|
||||
@@ -0,0 +1,9 @@
|
||||
import "foo";
|
||||
import foo from "foo";
|
||||
import { default as foo } from "foo";
|
||||
import * as foo from "foo";
|
||||
import foo, { baz as xyz } from "foo";
|
||||
import { bar } from "foo";
|
||||
import { bar, baz } from "foo";
|
||||
import { bar as baz } from "foo";
|
||||
import { bar as baz, xyz } from "foo";
|
||||
1
test/fixtures/generation/types/LabeledStatement/actual.js
vendored
Normal file
1
test/fixtures/generation/types/LabeledStatement/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
label: for (var i in test) {}
|
||||
1
test/fixtures/generation/types/LabeledStatement/expected.js
vendored
Normal file
1
test/fixtures/generation/types/LabeledStatement/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
label: for (var i in test) {}
|
||||
7
test/fixtures/generation/types/Literal/actual.js
vendored
Normal file
7
test/fixtures/generation/types/Literal/actual.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
5;
|
||||
"foobar";
|
||||
"\n\r\u2028\u2029";
|
||||
/foobar/g;
|
||||
null;
|
||||
true;
|
||||
false;
|
||||
7
test/fixtures/generation/types/Literal/expected.js
vendored
Normal file
7
test/fixtures/generation/types/Literal/expected.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
5;
|
||||
"foobar";
|
||||
"\n\r\u2028\u2029";
|
||||
/foobar/g;
|
||||
null;
|
||||
true;
|
||||
false;
|
||||
8
test/fixtures/generation/types/MemberExpression/actual.js
vendored
Normal file
8
test/fixtures/generation/types/MemberExpression/actual.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
foo["bar"];
|
||||
foo.bar;
|
||||
|
||||
foo.bar.foo;
|
||||
foo.bar["foo"];
|
||||
|
||||
foo["foo"]["bar"];
|
||||
foo[test()][bar()];
|
||||
8
test/fixtures/generation/types/MemberExpression/expected.js
vendored
Normal file
8
test/fixtures/generation/types/MemberExpression/expected.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
foo["bar"];
|
||||
foo.bar;
|
||||
|
||||
foo.bar.foo;
|
||||
foo.bar["foo"];
|
||||
|
||||
foo["foo"]["bar"];
|
||||
foo[test()][bar()];
|
||||
3
test/fixtures/generation/types/NewExpression/actual.js
vendored
Normal file
3
test/fixtures/generation/types/NewExpression/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
new Foo;
|
||||
new Foo();
|
||||
new Foo(bar);
|
||||
3
test/fixtures/generation/types/NewExpression/expected.js
vendored
Normal file
3
test/fixtures/generation/types/NewExpression/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
new Foo();
|
||||
new Foo();
|
||||
new Foo(bar);
|
||||
20
test/fixtures/generation/types/ObjectExpression-ObjectPattern-Property/actual.js
vendored
Normal file
20
test/fixtures/generation/types/ObjectExpression-ObjectPattern-Property/actual.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var foo = {};
|
||||
|
||||
var foo = { x, y };
|
||||
|
||||
var foo = { x: x, y: y };
|
||||
|
||||
var foo = {
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
|
||||
var foo = {
|
||||
["bar"]: "foo",
|
||||
["foo"]() {},
|
||||
foo() {},
|
||||
async foo() {},
|
||||
*foo() {},
|
||||
get foo() {},
|
||||
set foo() {}
|
||||
};
|
||||
20
test/fixtures/generation/types/ObjectExpression-ObjectPattern-Property/expected.js
vendored
Normal file
20
test/fixtures/generation/types/ObjectExpression-ObjectPattern-Property/expected.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var foo = {};
|
||||
|
||||
var foo = { x, y };
|
||||
|
||||
var foo = { x: x, y: y };
|
||||
|
||||
var foo = {
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
|
||||
var foo = {
|
||||
["bar"]: "foo",
|
||||
["foo"]() {},
|
||||
foo() {},
|
||||
async foo() {},
|
||||
*foo() {},
|
||||
get foo() {},
|
||||
set foo() {}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user