File tree Expand file tree Collapse file tree 3 files changed +76
-18
lines changed
rocket-chatter-ingestion-server Expand file tree Collapse file tree 3 files changed +76
-18
lines changed Original file line number Diff line number Diff line change 1- class Employee < T > extends Human {
2- private _salary : number = 0
3- private _name : T
1+ export namespace SomeNamespace {
2+ export class Employee < T > extends Human {
3+ private _salary : number = 0
4+ private _name : T
45
5- constructor ( name : T , salary : number ) {
6- this . _name = name
7- this . _salary = salary
8- }
6+ constructor ( name : T , salary : number ) {
7+ this . _name = name
8+ this . _salary = salary
9+ }
910
10- get salary ( ) : number {
11- return this . _salary
12- }
11+ get salary ( ) : number {
12+ return this . _salary
13+ }
1314
14- set salary ( value : number ) {
15- if ( value >= 0 ) {
16- this . _salary = value
17- } else {
18- throw new Error ( "Salary cannot be negative." )
15+ set salary ( value : number ) {
16+ if ( value >= 0 ) {
17+ this . _salary = value
18+ } else {
19+ throw new Error ( "Salary cannot be negative." )
20+ }
21+ }
22+
23+ dumb < B > ( a : T , b : B ) {
24+ return a
1925 }
2026 }
2127
22- dumb < B > ( a : T , b : B ) {
23- return a
28+ export function foo ( ) {
29+ return 1
2430 }
31+
32+ export const bar = 2
33+
34+ export const j = ( ) => { }
35+
36+ export const k = function ( ) { }
2537}
Original file line number Diff line number Diff line change 1+ import { namedTypes } from "ast-types/gen/namedTypes"
2+ import { Enums } from "./enums"
3+ import { Functions } from "./functions"
4+ import { DBNode } from "./fundamental/dbNode"
5+ import { Interface } from "./interface"
6+ import { TypeAlias } from "./typeAlias"
7+
8+ export namespace Namespaces {
9+ export function Handle ( n : namedTypes . TSModuleDeclaration ) {
10+ const node = new DBNode (
11+ ( n . id as any ) ?. name . toString ( ) ?? "" ,
12+ "Namespace" ,
13+ ""
14+ )
15+
16+ const body = ( n as any ) . declaration . body . body as namedTypes . TSModuleBlock [ ]
17+ for ( const b of body ) {
18+ let d = b
19+ if ( namedTypes . ExportNamedDeclaration . check ( b ) ) d = ( b as any ) . declaration
20+
21+ if ( namedTypes . FunctionDeclaration . check ( d ) ) {
22+ Functions . Handle ( d )
23+ } else if ( namedTypes . TSInterfaceDeclaration . check ( d ) ) {
24+ Interface . Handle ( d as any )
25+ } else if ( namedTypes . TSTypeAliasDeclaration . check ( d ) ) {
26+ TypeAlias . Handle ( d )
27+ } else if ( namedTypes . TSEnumDeclaration . check ( d ) ) {
28+ Enums . Handle ( d as any )
29+ } else if (
30+ namedTypes . TSModuleDeclaration . check ( d ) ||
31+ namedTypes . ExportNamedDeclaration . check ( d )
32+ ) {
33+ Namespaces . Handle ( d as any )
34+ } else if ( namedTypes . ClassDeclaration . check ( d ) ) {
35+ // Classes.Handle(d)
36+ }
37+ }
38+
39+ console . log ( node )
40+
41+ return node
42+ }
43+ }
Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ for (const node of ast.body) {
1818 // TypeAlias.Handle(node)
1919 } else if ( namedTypes . TSEnumDeclaration . check ( node ) ) {
2020 // Enums.Handle(node)
21- } else if ( namedTypes . TSModuleDeclaration . check ( node ) ) {
21+ } else if (
22+ namedTypes . TSModuleDeclaration . check ( node ) ||
23+ namedTypes . ExportNamedDeclaration . check ( node )
24+ ) {
2225 Namespaces . Handle ( node )
2326 } else if ( namedTypes . ClassDeclaration . check ( node ) ) {
2427 // Classes.Handle(node)
You can’t perform that action at this time.
0 commit comments