Last active
September 27, 2016 16:57
-
-
Save grodowski/3acce5d8a2eeacc20ab539dfbfbd28db to your computer and use it in GitHub Desktop.
gistasdasd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onExit(astChild: ts.Node, child: types.Node) { | |
switch (astChild.kind) { | |
case ts.SyntaxKind.ModuleDeclaration: | |
case ts.SyntaxKind.ClassDeclaration: | |
case ts.SyntaxKind.SourceFile: | |
this.namespaceStack.pop() | |
break | |
// BinaryExpression may contain a prototype function declaration, which | |
// should be given a NAMESPACE role. It's indicated by the state of | |
// maybePrototypeNs field. | |
case ts.SyntaxKind.BinaryExpression: | |
if (this.maybePrototypeNs === astChild && this.maybePrototypeNsName) { | |
child.roles.push(node.NAMESPACE) | |
child.setName(this.getQualifiedNsPrefix()) | |
this.maybePrototypeNsName = undefined | |
this.maybePrototypeNs = undefined | |
} | |
break | |
} | |
ns.roles.push(node.NAMESPACE) | |
this.namespaceStack.push(ns) | |
idlNode.setType(util.syntaxKindToName(astNode.kind)) | |
idlNode.setFilename(this.sourceFileAast.fileName) | |
idlNode.setStartLine(this.getLine(astNode.getStart())) | |
idlNode.setEndLine(this.getLine(astNode.getEnd())) | |
if (idlNode.roles.lastIndexOf(node.TERMINAL) > -1) { | |
idlNode.setValue(astNode.getText()) | |
} | |
return this.sourceFileAast.getLineAndCharacterOfPosition(pos).line + 1 | |
return this.getQualifiedNsPrefix() + "." + functionName | |
let ret = this.namespaceStack.map((ns) => ns.name) | |
if (this.maybePrototypeNs && this.maybePrototypeNsName) { | |
ret.push(this.maybePrototypeNsName) | |
} | |
return ret.join(".") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment