spider-src 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE.txt +74 -0
  5. data/README.md +37 -0
  6. data/Rakefile +25 -0
  7. data/lib/spider-src/support/spider/.eslintrc +17 -0
  8. data/lib/spider-src/support/spider/.npmignore +9 -0
  9. data/lib/spider-src/support/spider/.travis.yml +7 -0
  10. data/lib/spider-src/support/spider/.yo-rc.json +3 -0
  11. data/lib/spider-src/support/spider/CHANGELOG.md +64 -0
  12. data/lib/spider-src/support/spider/Gruntfile.js +97 -0
  13. data/lib/spider-src/support/spider/Gruntfile.spider +93 -0
  14. data/lib/spider-src/support/spider/LICENSE +201 -0
  15. data/lib/spider-src/support/spider/README.md +50 -0
  16. data/lib/spider-src/support/spider/cli.js +119 -0
  17. data/lib/spider-src/support/spider/lib/ast/CaseClause.js +179 -0
  18. data/lib/spider-src/support/spider/lib/ast/CatchClause.js +26 -0
  19. data/lib/spider-src/support/spider/lib/ast/ExportBatchSpecifier.js +19 -0
  20. data/lib/spider-src/support/spider/lib/ast/ExportSpecifier.js +33 -0
  21. data/lib/spider-src/support/spider/lib/ast/ImportDefaultSpecifier.js +23 -0
  22. data/lib/spider-src/support/spider/lib/ast/ImportNamespaceSpecifier.js +23 -0
  23. data/lib/spider-src/support/spider/lib/ast/ImportSpecifier.js +40 -0
  24. data/lib/spider-src/support/spider/lib/ast/Node.js +93 -0
  25. data/lib/spider-src/support/spider/lib/ast/Parameter.js +229 -0
  26. data/lib/spider-src/support/spider/lib/ast/Program.js +58 -0
  27. data/lib/spider-src/support/spider/lib/ast/Property.js +32 -0
  28. data/lib/spider-src/support/spider/lib/ast/Range.js +257 -0
  29. data/lib/spider-src/support/spider/lib/ast/VariableDeclarator.js +29 -0
  30. data/lib/spider-src/support/spider/lib/ast/expressions/ArrayExpression.js +41 -0
  31. data/lib/spider-src/support/spider/lib/ast/expressions/ArrayPattern.js +45 -0
  32. data/lib/spider-src/support/spider/lib/ast/expressions/AssignmentExpression.js +29 -0
  33. data/lib/spider-src/support/spider/lib/ast/expressions/BinaryExpression.js +104 -0
  34. data/lib/spider-src/support/spider/lib/ast/expressions/CallExpression.js +139 -0
  35. data/lib/spider-src/support/spider/lib/ast/expressions/ConditionalExpression.js +31 -0
  36. data/lib/spider-src/support/spider/lib/ast/expressions/CurryCallExpression.js +102 -0
  37. data/lib/spider-src/support/spider/lib/ast/expressions/ExistentialExpression.js +83 -0
  38. data/lib/spider-src/support/spider/lib/ast/expressions/ForInExpression.js +116 -0
  39. data/lib/spider-src/support/spider/lib/ast/expressions/FunctionExpression.js +157 -0
  40. data/lib/spider-src/support/spider/lib/ast/expressions/InExpression.js +99 -0
  41. data/lib/spider-src/support/spider/lib/ast/expressions/LogicalExpression.js +50 -0
  42. data/lib/spider-src/support/spider/lib/ast/expressions/MemberExpression.js +43 -0
  43. data/lib/spider-src/support/spider/lib/ast/expressions/NewExpression.js +46 -0
  44. data/lib/spider-src/support/spider/lib/ast/expressions/NullCheckCallExpression.js +132 -0
  45. data/lib/spider-src/support/spider/lib/ast/expressions/NullCoalescingExpression.js +114 -0
  46. data/lib/spider-src/support/spider/lib/ast/expressions/NullPropagatingExpression.js +161 -0
  47. data/lib/spider-src/support/spider/lib/ast/expressions/ObjectExpression.js +39 -0
  48. data/lib/spider-src/support/spider/lib/ast/expressions/ObjectPattern.js +49 -0
  49. data/lib/spider-src/support/spider/lib/ast/expressions/RangeMemberExpression.js +157 -0
  50. data/lib/spider-src/support/spider/lib/ast/expressions/SplatExpression.js +48 -0
  51. data/lib/spider-src/support/spider/lib/ast/expressions/SuperExpression.js +170 -0
  52. data/lib/spider-src/support/spider/lib/ast/expressions/ThisExpression.js +22 -0
  53. data/lib/spider-src/support/spider/lib/ast/expressions/UnaryExpression.js +147 -0
  54. data/lib/spider-src/support/spider/lib/ast/expressions/UpdateExpression.js +26 -0
  55. data/lib/spider-src/support/spider/lib/ast/literals/BooleanLiteral.js +24 -0
  56. data/lib/spider-src/support/spider/lib/ast/literals/Identifier.js +60 -0
  57. data/lib/spider-src/support/spider/lib/ast/literals/NullLiteral.js +24 -0
  58. data/lib/spider-src/support/spider/lib/ast/literals/NumberLiteral.js +24 -0
  59. data/lib/spider-src/support/spider/lib/ast/literals/RegularExpressionLiteral.js +25 -0
  60. data/lib/spider-src/support/spider/lib/ast/literals/StringLiteral.js +90 -0
  61. data/lib/spider-src/support/spider/lib/ast/literals/UndefinedLiteral.js +30 -0
  62. data/lib/spider-src/support/spider/lib/ast/statements/BlockStatement.js +47 -0
  63. data/lib/spider-src/support/spider/lib/ast/statements/BreakStatement.js +19 -0
  64. data/lib/spider-src/support/spider/lib/ast/statements/ContinueStatement.js +19 -0
  65. data/lib/spider-src/support/spider/lib/ast/statements/DebuggerStatement.js +19 -0
  66. data/lib/spider-src/support/spider/lib/ast/statements/DoWhileStatement.js +25 -0
  67. data/lib/spider-src/support/spider/lib/ast/statements/ExportDeclarationStatement.js +51 -0
  68. data/lib/spider-src/support/spider/lib/ast/statements/ExpressionStatement.js +22 -0
  69. data/lib/spider-src/support/spider/lib/ast/statements/FallthroughStatement.js +74 -0
  70. data/lib/spider-src/support/spider/lib/ast/statements/ForInStatement.js +79 -0
  71. data/lib/spider-src/support/spider/lib/ast/statements/ForOfStatement.js +98 -0
  72. data/lib/spider-src/support/spider/lib/ast/statements/ForStatement.js +43 -0
  73. data/lib/spider-src/support/spider/lib/ast/statements/FunctionDeclarationStatement.js +104 -0
  74. data/lib/spider-src/support/spider/lib/ast/statements/GoStatement.js +41 -0
  75. data/lib/spider-src/support/spider/lib/ast/statements/IfStatement.js +32 -0
  76. data/lib/spider-src/support/spider/lib/ast/statements/ImportDeclarationStatement.js +40 -0
  77. data/lib/spider-src/support/spider/lib/ast/statements/PushStatement.js +37 -0
  78. data/lib/spider-src/support/spider/lib/ast/statements/ReturnStatement.js +26 -0
  79. data/lib/spider-src/support/spider/lib/ast/statements/SwitchStatement.js +159 -0
  80. data/lib/spider-src/support/spider/lib/ast/statements/ThrowStatement.js +22 -0
  81. data/lib/spider-src/support/spider/lib/ast/statements/TryStatement.js +36 -0
  82. data/lib/spider-src/support/spider/lib/ast/statements/UntilStatement.js +31 -0
  83. data/lib/spider-src/support/spider/lib/ast/statements/UseStatement.js +49 -0
  84. data/lib/spider-src/support/spider/lib/ast/statements/VariableDeclarationStatement.js +36 -0
  85. data/lib/spider-src/support/spider/lib/ast/statements/WhileStatement.js +25 -0
  86. data/lib/spider-src/support/spider/lib/ast.js +16 -0
  87. data/lib/spider-src/support/spider/lib/parser.js +14878 -0
  88. data/lib/spider-src/support/spider/lib/spider.js +217 -0
  89. data/lib/spider-src/support/spider/package.json +61 -0
  90. data/lib/spider-src/support/spider/spider-script.js +6 -0
  91. data/lib/spider-src/support/spider/src/ast/CaseClause.spider +179 -0
  92. data/lib/spider-src/support/spider/src/ast/CatchClause.spider +30 -0
  93. data/lib/spider-src/support/spider/src/ast/ExportBatchSpecifier.spider +19 -0
  94. data/lib/spider-src/support/spider/src/ast/ExportSpecifier.spider +37 -0
  95. data/lib/spider-src/support/spider/src/ast/ImportDefaultSpecifier.spider +25 -0
  96. data/lib/spider-src/support/spider/src/ast/ImportNamespaceSpecifier.spider +25 -0
  97. data/lib/spider-src/support/spider/src/ast/ImportSpecifier.spider +44 -0
  98. data/lib/spider-src/support/spider/src/ast/Node.spider +104 -0
  99. data/lib/spider-src/support/spider/src/ast/Parameter.spider +233 -0
  100. data/lib/spider-src/support/spider/src/ast/Program.spider +109 -0
  101. data/lib/spider-src/support/spider/src/ast/Property.spider +36 -0
  102. data/lib/spider-src/support/spider/src/ast/Range.spider +291 -0
  103. data/lib/spider-src/support/spider/src/ast/VariableDeclarator.spider +33 -0
  104. data/lib/spider-src/support/spider/src/ast/expressions/ArrayExpression.spider +32 -0
  105. data/lib/spider-src/support/spider/src/ast/expressions/ArrayPattern.spider +37 -0
  106. data/lib/spider-src/support/spider/src/ast/expressions/AssignmentExpression.spider +34 -0
  107. data/lib/spider-src/support/spider/src/ast/expressions/BinaryExpression.spider +125 -0
  108. data/lib/spider-src/support/spider/src/ast/expressions/CallExpression.spider +149 -0
  109. data/lib/spider-src/support/spider/src/ast/expressions/ConditionalExpression.spider +34 -0
  110. data/lib/spider-src/support/spider/src/ast/expressions/CurryCallExpression.spider +109 -0
  111. data/lib/spider-src/support/spider/src/ast/expressions/ExistentialExpression.spider +102 -0
  112. data/lib/spider-src/support/spider/src/ast/expressions/ForInExpression.spider +140 -0
  113. data/lib/spider-src/support/spider/src/ast/expressions/FunctionExpression.spider +183 -0
  114. data/lib/spider-src/support/spider/src/ast/expressions/InExpression.spider +114 -0
  115. data/lib/spider-src/support/spider/src/ast/expressions/LogicalExpression.spider +62 -0
  116. data/lib/spider-src/support/spider/src/ast/expressions/MemberExpression.spider +57 -0
  117. data/lib/spider-src/support/spider/src/ast/expressions/NewExpression.spider +40 -0
  118. data/lib/spider-src/support/spider/src/ast/expressions/NullCheckCallExpression.spider +151 -0
  119. data/lib/spider-src/support/spider/src/ast/expressions/NullCoalescingExpression.spider +151 -0
  120. data/lib/spider-src/support/spider/src/ast/expressions/NullPropagatingExpression.spider +190 -0
  121. data/lib/spider-src/support/spider/src/ast/expressions/ObjectExpression.spider +30 -0
  122. data/lib/spider-src/support/spider/src/ast/expressions/ObjectPattern.spider +42 -0
  123. data/lib/spider-src/support/spider/src/ast/expressions/RangeMemberExpression.spider +179 -0
  124. data/lib/spider-src/support/spider/src/ast/expressions/SplatExpression.spider +49 -0
  125. data/lib/spider-src/support/spider/src/ast/expressions/SuperExpression.spider +235 -0
  126. data/lib/spider-src/support/spider/src/ast/expressions/ThisExpression.spider +21 -0
  127. data/lib/spider-src/support/spider/src/ast/expressions/UnaryExpression.spider +158 -0
  128. data/lib/spider-src/support/spider/src/ast/expressions/UpdateExpression.spider +28 -0
  129. data/lib/spider-src/support/spider/src/ast/literals/BooleanLiteral.spider +23 -0
  130. data/lib/spider-src/support/spider/src/ast/literals/Identifier.spider +68 -0
  131. data/lib/spider-src/support/spider/src/ast/literals/NullLiteral.spider +23 -0
  132. data/lib/spider-src/support/spider/src/ast/literals/NumberLiteral.spider +23 -0
  133. data/lib/spider-src/support/spider/src/ast/literals/RegularExpressionLiteral.spider +24 -0
  134. data/lib/spider-src/support/spider/src/ast/literals/StringLiteral.spider +91 -0
  135. data/lib/spider-src/support/spider/src/ast/literals/UndefinedLiteral.spider +30 -0
  136. data/lib/spider-src/support/spider/src/ast/statements/BlockStatement.spider +45 -0
  137. data/lib/spider-src/support/spider/src/ast/statements/BreakStatement.spider +19 -0
  138. data/lib/spider-src/support/spider/src/ast/statements/ContinueStatement.spider +19 -0
  139. data/lib/spider-src/support/spider/src/ast/statements/DebuggerStatement.spider +19 -0
  140. data/lib/spider-src/support/spider/src/ast/statements/DoWhileStatement.spider +28 -0
  141. data/lib/spider-src/support/spider/src/ast/statements/ExportDeclarationStatement.spider +46 -0
  142. data/lib/spider-src/support/spider/src/ast/statements/ExpressionStatement.spider +22 -0
  143. data/lib/spider-src/support/spider/src/ast/statements/FallthroughStatement.spider +85 -0
  144. data/lib/spider-src/support/spider/src/ast/statements/ForInStatement.spider +92 -0
  145. data/lib/spider-src/support/spider/src/ast/statements/ForOfStatement.spider +117 -0
  146. data/lib/spider-src/support/spider/src/ast/statements/ForStatement.spider +51 -0
  147. data/lib/spider-src/support/spider/src/ast/statements/FunctionDeclarationStatement.spider +115 -0
  148. data/lib/spider-src/support/spider/src/ast/statements/GoStatement.spider +44 -0
  149. data/lib/spider-src/support/spider/src/ast/statements/IfStatement.spider +38 -0
  150. data/lib/spider-src/support/spider/src/ast/statements/ImportDeclarationStatement.spider +33 -0
  151. data/lib/spider-src/support/spider/src/ast/statements/PushStatement.spider +40 -0
  152. data/lib/spider-src/support/spider/src/ast/statements/ReturnStatement.spider +28 -0
  153. data/lib/spider-src/support/spider/src/ast/statements/SwitchStatement.spider +161 -0
  154. data/lib/spider-src/support/spider/src/ast/statements/ThrowStatement.spider +23 -0
  155. data/lib/spider-src/support/spider/src/ast/statements/TryStatement.spider +42 -0
  156. data/lib/spider-src/support/spider/src/ast/statements/UntilStatement.spider +36 -0
  157. data/lib/spider-src/support/spider/src/ast/statements/UseStatement.spider +62 -0
  158. data/lib/spider-src/support/spider/src/ast/statements/VariableDeclarationStatement.spider +34 -0
  159. data/lib/spider-src/support/spider/src/ast/statements/WhileStatement.spider +28 -0
  160. data/lib/spider-src/support/spider/src/ast.spider +80 -0
  161. data/lib/spider-src/support/spider/src/spider.pegjs +1434 -0
  162. data/lib/spider-src/support/spider/src/spider.spider +276 -0
  163. data/lib/spider-src/support/spider/test/spider_test.js +1787 -0
  164. data/lib/spider-src/version.rb +5 -0
  165. data/lib/spider-src.rb +37 -0
  166. data/spider-src.gemspec +24 -0
  167. data/test/test_spider_src.rb +33 -0
  168. metadata +225 -0
@@ -0,0 +1,29 @@
1
+ $traceurRuntime.ModuleStore.getAnonymousModule(function() {
2
+ "use strict";
3
+ var Node = module.require("../Node").Node;
4
+ function AssignmentExpression(left, operator, right) {
5
+ Node.call(this);
6
+ this.type = "AssignmentExpression";
7
+ this.operator = operator;
8
+ this.left = left;
9
+ this.left.parent = this;
10
+ this.right = right;
11
+ this.right.parent = this;
12
+ }
13
+ AssignmentExpression.prototype = Object.create(Node);
14
+ AssignmentExpression.prototype.codegen = function() {
15
+ if (!Node.prototype.codegen.call(this)) {
16
+ return;
17
+ }
18
+ this.left = this.left.codegen();
19
+ this.right = this.right.codegen();
20
+ return this;
21
+ };
22
+ AssignmentExpression.prototype.hasCallExpression = function() {
23
+ return !!(typeof this.left !== "undefined" && this.left !== null ? this.left.hasCallExpression() : void 0) || !!(typeof this.right !== "undefined" && this.right !== null ? this.right.hasCallExpression() : void 0);
24
+ };
25
+ exports.AssignmentExpression = AssignmentExpression;
26
+ return {};
27
+ });
28
+
29
+ //# sourceMappingURL=AssignmentExpression.map
@@ -0,0 +1,104 @@
1
+ $traceurRuntime.ModuleStore.getAnonymousModule(function() {
2
+ "use strict";
3
+ var Node = module.require("../Node").Node;
4
+ function BinaryExpression(left, operator, right) {
5
+ Node.call(this);
6
+ this.type = "BinaryExpression";
7
+ this.operator = operator;
8
+ this.left = left;
9
+ this.left.parent = this;
10
+ this.right = right;
11
+ this.right.parent = this;
12
+ }
13
+ BinaryExpression.prototype = Object.create(Node);
14
+ BinaryExpression.prototype.codegen = function() {
15
+ if (!Node.prototype.codegen.call(this)) {
16
+ return;
17
+ }
18
+ var isRelational = function(operator) {
19
+ var inExpression0 = [">", ">=", "<", ">="];
20
+ return inExpression0 instanceof Array ? inExpression0.indexOf(operator) !== -1 : operator in inExpression0;
21
+ };
22
+ if (!!isRelational(this.operator) && !!isRelational(this.left.operator)) {
23
+ this.type = "LogicalExpression";
24
+ this.right = {
25
+ "type": "BinaryExpression",
26
+ "operator": this.operator,
27
+ "left": this.left.right,
28
+ "right": this.right.codegen()
29
+ };
30
+ this.left = this.left.codegen();
31
+ this.operator = "&&";
32
+ } else {
33
+ this.left = this.left.codegen();
34
+ this.right = this.right.codegen();
35
+ if (this.operator === "==") {
36
+ this.operator = "===";
37
+ } else if (this.operator === "!=") {
38
+ this.operator = "!==";
39
+ } else if (this.operator === "**") {
40
+ this.type = "CallExpression";
41
+ this.callee = {
42
+ "type": "MemberExpression",
43
+ "computed": false,
44
+ "object": {
45
+ "type": "Identifier",
46
+ "name": "Math"
47
+ },
48
+ "property": {
49
+ "type": "Identifier",
50
+ "name": "pow"
51
+ }
52
+ };
53
+ Object.defineProperty(this, "arguments", {
54
+ value: [this.left, this.right],
55
+ enumerable: true
56
+ });
57
+ } else if (this.operator === "#") {
58
+ this.type = "CallExpression";
59
+ this.callee = {
60
+ "type": "MemberExpression",
61
+ "computed": false,
62
+ "object": {
63
+ "type": "Identifier",
64
+ "name": "Math"
65
+ },
66
+ "property": {
67
+ "type": "Identifier",
68
+ "name": "floor"
69
+ }
70
+ };
71
+ Object.defineProperty(this, "arguments", {
72
+ value: [{
73
+ "type": "BinaryExpression",
74
+ "operator": "/",
75
+ "left": this.left,
76
+ "right": this.right
77
+ }],
78
+ enumerable: true
79
+ });
80
+ } else if (this.operator === "%%") {
81
+ this.operator = "%";
82
+ this.left = {
83
+ "type": "BinaryExpression",
84
+ "operator": "+",
85
+ "left": {
86
+ "type": "BinaryExpression",
87
+ "operator": "%",
88
+ "left": this.left,
89
+ "right": this.right
90
+ },
91
+ "right": this.right
92
+ };
93
+ }
94
+ }
95
+ return this;
96
+ };
97
+ BinaryExpression.prototype.hasCallExpression = function() {
98
+ return !!(typeof this.left !== "undefined" && this.left !== null ? this.left.hasCallExpression() : void 0) || !!(typeof this.right !== "undefined" && this.right !== null ? this.right.hasCallExpression() : void 0);
99
+ };
100
+ exports.BinaryExpression = BinaryExpression;
101
+ return {};
102
+ });
103
+
104
+ //# sourceMappingURL=BinaryExpression.map
@@ -0,0 +1,139 @@
1
+ $traceurRuntime.ModuleStore.getAnonymousModule(function() {
2
+ "use strict";
3
+ var Node = module.require("../Node").Node;
4
+ function CallExpression(callee, args) {
5
+ Node.call(this);
6
+ this.type = "CallExpression";
7
+ this.callee = callee;
8
+ this.callee.parent = this;
9
+ Object.defineProperty(this, "arguments", {
10
+ value: args,
11
+ enumerable: true
12
+ });
13
+ for (var $__0 = args[$traceurRuntime.toProperty(Symbol.iterator)](),
14
+ $__1; !($__1 = $__0.next()).done; ) {
15
+ var arg = $__1.value;
16
+ {
17
+ arg.parent = this;
18
+ }
19
+ }
20
+ }
21
+ CallExpression.prototype = Object.create(Node);
22
+ CallExpression.prototype.codegen = function() {
23
+ if (!Node.prototype.codegen.call(this)) {
24
+ return;
25
+ }
26
+ var calleeType = this.callee.type;
27
+ if (!this.callee.codeGenerated) {
28
+ this.callee = this.callee.codegen();
29
+ }
30
+ var args = this.arguments;
31
+ var splatPositions = [];
32
+ var i = 0;
33
+ for (var $__0 = args[$traceurRuntime.toProperty(Symbol.iterator)](),
34
+ $__1; !($__1 = $__0.next()).done; ) {
35
+ var arg = $__1.value;
36
+ {
37
+ if (!!(args[i].type === "SplatExpression") || !!args[i].__splat) {
38
+ splatPositions.push(i);
39
+ }
40
+ if (!args[i].codeGenerated) {
41
+ args[i] = arg.codegen();
42
+ }
43
+ i++;
44
+ }
45
+ }
46
+ if (splatPositions.length > 0) {
47
+ var argsClone = args.slice(0);
48
+ args.length = 0;
49
+ args.push({
50
+ "type": "Literal",
51
+ "value": null
52
+ });
53
+ if (argsClone.length === 1) {
54
+ args.push(argsClone[0].arguments[0]);
55
+ } else {
56
+ args.push({
57
+ "type": "CallExpression",
58
+ "callee": {
59
+ "type": "MemberExpression",
60
+ "computed": false,
61
+ "object": splatPositions[0] === 0 ? argsClone[0] : {
62
+ "type": "ArrayExpression",
63
+ "elements": argsClone.slice(0, splatPositions[0])
64
+ },
65
+ "property": {
66
+ "type": "Identifier",
67
+ "name": "concat"
68
+ }
69
+ },
70
+ "arguments": argsClone.slice(splatPositions[0] === 0 ? 1 : splatPositions[0]).map(function(arg, i) {
71
+ if (splatPositions.indexOf(i + (splatPositions[0] === 0 ? 1 : splatPositions[0])) !== -1) {
72
+ return arg;
73
+ }
74
+ return {
75
+ "type": "ArrayExpression",
76
+ "elements": [arg]
77
+ };
78
+ })
79
+ });
80
+ }
81
+ }
82
+ if (!!(this.callee.type === "ConditionalExpression") && !!(!!(calleeType === "NullPropagatingExpression") || !!(calleeType === "MemberExpression"))) {
83
+ var parent = this.parent;
84
+ var consequent = {
85
+ type: "CallExpression",
86
+ callee: this.callee.consequent,
87
+ arguments: this.arguments
88
+ };
89
+ if (splatPositions.length > 0) {
90
+ this.callee.consequent = {
91
+ "type": "MemberExpression",
92
+ "computed": false,
93
+ "object": this.callee.consequent,
94
+ "property": {
95
+ "type": "Identifier",
96
+ "name": "apply"
97
+ }
98
+ };
99
+ }
100
+ if (parent.type === "ExpressionStatement") {
101
+ parent.type = "IfStatement";
102
+ parent.test = this.callee.test;
103
+ parent.consequent = {
104
+ type: "BlockStatement",
105
+ body: [{
106
+ type: "ExpressionStatement",
107
+ expression: consequent
108
+ }]
109
+ };
110
+ parent.alternate = null;
111
+ } else {
112
+ this.type = "ConditionalExpression";
113
+ this.test = this.callee.test;
114
+ this.consequent = consequent;
115
+ this.alternate = this.callee.alternate;
116
+ }
117
+ } else {
118
+ if (splatPositions.length > 0) {
119
+ this.callee = {
120
+ "type": "MemberExpression",
121
+ "computed": false,
122
+ "object": this.callee,
123
+ "property": {
124
+ "type": "Identifier",
125
+ "name": "apply"
126
+ }
127
+ };
128
+ }
129
+ }
130
+ return this;
131
+ };
132
+ CallExpression.prototype.hasCallExpression = function() {
133
+ return true;
134
+ };
135
+ exports.CallExpression = CallExpression;
136
+ return {};
137
+ });
138
+
139
+ //# sourceMappingURL=CallExpression.map
@@ -0,0 +1,31 @@
1
+ $traceurRuntime.ModuleStore.getAnonymousModule(function() {
2
+ "use strict";
3
+ var Node = module.require("../Node").Node;
4
+ function ConditionalExpression(test, consequent, alternate) {
5
+ Node.call(this);
6
+ this.type = "ConditionalExpression";
7
+ this.test = test;
8
+ this.test.parent = this;
9
+ this.consequent = consequent;
10
+ this.consequent.parent = this;
11
+ this.alternate = alternate;
12
+ this.alternate.parent = this;
13
+ }
14
+ ConditionalExpression.prototype = Object.create(Node);
15
+ ConditionalExpression.prototype.codegen = function() {
16
+ if (!Node.prototype.codegen.call(this)) {
17
+ return;
18
+ }
19
+ this.test = this.test.codegen();
20
+ this.consequent = this.consequent.codegen();
21
+ this.alternate = this.alternate.codegen();
22
+ return this;
23
+ };
24
+ ConditionalExpression.prototype.hasCallExpression = function() {
25
+ return true;
26
+ };
27
+ exports.ConditionalExpression = ConditionalExpression;
28
+ return {};
29
+ });
30
+
31
+ //# sourceMappingURL=ConditionalExpression.map
@@ -0,0 +1,102 @@
1
+ $traceurRuntime.ModuleStore.getAnonymousModule(function() {
2
+ "use strict";
3
+ var Node = module.require("../Node").Node,
4
+ CallExpression = module.require("./CallExpression").CallExpression;
5
+ function CurryCallExpression(callee, args) {
6
+ Node.call(this);
7
+ this.type = "CurryCallExpression";
8
+ this.callee = callee;
9
+ this.args = args;
10
+ }
11
+ CurryCallExpression.prototype = Object.create(Node);
12
+ CurryCallExpression.prototype.codegen = function() {
13
+ if (!Node.prototype.codegen.call(this)) {
14
+ return;
15
+ }
16
+ var call = new CallExpression(this.callee, this.args);
17
+ call.parent = this;
18
+ call = call.codegen();
19
+ if (!!(call.type !== "CallExpression") || !!(!!((typeof call !== "undefined" && call !== null ? call.callee.type : void 0) === "MemberExpression") && !!((typeof call !== "undefined" && call !== null ? call.callee.property.name : void 0) === "apply"))) {
20
+ Node.getErrorManager().error({
21
+ type: "InvalidFunctionCurrying",
22
+ message: "currying functions with existential operator or splats is disallowed.",
23
+ loc: this.loc
24
+ });
25
+ }
26
+ this.type = "FunctionExpression";
27
+ this.id = null;
28
+ this.params = [];
29
+ this.defaults = [];
30
+ this.body = {
31
+ "type": "BlockStatement",
32
+ "body": [{
33
+ "type": "ReturnStatement",
34
+ "argument": {
35
+ "type": "CallExpression",
36
+ "callee": {
37
+ "type": "MemberExpression",
38
+ "computed": false,
39
+ "object": call.callee,
40
+ "property": {
41
+ "type": "Identifier",
42
+ "name": "apply"
43
+ }
44
+ },
45
+ "arguments": [{"type": "ThisExpression"}, {
46
+ "type": "CallExpression",
47
+ "callee": {
48
+ "type": "MemberExpression",
49
+ "computed": false,
50
+ "object": {
51
+ "type": "ArrayExpression",
52
+ "elements": call.arguments
53
+ },
54
+ "property": {
55
+ "type": "Identifier",
56
+ "name": "concat"
57
+ }
58
+ },
59
+ "arguments": [{
60
+ "type": "CallExpression",
61
+ "callee": {
62
+ "type": "MemberExpression",
63
+ "computed": false,
64
+ "object": {
65
+ "type": "MemberExpression",
66
+ "computed": false,
67
+ "object": {
68
+ "type": "ArrayExpression",
69
+ "elements": []
70
+ },
71
+ "property": {
72
+ "type": "Identifier",
73
+ "name": "slice"
74
+ }
75
+ },
76
+ "property": {
77
+ "type": "Identifier",
78
+ "name": "apply"
79
+ }
80
+ },
81
+ "arguments": [{
82
+ "type": "Identifier",
83
+ "name": "arguments"
84
+ }]
85
+ }]
86
+ }]
87
+ }
88
+ }]
89
+ };
90
+ this.rest = null;
91
+ this.generator = false;
92
+ this.expression = false;
93
+ return this;
94
+ };
95
+ CurryCallExpression.prototype.hasCallExpression = function() {
96
+ return true;
97
+ };
98
+ exports.CurryCallExpression = CurryCallExpression;
99
+ return {};
100
+ });
101
+
102
+ //# sourceMappingURL=CurryCallExpression.map
@@ -0,0 +1,83 @@
1
+ $traceurRuntime.ModuleStore.getAnonymousModule(function() {
2
+ "use strict";
3
+ var Node = module.require("../Node").Node;
4
+ function ExistentialExpression(argument) {
5
+ Node.call(this);
6
+ this.type = "ExistentialExpression";
7
+ this.argument = argument;
8
+ this.argument.parent = this;
9
+ }
10
+ ExistentialExpression.prototype = Object.create(Node);
11
+ ExistentialExpression.prototype.codegen = function() {
12
+ if (!Node.prototype.codegen.call(this)) {
13
+ return;
14
+ }
15
+ var nullCoalescing0 = typeof this.argument.hasCallExpression === "function" ? this.argument.hasCallExpression() : void 0;
16
+ var isArgumentCallExpression = nullCoalescing0 == null ? false : nullCoalescing0;
17
+ this.argument = this.argument.codegen();
18
+ if (isArgumentCallExpression) {
19
+ var context = this.getContext();
20
+ var id = {
21
+ "type": "Identifier",
22
+ "name": ExistentialExpression.getNextVariableName()
23
+ };
24
+ context.node.body.splice(context.position + (ExistentialExpression.existentialIndex - 2), 0, {
25
+ "type": "VariableDeclaration",
26
+ "declarations": [{
27
+ "type": "VariableDeclarator",
28
+ "id": id,
29
+ "init": this.argument
30
+ }],
31
+ "kind": "let",
32
+ "codeGenerated": true
33
+ });
34
+ this.argument = id;
35
+ }
36
+ var nullCheck = {
37
+ "type": "BinaryExpression",
38
+ "operator": "!==",
39
+ "left": this.argument,
40
+ "right": {
41
+ "type": "Literal",
42
+ "value": null,
43
+ "raw": "null"
44
+ }
45
+ };
46
+ this.type = "LogicalExpression";
47
+ this.operator = "&&";
48
+ this.left = {
49
+ "type": "BinaryExpression",
50
+ "operator": "!==",
51
+ "left": {
52
+ "type": "UnaryExpression",
53
+ "operator": "typeof",
54
+ "argument": this.argument,
55
+ "prefix": true
56
+ },
57
+ "right": {
58
+ "type": "Literal",
59
+ "value": "undefined",
60
+ "raw": "'undefined'"
61
+ }
62
+ };
63
+ this.right = nullCheck;
64
+ return this;
65
+ };
66
+ ExistentialExpression.prototype.hasCallExpression = function() {
67
+ var nullCoalescing1 = typeof this.argument !== "undefined" && this.argument !== null && typeof this.argument.hasCallExpression === "function" ? this.argument.hasCallExpression() : void 0;
68
+ return nullCoalescing1 == null ? false : nullCoalescing1;
69
+ };
70
+ ExistentialExpression.getNextVariableName = function() {
71
+ if (!(typeof this.existentialIndex !== "undefined" && this.existentialIndex !== null)) {
72
+ this.existentialIndex = 0;
73
+ }
74
+ return "existential" + this.existentialIndex++;
75
+ };
76
+ ExistentialExpression.resetVariableNames = function() {
77
+ this.existentialIndex = 0;
78
+ };
79
+ exports.ExistentialExpression = ExistentialExpression;
80
+ return {};
81
+ });
82
+
83
+ //# sourceMappingURL=ExistentialExpression.map
@@ -0,0 +1,116 @@
1
+ $traceurRuntime.ModuleStore.getAnonymousModule(function() {
2
+ "use strict";
3
+ var Node = module.require("../Node").Node,
4
+ ForInStatement = module.require("../statements/ForInStatement").ForInStatement,
5
+ BlockStatement = module.require("../statements/BlockStatement").BlockStatement;
6
+ function ForInExpression(expression, item, index, array, condition) {
7
+ Node.call(this);
8
+ this.type = "ForInExpression";
9
+ this.expression = expression;
10
+ this.expression.parent = this;
11
+ this.item = item;
12
+ this.item.parent = this;
13
+ this.index = index;
14
+ if (typeof this.index !== "undefined" && this.index !== null) {
15
+ this.index.parent = this;
16
+ }
17
+ this.array = array;
18
+ this.array.parent = this;
19
+ this.condition = condition;
20
+ if (typeof this.condition !== "undefined" && this.condition !== null) {
21
+ this.condition.parent = this;
22
+ }
23
+ }
24
+ ForInExpression.prototype = Object.create(Node);
25
+ ForInExpression.prototype.codegen = function() {
26
+ if (!Node.prototype.codegen.call(this)) {
27
+ return;
28
+ }
29
+ this.defineIdentifier(this.item);
30
+ if (typeof this.index !== "undefined" && this.index !== null) {
31
+ this.defineIdentifier(this.index);
32
+ }
33
+ var id = {
34
+ "type": "Identifier",
35
+ "name": ForInExpression.getNextVariableName(),
36
+ "codeGenerated": true
37
+ };
38
+ var pushStatement = {
39
+ "type": "ExpressionStatement",
40
+ "codeGenerated": true,
41
+ "expression": {
42
+ "type": "CallExpression",
43
+ "callee": {
44
+ "type": "MemberExpression",
45
+ "computed": false,
46
+ "object": id,
47
+ "property": {
48
+ "type": "Identifier",
49
+ "name": "push"
50
+ }
51
+ },
52
+ "arguments": [this.expression.codegen()]
53
+ }
54
+ };
55
+ if (typeof this.condition !== "undefined" && this.condition !== null) {
56
+ pushStatement = {
57
+ "type": "IfStatement",
58
+ "codeGenerated": true,
59
+ "test": this.condition.codegen(),
60
+ "consequent": {
61
+ "type": "BlockStatement",
62
+ "body": [pushStatement]
63
+ },
64
+ "alternate": null
65
+ };
66
+ }
67
+ var forInStatement = new ForInStatement(this.item, this.index, this.array, new BlockStatement([pushStatement]));
68
+ var fnBlock = new BlockStatement([{
69
+ "type": "VariableDeclaration",
70
+ "declarations": [{
71
+ "type": "VariableDeclarator",
72
+ "id": id,
73
+ "init": {
74
+ "type": "ArrayExpression",
75
+ "elements": []
76
+ }
77
+ }],
78
+ "kind": "let",
79
+ "codeGenerated": true
80
+ }, forInStatement, {
81
+ "type": "ReturnStatement",
82
+ "codeGenerated": true,
83
+ "argument": id
84
+ }]);
85
+ forInStatement.parent = fnBlock;
86
+ this.type = "CallExpression";
87
+ this.callee = {
88
+ "type": "FunctionExpression",
89
+ "id": null,
90
+ "params": [],
91
+ "defaults": [],
92
+ "body": fnBlock.codegen()
93
+ };
94
+ Object.defineProperty(this, "arguments", {
95
+ value: [],
96
+ enumerable: true
97
+ });
98
+ return this;
99
+ };
100
+ ForInExpression.prototype.hasCallExpression = function() {
101
+ return true;
102
+ };
103
+ ForInExpression.getNextVariableName = function() {
104
+ if (!(typeof this.forInIndex !== "undefined" && this.forInIndex !== null)) {
105
+ this.forInIndex = 0;
106
+ }
107
+ return "forIn" + this.forInIndex++;
108
+ };
109
+ ForInExpression.resetVariableNames = function() {
110
+ this.forInIndex = 0;
111
+ };
112
+ exports.ForInExpression = ForInExpression;
113
+ return {};
114
+ });
115
+
116
+ //# sourceMappingURL=ForInExpression.map