public class JsSrcUtils extends Object
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeUnicodeFormatChars(String str)
Builds a version of the given string that has literal Unicode Format characters (Unicode
category "Cf") changed to valid JavaScript Unicode escapes (i.e.
|
static String |
getJsTypeExpr(SoyType type)
Given a Soy type, return the corresponding jscompiler doc type expression.
|
static String |
getJsTypeExpr(SoyType type,
boolean addParensIfNeeded,
boolean addRequiredIfNeeded) |
static String |
getJsTypeName(SoyType type)
Given a Soy type, return the corresponding jscompiler type name.
|
static String |
getVariableName(String identity,
Deque<Map<String,JsExpr>> localVarTranslations)
Traverses up the stack of local variable name mappings to get the generated local variable
name for the given variable.
|
static boolean |
isDefaultOptional(SoyType type)
Returns true if the given type is optional by default (in the jscompiler).
|
static boolean |
isReservedWord(String key)
Returns true if key is a JavaScript reserved word.
|
public static String escapeUnicodeFormatChars(String str)
str - The string to escape.public static String getJsTypeExpr(SoyType type)
public static String getJsTypeExpr(SoyType type, boolean addParensIfNeeded, boolean addRequiredIfNeeded)
public static String getJsTypeName(SoyType type)
public static boolean isDefaultOptional(SoyType type)
public static boolean isReservedWord(String key)
public static String getVariableName(String identity, Deque<Map<String,JsExpr>> localVarTranslations)
identity - The local name of the variablelocalVarTranslations - The translations from local variables to generated variable name