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,147 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function UnaryExpression(operator, argument) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "UnaryExpression";
|
7
|
+
this.operator = operator;
|
8
|
+
this.argument = argument;
|
9
|
+
this.argument.parent = this;
|
10
|
+
this.prefix = true;
|
11
|
+
}
|
12
|
+
UnaryExpression.prototype = Object.create(Node);
|
13
|
+
UnaryExpression.prototype.codegen = function() {
|
14
|
+
if (!Node.prototype.codegen.call(this)) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
this.argument = this.argument.codegen();
|
18
|
+
if (this.operator === "typeof") {
|
19
|
+
var typeofExpression = {
|
20
|
+
"type": "CallExpression",
|
21
|
+
"callee": {
|
22
|
+
"type": "MemberExpression",
|
23
|
+
"computed": false,
|
24
|
+
"object": {
|
25
|
+
"type": "MemberExpression",
|
26
|
+
"computed": true,
|
27
|
+
"object": {
|
28
|
+
"type": "CallExpression",
|
29
|
+
"callee": {
|
30
|
+
"type": "MemberExpression",
|
31
|
+
"computed": false,
|
32
|
+
"object": {
|
33
|
+
"type": "CallExpression",
|
34
|
+
"callee": {
|
35
|
+
"type": "MemberExpression",
|
36
|
+
"computed": false,
|
37
|
+
"object": {
|
38
|
+
"type": "MemberExpression",
|
39
|
+
"computed": false,
|
40
|
+
"object": {
|
41
|
+
"type": "ObjectExpression",
|
42
|
+
"properties": []
|
43
|
+
},
|
44
|
+
"property": {
|
45
|
+
"type": "Identifier",
|
46
|
+
"name": "toString"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
"property": {
|
50
|
+
"type": "Identifier",
|
51
|
+
"name": "call"
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"arguments": [this.argument]
|
55
|
+
},
|
56
|
+
"property": {
|
57
|
+
"type": "Identifier",
|
58
|
+
"name": "match"
|
59
|
+
}
|
60
|
+
},
|
61
|
+
"arguments": [{
|
62
|
+
"type": "Literal",
|
63
|
+
"value": new RegExp("\\s([a-zA-Z]+)")
|
64
|
+
}]
|
65
|
+
},
|
66
|
+
"property": {
|
67
|
+
"type": "Literal",
|
68
|
+
"value": 1,
|
69
|
+
"raw": "1"
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"property": {
|
73
|
+
"type": "Identifier",
|
74
|
+
"name": "toLowerCase"
|
75
|
+
}
|
76
|
+
},
|
77
|
+
"arguments": []
|
78
|
+
};
|
79
|
+
if (!this.argument.hasCallExpression()) {
|
80
|
+
this.type = "ConditionalExpression";
|
81
|
+
this.test = {
|
82
|
+
"type": "BinaryExpression",
|
83
|
+
"operator": "===",
|
84
|
+
"left": {
|
85
|
+
"type": "UnaryExpression",
|
86
|
+
"operator": "typeof",
|
87
|
+
"argument": this.argument,
|
88
|
+
"prefix": true
|
89
|
+
},
|
90
|
+
"right": {
|
91
|
+
"type": "Literal",
|
92
|
+
"value": "undefined",
|
93
|
+
"raw": "'undefined'"
|
94
|
+
}
|
95
|
+
};
|
96
|
+
this.consequent = {
|
97
|
+
"type": "Literal",
|
98
|
+
"value": "undefined"
|
99
|
+
};
|
100
|
+
this.alternate = typeofExpression;
|
101
|
+
} else {
|
102
|
+
this.type = typeofExpression.type;
|
103
|
+
this.callee = typeofExpression.callee;
|
104
|
+
Object.defineProperty(this, "arguments", {
|
105
|
+
value: typeofExpression.arguments,
|
106
|
+
enumerable: true
|
107
|
+
});
|
108
|
+
}
|
109
|
+
} else {
|
110
|
+
if (this.operator === "<-") {
|
111
|
+
var parent = this.parent;
|
112
|
+
while (!!(!!(typeof parent !== "undefined" && parent !== null) && !!(parent.type !== "FunctionExpression")) && !!(parent.type !== "GoStatement")) {
|
113
|
+
parent = parent.parent;
|
114
|
+
}
|
115
|
+
if (!(typeof parent !== "undefined" && parent !== null) || !!(!!(parent.type !== "GoStatement") && !!(!!(parent.parent.type !== "UnaryExpression") || !!(parent.parent.operator !== "async")))) {
|
116
|
+
Node.getErrorManager().error({
|
117
|
+
type: "GetExpressionRequiresAsync",
|
118
|
+
message: "unary <- must be in a go statement or an async function",
|
119
|
+
loc: this.loc
|
120
|
+
});
|
121
|
+
}
|
122
|
+
this.operator = "await";
|
123
|
+
this.argument = {
|
124
|
+
"type": "CallExpression",
|
125
|
+
"callee": {
|
126
|
+
"type": "MemberExpression",
|
127
|
+
"object": this.argument,
|
128
|
+
"property": {
|
129
|
+
"type": "Identifier",
|
130
|
+
"name": "get"
|
131
|
+
},
|
132
|
+
"computed": false
|
133
|
+
},
|
134
|
+
"arguments": []
|
135
|
+
};
|
136
|
+
}
|
137
|
+
}
|
138
|
+
return this;
|
139
|
+
};
|
140
|
+
UnaryExpression.prototype.hasCallExpression = function() {
|
141
|
+
return typeof this.argument !== "undefined" && this.argument !== null ? this.argument.hasCallExpression() : void 0;
|
142
|
+
};
|
143
|
+
exports.UnaryExpression = UnaryExpression;
|
144
|
+
return {};
|
145
|
+
});
|
146
|
+
|
147
|
+
//# sourceMappingURL=UnaryExpression.map
|
@@ -0,0 +1,26 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function UpdateExpression(argument, operator, prefix) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "UpdateExpression";
|
7
|
+
this.operator = operator;
|
8
|
+
this.prefix = prefix;
|
9
|
+
this.argument = argument;
|
10
|
+
this.argument.parent = this;
|
11
|
+
}
|
12
|
+
UpdateExpression.prototype = Object.create(Node);
|
13
|
+
UpdateExpression.prototype.codegen = function() {
|
14
|
+
if (!Node.prototype.codegen.call(this)) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
return this;
|
18
|
+
};
|
19
|
+
UpdateExpression.prototype.hasCallExpression = function() {
|
20
|
+
return !!(this.argument !== null) && !!this.left.hasCallExpression();
|
21
|
+
};
|
22
|
+
exports.UpdateExpression = UpdateExpression;
|
23
|
+
return {};
|
24
|
+
});
|
25
|
+
|
26
|
+
//# sourceMappingURL=UpdateExpression.map
|
@@ -0,0 +1,24 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function BooleanLiteral(text) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "Literal";
|
7
|
+
this.value = text === "true";
|
8
|
+
this.raw = text;
|
9
|
+
}
|
10
|
+
BooleanLiteral.prototype = Object.create(Node);
|
11
|
+
BooleanLiteral.prototype.codegen = function() {
|
12
|
+
if (!Node.prototype.codegen.call(this)) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
return this;
|
16
|
+
};
|
17
|
+
BooleanLiteral.prototype.hasCallExpression = function() {
|
18
|
+
return false;
|
19
|
+
};
|
20
|
+
exports.BooleanLiteral = BooleanLiteral;
|
21
|
+
return {};
|
22
|
+
});
|
23
|
+
|
24
|
+
//# sourceMappingURL=BooleanLiteral.map
|
@@ -0,0 +1,60 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function Identifier(name) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "Identifier";
|
7
|
+
this.global = false;
|
8
|
+
Object.defineProperty(this, "name", {
|
9
|
+
value: name,
|
10
|
+
enumerable: true
|
11
|
+
});
|
12
|
+
}
|
13
|
+
Identifier.prototype = Object.create(Node);
|
14
|
+
Identifier.prototype.codegen = function() {
|
15
|
+
var undefinedCheck = arguments[0] !== (void 0) ? arguments[0] : true;
|
16
|
+
if (!Node.prototype.codegen.call(this)) {
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
if (!!undefinedCheck && !this.global) {
|
20
|
+
var inExpression1 = ["FunctionDeclaration", "VariableDeclarator"];
|
21
|
+
if (!(!!(inExpression1 instanceof Array ? inExpression1.indexOf(typeof this.parent !== "undefined" && this.parent !== null ? this.parent.type : void 0) !== -1 : (typeof this.parent !== "undefined" && this.parent !== null ? this.parent.type : void 0) in inExpression1) && !!(this.parent.id === this))) {
|
22
|
+
if (!this.parent.isIdentifierDefined(this.name)) {
|
23
|
+
Node.getErrorManager().error({
|
24
|
+
type: "UndefinedIdentifier",
|
25
|
+
identifier: this.name,
|
26
|
+
message: "undefined " + this.name,
|
27
|
+
loc: this.loc
|
28
|
+
});
|
29
|
+
}
|
30
|
+
} else {
|
31
|
+
if (this.parent.isIdentifierDefined(this.name)) {
|
32
|
+
Node.getErrorManager().error({
|
33
|
+
type: "AlreadyDefinedIdentifier",
|
34
|
+
identifier: this.name,
|
35
|
+
message: this.name + " is already defined",
|
36
|
+
loc: this.loc
|
37
|
+
});
|
38
|
+
} else {
|
39
|
+
this.parent.getContext().node.defineIdentifier(this);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
return this;
|
44
|
+
};
|
45
|
+
Identifier.prototype.hasCallExpression = function() {
|
46
|
+
return false;
|
47
|
+
};
|
48
|
+
Identifier.prototype.asGlobal = function() {
|
49
|
+
this.global = true;
|
50
|
+
return this;
|
51
|
+
};
|
52
|
+
Identifier.prototype.asPredefinedCollection = function() {
|
53
|
+
this.predefinedCollection = true;
|
54
|
+
return this;
|
55
|
+
};
|
56
|
+
exports.Identifier = Identifier;
|
57
|
+
return {};
|
58
|
+
});
|
59
|
+
|
60
|
+
//# sourceMappingURL=Identifier.map
|
@@ -0,0 +1,24 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function NullLiteral() {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "Literal";
|
7
|
+
this.value = null;
|
8
|
+
this.raw = "null";
|
9
|
+
}
|
10
|
+
NullLiteral.prototype = Object.create(Node);
|
11
|
+
NullLiteral.prototype.codegen = function() {
|
12
|
+
if (!Node.prototype.codegen.call(this)) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
return this;
|
16
|
+
};
|
17
|
+
NullLiteral.prototype.hasCallExpression = function() {
|
18
|
+
return false;
|
19
|
+
};
|
20
|
+
exports.NullLiteral = NullLiteral;
|
21
|
+
return {};
|
22
|
+
});
|
23
|
+
|
24
|
+
//# sourceMappingURL=NullLiteral.map
|
@@ -0,0 +1,24 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function NumberLiteral(text) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "Literal";
|
7
|
+
this.value = Number(text);
|
8
|
+
this.raw = text;
|
9
|
+
}
|
10
|
+
NumberLiteral.prototype = Object.create(Node);
|
11
|
+
NumberLiteral.prototype.codegen = function() {
|
12
|
+
if (!Node.prototype.codegen.call(this)) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
return this;
|
16
|
+
};
|
17
|
+
NumberLiteral.prototype.hasCallExpression = function() {
|
18
|
+
return false;
|
19
|
+
};
|
20
|
+
exports.NumberLiteral = NumberLiteral;
|
21
|
+
return {};
|
22
|
+
});
|
23
|
+
|
24
|
+
//# sourceMappingURL=NumberLiteral.map
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function RegularExpressionLiteral(pattern, flags) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "Literal";
|
7
|
+
this.pattern = pattern;
|
8
|
+
this.flags = flags;
|
9
|
+
}
|
10
|
+
RegularExpressionLiteral.prototype = Object.create(Node);
|
11
|
+
RegularExpressionLiteral.prototype.codegen = function() {
|
12
|
+
if (!Node.prototype.codegen.call(this)) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
this.value = new RegExp(this.pattern, this.flags);
|
16
|
+
return this;
|
17
|
+
};
|
18
|
+
RegularExpressionLiteral.prototype.hasCallExpression = function() {
|
19
|
+
return false;
|
20
|
+
};
|
21
|
+
exports.RegularExpressionLiteral = RegularExpressionLiteral;
|
22
|
+
return {};
|
23
|
+
});
|
24
|
+
|
25
|
+
//# sourceMappingURL=RegularExpressionLiteral.map
|
@@ -0,0 +1,90 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function StringLiteral(chars, column) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "StringLiteral";
|
7
|
+
this.chars = chars;
|
8
|
+
this.column = column;
|
9
|
+
}
|
10
|
+
StringLiteral.prototype = Object.create(Node);
|
11
|
+
StringLiteral.prototype.codegen = function() {
|
12
|
+
if (!Node.prototype.codegen.call(this)) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
var elements = [];
|
16
|
+
for (var $__0 = this.chars[$traceurRuntime.toProperty(Symbol.iterator)](),
|
17
|
+
$__1; !($__1 = $__0.next()).done; ) {
|
18
|
+
var value = $__1.value;
|
19
|
+
{
|
20
|
+
var lastElement;
|
21
|
+
if ((typeof value === "undefined" ? "undefined" : {}.toString.call(value).match(/\s([a-zA-Z]+)/)[1].toLowerCase()) === "string") {
|
22
|
+
lastElement = elements[elements.length - 1];
|
23
|
+
if ((typeof lastElement !== "undefined" && lastElement !== null ? lastElement.type : void 0) === "Literal") {
|
24
|
+
lastElement.value += value;
|
25
|
+
} else {
|
26
|
+
elements.push({
|
27
|
+
type: "Literal",
|
28
|
+
value: value
|
29
|
+
});
|
30
|
+
}
|
31
|
+
} else {
|
32
|
+
if ((typeof value !== "undefined" && value !== null ? value.type : void 0) === "StringLiteralNewLine") {
|
33
|
+
lastElement = elements[elements.length - 1];
|
34
|
+
if ((typeof lastElement !== "undefined" && lastElement !== null ? lastElement.type : void 0) === "Literal") {
|
35
|
+
lastElement.value += value.toString(this.column - 1);
|
36
|
+
} else {
|
37
|
+
elements.push({
|
38
|
+
type: "Literal",
|
39
|
+
value: value.toString(this.column - 1)
|
40
|
+
});
|
41
|
+
}
|
42
|
+
} else {
|
43
|
+
value.parent = this;
|
44
|
+
elements.push(value.codegen());
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
if (elements.length === 0) {
|
50
|
+
return {
|
51
|
+
"type": "Literal",
|
52
|
+
"value": ""
|
53
|
+
};
|
54
|
+
} else {
|
55
|
+
if (elements.length === 1) {
|
56
|
+
return elements[0];
|
57
|
+
}
|
58
|
+
}
|
59
|
+
var reduced = elements.reduce(function(left, right) {
|
60
|
+
return {
|
61
|
+
type: "BinaryExpression",
|
62
|
+
operator: "+",
|
63
|
+
left: left,
|
64
|
+
right: right
|
65
|
+
};
|
66
|
+
});
|
67
|
+
this.type = reduced.type;
|
68
|
+
this.operator = reduced.operator;
|
69
|
+
this.left = reduced.left;
|
70
|
+
this.right = reduced.right;
|
71
|
+
return this;
|
72
|
+
};
|
73
|
+
StringLiteral.prototype.hasCallExpression = function() {
|
74
|
+
return false;
|
75
|
+
};
|
76
|
+
StringLiteral.NewLine = function(text) {
|
77
|
+
this.type = "StringLiteralNewLine";
|
78
|
+
this.toString = function(column) {
|
79
|
+
var t = text.replace(/\r\n/g, "").replace(/\t/g, " ");
|
80
|
+
if (t.length < column) {
|
81
|
+
return "";
|
82
|
+
}
|
83
|
+
return t.substring(column);
|
84
|
+
};
|
85
|
+
};
|
86
|
+
exports.StringLiteral = StringLiteral;
|
87
|
+
return {};
|
88
|
+
});
|
89
|
+
|
90
|
+
//# sourceMappingURL=StringLiteral.map
|
@@ -0,0 +1,30 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function UndefinedLiteral() {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "UndefinedLiteral";
|
7
|
+
}
|
8
|
+
UndefinedLiteral.prototype = Object.create(Node);
|
9
|
+
UndefinedLiteral.prototype.codegen = function() {
|
10
|
+
if (!Node.prototype.codegen.call(this)) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
this.type = "UnaryExpression";
|
14
|
+
this.operator = "void";
|
15
|
+
this.argument = {
|
16
|
+
"type": "Literal",
|
17
|
+
"value": 0,
|
18
|
+
"raw": "0"
|
19
|
+
};
|
20
|
+
this.prefix = true;
|
21
|
+
return this;
|
22
|
+
};
|
23
|
+
UndefinedLiteral.prototype.hasCallExpression = function() {
|
24
|
+
return false;
|
25
|
+
};
|
26
|
+
exports.UndefinedLiteral = UndefinedLiteral;
|
27
|
+
return {};
|
28
|
+
});
|
29
|
+
|
30
|
+
//# sourceMappingURL=UndefinedLiteral.map
|
@@ -0,0 +1,47 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function BlockStatement(body) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "BlockStatement";
|
7
|
+
this.body = body;
|
8
|
+
var i = 0;
|
9
|
+
for (var $__0 = body[$traceurRuntime.toProperty(Symbol.iterator)](),
|
10
|
+
$__1; !($__1 = $__0.next()).done; ) {
|
11
|
+
var statement = $__1.value;
|
12
|
+
{
|
13
|
+
if (statement) {
|
14
|
+
statement.parent = this;
|
15
|
+
} else {
|
16
|
+
body[i] = {type: "EmptyStatement"};
|
17
|
+
}
|
18
|
+
i++;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
BlockStatement.prototype = Object.create(Node);
|
23
|
+
BlockStatement.prototype.codegen = function() {
|
24
|
+
if (!Node.prototype.codegen.call(this)) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
var i = 0;
|
28
|
+
while (i < this.body.length) {
|
29
|
+
var statement = this.body[i];
|
30
|
+
if (!statement || !!statement.codeGenerated) {
|
31
|
+
i++;
|
32
|
+
continue;
|
33
|
+
}
|
34
|
+
if (typeof statement.codegen === "function" ? statement.codegen() : void 0) {
|
35
|
+
this.body[this.body.indexOf(statement)] = statement;
|
36
|
+
i++;
|
37
|
+
} else {
|
38
|
+
this.body.splice(i, 1);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
return this;
|
42
|
+
};
|
43
|
+
exports.BlockStatement = BlockStatement;
|
44
|
+
return {};
|
45
|
+
});
|
46
|
+
|
47
|
+
//# sourceMappingURL=BlockStatement.map
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function BreakStatement() {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "BreakStatement";
|
7
|
+
}
|
8
|
+
BreakStatement.prototype = Object.create(Node);
|
9
|
+
BreakStatement.prototype.codegen = function() {
|
10
|
+
if (!Node.prototype.codegen.call(this)) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
return this;
|
14
|
+
};
|
15
|
+
exports.BreakStatement = BreakStatement;
|
16
|
+
return {};
|
17
|
+
});
|
18
|
+
|
19
|
+
//# sourceMappingURL=BreakStatement.map
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function ContinueStatement() {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "ContinueStatement";
|
7
|
+
}
|
8
|
+
ContinueStatement.prototype = Object.create(Node);
|
9
|
+
ContinueStatement.prototype.codegen = function() {
|
10
|
+
if (!Node.prototype.codegen.call(this)) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
return this;
|
14
|
+
};
|
15
|
+
exports.ContinueStatement = ContinueStatement;
|
16
|
+
return {};
|
17
|
+
});
|
18
|
+
|
19
|
+
//# sourceMappingURL=ContinueStatement.map
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function DebuggerStatement() {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "DebuggerStatement";
|
7
|
+
}
|
8
|
+
DebuggerStatement.prototype = Object.create(Node);
|
9
|
+
DebuggerStatement.prototype.codegen = function() {
|
10
|
+
if (!Node.prototype.codegen.call(this)) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
return this;
|
14
|
+
};
|
15
|
+
exports.DebuggerStatement = DebuggerStatement;
|
16
|
+
return {};
|
17
|
+
});
|
18
|
+
|
19
|
+
//# sourceMappingURL=DebuggerStatement.map
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function DoWhileStatement(test, body) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "DoWhileStatement";
|
7
|
+
this.test = test;
|
8
|
+
this.test.parent = this;
|
9
|
+
this.body = body;
|
10
|
+
this.body.parent = this;
|
11
|
+
}
|
12
|
+
DoWhileStatement.prototype = Object.create(Node);
|
13
|
+
DoWhileStatement.prototype.codegen = function() {
|
14
|
+
if (!Node.prototype.codegen.call(this)) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
this.test = this.test.codegen();
|
18
|
+
this.body = this.body.blockWrap().codegen();
|
19
|
+
return this;
|
20
|
+
};
|
21
|
+
exports.DoWhileStatement = DoWhileStatement;
|
22
|
+
return {};
|
23
|
+
});
|
24
|
+
|
25
|
+
//# sourceMappingURL=DoWhileStatement.map
|
@@ -0,0 +1,51 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function ExportDeclarationStatement(specifiers, source, declaration, isDefault) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "ExportDeclaration";
|
7
|
+
this["default"] = isDefault;
|
8
|
+
this.specifiers = specifiers;
|
9
|
+
if (typeof specifiers !== "undefined" && specifiers !== null) {
|
10
|
+
for (var $__0 = this.specifiers[$traceurRuntime.toProperty(Symbol.iterator)](),
|
11
|
+
$__1; !($__1 = $__0.next()).done; ) {
|
12
|
+
var specifier = $__1.value;
|
13
|
+
{
|
14
|
+
specifier.parent = this;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
this.source = source;
|
19
|
+
if (typeof source !== "undefined" && source !== null) {
|
20
|
+
this.source.parent = this;
|
21
|
+
}
|
22
|
+
this.declaration = declaration;
|
23
|
+
if (typeof declaration !== "undefined" && declaration !== null) {
|
24
|
+
this.declaration.parent = this;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
ExportDeclarationStatement.prototype = Object.create(Node);
|
28
|
+
ExportDeclarationStatement.prototype.codegen = function() {
|
29
|
+
if (!Node.prototype.codegen.call(this)) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
if (typeof this.specifiers !== "undefined" && this.specifiers !== null) {
|
33
|
+
var i = 0;
|
34
|
+
for (var $__0 = this.specifiers[$traceurRuntime.toProperty(Symbol.iterator)](),
|
35
|
+
$__1; !($__1 = $__0.next()).done; ) {
|
36
|
+
var specifier = $__1.value;
|
37
|
+
{
|
38
|
+
this.specifiers[i] = specifier.codegen();
|
39
|
+
i++;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
this.source = typeof this.source !== "undefined" && this.source !== null ? this.source.codegen() : void 0;
|
44
|
+
this.declaration = typeof this.declaration !== "undefined" && this.declaration !== null ? this.declaration.codegen() : void 0;
|
45
|
+
return this;
|
46
|
+
};
|
47
|
+
exports.ExportDeclarationStatement = ExportDeclarationStatement;
|
48
|
+
return {};
|
49
|
+
});
|
50
|
+
|
51
|
+
//# sourceMappingURL=ExportDeclarationStatement.map
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$traceurRuntime.ModuleStore.getAnonymousModule(function() {
|
2
|
+
"use strict";
|
3
|
+
var Node = module.require("../Node").Node;
|
4
|
+
function ExpressionStatement(expression) {
|
5
|
+
Node.call(this);
|
6
|
+
this.type = "ExpressionStatement";
|
7
|
+
this.expression = expression;
|
8
|
+
this.expression.parent = this;
|
9
|
+
}
|
10
|
+
ExpressionStatement.prototype = Object.create(Node);
|
11
|
+
ExpressionStatement.prototype.codegen = function() {
|
12
|
+
if (!Node.prototype.codegen.call(this)) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
this.expression = this.expression.codegen();
|
16
|
+
return this;
|
17
|
+
};
|
18
|
+
exports.ExpressionStatement = ExpressionStatement;
|
19
|
+
return {};
|
20
|
+
});
|
21
|
+
|
22
|
+
//# sourceMappingURL=ExpressionStatement.map
|