AstCreator

class AstCreator(val config: Config, val parserResult: ParseResult, val usedTypes: ConcurrentHashMap[(String, String), Boolean]) extends AstCreatorBase with AstForExpressionsCreator with AstForPrimitivesCreator with AstForTypesCreator with AstForFunctionsCreator with AstForDeclarationsCreator with AstForStatementsCreator with AstForTemplateDomCreator with AstNodeBuilder with TypeHelper with AstCreatorHelper

Type members

Inherited classlikes

case class MethodAst(ast: Ast, methodNode: NewMethod)
Inherited from:
AstForFunctionsCreator

Value members

Concrete methods

override def absolutePath(filename: String): String
Definition Classes
AstCreatorBase
protected def astForNode(json: Value): Ast
protected def astForNodeWithFunctionReference(json: Value): Ast
protected def astForNodes(jsons: List[Value]): List[Ast]
override def createAst(): DiffGraphBuilder
Definition Classes
AstCreatorBase

Inherited methods

protected def addModifier(node: NewNode, json: Value): Unit
Inherited from:
AstForTypesCreator
protected def astForArrayExpression(arrExpr: BabelNodeInfo): Ast
protected def astForAssignmentExpression(assignment: BabelNodeInfo): Ast
protected def astForAwaitExpression(awaitExpr: BabelNodeInfo): Ast
protected def astForBigIntLiteral(bigIntLiteral: BabelNodeInfo): Ast
protected def astForBinaryExpression(binExpr: BabelNodeInfo): Ast
protected def astForBlockStatement(block: BabelNodeInfo): Ast
protected def astForBooleanLiteral(booleanLiteral: BabelNodeInfo): Ast
protected def astForBreakStatement(breakStmt: BabelNodeInfo): Ast
protected def astForCallExpression(callExpr: BabelNodeInfo): Ast
protected def astForCastExpression(castExpr: BabelNodeInfo): Ast
protected def astForClass(clazz: BabelNodeInfo): Ast
Inherited from:
AstForTypesCreator
protected def astForConditionalExpression(ternary: BabelNodeInfo): Ast
protected def astForContinueStatement(continueStmt: BabelNodeInfo): Ast
protected def astForDecimalLiteral(decimalLiteral: BabelNodeInfo): Ast
protected def astForDeconstruction(pattern: BabelNodeInfo, sourceAst: Ast, paramName: Option[String]): Ast
protected def astForDoWhileStatement(doWhileStmt: BabelNodeInfo): Ast
protected def astForEnum(tsEnum: BabelNodeInfo): Ast
Inherited from:
AstForTypesCreator
protected def astForExportAllDeclaration(declaration: BabelNodeInfo): Ast
protected def astForExportAssignment(assignment: BabelNodeInfo): Ast
protected def astForExportDefaultDeclaration(declaration: BabelNodeInfo): Ast
protected def astForExportNamedDeclaration(declaration: BabelNodeInfo): Ast
protected def astForExpressionStatement(exprStmt: BabelNodeInfo): Ast
protected def astForForStatement(forStmt: BabelNodeInfo): Ast
protected def astForFunctionDeclaration(func: BabelNodeInfo, shouldCreateFunctionReference: Boolean, shouldCreateAssignmentCall: Boolean): Ast
Inherited from:
AstForFunctionsCreator
protected def astForIdentifier(ident: BabelNodeInfo): Ast
protected def astForImportDeclaration(impDecl: BabelNodeInfo): Ast
protected def astForImportKeyword(importKeyword: BabelNodeInfo): Ast
protected def astForInOfStatement(forInOfStmt: BabelNodeInfo): Ast

De-sugaring from:

De-sugaring from:

for (var i in/of arr) { body }

to:

{ var _iterator = Object.keys(arr)Symbol.iterator; var _result; var i; while (!(_result = _iterator.next()).done) { i = _result.value; body } }

Inherited from:
AstForStatementsCreator
protected def astForInterface(tsInterface: BabelNodeInfo): Ast
Inherited from:
AstForTypesCreator
protected def astForJsxAttribute(jsxAttr: BabelNodeInfo): Ast
protected def astForJsxClosingElement(jsxClosingElem: BabelNodeInfo): Ast
protected def astForJsxElement(jsxElem: BabelNodeInfo): Ast
protected def astForJsxExprContainer(jsxExprContainer: BabelNodeInfo): Ast
protected def astForJsxFragment(jsxFragment: BabelNodeInfo): Ast
protected def astForJsxOpeningElement(jsxOpeningElem: BabelNodeInfo): Ast
protected def astForJsxSpreadAttribute(jsxSpreadAttr: BabelNodeInfo): Ast
protected def astForJsxText(jsxText: BabelNodeInfo): Ast
protected def astForLabeledStatement(labelStmt: BabelNodeInfo): Ast
protected def astForLogicalExpression(logicalExpr: BabelNodeInfo): Ast
protected def astForMemberExpression(memberExpr: BabelNodeInfo): Ast
protected def astForModule(tsModuleDecl: BabelNodeInfo): Ast
Inherited from:
AstForTypesCreator
protected def astForNewExpression(newExpr: BabelNodeInfo): Ast
protected def astForNullLiteral(nullLiteral: BabelNodeInfo): Ast
protected def astForNumberLiteral(numberLiteral: BabelNodeInfo): Ast
protected def astForNumericLiteral(numericLiteral: BabelNodeInfo): Ast
protected def astForObjectExpression(objExpr: BabelNodeInfo): Ast
protected def astForRegExpLiteral(regExpLiteral: BabelNodeInfo): Ast
protected def astForRegexLiteral(regexLiteral: BabelNodeInfo): Ast
protected def astForReturnStatement(ret: BabelNodeInfo): Ast
protected def astForSequenceExpression(seq: BabelNodeInfo): Ast
protected def astForStringLiteral(stringLiteral: BabelNodeInfo): Ast
protected def astForSuperKeyword(superKeyword: BabelNodeInfo): Ast
protected def astForSwitchStatement(switchStmt: BabelNodeInfo): Ast
protected def astForTSDeclareFunction(func: BabelNodeInfo): Ast
Inherited from:
AstForFunctionsCreator
protected def astForTemplateElement(templateElement: BabelNodeInfo): Ast
protected def astForTemplateLiteral(templateLiteral: BabelNodeInfo): Ast
protected def astForThisExpression(thisExpr: BabelNodeInfo): Ast
protected def astForThrowStatement(throwStmt: BabelNodeInfo): Ast
protected def astForTryStatement(tryStmt: BabelNodeInfo): Ast
protected def astForTypeAlias(alias: BabelNodeInfo): Ast
Inherited from:
AstForTypesCreator
protected def astForUnaryExpression(unaryExpr: BabelNodeInfo): Ast
protected def astForUpdateExpression(updateExpr: BabelNodeInfo): Ast
protected def astForVariableDeclaration(declaration: BabelNodeInfo): Ast
protected def astForWhileStatement(whileStmt: BabelNodeInfo): Ast
def blockAst(blockNode: NewBlock, statements: List[Ast]): Ast

For a given block node and statement ASTs, create an AST that represents the block. The main purpose of this method is to increase the readability of the code which creates block asts.

For a given block node and statement ASTs, create an AST that represents the block. The main purpose of this method is to increase the readability of the code which creates block asts.

Inherited from:
AstCreatorBase
protected def calcMethodNameAndFullName(func: BabelNodeInfo): (String, String)
Inherited from:
AstCreatorHelper
protected def calcTypeNameAndFullName(classNode: BabelNodeInfo, preCalculatedName: Option[String]): (String, String)
Inherited from:
AstCreatorHelper
def callAst(callNode: NewCall, arguments: Seq[Ast], receiver: Option[Ast], withRecvArgEdge: Boolean): Ast

For a given call node, arguments, and optionally, a receiver, create an AST that represents the call site. The main purpose of this method is to automatically assign the correct argument indices.

For a given call node, arguments, and optionally, a receiver, create an AST that represents the call site. The main purpose of this method is to automatically assign the correct argument indices.

Inherited from:
AstCreatorBase
protected def code(node: Value): String
Inherited from:
AstCreatorHelper
protected def codeOf(node: NewNode): String
Inherited from:
AstNodeBuilder
protected def column(node: Value): Option[Integer]
Inherited from:
AstCreatorHelper
protected def columnEnd(node: Value): Option[Integer]
Inherited from:
AstCreatorHelper
def controlStructureAst(controlStructureNode: NewControlStructure, condition: Option[Ast], children: List[Ast], placeConditionLast: Boolean): Ast

For a given node, condition AST and children ASTs, create an AST that represents the control structure. The main purpose of this method is to automatically assign the correct condition edges.

For a given node, condition AST and children ASTs, create an AST that represents the control structure. The main purpose of this method is to automatically assign the correct condition edges.

Inherited from:
AstCreatorBase
protected def convertDestructingObjectElementWithDefault(element: BabelNodeInfo, key: BabelNodeInfo, localTmpName: String): Ast
protected def createAssignmentCallAst(destId: NewNode, sourceId: NewNode, code: String, line: Option[Integer], column: Option[Integer]): Ast
Inherited from:
AstNodeBuilder
protected def createAstForFakeStaticInitMethod(name: String, filename: String, lineNumber: Option[Integer], childrenAsts: Seq[Ast]): Ast
Inherited from:
AstNodeBuilder
protected def createBabelNodeInfo(json: Value): BabelNodeInfo
Inherited from:
AstCreatorHelper
protected def createBindingNode(): NewBinding
Inherited from:
AstNodeBuilder
protected def createBlockNode(node: BabelNodeInfo): NewBlock
Inherited from:
AstNodeBuilder
protected def createBlockStatementAsts(json: Value): List[Ast]
protected def createCallAst(callNode: NewCall, arguments: List[Ast], receiver: Option[Ast]): Ast
Inherited from:
AstNodeBuilder
protected def createCallNode(code: String, callName: String, dispatchType: String, line: Option[Integer], column: Option[Integer]): NewCall
Inherited from:
AstNodeBuilder
protected def createClosureBindingNode(closureBindingId: String, closureOriginalName: String): NewClosureBinding
Inherited from:
AstNodeBuilder
protected def createControlStructureNode(node: BabelNodeInfo, controlStructureType: String): NewControlStructure
Inherited from:
AstNodeBuilder
protected def createDependencyNode(name: String, groupId: String, version: String): NewDependency
Inherited from:
AstNodeBuilder
protected def createEqualsCallAst(destId: NewNode, sourceId: NewNode, line: Option[Integer], column: Option[Integer]): Ast
Inherited from:
AstNodeBuilder
protected def createFieldAccessCallAst(baseNode: NewNode, partNode: NewNode, line: Option[Integer], column: Option[Integer]): Ast
Inherited from:
AstNodeBuilder
protected def createFieldIdentifierNode(name: String, line: Option[Integer], column: Option[Integer]): NewFieldIdentifier
Inherited from:
AstNodeBuilder
protected def createFunctionTypeAndTypeDeclAst(methodNode: NewMethod, parentNode: NewNode, methodName: String, methodFullName: String, filename: String): Ast
Inherited from:
AstNodeBuilder
protected def createIdentifierNode(name: String, dynamicTypeOption: Option[String], line: Option[Integer], column: Option[Integer]): NewIdentifier
Inherited from:
AstNodeBuilder
protected def createIdentifierNode(name: String, node: BabelNodeInfo): NewIdentifier
Inherited from:
AstNodeBuilder
protected def createImportNode(impDecl: BabelNodeInfo, importedEntity: Option[String], importedAs: String): NewImport
Inherited from:
AstNodeBuilder
protected def createIndexAccessCallAst(baseNode: NewNode, partNode: NewNode, line: Option[Integer], column: Option[Integer]): Ast
Inherited from:
AstNodeBuilder
protected def createJumpTarget(switchCase: BabelNodeInfo): NewJumpTarget
Inherited from:
AstNodeBuilder
protected def createLiteralNode(code: String, dynamicTypeOption: Option[String], line: Option[Integer], column: Option[Integer]): NewLiteral
Inherited from:
AstNodeBuilder
protected def createLocalNode(name: String, typeFullName: String, closureBindingId: Option[String]): NewLocal
Inherited from:
AstNodeBuilder
protected def createMemberNode(name: String, code: String, dynamicTypeOption: Option[String]): NewMember
Inherited from:
AstNodeBuilder
protected def createMethodAstAndNode(func: BabelNodeInfo, shouldCreateFunctionReference: Boolean, shouldCreateAssignmentCall: Boolean): MethodAst
Inherited from:
AstForFunctionsCreator
protected def createMethodDefinitionNode(func: BabelNodeInfo): NewMethod
Inherited from:
AstForFunctionsCreator
protected def createMethodNode(methodName: String, methodFullName: String, func: BabelNodeInfo): NewMethod
Inherited from:
AstNodeBuilder
protected def createMethodRefNode(code: String, methodFullName: String, func: BabelNodeInfo): NewMethodRef
Inherited from:
AstNodeBuilder
protected def createMethodReturnNode(func: BabelNodeInfo): NewMethodReturn
Inherited from:
AstNodeBuilder
protected def createParameterInNode(name: String, code: String, index: Int, isVariadic: Boolean, line: Option[Integer], column: Option[Integer], tpe: Option[String]): NewMethodParameterIn
Inherited from:
AstNodeBuilder
protected def createReturnAst(returnNode: NewReturn, arguments: List[Ast]): Ast
Inherited from:
AstNodeBuilder
protected def createReturnNode(ret: BabelNodeInfo): NewReturn
Inherited from:
AstNodeBuilder
protected def createStaticCallNode(code: String, methodName: String, fullName: String, line: Option[Integer], column: Option[Integer]): NewCall
Inherited from:
AstNodeBuilder
protected def createTemplateDomNode(name: String, code: String, line: Option[Integer], column: Option[Integer]): NewTemplateDom
Inherited from:
AstNodeBuilder
protected def createTernaryCallAst(testNode: NewNode, trueNode: NewNode, falseNode: NewNode, line: Option[Integer], column: Option[Integer]): Ast
Inherited from:
AstNodeBuilder
protected def createTypeDeclNode(name: String, fullname: String, filename: String, code: String, astParentType: String, astParentFullName: String, inherits: Seq[String], alias: Option[String], line: Option[Integer], column: Option[Integer]): NewTypeDecl
Inherited from:
AstNodeBuilder
protected def createTypeRefNode(code: String, typeFullName: String, classNode: BabelNodeInfo): NewTypeRef
Inherited from:
AstNodeBuilder
protected def createVoidCallNode(line: Option[Integer], column: Option[Integer]): NewCall
Inherited from:
AstNodeBuilder
protected def fixMethodFullName(method: NewMethod, withTypeName: String): NewMethod
Inherited from:
AstForTypesCreator
protected def generateUnusedVariableName(usedVariableNames: HashMap[String, Int], variableName: String): String
Inherited from:
AstCreatorHelper
def globalNamespaceBlock(): NewNamespaceBlock

Create a global namespace block for the given filename

Create a global namespace block for the given filename

Inherited from:
AstCreatorBase
protected def hasKey(node: Value, key: String): Boolean
Inherited from:
AstCreatorHelper
protected def isPlainTypeAlias(alias: BabelNodeInfo): Boolean
Inherited from:
TypeHelper
protected def line(node: Value): Option[Integer]
Inherited from:
AstCreatorHelper
protected def lineEnd(node: Value): Option[Integer]
Inherited from:
AstCreatorHelper
def methodAst(method: NewMethod, parameters: Seq[NewMethodParameterIn], body: Ast, methodReturn: NewMethodReturn, modifiers: Seq[NewModifier]): Ast

Creates an AST that represents an entire method, including its content.

Creates an AST that represents an entire method, including its content.

Inherited from:
AstCreatorBase
def methodAstWithAnnotations(method: NewMethod, parameters: Seq[Ast], body: Ast, methodReturn: NewMethodReturn, modifiers: Seq[NewModifier], annotations: Seq[Ast]): Ast

Creates an AST that represents an entire method, including its content and with support for both method and parameter annotations.

Creates an AST that represents an entire method, including its content and with support for both method and parameter annotations.

Inherited from:
AstCreatorBase
def methodReturnNode(tfn: String, dtfn: Option[String], line: Option[Integer], column: Option[Integer]): NewMethodReturn

Create a method return node

Create a method return node

Inherited from:
AstCreatorBase
def methodStubAst(method: NewMethod, parameters: Seq[NewMethodParameterIn], methodReturn: NewMethodReturn): Ast

Creates an AST that represents a method stub, containing information about the method, its parameters, and the return type.

Creates an AST that represents a method stub, containing information about the method, its parameters, and the return type.

Inherited from:
AstCreatorBase
protected def newUnknown(node: BabelNodeInfo): NewUnknown
Inherited from:
AstNodeBuilder
protected def notHandledYet(node: BabelNodeInfo, additionalInfo: String): Ast
Inherited from:
AstCreatorHelper
protected def positionLookupTables(source: String): (SortedMap[Int, Int], SortedMap[Int, Int])
Inherited from:
AstCreatorHelper
protected def registerType(typeName: String, typeFullName: String): Unit
Inherited from:
AstCreatorHelper
def returnAst(returnNode: NewReturn, arguments: Seq[Ast]): Ast

For a given return node and arguments, create an AST that represents the return instruction. The main purpose of this method is to automatically assign the correct argument indices.

For a given return node and arguments, create an AST that represents the return instruction. The main purpose of this method is to automatically assign the correct argument indices.

Inherited from:
AstCreatorBase
protected def safeBool(node: Value, key: String): Option[Boolean]
Inherited from:
AstCreatorHelper
protected def safeObj(node: Value, key: String): Option[LinkedHashMap[String, Value]]
Inherited from:
AstCreatorHelper
protected def safeStr(node: Value, key: String): Option[String]
Inherited from:
AstCreatorHelper
def setArgumentIndices(arguments: Seq[Ast]): Unit
Inherited from:
AstCreatorBase
protected def setIndices(asts: List[Ast], receiver: Option[Ast], countEmpty: Boolean): Unit
Inherited from:
AstNodeBuilder
protected def typeFor(node: BabelNodeInfo): String
Inherited from:
TypeHelper
def withArgumentIndex[T <: ExpressionNew](node: T, argIdxOpt: Option[Int]): T
Inherited from:
AstCreatorBase
def withIndex[T, X](nodes: Array[T])(f: (T, Int) => X): Seq[X]
Inherited from:
AstCreatorBase
def withIndex[T, X](nodes: Seq[T])(f: (T, Int) => X): Seq[X]
Inherited from:
AstCreatorBase

Concrete fields

protected val dynamicInstanceTypeStack: ListBuffer[String]
protected val functionFullNames: HashSet[String]
protected val functionNodeToNameAndFullName: HashMap[BabelNodeInfo, (String, String)]
protected val localAstParentStack: ListBuffer[NewBlock]
protected val logger: Logger
protected val metaTypeRefIdStack: ListBuffer[NewTypeRef]
protected val methodAstParentStack: ListBuffer[NewNode]
protected val positionToFirstPositionInLineMapping: SortedMap[Int, Int]
protected val positionToLineNumberMapping: SortedMap[Int, Int]
protected val rootTypeDecl: ListBuffer[NewTypeDecl]
protected val scope: Scope
protected val seenAliasTypes: HashSet[NewTypeDecl]
protected val typeFullNameToPostfix: HashMap[String, Int]
val usedTypes: ConcurrentHashMap[(String, String), Boolean]
protected val usedVariableNames: HashMap[String, Int]

Inherited fields

val diffGraph: DiffGraphBuilder
Inherited from:
AstCreatorBase