Revert "Added a new test case and fixed some missing generators"

This reverts commit 9818385a29.
canary
WolverinDEV 2019-03-17 15:19:34 +01:00
parent 4d983dc36a
commit 6ce07804b5
3 changed files with 15 additions and 20 deletions

View File

@ -1,8 +1,6 @@
import * as ts from "typescript";
import {SyntaxKind} from "typescript";
type TSExpression = ts.Type | ts.Node;
interface Array<T> {
last?(): T;
}
@ -102,9 +100,9 @@ class StackParameters implements StackParameter {
}
const generators: {[key: number]:((settings: _Settings, stack: StackParameters, node: ts.Node | ts.Type) => ts.Node | ts.Type | undefined) | undefined} = {};
const generators: {[key: number]:((settings: _Settings, stack: StackParameters, node: ts.Node) => ts.Node | undefined) | undefined} = {};
function _generate(settings: _Settings, stack: StackParameters, layer: TSExpression[], node: ts.Node) {
function _generate(settings: _Settings, stack: StackParameters, layer: ts.Node[], node: ts.Node) {
//console.log(SyntaxKind[node.kind]);
if(generators[node.kind]) {
const result = generators[node.kind](settings, stack, node);
@ -324,6 +322,7 @@ generators[SyntaxKind.ClassDeclaration] = (settings, stack, node: ts.ClassDeclar
};
generators[SyntaxKind.PropertySignature] = (settings, stack, node: ts.PropertySignature) => {
console.log(SyntaxKind[node.type.kind]);
let type: ts.TypeNode = node.type;
switch (node.type.kind) {
case SyntaxKind.LiteralType:
@ -384,11 +383,4 @@ generators[SyntaxKind.EnumDeclaration] = (settings, stack, node: ts.EnumDeclarat
for(const member of node.members)
members.push(generators[SyntaxKind.EnumMember](settings, stack, member));
return ts.createEnumDeclaration(undefined, append_export(append_declare(node.modifiers, !stack.flag_declare), stack.flag_namespace), node.name, members);
};
generators[SyntaxKind.TypeParameter] = (settings, stack, node: ts.TypeParameter) => undefined;
generators[SyntaxKind.HeritageClause] = (settings, stack, node: ts.HeritageClause) => undefined;
generators[SyntaxKind.IfStatement] = (settings, stack, node: ts.IfStatement) => undefined;
generators[SyntaxKind.ExpressionStatement] = (settings, stack, node: ts.ExpressionStatement) => undefined;
generators[SyntaxKind.SemicolonClassElement] = (settings, stack, node: ts.ExpressionStatement) => undefined;
};

15
tools/dtsgen/out.d.ts vendored
View File

@ -1,6 +1,13 @@
/* File: /home/wolverindev/TeaSpeak/TeaSpeak/Web-Client/tools/dtsgen/test/test_04.ts */
declare class TestClass<T> extends Promise<T> {
/* File: /home/wolverindev/TeaSpeak/TeaSpeak/Web-Client/tools/dtsgen/test/test_03.ts */
declare enum YY {
H,
B
}
declare interface X {
type: any;
c: YY.B;
}
declare class X {
static x();
}
declare const lambda_function;
declare const lambda_function2;

View File

@ -1,4 +0,0 @@
class TestClass<T> extends Promise<T> { }
const lambda_function = (str) => {};
const lambda_function2 = (str: string) => {};