File tree Expand file tree Collapse file tree
YantraJS.JSClassGenerator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ private string GenerateCode()
4141 {
4242 // get attribute info...
4343
44+ StringExtensions . UseKeyStringEnum = type . Type . ContainingAssembly . Name == "YantraJS.Core" ;
45+
4446 var sb = new StringBuilder ( ) ;
4547
4648 try
Original file line number Diff line number Diff line change @@ -7,8 +7,25 @@ namespace YantraJS.JSClassGenerator
77
88 internal static class StringExtensions
99 {
10+
11+ internal static bool UseKeyStringEnum = false ;
12+
1013 public static string ToKeyStringName ( this string name ) {
11- return $ "\" { name } \" .ToKeyString()";
14+ if ( ! UseKeyStringEnum )
15+ {
16+ return $ "\" { name } \" .ToKeyString()";
17+ }
18+ switch ( name )
19+ {
20+ case "return" :
21+ case "throw" :
22+ case "is" :
23+ case "catch" :
24+ case "finally" :
25+ case "for" :
26+ return $ "KeyString.@{ name } ";
27+ }
28+ return $ "KeyString.{ name } ";
1229 }
1330 }
1431
You can’t perform that action at this time.
0 commit comments