@@ -1543,8 +1543,8 @@ export class Program extends DiagnosticEmitter {
15431543 /** Requires that a global library element of the specified kind is present and returns it. */
15441544 private require ( name : string , kind : ElementKind ) : Element {
15451545 var element = this . lookup ( name ) ;
1546- if ( ! element ) throw new Error ( " Missing standard library component: " + name ) ;
1547- if ( element . kind != kind ) throw Error ( " Invalid standard library component kind: " + name ) ;
1546+ if ( ! element ) throw new Error ( ` Missing standard library component: ${ name } ` ) ;
1547+ if ( element . kind != kind ) throw Error ( ` Invalid standard library component kind: ${ name } ` ) ;
15481548 return element ;
15491549 }
15501550
@@ -1557,15 +1557,15 @@ export class Program extends DiagnosticEmitter {
15571557 requireClass ( name : string ) : Class {
15581558 var prototype = this . require ( name , ElementKind . CLASS_PROTOTYPE ) ;
15591559 var resolved = this . resolver . resolveClass ( < ClassPrototype > prototype , null ) ;
1560- if ( ! resolved ) throw new Error ( " Invalid standard library class: " + name ) ;
1560+ if ( ! resolved ) throw new Error ( ` Invalid standard library class: ${ name } ` ) ;
15611561 return resolved ;
15621562 }
15631563
15641564 /** Requires that a global function is present and returns it. */
15651565 requireFunction ( name : string , typeArguments : Type [ ] | null = null ) : Function {
15661566 var prototype = < FunctionPrototype > this . require ( name , ElementKind . FUNCTION_PROTOTYPE ) ;
15671567 var resolved = this . resolver . resolveFunction ( prototype , typeArguments ) ;
1568- if ( ! resolved ) throw new Error ( " Invalid standard library function: " + name ) ;
1568+ if ( ! resolved ) throw new Error ( ` Invalid standard library function: ${ name } ` ) ;
15691569 return resolved ;
15701570 }
15711571
@@ -2873,7 +2873,7 @@ export abstract class Element {
28732873
28742874 /** Returns a string representation of this element. */
28752875 toString ( ) : string {
2876- return this . internalName + " , kind=" + this . kind . toString ( ) ;
2876+ return ` ${ this . internalName } , kind=${ this . kind } ` ;
28772877 }
28782878}
28792879
@@ -3049,7 +3049,7 @@ export class File extends Element {
30493049 assert ( ! program . filesByName . has ( this . internalName ) ) ;
30503050 program . filesByName . set ( this . internalName , this ) ;
30513051 var startFunction = this . program . makeNativeFunction (
3052- " start:" + this . internalName ,
3052+ ` start:${ this . internalName } ` ,
30533053 new Signature ( program , null , Type . void ) ,
30543054 this
30553055 ) ;
@@ -3693,9 +3693,7 @@ export class Function extends TypedElement {
36933693 // if it has a name, check previously as this method will throw otherwise
36943694 var localIndex = this . signature . parameterTypes . length + this . additionalLocals . length ;
36953695 if ( this . is ( CommonFlags . INSTANCE ) ) ++ localIndex ;
3696- var localName = name != null
3697- ? name
3698- : "var$" + localIndex . toString ( ) ;
3696+ var localName = name != null ? name : `var$${ localIndex } ` ;
36993697 if ( ! declaration ) declaration = this . program . makeNativeVariableDeclaration ( localName ) ;
37003698 var local = new Local (
37013699 localName ,
@@ -3851,31 +3849,39 @@ export class Field extends VariableLikeElement {
38513849 /** Gets the internal name of the respective getter function. */
38523850 get internalGetterName ( ) : string {
38533851 var cached = this . _internalGetterName ;
3854- if ( cached == null ) this . _internalGetterName = cached = this . parent . internalName + INSTANCE_DELIMITER + GETTER_PREFIX + this . name ;
3852+ if ( cached == null ) {
3853+ this . _internalGetterName = cached = `${ this . parent . internalName } ${ INSTANCE_DELIMITER } ${ GETTER_PREFIX } ${ this . name } ` ;
3854+ }
38553855 return cached ;
38563856 }
38573857 private _internalGetterName : string | null = null ;
38583858
38593859 /** Gets the internal name of the respective setter function. */
38603860 get internalSetterName ( ) : string {
38613861 var cached = this . _internalSetterName ;
3862- if ( cached == null ) this . _internalSetterName = cached = this . parent . internalName + INSTANCE_DELIMITER + SETTER_PREFIX + this . name ;
3862+ if ( cached == null ) {
3863+ this . _internalSetterName = cached = `${ this . parent . internalName } ${ INSTANCE_DELIMITER } ${ SETTER_PREFIX } ${ this . name } ` ;
3864+ }
38633865 return cached ;
38643866 }
38653867 private _internalSetterName : string | null = null ;
38663868
38673869 /** Gets the signature of the respective getter function. */
38683870 get internalGetterSignature ( ) : Signature {
38693871 var cached = this . _internalGetterSignature ;
3870- if ( ! cached ) this . _internalGetterSignature = cached = new Signature ( this . program , null , this . type , this . thisType ) ;
3872+ if ( ! cached ) {
3873+ this . _internalGetterSignature = cached = new Signature ( this . program , null , this . type , this . thisType ) ;
3874+ }
38713875 return cached ;
38723876 }
38733877 private _internalGetterSignature : Signature | null = null ;
38743878
38753879 /** Gets the signature of the respective setter function. */
38763880 get internalSetterSignature ( ) : Signature {
38773881 var cached = this . _internalSetterSignature ;
3878- if ( ! cached ) this . _internalGetterSignature = cached = new Signature ( this . program , [ this . type ] , Type . void , this . thisType ) ;
3882+ if ( ! cached ) {
3883+ this . _internalGetterSignature = cached = new Signature ( this . program , [ this . type ] , Type . void , this . thisType ) ;
3884+ }
38793885 return cached ;
38803886 }
38813887 private _internalSetterSignature : Signature | null = null ;
@@ -4720,7 +4726,12 @@ function copyMembers(src: Element, dest: Element): void {
47204726}
47214727
47224728/** Mangles the internal name of an element with the specified name that is a child of the given parent. */
4723- export function mangleInternalName ( name : string , parent : Element , isInstance : bool , asGlobal : bool = false ) : string {
4729+ export function mangleInternalName (
4730+ name : string ,
4731+ parent : Element ,
4732+ isInstance : bool ,
4733+ asGlobal : bool = false
4734+ ) : string {
47244735 switch ( parent . kind ) {
47254736 case ElementKind . FILE : {
47264737 if ( asGlobal ) return name ;
@@ -4737,8 +4748,10 @@ export function mangleInternalName(name: string, parent: Element, isInstance: bo
47374748 // fall-through
47384749 }
47394750 default : {
4740- return mangleInternalName ( parent . name , parent . parent , parent . is ( CommonFlags . INSTANCE ) , asGlobal )
4741- + ( isInstance ? INSTANCE_DELIMITER : STATIC_DELIMITER ) + name ;
4751+ return (
4752+ mangleInternalName ( parent . name , parent . parent , parent . is ( CommonFlags . INSTANCE ) , asGlobal ) +
4753+ ( isInstance ? INSTANCE_DELIMITER : STATIC_DELIMITER ) + name
4754+ ) ;
47424755 }
47434756 }
47444757}
@@ -4749,7 +4762,7 @@ var cachedDefaultParameterNames: string[] = [];
47494762/** Gets the cached default parameter name for the specified index. */
47504763export function getDefaultParameterName ( index : i32 ) : string {
47514764 for ( let i = cachedDefaultParameterNames . length ; i <= index ; ++ i ) {
4752- cachedDefaultParameterNames . push ( "$" + i . toString ( ) ) ;
4765+ cachedDefaultParameterNames . push ( `$ ${ i } ` ) ;
47534766 }
47544767 return cachedDefaultParameterNames [ index ] ;
47554768}
0 commit comments