@bikky/compiler 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/GlobalTypes.d.ts +34 -22
- package/Source/ASTInterface/Crawler.js +1 -1
- package/Transformers/MacroTransformer.d.ts +0 -2
- package/Transformers/MacroTransformer.d.ts.map +1 -1
- package/Transformers/MacroTransformer.js +315 -281
- package/Transformers/MixinTransformer.d.ts.map +1 -1
- package/Transformers/MixinTransformer.js +33 -207
- package/Transformers/SuperTransformer.d.ts +0 -2
- package/Transformers/SuperTransformer.d.ts.map +1 -1
- package/Transformers/SuperTransformer.js +153 -137
- package/obj/Debug/BiscuitCompiler.njsproj.AssemblyReference.cache +0 -0
- package/package.json +1 -1
- package/tsconfig.build.libs.tsbuildinfo +1 -1
- package/tsconfig.build.src.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MixinTransformer.d.ts","sourceRoot":"","sources":["MixinTransformer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"MixinTransformer.d.ts","sourceRoot":"","sources":["MixinTransformer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAkKjC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,aAC7C,GAAG,qBAAqB,kBAEpB,GAAG,UAAU,aAKlC"}
|
|
@@ -100,220 +100,46 @@ Class_1.Class.onClass((mixClass) => {
|
|
|
100
100
|
});
|
|
101
101
|
return [declareSuperSymbol, mixClass.update()];
|
|
102
102
|
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
console.log(ts.getDecorators(node));
|
|
114
|
-
}
|
|
115
|
-
// if (node.pos > 0 && node.end < this.sourceFile.end) {
|
|
116
|
-
// console.log(node.getText(this.sourceFile));
|
|
117
|
-
// }
|
|
118
|
-
if (ts.isDecorator(node)) {
|
|
119
|
-
// console.log("FOUND DECORATOR");
|
|
120
|
-
// console.log(getNodeText(node, this.sourceFile));
|
|
121
|
-
}
|
|
122
|
-
else if (ts.isClassDeclaration(node) || ts.isClassExpression(node)) {
|
|
123
|
-
var Class = ClassDeclaration.from(<ts.ClassDeclaration>node);
|
|
124
|
-
// console.log("FOUND CLASS");
|
|
125
|
-
// console.log(getNodeText(node, this.sourceFile).split("\n")[0].replace("\r", ""));
|
|
126
|
-
// if (ts.isClassExpression(node)) {
|
|
127
|
-
// console.log(node);
|
|
128
|
-
// console.log(ts.getModifiers(node));
|
|
129
|
-
// console.log(node.modifiers);
|
|
130
|
-
// }
|
|
131
|
-
if (Class.hasDecorator("mixin")) {
|
|
132
|
-
console.log("FOUND ONE", Class.name);
|
|
133
|
-
var name = Class.getName().text;
|
|
134
|
-
var symbolName = ID("Super_" + declarations.length).toAST();
|
|
135
|
-
var declareSuperSymbol = (new VariableDeclaration(symbolName))
|
|
136
|
-
.setValue(
|
|
137
|
-
CALL(ID("Symbol"), LITERAL("super_"+name)).toAST()
|
|
138
|
-
).make(context);
|
|
139
|
-
declarations.push(<ts.Statement>declareSuperSymbol);
|
|
140
|
-
var test = MixClass(this.context, <ts.ClassDeclaration>node, symbolName);
|
|
141
|
-
return test;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
// let text = getNodeText(node, this.sourceFile).substring(0, 50);
|
|
146
|
-
// if (text.includes("class")) {
|
|
147
|
-
// console.log("FOUND OTHER", node.kind);
|
|
148
|
-
// console.log(getNodeText(node, this.sourceFile).substring(0, 50));
|
|
149
|
-
// console.log(node);
|
|
150
|
-
// }
|
|
151
|
-
}
|
|
152
|
-
return ts.visitEachChild(node, crawl, this.context);
|
|
103
|
+
//Resolve ERROR_INFO macro:
|
|
104
|
+
Crawler_1.Crawler.Register((node) => {
|
|
105
|
+
if (ts.isIdentifier(node) && node.text === "ERROR_INFO") {
|
|
106
|
+
let arg = node;
|
|
107
|
+
let parent = node.parent;
|
|
108
|
+
while (!ts.isCallExpression(parent) || !parent.arguments.includes(arg)) {
|
|
109
|
+
arg = parent;
|
|
110
|
+
parent = arg.parent;
|
|
111
|
+
if (ts.isSourceFile(parent))
|
|
112
|
+
return false;
|
|
153
113
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
// // runs after the mixin code, and class variables are assigned in the constructor).
|
|
178
|
-
// //var declareSuperPrototype = (new PropertyDeclaration(computedSymbolName))
|
|
179
|
-
// // .setValue(Class.getExtends()!);
|
|
180
|
-
// //Class.addMemberAtStart(declareSuperPrototype.make(context));
|
|
181
|
-
//
|
|
182
|
-
// Class.setExtends(CALL(ID(mixMakerName), Class.getExtends()!).toAST());
|
|
183
|
-
//
|
|
184
|
-
// var newRawClass = Class.update(context)!;
|
|
185
|
-
//
|
|
186
|
-
// newRawClass = ts.visitNode(newRawClass, ReplaceSuper(Class.getName(), symbolName, context)) as ts.ClassDeclaration;
|
|
187
|
-
//
|
|
188
|
-
// return newRawClass;
|
|
189
|
-
// }
|
|
190
|
-
//
|
|
191
|
-
// //Change all references in member functions of super. to this[Super].
|
|
192
|
-
// function ReplaceSuper(classID: ts.Identifier, computedSuperID: ts.Identifier, context: ts.TransformationContext) {
|
|
193
|
-
// var className = classID.text;
|
|
194
|
-
// return (node: ts.Node) => {
|
|
195
|
-
// return ClassDeclaration.eachContextualNode(<ts.ClassDeclaration>node, (node: ts.Node) => {
|
|
196
|
-
// //check to see if node chain represents this.method().
|
|
197
|
-
// if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.expression.kind === ts.SyntaxKind.SuperKeyword) {
|
|
198
|
-
// var f = context.factory;
|
|
199
|
-
// var access = METHOD_CALL(THIS().LOOKUP(computedSuperID), ID(node.expression.name.text), THIS(), ...Array.from(node.arguments));
|
|
200
|
-
// //DOT(ID(node.expression.name.text))
|
|
201
|
-
// // .DOT(CALL(ID("call"), THIS(), ...Array.from(node.arguments)));
|
|
202
|
-
// // var access = (new AccessExpression(context)).this().access(computedSuperID)
|
|
203
|
-
// // /*.access(f.createIdentifier("prototype"))*/.access(f.createIdentifier(node.expression.name.text)).access(
|
|
204
|
-
// // (new CallExpression(f.createIdentifier("call")))
|
|
205
|
-
// // .addArgument(f.createThis())
|
|
206
|
-
// // .addArgument(...Array.from(node.arguments)
|
|
207
|
-
// // ).make(context)
|
|
208
|
-
// // );
|
|
209
|
-
// //this[super].prototype.method.call(this, arguments);
|
|
210
|
-
// // return access.make();
|
|
211
|
-
// return access.toAST();
|
|
212
|
-
// }
|
|
213
|
-
// else {
|
|
214
|
-
// return node;
|
|
215
|
-
// }
|
|
216
|
-
// }, context);
|
|
217
|
-
// }
|
|
218
|
-
// }
|
|
219
|
-
//
|
|
220
|
-
// /**
|
|
221
|
-
// *
|
|
222
|
-
// * Searching stuff!
|
|
223
|
-
// * 1) Find classes defined with the @mixin decorator.
|
|
224
|
-
// *
|
|
225
|
-
// */
|
|
226
|
-
//
|
|
227
|
-
// class MixinSource {
|
|
228
|
-
// sourceFile: ts.SourceFile;
|
|
229
|
-
// context!: ts.TransformationContext;
|
|
230
|
-
// constructor(sourceFile: ts.SourceFile) {
|
|
231
|
-
// this.sourceFile = sourceFile;
|
|
232
|
-
// }
|
|
233
|
-
//
|
|
234
|
-
// //Look for a class with the @mixin decorator!
|
|
235
|
-
// update(context: ts.TransformationContext) {
|
|
236
|
-
// this.context = context;
|
|
237
|
-
// var declarations = <ts.Statement[]>[];
|
|
238
|
-
//
|
|
239
|
-
// var crawl = (node: ts.Node): ts.Node => {
|
|
240
|
-
// if (ts.canHaveDecorators(node)) {
|
|
241
|
-
// console.log("DECORATOR?");
|
|
242
|
-
// let text = getNodeText(node, this.sourceFile).split("\n")[0].replace("\r", "");
|
|
243
|
-
// console.log(node.kind, text);
|
|
244
|
-
// if (text.includes("implements")) {
|
|
245
|
-
// console.log(node);
|
|
246
|
-
// }
|
|
247
|
-
// console.log(ts.getDecorators(node));
|
|
248
|
-
// }
|
|
249
|
-
// // if (node.pos > 0 && node.end < this.sourceFile.end) {
|
|
250
|
-
// // console.log(node.getText(this.sourceFile));
|
|
251
|
-
// // }
|
|
252
|
-
// if (ts.isDecorator(node)) {
|
|
253
|
-
// // console.log("FOUND DECORATOR");
|
|
254
|
-
// // console.log(getNodeText(node, this.sourceFile));
|
|
255
|
-
// }
|
|
256
|
-
// else if (ts.isClassDeclaration(node) || ts.isClassExpression(node)) {
|
|
257
|
-
// var Class = ClassDeclaration.from(<ts.ClassDeclaration>node);
|
|
258
|
-
// // console.log("FOUND CLASS");
|
|
259
|
-
// // console.log(getNodeText(node, this.sourceFile).split("\n")[0].replace("\r", ""));
|
|
260
|
-
// // if (ts.isClassExpression(node)) {
|
|
261
|
-
// // console.log(node);
|
|
262
|
-
// // console.log(ts.getModifiers(node));
|
|
263
|
-
// // console.log(node.modifiers);
|
|
264
|
-
// // }
|
|
265
|
-
// if (Class.hasDecorator("mixin")) {
|
|
266
|
-
// console.log("FOUND ONE", Class.name);
|
|
267
|
-
// var name = Class.getName().text;
|
|
268
|
-
// var symbolName = ID("Super_" + declarations.length).toAST();
|
|
269
|
-
// var declareSuperSymbol = (new VariableDeclaration(symbolName))
|
|
270
|
-
// .setValue(
|
|
271
|
-
// CALL(ID("Symbol"), LITERAL("super_"+name)).toAST()
|
|
272
|
-
// ).make(context);
|
|
273
|
-
// declarations.push(<ts.Statement>declareSuperSymbol);
|
|
274
|
-
// var test = MixClass(this.context, <ts.ClassDeclaration>node, symbolName);
|
|
275
|
-
// return test;
|
|
276
|
-
// }
|
|
277
|
-
// }
|
|
278
|
-
// else {
|
|
279
|
-
// // let text = getNodeText(node, this.sourceFile).substring(0, 50);
|
|
280
|
-
// // if (text.includes("class")) {
|
|
281
|
-
// // console.log("FOUND OTHER", node.kind);
|
|
282
|
-
// // console.log(getNodeText(node, this.sourceFile).substring(0, 50));
|
|
283
|
-
// // console.log(node);
|
|
284
|
-
// // }
|
|
285
|
-
// }
|
|
286
|
-
// return ts.visitEachChild(node, crawl, this.context);
|
|
287
|
-
// }
|
|
288
|
-
//
|
|
289
|
-
// var source = ts.visitNode(this.sourceFile, crawl);
|
|
290
|
-
//
|
|
291
|
-
// var file = SourceFile.from(source as ts.SourceFile);
|
|
292
|
-
// for (var declaration of declarations) {
|
|
293
|
-
// file.insertUnderImports(declaration);
|
|
294
|
-
// }
|
|
295
|
-
// var result = file.update(context);
|
|
296
|
-
// this.sourceFile = result;
|
|
297
|
-
// if (declarations.length > 0) {
|
|
298
|
-
// console.log("Updated file", file.original?.fileName, "with mixin data");
|
|
299
|
-
// // console.log("~~~~~~~~~~~");
|
|
300
|
-
// // console.log(Printer.printNode(result, this.sourceFile));
|
|
301
|
-
// // console.log("~~~~~~~~~~~");
|
|
302
|
-
// }
|
|
303
|
-
// return result;
|
|
304
|
-
// }
|
|
305
|
-
// }
|
|
306
|
-
//
|
|
307
|
-
// console.log("MIXINS ENABLED lalala");
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}, (node) => {
|
|
118
|
+
if (ts.isIdentifier(node) && node.text === "ERROR_INFO") {
|
|
119
|
+
let thisArg = node;
|
|
120
|
+
let parent = node.parent;
|
|
121
|
+
while (!ts.isCallExpression(parent) || !parent.arguments.includes(thisArg)) {
|
|
122
|
+
thisArg = parent;
|
|
123
|
+
parent = thisArg.parent;
|
|
124
|
+
if (ts.isSourceFile(parent))
|
|
125
|
+
return node;
|
|
126
|
+
}
|
|
127
|
+
let text = [];
|
|
128
|
+
for (let arg of parent.arguments) {
|
|
129
|
+
if (arg === thisArg)
|
|
130
|
+
continue;
|
|
131
|
+
text.push(ts.factory.createStringLiteral(arg.getText()));
|
|
132
|
+
}
|
|
133
|
+
return ts.factory.createArrayLiteralExpression(text);
|
|
134
|
+
}
|
|
135
|
+
return node;
|
|
136
|
+
});
|
|
308
137
|
function default_1(program, pluginOptions) {
|
|
309
138
|
return (context) => {
|
|
310
139
|
Crawler_1.Crawler.setContext(context);
|
|
311
140
|
return (sourceFile) => {
|
|
312
141
|
numDeclarations = 0;
|
|
313
142
|
return Crawler_1.Crawler.Crawl(sourceFile);
|
|
314
|
-
// console.log(sourceFile.fileName);
|
|
315
|
-
// return (new MixinSource(sourceFile)).update(context);
|
|
316
|
-
//return sourceFile;
|
|
317
143
|
};
|
|
318
144
|
};
|
|
319
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperTransformer.d.ts","sourceRoot":"","sources":["SuperTransformer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SuperTransformer.d.ts","sourceRoot":"","sources":["SuperTransformer.ts"],"names":[],"mappings":""}
|
|
@@ -1,139 +1,155 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class SuperTransformer {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
2
|
+
// // transformer1-module
|
|
3
|
+
// import * as ts from "typescript";
|
|
4
|
+
// import {ScriptKind, ScriptTarget} from "typescript";
|
|
5
|
+
// import {ClassDeclaration, setContext} from "../Source/ASTHelper";
|
|
6
|
+
// import {ID, IF, LITERAL, SUPER} from "../Source/ASTBuilder";
|
|
7
|
+
//
|
|
8
|
+
// class SuperTransformer {
|
|
9
|
+
// has_super = false;
|
|
10
|
+
// identifier!: string;
|
|
11
|
+
// context: ts.TransformationContext;
|
|
12
|
+
// result: ts.Statement;
|
|
13
|
+
// iter: (node: ts.Node) => ts.Node;
|
|
14
|
+
// constructor(line: ts.Statement, context: ts.TransformationContext, iter: (node: ts.Node) => ts.Node) {
|
|
15
|
+
// this.iter = iter;
|
|
16
|
+
// this.context = context;
|
|
17
|
+
// //TODO: Check that this is OK.
|
|
18
|
+
// this.result = <ts.Statement>this.find_super(line);
|
|
19
|
+
// if (this.has_super) {
|
|
20
|
+
// const f = ts.factory;
|
|
21
|
+
// ts.createSourceFile("SuperTransformer.ts", `
|
|
22
|
+
// `, ScriptTarget.ES5, true, ScriptKind.TS)
|
|
23
|
+
//
|
|
24
|
+
// this.result = IF(
|
|
25
|
+
// SUPER().DOT(ID(this.identifier)).OP("!==", LITERAL("undefined")).toAST(),
|
|
26
|
+
// this.result
|
|
27
|
+
// );
|
|
28
|
+
// }
|
|
29
|
+
// }
|
|
30
|
+
//
|
|
31
|
+
// find_identifier(node: ts.Node) {
|
|
32
|
+
// if (node.kind == ts.SyntaxKind.Identifier) {
|
|
33
|
+
// if (node.getText() != "_super") {
|
|
34
|
+
// this.identifier = node.getText();
|
|
35
|
+
// }
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
38
|
+
//
|
|
39
|
+
// //Change the _super call over to super.
|
|
40
|
+
// find_super(node: ts.Node) {
|
|
41
|
+
// var result: ts.Node;
|
|
42
|
+
// if (ts.isPropertyAccessExpression(node)) {
|
|
43
|
+
// var has_super = false;
|
|
44
|
+
// var id: string | undefined;
|
|
45
|
+
// result = ts.visitEachChild(node, (node) => {
|
|
46
|
+
// if (ts.isIdentifier(node)) {
|
|
47
|
+
// if (node.text == "_super") {
|
|
48
|
+
// has_super = true;
|
|
49
|
+
// let result: ts.Node = ts.factory.createIdentifier("super");
|
|
50
|
+
// //ts.setOriginalNode(result, ts.getOriginalNode(node));
|
|
51
|
+
// return result;
|
|
52
|
+
// }
|
|
53
|
+
// else {
|
|
54
|
+
// id = node.text;
|
|
55
|
+
// }
|
|
56
|
+
// }
|
|
57
|
+
// return node;
|
|
58
|
+
// }, this.context);
|
|
59
|
+
// if (has_super && id) {
|
|
60
|
+
// this.has_super = has_super;
|
|
61
|
+
// this.identifier = id;
|
|
62
|
+
// }
|
|
63
|
+
// return result;
|
|
64
|
+
// }
|
|
65
|
+
// if (ts.isBlock(node) || ts.isCaseBlock(node) || ts.isModuleBlock(node)) {
|
|
66
|
+
// return this.iter(node);
|
|
67
|
+
// }
|
|
68
|
+
// result = ts.visitEachChild(node, this.find_super.bind(this), this.context);
|
|
69
|
+
// return result;
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
72
|
+
//
|
|
73
|
+
// export default function (program: ts.Program, pluginOptions: {}) {
|
|
74
|
+
// // let checker = program.getTypeChecker();
|
|
75
|
+
// return (context: ts.TransformationContext) => {
|
|
76
|
+
// setContext(context);
|
|
77
|
+
// return (sourceFile: ts.SourceFile) => {
|
|
78
|
+
// var parent = <any>{
|
|
79
|
+
// kind: ts.SyntaxKind[sourceFile.kind],
|
|
80
|
+
// flags: []
|
|
81
|
+
// };
|
|
82
|
+
// var map = new Map<ts.Node, any>();
|
|
83
|
+
// map.set(sourceFile, parent);
|
|
84
|
+
//
|
|
85
|
+
// function visitor(node: ts.Node): ts.Node {
|
|
86
|
+
// console.log(node);
|
|
87
|
+
// if (!node.parent) (node as any).parent = sourceFile;
|
|
88
|
+
// // if (ts.isCallExpression(node)) {
|
|
89
|
+
// // return ts.createLiteral('call');
|
|
90
|
+
// // }
|
|
91
|
+
// var description = {
|
|
92
|
+
// kind: ts.SyntaxKind[node.kind],
|
|
93
|
+
// flags: <string[]>[]
|
|
94
|
+
// };
|
|
95
|
+
// parent[(node as any).escapedText || node.getText()] = description;
|
|
96
|
+
//
|
|
97
|
+
//
|
|
98
|
+
// //console.log(ts.SyntaxKind[node.kind], (node as any).escapedText || node.getText());
|
|
99
|
+
// for (var prop in ts.NodeFlags) {
|
|
100
|
+
// if (typeof prop == "string") {
|
|
101
|
+
// if ((node.flags & (ts.NodeFlags as any)[prop]) != 0) {
|
|
102
|
+
// description.flags.push(prop);
|
|
103
|
+
// }
|
|
104
|
+
// }
|
|
105
|
+
// }
|
|
106
|
+
// //console.log(node.modifiers);
|
|
107
|
+
// //if (node.kind == ts.SyntaxKind.Block) {
|
|
108
|
+
// // console.log(node);
|
|
109
|
+
// //}
|
|
110
|
+
// //console.log(node.decorators)
|
|
111
|
+
// var temp = parent;
|
|
112
|
+
// parent = description;
|
|
113
|
+
// var result: ts.Node;
|
|
114
|
+
// switch (node.kind) {
|
|
115
|
+
// case ts.SyntaxKind.ExpressionStatement: case ts.SyntaxKind.FirstStatement:
|
|
116
|
+
// case ts.SyntaxKind.ReturnStatement:
|
|
117
|
+
// var transformed = new SuperTransformer(<ts.Statement>node, context, visitor);
|
|
118
|
+
// result = transformed.result;
|
|
119
|
+
// ts.visitEachChild(node, visitor, context);
|
|
120
|
+
// break;
|
|
121
|
+
// default:
|
|
122
|
+
// result = ts.visitEachChild(node, visitor, context);
|
|
123
|
+
// break;
|
|
124
|
+
// }
|
|
125
|
+
// parent = temp;
|
|
126
|
+
//
|
|
127
|
+
// if (ts.isClassDeclaration(node)) {
|
|
128
|
+
// ClassDeclaration.eachContextualNode(node, (node) => {
|
|
129
|
+
// // if (ts.isFunctionLike(node)) {
|
|
130
|
+
// // ts.visitEachChild(node);
|
|
131
|
+
// // }
|
|
132
|
+
// // if (ts.)
|
|
133
|
+
// return node;
|
|
134
|
+
// }, context);
|
|
135
|
+
// }
|
|
136
|
+
// else {
|
|
137
|
+
// ts.visitEachChild(node, visitor, context);
|
|
138
|
+
// }
|
|
139
|
+
//
|
|
140
|
+
//
|
|
141
|
+
// return result;
|
|
142
|
+
// }
|
|
143
|
+
// var result = ts.visitNode(sourceFile, visitor);
|
|
144
|
+
// //console.log(sourceFile.fileName);
|
|
145
|
+
// //console.log(parent);
|
|
146
|
+
// //console.log(JSON.stringify(parent, null, 4));
|
|
147
|
+
//
|
|
148
|
+
// return result;
|
|
149
|
+
// };
|
|
150
|
+
// };
|
|
151
|
+
// }
|
|
152
|
+
// console.log("_SUPER ENABLED");
|
|
153
|
+
//
|
|
154
|
+
// console.log("SHOTO!");
|
|
139
155
|
//# sourceMappingURL=SuperTransformer.js.map
|
|
Binary file
|