Class Emitter

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(emittingFileName: string, outfile: TextWriter, emitOptions: EmitOptions, semanticInfoChain: SemanticInfoChain): Emitter

Parameters

Returns

Emitter

Properties

public captureThisStmtString: string

private currentVariableDeclaration: any

private declStack: any

private detachedCommentsElement: any

public document: Document

public emitOptions: EmitOptions

public emitState: EmitState

public emittingFileName: string

private exportAssignment: any

public extendsPrologueEmitted: boolean

public globalThisCapturePrologueEmitted: boolean

public inArrowFunction: boolean

private inWithBlock: any

public indenter: Indenter

public moduleName: string

public outfile: TextWriter

private semanticInfoChain: any

public sourceMapper: SourceMapper

public thisClassNode: ClassDeclaration

Methods

private canEmitDottedNameMemberAccessExpression(expression: any): any

Parameters

  • expression: any

Returns

any

public createSourceMapper(document: Document, jsFileName: string, jsFile: TextWriter, sourceMapOut: TextWriter, resolvePath: (path: string) => string)

Parameters

private emit(ast: any): any

Parameters

  • ast: any

Returns

any

private emitAccessorBody(funcDecl: any, parameterList: any, block: any): any

Parameters

  • funcDecl: any
  • parameterList: any
  • block: any

Returns

any

public emitAccessorMemberDeclaration(funcDecl: AST, name: IASTToken, className: string, isProto: boolean)

Parameters

  • funcDecl: AST
  • name: IASTToken
  • className: string
  • isProto: boolean

public emitAmbientVarDecl(varDecl: VariableDeclarator)

Parameters

private emitAnyArrowFunctionExpression(arrowFunction: any, funcName: any, parameters: any, block: any, expression: any): any

Parameters

  • arrowFunction: any
  • funcName: any
  • parameters: any
  • block: any
  • expression: any

Returns

any

public emitArrayLiteralExpression(arrayLiteral: ArrayLiteralExpression)

Parameters

public emitBinaryExpression(expression: BinaryExpression)

Parameters

public emitBlock(block: Block)

Parameters

public emitBlockOrStatement(node: AST)

Parameters

public emitBreakStatement(jump: BreakStatement)

Parameters

public emitCaseSwitchClause(clause: CaseSwitchClause)

Parameters

public emitCastExpression(expression: CastExpression)

Parameters

public emitCatchClause(clause: CatchClause)

Parameters

public emitClass(classDecl: ClassDeclaration)

Parameters

public emitClassDeclaration(declaration: ClassDeclaration)

Parameters

private emitClassMemberFunctionDeclaration(classDecl: any, funcDecl: any): any

Parameters

  • classDecl: any
  • funcDecl: any

Returns

any

private emitClassMembers(classDecl: any): any

Parameters

  • classDecl: any

Returns

any

private emitCommaSeparatedList(parent: any, list: any, buffer: any, preserveNewLines: any): any

Parameters

  • parent: any
  • list: any
  • buffer: any
  • preserveNewLines: any

Returns

any

public emitComment(comment: Comment, trailing: boolean, first: boolean)

Parameters

  • comment: Comment
  • trailing: boolean
  • first: boolean

public emitComments(ast: AST, pre: boolean, onlyPinnedOrTripleSlashComments?: boolean)

Parameters

  • ast: AST
  • pre: boolean
  • onlyPinnedOrTripleSlashComments?: boolean optional

public emitCommentsArray(comments: Comment[], trailing: boolean)

Parameters

  • comments: Comment[]
  • trailing: boolean

public emitConditionalExpression(expression: ConditionalExpression)

Parameters

public emitConstructor(funcDecl: ConstructorDeclaration)

Parameters

public emitConstructorDeclaration(declaration: ConstructorDeclaration)

Parameters

public emitConstructorStatements(funcDecl: ConstructorDeclaration)

Parameters

public emitContinueStatement(jump: ContinueStatement)

Parameters

public emitDebuggerStatement(statement: DebuggerStatement)

Parameters

public emitDefaultSwitchClause(clause: DefaultSwitchClause)

Parameters

private emitDefaultValueAssignments(parameters: any): any

Parameters

  • parameters: any

Returns

any

public emitDeleteExpression(expression: DeleteExpression)

Parameters

private emitDetachedComments(list: any): any

Parameters

  • list: any

Returns

any

public emitDoStatement(statement: DoStatement)

Parameters

private emitDottedNameMemberAccessExpression(expression: any): any

Parameters

  • expression: any

Returns

any

private emitDottedNameMemberAccessExpressionRecurse(expression: any): any

Parameters

  • expression: any

Returns

any

public emitElementAccessExpression(expression: ElementAccessExpression)

Parameters

public emitElseClause(elseClause: ElseClause)

Parameters

public emitEnum(moduleDecl: EnumDeclaration)

Parameters

public emitEnumDeclaration(declaration: EnumDeclaration)

Parameters

public emitEnumElement(varDecl: EnumElement)

Parameters

public emitEqualsValueClause(clause: EqualsValueClause)

Parameters

public emitExpressionStatement(statement: ExpressionStatement)

Parameters

public emitFinallyClause(clause: FinallyClause)

Parameters

public emitForInStatement(statement: ForInStatement)

Parameters

public emitForStatement(statement: ForStatement)

Parameters

public emitFunction(funcDecl: FunctionDeclaration)

Parameters

private emitFunctionBodyStatements(name: any, funcDecl: any, parameterList: any, block: any, bodyExpression: any): any

Parameters

  • name: any
  • funcDecl: any
  • parameterList: any
  • block: any
  • bodyExpression: any

Returns

any

public emitFunctionDeclaration(declaration: FunctionDeclaration)

Parameters

public emitFunctionExpression(funcDecl: FunctionExpression)

Parameters

private emitFunctionParameters(parameters: any): any

Parameters

  • parameters: any

Returns

any

public emitFunctionPropertyAssignment(funcProp: FunctionPropertyAssignment)

Parameters

public emitGenericType(type: GenericType)

Parameters

public emitGetAccessor(accessor: GetAccessor)

Parameters

public emitIfStatement(statement: IfStatement)

Parameters

public emitImportDeclaration(importDeclAST: ImportDeclaration)

Parameters

public emitIndent()

public emitInterfaceDeclaration(declaration: InterfaceDeclaration)

Parameters

public emitInvocationExpression(callNode: InvocationExpression)

Parameters

public emitJavascript(ast: AST, startLine: boolean)

Parameters

  • ast: AST
  • startLine: boolean

public emitLabeledStatement(statement: LabeledStatement)

Parameters

public emitList(list: ISyntaxList2, useNewLineSeparator?: boolean, startInclusive?: number, endExclusive?: number)

Parameters

  • list: ISyntaxList2
  • useNewLineSeparator?: boolean optional
  • startInclusive?: number optional
  • endExclusive?: number optional

public emitLiteralExpression(expression: LiteralExpression)

Parameters

public emitMemberAccessExpression(expression: MemberAccessExpression)

Parameters

private emitMemberVariableDeclaration(varDecl: any): any

Parameters

  • varDecl: any

Returns

any

private emitModuleDeclaration(declaration: any): any

Parameters

  • declaration: any

Returns

any

private emitModuleDeclarationWorker(moduleDecl: any): any

Parameters

  • moduleDecl: any

Returns

any

public emitName(name: Identifier, addThis: boolean)

Parameters

public emitNumericLiteral(literal: NumericLiteral)

Parameters

public emitObjectCreationExpression(objectCreationExpression: ObjectCreationExpression)

Parameters

public emitObjectLiteralExpression(objectLiteral: ObjectLiteralExpression)

Parameters

public emitParameter(parameter: Parameter)

Parameters

private emitParameterList(list: any): any

Parameters

  • list: any

Returns

any

private emitParameterPropertyAndMemberVariableAssignments(): any

Returns

any

public emitParenthesizedArrowFunctionExpression(arrowFunction: ParenthesizedArrowFunctionExpression)

Parameters

public emitParenthesizedExpression(parenthesizedExpression: ParenthesizedExpression)

Parameters

private emitPossibleCopyrightHeaders(script: any): any

Parameters

  • script: any

Returns

any

public emitPostfixUnaryExpression(expression: PostfixUnaryExpression)

Parameters

public emitPrefixUnaryExpression(expression: PrefixUnaryExpression)

Parameters

public emitPrologue(sourceUnit: SourceUnit)

Parameters

public emitQualifiedName(name: QualifiedName)

Parameters

public emitRegularExpressionLiteral(literal: RegularExpressionLiteral)

Parameters

private emitRestParameterInitializer(parameters: any): any

Parameters

  • parameters: any

Returns

any

public emitReturnStatement(statement: ReturnStatement)

Parameters

public emitScriptElements(sourceUnit: SourceUnit)

Parameters

public emitSeparatedList(list: ISeparatedSyntaxList2, useNewLineSeparator?: boolean, startInclusive?: number, endExclusive?: number)

Parameters

  • list: ISeparatedSyntaxList2
  • useNewLineSeparator?: boolean optional
  • startInclusive?: number optional
  • endExclusive?: number optional

public emitSetAccessor(accessor: SetAccessor)

Parameters

public emitSimpleArrowFunctionExpression(arrowFunction: SimpleArrowFunctionExpression)

Parameters

public emitSimplePropertyAssignment(property: SimplePropertyAssignment)

Parameters

public emitSingleModuleDeclaration(moduleDecl: ModuleDeclaration, moduleName: IASTToken)

Parameters

private emitSourceUnit(sourceUnit: any): any

Parameters

  • sourceUnit: any

Returns

any

public emitSpaceBetweenConstructs(node1: AST, node2: AST)

Parameters

public emitStringLiteral(literal: StringLiteral)

Parameters

public emitSuperExpression(expression: SuperExpression)

Parameters

private emitSwitchClauseBody(body: any): any

Parameters

  • body: any

Returns

any

public emitSwitchStatement(statement: SwitchStatement)

Parameters

public emitThis()

public emitThisExpression(expression: ThisExpression)

Parameters

public emitThrowStatement(statement: ThrowStatement)

Parameters

public emitTryStatement(statement: TryStatement)

Parameters

public emitTypeOfExpression(expression: TypeOfExpression)

Parameters

public emitVarDeclVar()

public emitVariableDeclaration(declaration: VariableDeclaration)

Parameters

public emitVariableDeclarator(varDecl: VariableDeclarator)

Parameters

public emitVariableStatement(statement: VariableStatement)

Parameters

public emitVoidExpression(expression: VoidExpression)

Parameters

public emitWhileStatement(statement: WhileStatement)

Parameters

public emitWithStatement(statement: WithStatement)

Parameters

private emitWorker(ast: any): any

Parameters

  • ast: any

Returns

any

private firstVariableDeclarator(statement: any): any

Parameters

  • statement: any

Returns

any

public getConstantDecl(dotExpr: MemberAccessExpression): PullEnumElementDecl

Parameters

Returns

PullEnumElementDecl

private getDetachedComments(element: any): any

Parameters

  • element: any

Returns

any

private getEnclosingDecl(): any

Returns

any

public getExportAssignment(): ExportAssignment

Returns

ExportAssignment

private getImportDecls(fileName: any): any

Parameters

  • fileName: any

Returns

any

private getIndentString(): any

Returns

any

private getModuleDeclToVerifyChildNameCollision(moduleDecl: any, changeNameIfAnyDeclarationInContext: any): any

Parameters

  • moduleDecl: any
  • changeNameIfAnyDeclarationInContext: any

Returns

any

public getModuleImportAndDependencyList(sourceUnit: SourceUnit): { importList: string; dependencyList: string; }

Parameters

Returns

{ importList: string; dependencyList: string; }

private getModuleName(moduleDecl: any, changeNameIfAnyDeclarationInContext?: any): any

Parameters

  • moduleDecl: any
  • changeNameIfAnyDeclarationInContext?: any optional

Returns

any

public getOutputFiles(): OutputFile[]

Returns

OutputFile[]

private getSymbolForEmit(ast: any): any

Parameters

  • ast: any

Returns

any

private hasChildNameCollision(moduleName: any, parentDecl: any): any

Parameters

  • moduleName: any
  • parentDecl: any

Returns

any

private isDirectivePrologueElement(node: any): any

Parameters

  • node: any

Returns

any

private isNotAmbientOrHasInitializer(variableStatement: any): any

Parameters

  • variableStatement: any

Returns

any

private isOnSameLine(pos1: any, pos2: any): any

Parameters

  • pos1: any
  • pos2: any

Returns

any

private isPinnedOrTripleSlash(comment: any): any

Parameters

  • comment: any

Returns

any

private popDecl(decl: any): any

Parameters

  • decl: any

Returns

any

private pushDecl(decl: any): any

Parameters

  • decl: any

Returns

any

public recordSourceMappingEnd(ast: IASTSpan)

Parameters

public recordSourceMappingNameEnd()

public recordSourceMappingNameStart(name: string)

Parameters

  • name: string

public recordSourceMappingStart(ast: IASTSpan)

Parameters

private requiresExtendsBlock(moduleElements: any): any

Parameters

  • moduleElements: any

Returns

any

public setContainer(c: number): number

Parameters

  • c: number

Returns

number

public setDocument(document: Document)

Parameters

public setExportAssignment(exportAssignment: ExportAssignment)

Parameters

public setSourceMapperNewSourceFile(document: Document)

Parameters

public shouldCaptureThis(ast: AST): boolean

Parameters

Returns

boolean

private shouldEmit(ast: any): any

Parameters

  • ast: any

Returns

any

public shouldEmitClassDeclaration(declaration: ClassDeclaration): boolean

Parameters

Returns

boolean

public shouldEmitEnumDeclaration(declaration: EnumDeclaration): boolean

Parameters

Returns

boolean

public shouldEmitFunctionDeclaration(declaration: FunctionDeclaration): boolean

Parameters

Returns

boolean

public shouldEmitImportDeclaration(importDeclAST: ImportDeclaration): boolean

Parameters

Returns

boolean

public shouldEmitInterfaceDeclaration(declaration: InterfaceDeclaration): boolean

Parameters

Returns

boolean

public shouldEmitModuleDeclaration(declaration: ModuleDeclaration): boolean

Parameters

Returns

boolean

public shouldEmitVariableStatement(statement: VariableStatement): boolean

Parameters

Returns

boolean

private shouldQualifySymbolNameWithParentName(symbol: any): any

Parameters

  • symbol: any

Returns

any

private symbolIsUsedInItsEnclosingContainer(symbol: any, dynamic?: any): any

Parameters

  • symbol: any
  • dynamic?: any optional

Returns

any

public tryEmitConstant(dotExpr: MemberAccessExpression): boolean

Parameters

Returns

boolean

private updateLineAndColumn(s: any): any

Parameters

  • s: any

Returns

any

public writeCaptureThisStatement(ast: AST)

Parameters

public writeLineToOutput(s: string, force?: boolean)

Parameters

  • s: string
  • force?: boolean optional

public writeToOutput(s: string)

Parameters

  • s: string

public writeToOutputWithSourceMapRecord(s: string, astSpan: IASTSpan)

Parameters