File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -514,7 +514,8 @@ export class TSHelper {
514514 }
515515
516516 public static isValidLuaIdentifier ( str : string ) : boolean {
517- return str . match ( / [ a - z A - Z _ ] [ a - z A - Z 0 - 9 _ ] * / ) !== null ;
517+ const match = str . match ( / [ a - z A - Z _ ] [ a - z A - Z 0 - 9 _ ] * / ) ;
518+ return match && match [ 0 ] === str ;
518519 }
519520
520521 public static isFalsible ( type : ts . Type , strictNullChecks : boolean ) : boolean {
Original file line number Diff line number Diff line change @@ -803,4 +803,14 @@ export class AssignmentTests {
803803 "Unsupported assignment of mixed function/method overload. "
804804 + "Overloads should either be all functions or all methods, but not both." ) ;
805805 }
806+
807+ @Test ( "String table access" )
808+ public stringTableAccess ( assignType : string ) : void {
809+ const code = `const dict : {[key:string]:any} = {};
810+ dict["a b"] = 3;
811+ return dict["a b"];` ;
812+ const result = util . transpileAndExecute ( code ) ;
813+ Expect ( result ) . toBe ( 3 ) ;
814+ }
815+
806816}
You can’t perform that action at this time.
0 commit comments