spider-src 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +74 -0
- data/README.md +37 -0
- data/Rakefile +25 -0
- data/lib/spider-src/support/spider/.eslintrc +17 -0
- data/lib/spider-src/support/spider/.npmignore +9 -0
- data/lib/spider-src/support/spider/.travis.yml +7 -0
- data/lib/spider-src/support/spider/.yo-rc.json +3 -0
- data/lib/spider-src/support/spider/CHANGELOG.md +64 -0
- data/lib/spider-src/support/spider/Gruntfile.js +97 -0
- data/lib/spider-src/support/spider/Gruntfile.spider +93 -0
- data/lib/spider-src/support/spider/LICENSE +201 -0
- data/lib/spider-src/support/spider/README.md +50 -0
- data/lib/spider-src/support/spider/cli.js +119 -0
- data/lib/spider-src/support/spider/lib/ast/CaseClause.js +179 -0
- data/lib/spider-src/support/spider/lib/ast/CatchClause.js +26 -0
- data/lib/spider-src/support/spider/lib/ast/ExportBatchSpecifier.js +19 -0
- data/lib/spider-src/support/spider/lib/ast/ExportSpecifier.js +33 -0
- data/lib/spider-src/support/spider/lib/ast/ImportDefaultSpecifier.js +23 -0
- data/lib/spider-src/support/spider/lib/ast/ImportNamespaceSpecifier.js +23 -0
- data/lib/spider-src/support/spider/lib/ast/ImportSpecifier.js +40 -0
- data/lib/spider-src/support/spider/lib/ast/Node.js +93 -0
- data/lib/spider-src/support/spider/lib/ast/Parameter.js +229 -0
- data/lib/spider-src/support/spider/lib/ast/Program.js +58 -0
- data/lib/spider-src/support/spider/lib/ast/Property.js +32 -0
- data/lib/spider-src/support/spider/lib/ast/Range.js +257 -0
- data/lib/spider-src/support/spider/lib/ast/VariableDeclarator.js +29 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/ArrayExpression.js +41 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/ArrayPattern.js +45 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/AssignmentExpression.js +29 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/BinaryExpression.js +104 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/CallExpression.js +139 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/ConditionalExpression.js +31 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/CurryCallExpression.js +102 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/ExistentialExpression.js +83 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/ForInExpression.js +116 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/FunctionExpression.js +157 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/InExpression.js +99 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/LogicalExpression.js +50 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/MemberExpression.js +43 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/NewExpression.js +46 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/NullCheckCallExpression.js +132 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/NullCoalescingExpression.js +114 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/NullPropagatingExpression.js +161 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/ObjectExpression.js +39 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/ObjectPattern.js +49 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/RangeMemberExpression.js +157 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/SplatExpression.js +48 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/SuperExpression.js +170 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/ThisExpression.js +22 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/UnaryExpression.js +147 -0
- data/lib/spider-src/support/spider/lib/ast/expressions/UpdateExpression.js +26 -0
- data/lib/spider-src/support/spider/lib/ast/literals/BooleanLiteral.js +24 -0
- data/lib/spider-src/support/spider/lib/ast/literals/Identifier.js +60 -0
- data/lib/spider-src/support/spider/lib/ast/literals/NullLiteral.js +24 -0
- data/lib/spider-src/support/spider/lib/ast/literals/NumberLiteral.js +24 -0
- data/lib/spider-src/support/spider/lib/ast/literals/RegularExpressionLiteral.js +25 -0
- data/lib/spider-src/support/spider/lib/ast/literals/StringLiteral.js +90 -0
- data/lib/spider-src/support/spider/lib/ast/literals/UndefinedLiteral.js +30 -0
- data/lib/spider-src/support/spider/lib/ast/statements/BlockStatement.js +47 -0
- data/lib/spider-src/support/spider/lib/ast/statements/BreakStatement.js +19 -0
- data/lib/spider-src/support/spider/lib/ast/statements/ContinueStatement.js +19 -0
- data/lib/spider-src/support/spider/lib/ast/statements/DebuggerStatement.js +19 -0
- data/lib/spider-src/support/spider/lib/ast/statements/DoWhileStatement.js +25 -0
- data/lib/spider-src/support/spider/lib/ast/statements/ExportDeclarationStatement.js +51 -0
- data/lib/spider-src/support/spider/lib/ast/statements/ExpressionStatement.js +22 -0
- data/lib/spider-src/support/spider/lib/ast/statements/FallthroughStatement.js +74 -0
- data/lib/spider-src/support/spider/lib/ast/statements/ForInStatement.js +79 -0
- data/lib/spider-src/support/spider/lib/ast/statements/ForOfStatement.js +98 -0
- data/lib/spider-src/support/spider/lib/ast/statements/ForStatement.js +43 -0
- data/lib/spider-src/support/spider/lib/ast/statements/FunctionDeclarationStatement.js +104 -0
- data/lib/spider-src/support/spider/lib/ast/statements/GoStatement.js +41 -0
- data/lib/spider-src/support/spider/lib/ast/statements/IfStatement.js +32 -0
- data/lib/spider-src/support/spider/lib/ast/statements/ImportDeclarationStatement.js +40 -0
- data/lib/spider-src/support/spider/lib/ast/statements/PushStatement.js +37 -0
- data/lib/spider-src/support/spider/lib/ast/statements/ReturnStatement.js +26 -0
- data/lib/spider-src/support/spider/lib/ast/statements/SwitchStatement.js +159 -0
- data/lib/spider-src/support/spider/lib/ast/statements/ThrowStatement.js +22 -0
- data/lib/spider-src/support/spider/lib/ast/statements/TryStatement.js +36 -0
- data/lib/spider-src/support/spider/lib/ast/statements/UntilStatement.js +31 -0
- data/lib/spider-src/support/spider/lib/ast/statements/UseStatement.js +49 -0
- data/lib/spider-src/support/spider/lib/ast/statements/VariableDeclarationStatement.js +36 -0
- data/lib/spider-src/support/spider/lib/ast/statements/WhileStatement.js +25 -0
- data/lib/spider-src/support/spider/lib/ast.js +16 -0
- data/lib/spider-src/support/spider/lib/parser.js +14878 -0
- data/lib/spider-src/support/spider/lib/spider.js +217 -0
- data/lib/spider-src/support/spider/package.json +61 -0
- data/lib/spider-src/support/spider/spider-script.js +6 -0
- data/lib/spider-src/support/spider/src/ast/CaseClause.spider +179 -0
- data/lib/spider-src/support/spider/src/ast/CatchClause.spider +30 -0
- data/lib/spider-src/support/spider/src/ast/ExportBatchSpecifier.spider +19 -0
- data/lib/spider-src/support/spider/src/ast/ExportSpecifier.spider +37 -0
- data/lib/spider-src/support/spider/src/ast/ImportDefaultSpecifier.spider +25 -0
- data/lib/spider-src/support/spider/src/ast/ImportNamespaceSpecifier.spider +25 -0
- data/lib/spider-src/support/spider/src/ast/ImportSpecifier.spider +44 -0
- data/lib/spider-src/support/spider/src/ast/Node.spider +104 -0
- data/lib/spider-src/support/spider/src/ast/Parameter.spider +233 -0
- data/lib/spider-src/support/spider/src/ast/Program.spider +109 -0
- data/lib/spider-src/support/spider/src/ast/Property.spider +36 -0
- data/lib/spider-src/support/spider/src/ast/Range.spider +291 -0
- data/lib/spider-src/support/spider/src/ast/VariableDeclarator.spider +33 -0
- data/lib/spider-src/support/spider/src/ast/expressions/ArrayExpression.spider +32 -0
- data/lib/spider-src/support/spider/src/ast/expressions/ArrayPattern.spider +37 -0
- data/lib/spider-src/support/spider/src/ast/expressions/AssignmentExpression.spider +34 -0
- data/lib/spider-src/support/spider/src/ast/expressions/BinaryExpression.spider +125 -0
- data/lib/spider-src/support/spider/src/ast/expressions/CallExpression.spider +149 -0
- data/lib/spider-src/support/spider/src/ast/expressions/ConditionalExpression.spider +34 -0
- data/lib/spider-src/support/spider/src/ast/expressions/CurryCallExpression.spider +109 -0
- data/lib/spider-src/support/spider/src/ast/expressions/ExistentialExpression.spider +102 -0
- data/lib/spider-src/support/spider/src/ast/expressions/ForInExpression.spider +140 -0
- data/lib/spider-src/support/spider/src/ast/expressions/FunctionExpression.spider +183 -0
- data/lib/spider-src/support/spider/src/ast/expressions/InExpression.spider +114 -0
- data/lib/spider-src/support/spider/src/ast/expressions/LogicalExpression.spider +62 -0
- data/lib/spider-src/support/spider/src/ast/expressions/MemberExpression.spider +57 -0
- data/lib/spider-src/support/spider/src/ast/expressions/NewExpression.spider +40 -0
- data/lib/spider-src/support/spider/src/ast/expressions/NullCheckCallExpression.spider +151 -0
- data/lib/spider-src/support/spider/src/ast/expressions/NullCoalescingExpression.spider +151 -0
- data/lib/spider-src/support/spider/src/ast/expressions/NullPropagatingExpression.spider +190 -0
- data/lib/spider-src/support/spider/src/ast/expressions/ObjectExpression.spider +30 -0
- data/lib/spider-src/support/spider/src/ast/expressions/ObjectPattern.spider +42 -0
- data/lib/spider-src/support/spider/src/ast/expressions/RangeMemberExpression.spider +179 -0
- data/lib/spider-src/support/spider/src/ast/expressions/SplatExpression.spider +49 -0
- data/lib/spider-src/support/spider/src/ast/expressions/SuperExpression.spider +235 -0
- data/lib/spider-src/support/spider/src/ast/expressions/ThisExpression.spider +21 -0
- data/lib/spider-src/support/spider/src/ast/expressions/UnaryExpression.spider +158 -0
- data/lib/spider-src/support/spider/src/ast/expressions/UpdateExpression.spider +28 -0
- data/lib/spider-src/support/spider/src/ast/literals/BooleanLiteral.spider +23 -0
- data/lib/spider-src/support/spider/src/ast/literals/Identifier.spider +68 -0
- data/lib/spider-src/support/spider/src/ast/literals/NullLiteral.spider +23 -0
- data/lib/spider-src/support/spider/src/ast/literals/NumberLiteral.spider +23 -0
- data/lib/spider-src/support/spider/src/ast/literals/RegularExpressionLiteral.spider +24 -0
- data/lib/spider-src/support/spider/src/ast/literals/StringLiteral.spider +91 -0
- data/lib/spider-src/support/spider/src/ast/literals/UndefinedLiteral.spider +30 -0
- data/lib/spider-src/support/spider/src/ast/statements/BlockStatement.spider +45 -0
- data/lib/spider-src/support/spider/src/ast/statements/BreakStatement.spider +19 -0
- data/lib/spider-src/support/spider/src/ast/statements/ContinueStatement.spider +19 -0
- data/lib/spider-src/support/spider/src/ast/statements/DebuggerStatement.spider +19 -0
- data/lib/spider-src/support/spider/src/ast/statements/DoWhileStatement.spider +28 -0
- data/lib/spider-src/support/spider/src/ast/statements/ExportDeclarationStatement.spider +46 -0
- data/lib/spider-src/support/spider/src/ast/statements/ExpressionStatement.spider +22 -0
- data/lib/spider-src/support/spider/src/ast/statements/FallthroughStatement.spider +85 -0
- data/lib/spider-src/support/spider/src/ast/statements/ForInStatement.spider +92 -0
- data/lib/spider-src/support/spider/src/ast/statements/ForOfStatement.spider +117 -0
- data/lib/spider-src/support/spider/src/ast/statements/ForStatement.spider +51 -0
- data/lib/spider-src/support/spider/src/ast/statements/FunctionDeclarationStatement.spider +115 -0
- data/lib/spider-src/support/spider/src/ast/statements/GoStatement.spider +44 -0
- data/lib/spider-src/support/spider/src/ast/statements/IfStatement.spider +38 -0
- data/lib/spider-src/support/spider/src/ast/statements/ImportDeclarationStatement.spider +33 -0
- data/lib/spider-src/support/spider/src/ast/statements/PushStatement.spider +40 -0
- data/lib/spider-src/support/spider/src/ast/statements/ReturnStatement.spider +28 -0
- data/lib/spider-src/support/spider/src/ast/statements/SwitchStatement.spider +161 -0
- data/lib/spider-src/support/spider/src/ast/statements/ThrowStatement.spider +23 -0
- data/lib/spider-src/support/spider/src/ast/statements/TryStatement.spider +42 -0
- data/lib/spider-src/support/spider/src/ast/statements/UntilStatement.spider +36 -0
- data/lib/spider-src/support/spider/src/ast/statements/UseStatement.spider +62 -0
- data/lib/spider-src/support/spider/src/ast/statements/VariableDeclarationStatement.spider +34 -0
- data/lib/spider-src/support/spider/src/ast/statements/WhileStatement.spider +28 -0
- data/lib/spider-src/support/spider/src/ast.spider +80 -0
- data/lib/spider-src/support/spider/src/spider.pegjs +1434 -0
- data/lib/spider-src/support/spider/src/spider.spider +276 -0
- data/lib/spider-src/support/spider/test/spider_test.js +1787 -0
- data/lib/spider-src/version.rb +5 -0
- data/lib/spider-src.rb +37 -0
- data/spider-src.gemspec +24 -0
- data/test/test_spider_src.rb +33 -0
- metadata +225 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function FallthroughStatement() {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "FallthroughStatement";
|
7
|
+
}
|
8
|
+
FallthroughStatement.prototype = Object.create(Node);
|
9
|
+
FallthroughStatement.prototype.codegen = function() {
|
10
|
+
if (!Node.prototype.codegen.call(this)) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
var parent = this.parent;
|
14
|
+
var iterations = 0;
|
15
|
+
while (!!(typeof parent !== "undefined" && parent !== null) && !parent.switchCase) {
|
16
|
+
parent = parent.parent;
|
17
|
+
iterations++;
|
18
|
+
}
|
19
|
+
if (typeof parent !== "undefined" && parent !== null) {
|
20
|
+
parent.fallthrough = true;
|
21
|
+
} else {
|
22
|
+
Node.getErrorManager().error({
|
23
|
+
type: "InvalidFallthroughContext",
|
24
|
+
message: "fallthrough statement is only allowed in a switch case clause.",
|
25
|
+
loc: this.loc
|
26
|
+
});
|
27
|
+
}
|
28
|
+
var switchStatement = parent.parent;
|
29
|
+
if (!switchStatement.fallthroughId) {
|
30
|
+
switchStatement.fallthroughId = {
|
31
|
+
"type": "Identifier",
|
32
|
+
"name": FallthroughStatement.getNextVariableName()
|
33
|
+
};
|
34
|
+
}
|
35
|
+
switchStatement.branchFallthrough = true;
|
36
|
+
parent.body.body = [{
|
37
|
+
"type": "ExpressionStatement",
|
38
|
+
"codeGenerated": true,
|
39
|
+
"expression": {
|
40
|
+
"type": "AssignmentExpression",
|
41
|
+
"operator": "=",
|
42
|
+
"left": switchStatement.fallthroughId,
|
43
|
+
"right": {
|
44
|
+
"type": "Literal",
|
45
|
+
"value": 2
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}].concat(parent.body.body);
|
49
|
+
this.type = "ExpressionStatement";
|
50
|
+
this.expression = {
|
51
|
+
"type": "AssignmentExpression",
|
52
|
+
"operator": "=",
|
53
|
+
"left": switchStatement.fallthroughId,
|
54
|
+
"right": {
|
55
|
+
"type": "Literal",
|
56
|
+
"value": 1
|
57
|
+
}
|
58
|
+
};
|
59
|
+
return this;
|
60
|
+
};
|
61
|
+
FallthroughStatement.getNextVariableName = function() {
|
62
|
+
if (!(typeof this.fallthroughIndex !== "undefined" && this.fallthroughIndex !== null)) {
|
63
|
+
this.fallthroughIndex = 0;
|
64
|
+
}
|
65
|
+
return "fallthrough" + this.fallthroughIndex++;
|
66
|
+
};
|
67
|
+
FallthroughStatement.resetVariableNames = function() {
|
68
|
+
this.fallthroughIndex = 0;
|
69
|
+
};
|
70
|
+
exports.FallthroughStatement = FallthroughStatement;
|
71
|
+
return {};
|
72
|
+
});
|
73
|
+
|
74
|
+
//# sourceMappingURL=FallthroughStatement.map
|
@@ -0,0 +1,79 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function ForInStatement(item, index, array, body) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "ForInStatement";
|
7
|
+
this.item = item;
|
8
|
+
this.item.parent = this;
|
9
|
+
this.index = index;
|
10
|
+
if (typeof this.index !== "undefined" && this.index !== null) {
|
11
|
+
this.index.parent = this;
|
12
|
+
}
|
13
|
+
this.array = array;
|
14
|
+
this.array.parent = this;
|
15
|
+
this.body = body;
|
16
|
+
this.body.parent = this;
|
17
|
+
}
|
18
|
+
ForInStatement.prototype = Object.create(Node);
|
19
|
+
ForInStatement.prototype.codegen = function() {
|
20
|
+
if (!Node.prototype.codegen.call(this)) {
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
this.item = this.item.codegen(false);
|
24
|
+
if (typeof this.index !== "undefined" && this.index !== null) {
|
25
|
+
var context = this.getContext();
|
26
|
+
this.index = this.index.codegen(false);
|
27
|
+
context.node.body.splice(context.position, 0, {
|
28
|
+
"type": "VariableDeclaration",
|
29
|
+
"declarations": [{
|
30
|
+
"type": "VariableDeclarator",
|
31
|
+
"id": this.index,
|
32
|
+
"init": {
|
33
|
+
"type": "Literal",
|
34
|
+
"value": 0
|
35
|
+
}
|
36
|
+
}],
|
37
|
+
"kind": "let"
|
38
|
+
});
|
39
|
+
}
|
40
|
+
if (!this.array.codeGenerated) {
|
41
|
+
this.array = this.array.codegen();
|
42
|
+
}
|
43
|
+
this.body = this.body.blockWrap();
|
44
|
+
this.body.defineIdentifier(this.item);
|
45
|
+
if (typeof this.index !== "undefined" && this.index !== null) {
|
46
|
+
this.body.defineIdentifier(this.index);
|
47
|
+
}
|
48
|
+
this.body = this.body.codegen();
|
49
|
+
if (typeof this.index !== "undefined" && this.index !== null) {
|
50
|
+
this.body.body.push({
|
51
|
+
"type": "ExpressionStatement",
|
52
|
+
"codeGenerated": true,
|
53
|
+
"expression": {
|
54
|
+
"type": "UpdateExpression",
|
55
|
+
"operator": "++",
|
56
|
+
"argument": this.index,
|
57
|
+
"prefix": false
|
58
|
+
}
|
59
|
+
});
|
60
|
+
}
|
61
|
+
this.type = "ForOfStatement";
|
62
|
+
this.right = this.array;
|
63
|
+
this.left = {
|
64
|
+
"type": "VariableDeclaration",
|
65
|
+
"declarations": [{
|
66
|
+
"type": "VariableDeclarator",
|
67
|
+
"id": this.item,
|
68
|
+
"init": null
|
69
|
+
}],
|
70
|
+
"kind": "let"
|
71
|
+
};
|
72
|
+
this.each = false;
|
73
|
+
return this;
|
74
|
+
};
|
75
|
+
exports.ForInStatement = ForInStatement;
|
76
|
+
return {};
|
77
|
+
});
|
78
|
+
|
79
|
+
//# sourceMappingURL=ForInStatement.map
|
@@ -0,0 +1,98 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node,
|
4
|
+
ForInStatement = module.require("./ForInStatement").ForInStatement;
|
5
|
+
function ForOfStatement(key, value, object, body) {
|
6
|
+
Node.call(this);
|
7
|
+
this.type = "ForOfStatement";
|
8
|
+
this.key = key;
|
9
|
+
this.key.parent = this;
|
10
|
+
this.value = value;
|
11
|
+
if (typeof this.value !== "undefined" && this.value !== null) {
|
12
|
+
this.value.parent = this;
|
13
|
+
}
|
14
|
+
this.object = object;
|
15
|
+
this.object.parent = this;
|
16
|
+
this.body = body;
|
17
|
+
this.body.parent = this;
|
18
|
+
}
|
19
|
+
ForOfStatement.prototype = Object.create(Node);
|
20
|
+
ForOfStatement.prototype.codegen = function() {
|
21
|
+
if (!Node.prototype.codegen.call(this)) {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
this.object = this.object.codegen();
|
25
|
+
if (typeof this.value !== "undefined" && this.value !== null) {
|
26
|
+
this.value = this.value.codegen(false);
|
27
|
+
this.body.defineIdentifier(this.value);
|
28
|
+
if (this.object.hasCallExpression()) {
|
29
|
+
var id = {
|
30
|
+
"type": "Identifier",
|
31
|
+
"name": exports.ForOfStatement.getNextVariableName()
|
32
|
+
};
|
33
|
+
var context = this.getContext();
|
34
|
+
context.node.body.splice(context.position, 0, {
|
35
|
+
"type": "VariableDeclaration",
|
36
|
+
"declarations": [{
|
37
|
+
"type": "VariableDeclarator",
|
38
|
+
"id": id,
|
39
|
+
"init": this.object
|
40
|
+
}],
|
41
|
+
"kind": "let",
|
42
|
+
"codeGenerated": true
|
43
|
+
});
|
44
|
+
this.object = id;
|
45
|
+
}
|
46
|
+
this.body.body = [{
|
47
|
+
"type": "VariableDeclaration",
|
48
|
+
"codeGenerated": true,
|
49
|
+
"declarations": [{
|
50
|
+
"type": "VariableDeclarator",
|
51
|
+
"id": this.value,
|
52
|
+
"init": {
|
53
|
+
"type": "MemberExpression",
|
54
|
+
"computed": "true",
|
55
|
+
"object": this.object,
|
56
|
+
"property": this.key
|
57
|
+
}
|
58
|
+
}],
|
59
|
+
"kind": "let"
|
60
|
+
}].concat(this.body.body);
|
61
|
+
}
|
62
|
+
var forInLoop = new ForInStatement(this.key, null, {
|
63
|
+
"type": "CallExpression",
|
64
|
+
"codeGenerated": true,
|
65
|
+
"callee": {
|
66
|
+
"type": "MemberExpression",
|
67
|
+
"computed": false,
|
68
|
+
"object": {
|
69
|
+
"type": "Identifier",
|
70
|
+
"name": "Object"
|
71
|
+
},
|
72
|
+
"property": {
|
73
|
+
"type": "Identifier",
|
74
|
+
"name": "keys"
|
75
|
+
}
|
76
|
+
},
|
77
|
+
"arguments": [this.object]
|
78
|
+
}, this.body).codegen();
|
79
|
+
this.type = forInLoop.type;
|
80
|
+
this.right = forInLoop.right;
|
81
|
+
this.left = forInLoop.left;
|
82
|
+
this.each = forInLoop.each;
|
83
|
+
return this;
|
84
|
+
};
|
85
|
+
ForOfStatement.getNextVariableName = function() {
|
86
|
+
if (!this.forOfIndex) {
|
87
|
+
this.forOfIndex = 0;
|
88
|
+
}
|
89
|
+
return "forOf" + this.forOfIndex++;
|
90
|
+
};
|
91
|
+
ForOfStatement.resetVariableNames = function() {
|
92
|
+
this.forOfIndex = 0;
|
93
|
+
};
|
94
|
+
exports.ForOfStatement = ForOfStatement;
|
95
|
+
return {};
|
96
|
+
});
|
97
|
+
|
98
|
+
//# sourceMappingURL=ForOfStatement.map
|
@@ -0,0 +1,43 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function ForStatement(init, test, update, body) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "ForStatement";
|
7
|
+
this.init = init;
|
8
|
+
if (typeof this.init !== "undefined" && this.init !== null) {
|
9
|
+
this.init.parent = this;
|
10
|
+
}
|
11
|
+
this.test = test;
|
12
|
+
if (typeof this.test !== "undefined" && this.test !== null) {
|
13
|
+
this.test.parent = this;
|
14
|
+
}
|
15
|
+
this.update = update;
|
16
|
+
if (typeof this.update !== "undefined" && this.update !== null) {
|
17
|
+
this.update.parent = this;
|
18
|
+
}
|
19
|
+
this.body = body;
|
20
|
+
this.body.parent = this;
|
21
|
+
}
|
22
|
+
ForStatement.prototype = Object.create(Node);
|
23
|
+
ForStatement.prototype.codegen = function() {
|
24
|
+
if (!Node.prototype.codegen.call(this)) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
if (typeof this.init !== "undefined" && this.init !== null) {
|
28
|
+
this.init = this.init.codegen();
|
29
|
+
}
|
30
|
+
if (typeof this.test !== "undefined" && this.test !== null) {
|
31
|
+
this.test = this.test.codegen();
|
32
|
+
}
|
33
|
+
if (typeof this.update !== "undefined" && this.update !== null) {
|
34
|
+
this.update = this.update.codegen();
|
35
|
+
}
|
36
|
+
this.body = this.body.blockWrap().codegen();
|
37
|
+
return this;
|
38
|
+
};
|
39
|
+
exports.ForStatement = ForStatement;
|
40
|
+
return {};
|
41
|
+
});
|
42
|
+
|
43
|
+
//# sourceMappingURL=ForStatement.map
|
@@ -0,0 +1,104 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node,
|
4
|
+
Parameter = module.require("../Parameter").Parameter,
|
5
|
+
CallExpression = module.require("../expressions/CallExpression").CallExpression;
|
6
|
+
function FunctionDeclarationStatement(id, params, body, inheritsFrom) {
|
7
|
+
Node.call(this);
|
8
|
+
this.type = "FunctionDeclaration";
|
9
|
+
this.defaults = [];
|
10
|
+
this.rest = null;
|
11
|
+
this.generator = false;
|
12
|
+
this.expression = false;
|
13
|
+
this.id = id;
|
14
|
+
this.id.parent = this;
|
15
|
+
this.body = body;
|
16
|
+
this.body.parent = this;
|
17
|
+
this.params = params;
|
18
|
+
for (var $__0 = params[$traceurRuntime.toProperty(Symbol.iterator)](),
|
19
|
+
$__1; !($__1 = $__0.next()).done; ) {
|
20
|
+
var param = $__1.value;
|
21
|
+
{
|
22
|
+
param.parent = this;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
this.inheritsFrom = inheritsFrom;
|
26
|
+
if (typeof this.inheritsFrom !== "undefined" && this.inheritsFrom !== null) {
|
27
|
+
this.inheritsFrom.parent = this;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
FunctionDeclarationStatement.prototype = Object.create(Node);
|
31
|
+
FunctionDeclarationStatement.prototype.codegen = function() {
|
32
|
+
if (!Node.prototype.codegen.call(this)) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
this.id = this.id.codegen();
|
36
|
+
Parameter.generateFunctionBody(this, this.params, this.body, this.defaults);
|
37
|
+
this.body = this.body.codegen();
|
38
|
+
if (typeof this.inheritsFrom !== "undefined" && this.inheritsFrom !== null) {
|
39
|
+
if (this.inheritsFrom.type !== "CallExpression") {
|
40
|
+
this.inheritsFrom = new CallExpression(this.inheritsFrom, []);
|
41
|
+
this.inheritsFrom.parent = this;
|
42
|
+
}
|
43
|
+
this.inheritsFrom = this.inheritsFrom.codegen();
|
44
|
+
this.body.body.splice(0, 0, {
|
45
|
+
"type": "ExpressionStatement",
|
46
|
+
"expression": {
|
47
|
+
"type": "CallExpression",
|
48
|
+
"callee": {
|
49
|
+
"type": "MemberExpression",
|
50
|
+
"computed": false,
|
51
|
+
"object": this.inheritsFrom.callee,
|
52
|
+
"property": {
|
53
|
+
"type": "Identifier",
|
54
|
+
"name": "call"
|
55
|
+
}
|
56
|
+
},
|
57
|
+
"arguments": [{"type": "ThisExpression"}].concat(this.inheritsFrom.arguments)
|
58
|
+
}
|
59
|
+
});
|
60
|
+
var context = this.getContext();
|
61
|
+
context.node.body.splice(context.position + 1, 0, {
|
62
|
+
"type": "ExpressionStatement",
|
63
|
+
"codeGenerated": "true",
|
64
|
+
"expression": {
|
65
|
+
"type": "AssignmentExpression",
|
66
|
+
"operator": "=",
|
67
|
+
"left": {
|
68
|
+
"type": "MemberExpression",
|
69
|
+
"computed": false,
|
70
|
+
"object": this.id,
|
71
|
+
"property": {
|
72
|
+
"type": "Identifier",
|
73
|
+
"name": "prototype"
|
74
|
+
}
|
75
|
+
},
|
76
|
+
"right": {
|
77
|
+
"type": "CallExpression",
|
78
|
+
"callee": {
|
79
|
+
"type": "MemberExpression",
|
80
|
+
"computed": false,
|
81
|
+
"object": {
|
82
|
+
"type": "Identifier",
|
83
|
+
"name": "Object"
|
84
|
+
},
|
85
|
+
"property": {
|
86
|
+
"type": "Identifier",
|
87
|
+
"name": "create"
|
88
|
+
}
|
89
|
+
},
|
90
|
+
"arguments": [this.inheritsFrom.callee]
|
91
|
+
}
|
92
|
+
}
|
93
|
+
});
|
94
|
+
}
|
95
|
+
return this;
|
96
|
+
};
|
97
|
+
FunctionDeclarationStatement.prototype.hasCallExpression = function() {
|
98
|
+
return true;
|
99
|
+
};
|
100
|
+
exports.FunctionDeclarationStatement = FunctionDeclarationStatement;
|
101
|
+
return {};
|
102
|
+
});
|
103
|
+
|
104
|
+
//# sourceMappingURL=FunctionDeclarationStatement.map
|
@@ -0,0 +1,41 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function GoStatement(body) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "GoStatement";
|
7
|
+
this.body = body;
|
8
|
+
this.body.parent = this;
|
9
|
+
}
|
10
|
+
GoStatement.prototype = Object.create(Node);
|
11
|
+
GoStatement.prototype.codegen = function() {
|
12
|
+
if (!Node.prototype.codegen.call(this)) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
this.body = this.body.codegen();
|
16
|
+
this.type = "ExpressionStatement";
|
17
|
+
this.expression = {
|
18
|
+
"type": "CallExpression",
|
19
|
+
"callee": {
|
20
|
+
"type": "UnaryExpression",
|
21
|
+
"operator": "async",
|
22
|
+
"argument": {
|
23
|
+
"type": "FunctionExpression",
|
24
|
+
"id": null,
|
25
|
+
"params": [],
|
26
|
+
"defaults": [],
|
27
|
+
"body": this.body,
|
28
|
+
"rest": null,
|
29
|
+
"generator": false,
|
30
|
+
"expression": false
|
31
|
+
}
|
32
|
+
},
|
33
|
+
"arguments": []
|
34
|
+
};
|
35
|
+
return this;
|
36
|
+
};
|
37
|
+
exports.GoStatement = GoStatement;
|
38
|
+
return {};
|
39
|
+
});
|
40
|
+
|
41
|
+
//# sourceMappingURL=GoStatement.map
|
@@ -0,0 +1,32 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function IfStatement(test, consequent, alternate) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "IfStatement";
|
7
|
+
this.test = test;
|
8
|
+
this.test.parent = this;
|
9
|
+
this.consequent = consequent;
|
10
|
+
this.consequent.parent = this;
|
11
|
+
this.alternate = alternate;
|
12
|
+
if (typeof this.alternate !== "undefined" && this.alternate !== null) {
|
13
|
+
this.alternate.parent = this;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
IfStatement.prototype = Object.create(Node);
|
17
|
+
IfStatement.prototype.codegen = function() {
|
18
|
+
if (!Node.prototype.codegen.call(this)) {
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
this.test = this.test.codegen();
|
22
|
+
this.consequent = this.consequent.blockWrap().codegen();
|
23
|
+
if (typeof this.alternate !== "undefined" && this.alternate !== null) {
|
24
|
+
this.alternate = this.alternate.blockWrap().codegen();
|
25
|
+
}
|
26
|
+
return this;
|
27
|
+
};
|
28
|
+
exports.IfStatement = IfStatement;
|
29
|
+
return {};
|
30
|
+
});
|
31
|
+
|
32
|
+
//# sourceMappingURL=IfStatement.map
|
@@ -0,0 +1,40 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function ImportDeclarationStatement(specifiers, source, kind) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "ImportDeclaration";
|
7
|
+
this.kind = kind;
|
8
|
+
this.specifiers = specifiers;
|
9
|
+
for (var $__0 = this.specifiers[$traceurRuntime.toProperty(Symbol.iterator)](),
|
10
|
+
$__1; !($__1 = $__0.next()).done; ) {
|
11
|
+
var specifier = $__1.value;
|
12
|
+
{
|
13
|
+
specifier.parent = this;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
this.source = source;
|
17
|
+
this.source.parent = this;
|
18
|
+
}
|
19
|
+
ImportDeclarationStatement.prototype = Object.create(Node);
|
20
|
+
ImportDeclarationStatement.prototype.codegen = function() {
|
21
|
+
if (!Node.prototype.codegen.call(this)) {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
var i = 0;
|
25
|
+
for (var $__0 = this.specifiers[$traceurRuntime.toProperty(Symbol.iterator)](),
|
26
|
+
$__1; !($__1 = $__0.next()).done; ) {
|
27
|
+
var specifier = $__1.value;
|
28
|
+
{
|
29
|
+
this.specifiers[i] = specifier.codegen();
|
30
|
+
i++;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
this.source = this.source.codegen();
|
34
|
+
return this;
|
35
|
+
};
|
36
|
+
exports.ImportDeclarationStatement = ImportDeclarationStatement;
|
37
|
+
return {};
|
38
|
+
});
|
39
|
+
|
40
|
+
//# sourceMappingURL=ImportDeclarationStatement.map
|
@@ -0,0 +1,37 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function PushStatement(left, right) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "PushStatement";
|
7
|
+
this.left = left;
|
8
|
+
this.left.parent = this;
|
9
|
+
this.right = right;
|
10
|
+
this.right.parent = this;
|
11
|
+
}
|
12
|
+
PushStatement.prototype = Object.create(Node);
|
13
|
+
PushStatement.prototype.codegen = function() {
|
14
|
+
if (!Node.prototype.codegen.call(this)) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
this.type = "ExpressionStatement";
|
18
|
+
this.expression = {
|
19
|
+
"type": "CallExpression",
|
20
|
+
"callee": {
|
21
|
+
"type": "MemberExpression",
|
22
|
+
"object": this.left.codegen(),
|
23
|
+
"property": {
|
24
|
+
"type": "Identifier",
|
25
|
+
"name": "push"
|
26
|
+
},
|
27
|
+
"computed": false
|
28
|
+
},
|
29
|
+
"arguments": [this.right.codegen()]
|
30
|
+
};
|
31
|
+
return this;
|
32
|
+
};
|
33
|
+
exports.PushStatement = PushStatement;
|
34
|
+
return {};
|
35
|
+
});
|
36
|
+
|
37
|
+
//# sourceMappingURL=PushStatement.map
|
@@ -0,0 +1,26 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function ReturnStatement(argument) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "ReturnStatement";
|
7
|
+
this.argument = argument;
|
8
|
+
if (typeof this.argument !== "undefined" && this.argument !== null) {
|
9
|
+
this.argument.parent = this;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
ReturnStatement.prototype = Object.create(Node);
|
13
|
+
ReturnStatement.prototype.codegen = function() {
|
14
|
+
if (!Node.prototype.codegen.call(this)) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
if (typeof this.argument !== "undefined" && this.argument !== null) {
|
18
|
+
this.argument = this.argument.codegen();
|
19
|
+
}
|
20
|
+
return this;
|
21
|
+
};
|
22
|
+
exports.ReturnStatement = ReturnStatement;
|
23
|
+
return {};
|
24
|
+
});
|
25
|
+
|
26
|
+
//# sourceMappingURL=ReturnStatement.map
|