id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
53,600 | google/closure-templates | java/src/com/google/template/soy/xliffmsgplugin/XliffParser.java | XliffParser.parseXliffTargetMsgs | static SoyMsgBundle parseXliffTargetMsgs(String xliffContent) throws SAXException {
// Get a SAX parser.
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
SAXParser saxParser;
try {
saxParser = saxParserFactory.newSAXParser();
} catch (ParserConfigurationException pce) {
... | java | static SoyMsgBundle parseXliffTargetMsgs(String xliffContent) throws SAXException {
// Get a SAX parser.
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
SAXParser saxParser;
try {
saxParser = saxParserFactory.newSAXParser();
} catch (ParserConfigurationException pce) {
... | [
"static",
"SoyMsgBundle",
"parseXliffTargetMsgs",
"(",
"String",
"xliffContent",
")",
"throws",
"SAXException",
"{",
"// Get a SAX parser.",
"SAXParserFactory",
"saxParserFactory",
"=",
"SAXParserFactory",
".",
"newInstance",
"(",
")",
";",
"SAXParser",
"saxParser",
";",
... | Parses the content of a translated XLIFF file and creates a SoyMsgBundle.
@param xliffContent The XLIFF content to parse.
@return The resulting SoyMsgBundle.
@throws SAXException If there's an error parsing the data.
@throws SoyMsgException If there's an error in parsing the data. | [
"Parses",
"the",
"content",
"of",
"a",
"translated",
"XLIFF",
"file",
"and",
"creates",
"a",
"SoyMsgBundle",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/xliffmsgplugin/XliffParser.java#L56-L79 |
53,601 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java | SoyNodeCompiler.create | static SoyNodeCompiler create(
CompiledTemplateRegistry registry,
InnerClasses innerClasses,
FieldRef stateField,
Expression thisVar,
AppendableExpression appendableVar,
TemplateVariableManager variables,
TemplateParameterLookup parameterLookup,
ErrorReporter reporter,
... | java | static SoyNodeCompiler create(
CompiledTemplateRegistry registry,
InnerClasses innerClasses,
FieldRef stateField,
Expression thisVar,
AppendableExpression appendableVar,
TemplateVariableManager variables,
TemplateParameterLookup parameterLookup,
ErrorReporter reporter,
... | [
"static",
"SoyNodeCompiler",
"create",
"(",
"CompiledTemplateRegistry",
"registry",
",",
"InnerClasses",
"innerClasses",
",",
"FieldRef",
"stateField",
",",
"Expression",
"thisVar",
",",
"AppendableExpression",
"appendableVar",
",",
"TemplateVariableManager",
"variables",
"... | Creates a SoyNodeCompiler
@param innerClasses The current set of inner classes
@param stateField The field on the current class that holds the state variable
@param thisVar An expression that returns 'this'
@param appendableVar An expression that returns the current AdvisingAppendable that we are
rendering into
@param... | [
"Creates",
"a",
"SoyNodeCompiler"
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java#L136-L168 |
53,602 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java | SoyNodeCompiler.computeRangeValue | private Expression computeRangeValue(
SyntheticVarName varName,
Optional<ExprNode> expression,
int defaultValue,
Scope scope,
final ImmutableList.Builder<Statement> initStatements) {
if (!expression.isPresent()) {
return constant(defaultValue);
} else if (expression.get() ins... | java | private Expression computeRangeValue(
SyntheticVarName varName,
Optional<ExprNode> expression,
int defaultValue,
Scope scope,
final ImmutableList.Builder<Statement> initStatements) {
if (!expression.isPresent()) {
return constant(defaultValue);
} else if (expression.get() ins... | [
"private",
"Expression",
"computeRangeValue",
"(",
"SyntheticVarName",
"varName",
",",
"Optional",
"<",
"ExprNode",
">",
"expression",
",",
"int",
"defaultValue",
",",
"Scope",
"scope",
",",
"final",
"ImmutableList",
".",
"Builder",
"<",
"Statement",
">",
"initSta... | Computes a single range argument.
@param varName The variable name to use if this value should be stored in a local
@param expression The expression
@param defaultValue The value to use if there is no expression
@param scope The current variable scope to add variables to
@param initStatements Initializing statements, ... | [
"Computes",
"a",
"single",
"range",
"argument",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java#L497-L524 |
53,603 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java | SoyNodeCompiler.shouldCheckBuffer | private static boolean shouldCheckBuffer(PrintNode node) {
if (!(node.getExpr().getRoot() instanceof FunctionNode)) {
return true;
}
FunctionNode fn = (FunctionNode) node.getExpr().getRoot();
if (!(fn.getSoyFunction() instanceof BuiltinFunction)) {
return true;
}
BuiltinFunction bf... | java | private static boolean shouldCheckBuffer(PrintNode node) {
if (!(node.getExpr().getRoot() instanceof FunctionNode)) {
return true;
}
FunctionNode fn = (FunctionNode) node.getExpr().getRoot();
if (!(fn.getSoyFunction() instanceof BuiltinFunction)) {
return true;
}
BuiltinFunction bf... | [
"private",
"static",
"boolean",
"shouldCheckBuffer",
"(",
"PrintNode",
"node",
")",
"{",
"if",
"(",
"!",
"(",
"node",
".",
"getExpr",
"(",
")",
".",
"getRoot",
"(",
")",
"instanceof",
"FunctionNode",
")",
")",
"{",
"return",
"true",
";",
"}",
"FunctionNo... | Returns true if the print expression should check the rendering buffer and generate a detach.
<p>We do not generate detaches for css() and xid() builtin functions, since they are typically
very short. | [
"Returns",
"true",
"if",
"the",
"print",
"expression",
"should",
"check",
"the",
"rendering",
"buffer",
"and",
"generate",
"a",
"detach",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java#L712-L728 |
53,604 | google/closure-templates | java/src/com/google/template/soy/passes/VeLogValidationPass.java | VeLogValidationPass.validateVeLogNode | private void validateVeLogNode(VeLogNode node) {
if (node.getVeDataExpression().getRoot().getType().getKind() != Kind.VE_DATA) {
reporter.report(
node.getVeDataExpression().getSourceLocation(),
INVALID_VE,
node.getVeDataExpression().getRoot().getType());
}
if (node.getLog... | java | private void validateVeLogNode(VeLogNode node) {
if (node.getVeDataExpression().getRoot().getType().getKind() != Kind.VE_DATA) {
reporter.report(
node.getVeDataExpression().getSourceLocation(),
INVALID_VE,
node.getVeDataExpression().getRoot().getType());
}
if (node.getLog... | [
"private",
"void",
"validateVeLogNode",
"(",
"VeLogNode",
"node",
")",
"{",
"if",
"(",
"node",
".",
"getVeDataExpression",
"(",
")",
".",
"getRoot",
"(",
")",
".",
"getType",
"(",
")",
".",
"getKind",
"(",
")",
"!=",
"Kind",
".",
"VE_DATA",
")",
"{",
... | Type checks the VE and logonly expressions. | [
"Type",
"checks",
"the",
"VE",
"and",
"logonly",
"expressions",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/VeLogValidationPass.java#L183-L205 |
53,605 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsSrcNameGenerators.java | JsSrcNameGenerators.forLocalVariables | public static UniqueNameGenerator forLocalVariables() {
UniqueNameGenerator generator = new UniqueNameGenerator(DANGEROUS_CHARACTERS, "$$");
generator.reserve(JsSrcUtils.JS_LITERALS);
generator.reserve(JsSrcUtils.JS_RESERVED_WORDS);
return generator;
} | java | public static UniqueNameGenerator forLocalVariables() {
UniqueNameGenerator generator = new UniqueNameGenerator(DANGEROUS_CHARACTERS, "$$");
generator.reserve(JsSrcUtils.JS_LITERALS);
generator.reserve(JsSrcUtils.JS_RESERVED_WORDS);
return generator;
} | [
"public",
"static",
"UniqueNameGenerator",
"forLocalVariables",
"(",
")",
"{",
"UniqueNameGenerator",
"generator",
"=",
"new",
"UniqueNameGenerator",
"(",
"DANGEROUS_CHARACTERS",
",",
"\"$$\"",
")",
";",
"generator",
".",
"reserve",
"(",
"JsSrcUtils",
".",
"JS_LITERAL... | Returns a name generator suitable for generating local variable names. | [
"Returns",
"a",
"name",
"generator",
"suitable",
"for",
"generating",
"local",
"variable",
"names",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsSrcNameGenerators.java#L34-L39 |
53,606 | google/closure-templates | java/src/com/google/template/soy/shared/SoyAstCache.java | SoyAstCache.put | public synchronized void put(String fileName, VersionedFile versionedFile) {
cache.put(fileName, versionedFile.copy());
} | java | public synchronized void put(String fileName, VersionedFile versionedFile) {
cache.put(fileName, versionedFile.copy());
} | [
"public",
"synchronized",
"void",
"put",
"(",
"String",
"fileName",
",",
"VersionedFile",
"versionedFile",
")",
"{",
"cache",
".",
"put",
"(",
"fileName",
",",
"versionedFile",
".",
"copy",
"(",
")",
")",
";",
"}"
] | Stores a cached version of the AST.
<p>Please treat this as superpackage-private for Soy internals.
@param fileName The name of the file.
@param versionedFile The compiled AST at the particular version. The node is defensively
copied; the caller is free to modify it. | [
"Stores",
"a",
"cached",
"version",
"of",
"the",
"AST",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/SoyAstCache.java#L80-L82 |
53,607 | google/closure-templates | java/src/com/google/template/soy/shared/SoyAstCache.java | SoyAstCache.get | public synchronized VersionedFile get(String fileName, Version version) {
VersionedFile entry = cache.get(fileName);
if (entry != null) {
if (entry.version().equals(version)) {
// Make a defensive copy since the caller might run further passes on it.
return entry.copy();
} else {
... | java | public synchronized VersionedFile get(String fileName, Version version) {
VersionedFile entry = cache.get(fileName);
if (entry != null) {
if (entry.version().equals(version)) {
// Make a defensive copy since the caller might run further passes on it.
return entry.copy();
} else {
... | [
"public",
"synchronized",
"VersionedFile",
"get",
"(",
"String",
"fileName",
",",
"Version",
"version",
")",
"{",
"VersionedFile",
"entry",
"=",
"cache",
".",
"get",
"(",
"fileName",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"if",
"(",
"entry... | Retrieves a cached version of this file supplier AST, if any.
<p>Please treat this as superpackage-private for Soy internals.
@param fileName The name of the file
@param version The current file version.
@return A fresh copy of the tree that may be modified by the caller, or null if no entry was
found in the cache. | [
"Retrieves",
"a",
"cached",
"version",
"of",
"this",
"file",
"supplier",
"AST",
"if",
"any",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/SoyAstCache.java#L94-L106 |
53,608 | google/closure-templates | java/src/com/google/template/soy/internal/proto/ProtoUtils.java | ProtoUtils.isSanitizedContentField | public static boolean isSanitizedContentField(FieldDescriptor fieldDescriptor) {
return fieldDescriptor.getType() == Type.MESSAGE
&& SAFE_PROTO_TYPES.contains(fieldDescriptor.getMessageType().getFullName());
} | java | public static boolean isSanitizedContentField(FieldDescriptor fieldDescriptor) {
return fieldDescriptor.getType() == Type.MESSAGE
&& SAFE_PROTO_TYPES.contains(fieldDescriptor.getMessageType().getFullName());
} | [
"public",
"static",
"boolean",
"isSanitizedContentField",
"(",
"FieldDescriptor",
"fieldDescriptor",
")",
"{",
"return",
"fieldDescriptor",
".",
"getType",
"(",
")",
"==",
"Type",
".",
"MESSAGE",
"&&",
"SAFE_PROTO_TYPES",
".",
"contains",
"(",
"fieldDescriptor",
"."... | Returns true if fieldDescriptor holds a sanitized proto type. | [
"Returns",
"true",
"if",
"fieldDescriptor",
"holds",
"a",
"sanitized",
"proto",
"type",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/ProtoUtils.java#L66-L69 |
53,609 | google/closure-templates | java/src/com/google/template/soy/internal/proto/ProtoUtils.java | ProtoUtils.isSanitizedContentMap | public static boolean isSanitizedContentMap(FieldDescriptor fieldDescriptor) {
if (!fieldDescriptor.isMapField()) {
return false;
}
Descriptor valueDesc = getMapValueMessageType(fieldDescriptor);
if (valueDesc == null) {
return false;
}
return SAFE_PROTO_TYPES.contains(valueDesc.getF... | java | public static boolean isSanitizedContentMap(FieldDescriptor fieldDescriptor) {
if (!fieldDescriptor.isMapField()) {
return false;
}
Descriptor valueDesc = getMapValueMessageType(fieldDescriptor);
if (valueDesc == null) {
return false;
}
return SAFE_PROTO_TYPES.contains(valueDesc.getF... | [
"public",
"static",
"boolean",
"isSanitizedContentMap",
"(",
"FieldDescriptor",
"fieldDescriptor",
")",
"{",
"if",
"(",
"!",
"fieldDescriptor",
".",
"isMapField",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Descriptor",
"valueDesc",
"=",
"getMapValueMessageT... | Returns true if fieldDescriptor holds a map where the values are a sanitized proto type. | [
"Returns",
"true",
"if",
"fieldDescriptor",
"holds",
"a",
"map",
"where",
"the",
"values",
"are",
"a",
"sanitized",
"proto",
"type",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/ProtoUtils.java#L72-L81 |
53,610 | google/closure-templates | java/src/com/google/template/soy/internal/proto/ProtoUtils.java | ProtoUtils.getMapValueMessageType | @Nullable
public static Descriptor getMapValueMessageType(FieldDescriptor mapField) {
FieldDescriptor valueDesc = mapField.getMessageType().findFieldByName("value");
if (valueDesc.getType() == FieldDescriptor.Type.MESSAGE) {
return valueDesc.getMessageType();
} else {
return null;
}
} | java | @Nullable
public static Descriptor getMapValueMessageType(FieldDescriptor mapField) {
FieldDescriptor valueDesc = mapField.getMessageType().findFieldByName("value");
if (valueDesc.getType() == FieldDescriptor.Type.MESSAGE) {
return valueDesc.getMessageType();
} else {
return null;
}
} | [
"@",
"Nullable",
"public",
"static",
"Descriptor",
"getMapValueMessageType",
"(",
"FieldDescriptor",
"mapField",
")",
"{",
"FieldDescriptor",
"valueDesc",
"=",
"mapField",
".",
"getMessageType",
"(",
")",
".",
"findFieldByName",
"(",
"\"value\"",
")",
";",
"if",
"... | Returns the descriptor representing the type of the value of the map field. Returns null if the
map value isn't a message. | [
"Returns",
"the",
"descriptor",
"representing",
"the",
"type",
"of",
"the",
"value",
"of",
"the",
"map",
"field",
".",
"Returns",
"null",
"if",
"the",
"map",
"value",
"isn",
"t",
"a",
"message",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/ProtoUtils.java#L87-L95 |
53,611 | google/closure-templates | java/src/com/google/template/soy/internal/proto/ProtoUtils.java | ProtoUtils.getJsExtensionImport | public static String getJsExtensionImport(FieldDescriptor desc) {
Descriptor scope = desc.getExtensionScope();
if (scope != null) {
while (scope.getContainingType() != null) {
scope = scope.getContainingType();
}
return calculateQualifiedJsName(scope);
}
return getJsPackage(des... | java | public static String getJsExtensionImport(FieldDescriptor desc) {
Descriptor scope = desc.getExtensionScope();
if (scope != null) {
while (scope.getContainingType() != null) {
scope = scope.getContainingType();
}
return calculateQualifiedJsName(scope);
}
return getJsPackage(des... | [
"public",
"static",
"String",
"getJsExtensionImport",
"(",
"FieldDescriptor",
"desc",
")",
"{",
"Descriptor",
"scope",
"=",
"desc",
".",
"getExtensionScope",
"(",
")",
";",
"if",
"(",
"scope",
"!=",
"null",
")",
"{",
"while",
"(",
"scope",
".",
"getContainin... | Returns the JS name of the import for the given extension, suitable for goog.require. | [
"Returns",
"the",
"JS",
"name",
"of",
"the",
"import",
"for",
"the",
"given",
"extension",
"suitable",
"for",
"goog",
".",
"require",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/ProtoUtils.java#L118-L127 |
53,612 | google/closure-templates | java/src/com/google/template/soy/internal/proto/ProtoUtils.java | ProtoUtils.computeJsExtensionName | private static String computeJsExtensionName(FieldDescriptor field) {
String name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, field.getName());
return field.isRepeated() ? name + "List" : name;
} | java | private static String computeJsExtensionName(FieldDescriptor field) {
String name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, field.getName());
return field.isRepeated() ? name + "List" : name;
} | [
"private",
"static",
"String",
"computeJsExtensionName",
"(",
"FieldDescriptor",
"field",
")",
"{",
"String",
"name",
"=",
"CaseFormat",
".",
"LOWER_UNDERSCORE",
".",
"to",
"(",
"CaseFormat",
".",
"LOWER_CAMEL",
",",
"field",
".",
"getName",
"(",
")",
")",
";"... | Performs camelcase translation. | [
"Performs",
"camelcase",
"translation",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/ProtoUtils.java#L139-L142 |
53,613 | google/closure-templates | java/src/com/google/template/soy/internal/proto/ProtoUtils.java | ProtoUtils.getJsPackage | private static String getJsPackage(FileDescriptor file) {
String protoPackage = file.getPackage();
if (!protoPackage.isEmpty()) {
return "proto." + protoPackage;
}
return "proto";
} | java | private static String getJsPackage(FileDescriptor file) {
String protoPackage = file.getPackage();
if (!protoPackage.isEmpty()) {
return "proto." + protoPackage;
}
return "proto";
} | [
"private",
"static",
"String",
"getJsPackage",
"(",
"FileDescriptor",
"file",
")",
"{",
"String",
"protoPackage",
"=",
"file",
".",
"getPackage",
"(",
")",
";",
"if",
"(",
"!",
"protoPackage",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"\"proto.\"",
"+"... | Returns the expected javascript package for protos based on the .proto file. | [
"Returns",
"the",
"expected",
"javascript",
"package",
"for",
"protos",
"based",
"on",
"the",
".",
"proto",
"file",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/ProtoUtils.java#L145-L151 |
53,614 | google/closure-templates | java/src/com/google/template/soy/internal/proto/ProtoUtils.java | ProtoUtils.hasJsType | public static boolean hasJsType(FieldDescriptor fieldDescriptor) {
if (!JS_TYPEABLE_FIELDS.contains(fieldDescriptor.getType())) {
return false;
}
if (fieldDescriptor.getOptions().hasJstype()) {
return true;
}
return false;
} | java | public static boolean hasJsType(FieldDescriptor fieldDescriptor) {
if (!JS_TYPEABLE_FIELDS.contains(fieldDescriptor.getType())) {
return false;
}
if (fieldDescriptor.getOptions().hasJstype()) {
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"hasJsType",
"(",
"FieldDescriptor",
"fieldDescriptor",
")",
"{",
"if",
"(",
"!",
"JS_TYPEABLE_FIELDS",
".",
"contains",
"(",
"fieldDescriptor",
".",
"getType",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
... | Returns true if this field has a valid jstype annotation. | [
"Returns",
"true",
"if",
"this",
"field",
"has",
"a",
"valid",
"jstype",
"annotation",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/ProtoUtils.java#L162-L170 |
53,615 | google/closure-templates | java/src/com/google/template/soy/internal/proto/ProtoUtils.java | ProtoUtils.isUnsigned | public static boolean isUnsigned(FieldDescriptor descriptor) {
switch (descriptor.getType()) {
case FIXED32:
case FIXED64:
case UINT32:
case UINT64:
return true;
default:
return false;
}
} | java | public static boolean isUnsigned(FieldDescriptor descriptor) {
switch (descriptor.getType()) {
case FIXED32:
case FIXED64:
case UINT32:
case UINT64:
return true;
default:
return false;
}
} | [
"public",
"static",
"boolean",
"isUnsigned",
"(",
"FieldDescriptor",
"descriptor",
")",
"{",
"switch",
"(",
"descriptor",
".",
"getType",
"(",
")",
")",
"{",
"case",
"FIXED32",
":",
"case",
"FIXED64",
":",
"case",
"UINT32",
":",
"case",
"UINT64",
":",
"ret... | Returns true if this field is an unsigned integer. | [
"Returns",
"true",
"if",
"this",
"field",
"is",
"an",
"unsigned",
"integer",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/ProtoUtils.java#L173-L183 |
53,616 | google/closure-templates | java/src/com/google/template/soy/internal/proto/ProtoUtils.java | ProtoUtils.shouldCheckFieldPresenceToEmulateJspbNullability | static boolean shouldCheckFieldPresenceToEmulateJspbNullability(FieldDescriptor desc) {
boolean hasBrokenSemantics = false;
if (desc.hasDefaultValue() || desc.isRepeated()) {
return false;
} else if (desc.getFile().getSyntax() == Syntax.PROTO3 || !hasBrokenSemantics) {
// in proto3 or proto2 wit... | java | static boolean shouldCheckFieldPresenceToEmulateJspbNullability(FieldDescriptor desc) {
boolean hasBrokenSemantics = false;
if (desc.hasDefaultValue() || desc.isRepeated()) {
return false;
} else if (desc.getFile().getSyntax() == Syntax.PROTO3 || !hasBrokenSemantics) {
// in proto3 or proto2 wit... | [
"static",
"boolean",
"shouldCheckFieldPresenceToEmulateJspbNullability",
"(",
"FieldDescriptor",
"desc",
")",
"{",
"boolean",
"hasBrokenSemantics",
"=",
"false",
";",
"if",
"(",
"desc",
".",
"hasDefaultValue",
"(",
")",
"||",
"desc",
".",
"isRepeated",
"(",
")",
"... | Returns whether or not we should check for presence to emulate jspb nullability semantics in
server side soy. | [
"Returns",
"whether",
"or",
"not",
"we",
"should",
"check",
"for",
"presence",
"to",
"emulate",
"jspb",
"nullability",
"semantics",
"in",
"server",
"side",
"soy",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/ProtoUtils.java#L217-L228 |
53,617 | google/closure-templates | java/src/com/google/template/soy/soytree/MsgPlaceholderNode.java | MsgPlaceholderNode.shouldUseSameVarNameAs | @Override
public boolean shouldUseSameVarNameAs(MsgSubstUnitNode other) {
return (other instanceof MsgPlaceholderNode)
&& this.initialNodeKind == ((MsgPlaceholderNode) other).initialNodeKind
&& this.samenessKey.equals(((MsgPlaceholderNode) other).samenessKey);
} | java | @Override
public boolean shouldUseSameVarNameAs(MsgSubstUnitNode other) {
return (other instanceof MsgPlaceholderNode)
&& this.initialNodeKind == ((MsgPlaceholderNode) other).initialNodeKind
&& this.samenessKey.equals(((MsgPlaceholderNode) other).samenessKey);
} | [
"@",
"Override",
"public",
"boolean",
"shouldUseSameVarNameAs",
"(",
"MsgSubstUnitNode",
"other",
")",
"{",
"return",
"(",
"other",
"instanceof",
"MsgPlaceholderNode",
")",
"&&",
"this",
".",
"initialNodeKind",
"==",
"(",
"(",
"MsgPlaceholderNode",
")",
"other",
"... | Returns whether this node and the given other node are the same, such that they should be
represented by the same placeholder. | [
"Returns",
"whether",
"this",
"node",
"and",
"the",
"given",
"other",
"node",
"are",
"the",
"same",
"such",
"that",
"they",
"should",
"be",
"represented",
"by",
"the",
"same",
"placeholder",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/MsgPlaceholderNode.java#L99-L104 |
53,618 | google/closure-templates | java/src/com/google/template/soy/msgs/internal/IcuSyntaxUtils.java | IcuSyntaxUtils.icuEscape | @VisibleForTesting
static String icuEscape(String rawText) {
Matcher matcher = ICU_SYNTAX_CHAR_NEEDING_ESCAPE_PATTERN.matcher(rawText);
if (!matcher.find()) {
return rawText;
}
StringBuffer escapedTextSb = new StringBuffer();
do {
String repl = ICU_SYNTAX_CHAR_ESCAPE_MAP.get(matcher.... | java | @VisibleForTesting
static String icuEscape(String rawText) {
Matcher matcher = ICU_SYNTAX_CHAR_NEEDING_ESCAPE_PATTERN.matcher(rawText);
if (!matcher.find()) {
return rawText;
}
StringBuffer escapedTextSb = new StringBuffer();
do {
String repl = ICU_SYNTAX_CHAR_ESCAPE_MAP.get(matcher.... | [
"@",
"VisibleForTesting",
"static",
"String",
"icuEscape",
"(",
"String",
"rawText",
")",
"{",
"Matcher",
"matcher",
"=",
"ICU_SYNTAX_CHAR_NEEDING_ESCAPE_PATTERN",
".",
"matcher",
"(",
"rawText",
")",
";",
"if",
"(",
"!",
"matcher",
".",
"find",
"(",
")",
")",... | Escapes ICU syntax characters in raw text.
@param rawText The raw text to escaped.
@return The escaped raw text. If the given raw text doesn't need escaping, then the same string
object is returned. | [
"Escapes",
"ICU",
"syntax",
"characters",
"in",
"raw",
"text",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/internal/IcuSyntaxUtils.java#L240-L255 |
53,619 | google/closure-templates | java/src/com/google/template/soy/msgs/restricted/RenderOnlySoyMsgBundleImpl.java | RenderOnlySoyMsgBundleImpl.resurrectMsg | @SuppressWarnings("unchecked") // The constructor guarantees the type of ImmutableList.
private SoyMsg resurrectMsg(long id, ImmutableList<SoyMsgPart> parts) {
return SoyMsg.builder()
.setId(id)
.setLocaleString(localeString)
.setIsPlrselMsg(MsgPartUtils.hasPlrselPart(parts))
.setP... | java | @SuppressWarnings("unchecked") // The constructor guarantees the type of ImmutableList.
private SoyMsg resurrectMsg(long id, ImmutableList<SoyMsgPart> parts) {
return SoyMsg.builder()
.setId(id)
.setLocaleString(localeString)
.setIsPlrselMsg(MsgPartUtils.hasPlrselPart(parts))
.setP... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// The constructor guarantees the type of ImmutableList.",
"private",
"SoyMsg",
"resurrectMsg",
"(",
"long",
"id",
",",
"ImmutableList",
"<",
"SoyMsgPart",
">",
"parts",
")",
"{",
"return",
"SoyMsg",
".",
"builder",
... | Brings a message back to life from only its ID and parts. | [
"Brings",
"a",
"message",
"back",
"to",
"life",
"from",
"only",
"its",
"ID",
"and",
"parts",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/restricted/RenderOnlySoyMsgBundleImpl.java#L103-L111 |
53,620 | google/closure-templates | java/src/com/google/template/soy/exprtree/VarRefNode.java | VarRefNode.isPossibleHeaderVar | public Boolean isPossibleHeaderVar() {
if (defn == null) {
throw new NullPointerException(getSourceLocation().toString());
}
return defn.kind() == VarDefn.Kind.PARAM
|| defn.kind() == VarDefn.Kind.STATE
|| defn.kind() == VarDefn.Kind.UNDECLARED;
} | java | public Boolean isPossibleHeaderVar() {
if (defn == null) {
throw new NullPointerException(getSourceLocation().toString());
}
return defn.kind() == VarDefn.Kind.PARAM
|| defn.kind() == VarDefn.Kind.STATE
|| defn.kind() == VarDefn.Kind.UNDECLARED;
} | [
"public",
"Boolean",
"isPossibleHeaderVar",
"(",
")",
"{",
"if",
"(",
"defn",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"getSourceLocation",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"defn",
".",
"kind",
"("... | Returns whether this might be header variable reference. A header variable is declared in Soy
with the @param or @state annotation. | [
"Returns",
"whether",
"this",
"might",
"be",
"header",
"variable",
"reference",
".",
"A",
"header",
"variable",
"is",
"declared",
"in",
"Soy",
"with",
"the"
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/exprtree/VarRefNode.java#L121-L128 |
53,621 | google/closure-templates | java/src/com/google/template/soy/soytree/AbstractParentCommandNode.java | AbstractParentCommandNode.firstChildThatMatches | @Nullable
public SoyNode firstChildThatMatches(Predicate<SoyNode> condition) {
int firstChildIndex = 0;
while (firstChildIndex < numChildren() && !condition.test(getChild(firstChildIndex))) {
firstChildIndex++;
}
if (firstChildIndex < numChildren()) {
return getChild(firstChildIndex);
... | java | @Nullable
public SoyNode firstChildThatMatches(Predicate<SoyNode> condition) {
int firstChildIndex = 0;
while (firstChildIndex < numChildren() && !condition.test(getChild(firstChildIndex))) {
firstChildIndex++;
}
if (firstChildIndex < numChildren()) {
return getChild(firstChildIndex);
... | [
"@",
"Nullable",
"public",
"SoyNode",
"firstChildThatMatches",
"(",
"Predicate",
"<",
"SoyNode",
">",
"condition",
")",
"{",
"int",
"firstChildIndex",
"=",
"0",
";",
"while",
"(",
"firstChildIndex",
"<",
"numChildren",
"(",
")",
"&&",
"!",
"condition",
".",
... | Returns the template's first child node that matches the given condition. | [
"Returns",
"the",
"template",
"s",
"first",
"child",
"node",
"that",
"matches",
"the",
"given",
"condition",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/AbstractParentCommandNode.java#L140-L150 |
53,622 | google/closure-templates | java/src/com/google/template/soy/soytree/AbstractParentCommandNode.java | AbstractParentCommandNode.lastChildThatMatches | @Nullable
public SoyNode lastChildThatMatches(Predicate<SoyNode> condition) {
int lastChildIndex = numChildren() - 1;
while (lastChildIndex >= 0 && !condition.test(getChild(lastChildIndex))) {
lastChildIndex--;
}
if (lastChildIndex >= 0) {
return getChild(lastChildIndex);
}
return ... | java | @Nullable
public SoyNode lastChildThatMatches(Predicate<SoyNode> condition) {
int lastChildIndex = numChildren() - 1;
while (lastChildIndex >= 0 && !condition.test(getChild(lastChildIndex))) {
lastChildIndex--;
}
if (lastChildIndex >= 0) {
return getChild(lastChildIndex);
}
return ... | [
"@",
"Nullable",
"public",
"SoyNode",
"lastChildThatMatches",
"(",
"Predicate",
"<",
"SoyNode",
">",
"condition",
")",
"{",
"int",
"lastChildIndex",
"=",
"numChildren",
"(",
")",
"-",
"1",
";",
"while",
"(",
"lastChildIndex",
">=",
"0",
"&&",
"!",
"condition... | Returns the template's last child node that matches the given condition. | [
"Returns",
"the",
"template",
"s",
"last",
"child",
"node",
"that",
"matches",
"the",
"given",
"condition",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/AbstractParentCommandNode.java#L153-L163 |
53,623 | google/closure-templates | java/src/com/google/template/soy/soyparse/SoyParseUtils.java | SoyParseUtils.calculateFullCalleeName | @SuppressWarnings("unused") // called in SoyFileParser.jj
public static final String calculateFullCalleeName(
Identifier ident, SoyFileHeaderInfo header, ErrorReporter errorReporter) {
String name = ident.identifier();
switch (ident.type()) {
case DOT_IDENT:
// Case 1: Source callee name ... | java | @SuppressWarnings("unused") // called in SoyFileParser.jj
public static final String calculateFullCalleeName(
Identifier ident, SoyFileHeaderInfo header, ErrorReporter errorReporter) {
String name = ident.identifier();
switch (ident.type()) {
case DOT_IDENT:
// Case 1: Source callee name ... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"// called in SoyFileParser.jj",
"public",
"static",
"final",
"String",
"calculateFullCalleeName",
"(",
"Identifier",
"ident",
",",
"SoyFileHeaderInfo",
"header",
",",
"ErrorReporter",
"errorReporter",
")",
"{",
"String",
... | Given a template call and file header info, return the expanded callee name if possible. | [
"Given",
"a",
"template",
"call",
"and",
"file",
"header",
"info",
"return",
"the",
"expanded",
"callee",
"name",
"if",
"possible",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/SoyParseUtils.java#L41-L66 |
53,624 | google/closure-templates | java/src/com/google/template/soy/soyparse/SoyParseUtils.java | SoyParseUtils.unescapeString | @SuppressWarnings("unused") // called in SoyFileParser.jj
public static String unescapeString(String s, ErrorReporter errorReporter, SourceLocation loc) {
StringBuilder sb = new StringBuilder(s.length());
for (int i = 0; i < s.length(); ) {
char c = s.charAt(i);
if (c == '\\') {
i = doUnes... | java | @SuppressWarnings("unused") // called in SoyFileParser.jj
public static String unescapeString(String s, ErrorReporter errorReporter, SourceLocation loc) {
StringBuilder sb = new StringBuilder(s.length());
for (int i = 0; i < s.length(); ) {
char c = s.charAt(i);
if (c == '\\') {
i = doUnes... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"// called in SoyFileParser.jj",
"public",
"static",
"String",
"unescapeString",
"(",
"String",
"s",
",",
"ErrorReporter",
"errorReporter",
",",
"SourceLocation",
"loc",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"S... | Unescapes a Soy string, according to JavaScript rules. | [
"Unescapes",
"a",
"Soy",
"string",
"according",
"to",
"JavaScript",
"rules",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/SoyParseUtils.java#L69-L82 |
53,625 | google/closure-templates | java/src/com/google/template/soy/soyparse/SoyParseUtils.java | SoyParseUtils.doUnescape | private static int doUnescape(
String s, int i, StringBuilder sb, ErrorReporter errorReporter, SourceLocation loc) {
checkArgument(i < s.length(), "Found escape sequence at the end of a string.");
char c = s.charAt(i++);
switch (c) {
case 'n':
sb.append('\n');
break;
case ... | java | private static int doUnescape(
String s, int i, StringBuilder sb, ErrorReporter errorReporter, SourceLocation loc) {
checkArgument(i < s.length(), "Found escape sequence at the end of a string.");
char c = s.charAt(i++);
switch (c) {
case 'n':
sb.append('\n');
break;
case ... | [
"private",
"static",
"int",
"doUnescape",
"(",
"String",
"s",
",",
"int",
"i",
",",
"StringBuilder",
"sb",
",",
"ErrorReporter",
"errorReporter",
",",
"SourceLocation",
"loc",
")",
"{",
"checkArgument",
"(",
"i",
"<",
"s",
".",
"length",
"(",
")",
",",
"... | Looks for an escape code starting at index i of s, and appends it to sb.
@return the index of the first character in s after the escape code. | [
"Looks",
"for",
"an",
"escape",
"code",
"starting",
"at",
"index",
"i",
"of",
"s",
"and",
"appends",
"it",
"to",
"sb",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/SoyParseUtils.java#L89-L163 |
53,626 | google/closure-templates | java/src/com/google/template/soy/soyparse/SoyParseUtils.java | SoyParseUtils.unescapeCommandAttributeValue | static String unescapeCommandAttributeValue(String s, QuoteStyle quoteStyle) {
// NOTE: we don't just use String.replace since it internally allocates/compiles a regular
// expression. Instead we have a handrolled loop.
int index = s.indexOf(quoteStyle == QuoteStyle.DOUBLE ? "\\\"" : "\\\'");
if (index... | java | static String unescapeCommandAttributeValue(String s, QuoteStyle quoteStyle) {
// NOTE: we don't just use String.replace since it internally allocates/compiles a regular
// expression. Instead we have a handrolled loop.
int index = s.indexOf(quoteStyle == QuoteStyle.DOUBLE ? "\\\"" : "\\\'");
if (index... | [
"static",
"String",
"unescapeCommandAttributeValue",
"(",
"String",
"s",
",",
"QuoteStyle",
"quoteStyle",
")",
"{",
"// NOTE: we don't just use String.replace since it internally allocates/compiles a regular",
"// expression. Instead we have a handrolled loop.",
"int",
"index",
"=",
... | Unescapes backslash quote sequences in an attribute value to just the quote. | [
"Unescapes",
"backslash",
"quote",
"sequences",
"in",
"an",
"attribute",
"value",
"to",
"just",
"the",
"quote",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/SoyParseUtils.java#L170-L188 |
53,627 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java | FieldRef.defineField | public void defineField(ClassVisitor cv) {
cv.visitField(
accessFlags(),
name(),
type().getDescriptor(),
null /* no generic signature */,
null /* no initializer */);
} | java | public void defineField(ClassVisitor cv) {
cv.visitField(
accessFlags(),
name(),
type().getDescriptor(),
null /* no generic signature */,
null /* no initializer */);
} | [
"public",
"void",
"defineField",
"(",
"ClassVisitor",
"cv",
")",
"{",
"cv",
".",
"visitField",
"(",
"accessFlags",
"(",
")",
",",
"name",
"(",
")",
",",
"type",
"(",
")",
".",
"getDescriptor",
"(",
")",
",",
"null",
"/* no generic signature */",
",",
"nu... | Defines the given field as member of the class. | [
"Defines",
"the",
"given",
"field",
"as",
"member",
"of",
"the",
"class",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java#L140-L147 |
53,628 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java | FieldRef.accessor | public Expression accessor(final Expression owner) {
checkState(!isStatic());
checkArgument(owner.resultType().equals(this.owner().type()));
Features features = Features.of();
if (owner.isCheap()) {
features = features.plus(Feature.CHEAP);
}
if (!isNullable()) {
features = features.p... | java | public Expression accessor(final Expression owner) {
checkState(!isStatic());
checkArgument(owner.resultType().equals(this.owner().type()));
Features features = Features.of();
if (owner.isCheap()) {
features = features.plus(Feature.CHEAP);
}
if (!isNullable()) {
features = features.p... | [
"public",
"Expression",
"accessor",
"(",
"final",
"Expression",
"owner",
")",
"{",
"checkState",
"(",
"!",
"isStatic",
"(",
")",
")",
";",
"checkArgument",
"(",
"owner",
".",
"resultType",
"(",
")",
".",
"equals",
"(",
"this",
".",
"owner",
"(",
")",
"... | Returns an accessor that accesses this field on the given owner. | [
"Returns",
"an",
"accessor",
"that",
"accesses",
"this",
"field",
"on",
"the",
"given",
"owner",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java#L157-L174 |
53,629 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java | FieldRef.accessor | public Expression accessor() {
checkState(isStatic());
Features features = Features.of(Feature.CHEAP);
if (!isNullable()) {
features = features.plus(Feature.NON_NULLABLE);
}
return new Expression(type(), features) {
@Override
protected void doGen(CodeBuilder mv) {
accessSta... | java | public Expression accessor() {
checkState(isStatic());
Features features = Features.of(Feature.CHEAP);
if (!isNullable()) {
features = features.plus(Feature.NON_NULLABLE);
}
return new Expression(type(), features) {
@Override
protected void doGen(CodeBuilder mv) {
accessSta... | [
"public",
"Expression",
"accessor",
"(",
")",
"{",
"checkState",
"(",
"isStatic",
"(",
")",
")",
";",
"Features",
"features",
"=",
"Features",
".",
"of",
"(",
"Feature",
".",
"CHEAP",
")",
";",
"if",
"(",
"!",
"isNullable",
"(",
")",
")",
"{",
"featu... | Returns an expression that accesses this static field. | [
"Returns",
"an",
"expression",
"that",
"accesses",
"this",
"static",
"field",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java#L177-L189 |
53,630 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java | FieldRef.accessStaticUnchecked | void accessStaticUnchecked(CodeBuilder mv) {
checkState(isStatic());
mv.getStatic(owner().type(), FieldRef.this.name(), type());
} | java | void accessStaticUnchecked(CodeBuilder mv) {
checkState(isStatic());
mv.getStatic(owner().type(), FieldRef.this.name(), type());
} | [
"void",
"accessStaticUnchecked",
"(",
"CodeBuilder",
"mv",
")",
"{",
"checkState",
"(",
"isStatic",
"(",
")",
")",
";",
"mv",
".",
"getStatic",
"(",
"owner",
"(",
")",
".",
"type",
"(",
")",
",",
"FieldRef",
".",
"this",
".",
"name",
"(",
")",
",",
... | Accesses a static field. | [
"Accesses",
"a",
"static",
"field",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java#L192-L195 |
53,631 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java | FieldRef.putUnchecked | public void putUnchecked(CodeBuilder adapter) {
checkState(!isStatic(), "This field is static!");
adapter.putField(owner().type(), name(), type());
} | java | public void putUnchecked(CodeBuilder adapter) {
checkState(!isStatic(), "This field is static!");
adapter.putField(owner().type(), name(), type());
} | [
"public",
"void",
"putUnchecked",
"(",
"CodeBuilder",
"adapter",
")",
"{",
"checkState",
"(",
"!",
"isStatic",
"(",
")",
",",
"\"This field is static!\"",
")",
";",
"adapter",
".",
"putField",
"(",
"owner",
"(",
")",
".",
"type",
"(",
")",
",",
"name",
"... | Adds code to place the top item of the stack into this field.
@throws IllegalStateException if this is a static field | [
"Adds",
"code",
"to",
"place",
"the",
"top",
"item",
"of",
"the",
"stack",
"into",
"this",
"field",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/FieldRef.java#L240-L243 |
53,632 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/TemplateFactoryCompiler.java | TemplateFactoryCompiler.compile | void compile() {
TypeInfo factoryType = innerClasses.registerInnerClass(FACTORY_CLASS, FACTORY_ACCESS);
SoyClassWriter cw =
SoyClassWriter.builder(factoryType)
.implementing(FACTORY_TYPE)
.setAccess(FACTORY_ACCESS)
.sourceFileName(templateNode.getSourceLocation().getF... | java | void compile() {
TypeInfo factoryType = innerClasses.registerInnerClass(FACTORY_CLASS, FACTORY_ACCESS);
SoyClassWriter cw =
SoyClassWriter.builder(factoryType)
.implementing(FACTORY_TYPE)
.setAccess(FACTORY_ACCESS)
.sourceFileName(templateNode.getSourceLocation().getF... | [
"void",
"compile",
"(",
")",
"{",
"TypeInfo",
"factoryType",
"=",
"innerClasses",
".",
"registerInnerClass",
"(",
"FACTORY_CLASS",
",",
"FACTORY_ACCESS",
")",
";",
"SoyClassWriter",
"cw",
"=",
"SoyClassWriter",
".",
"builder",
"(",
"factoryType",
")",
".",
"impl... | Compiles the factory. | [
"Compiles",
"the",
"factory",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/TemplateFactoryCompiler.java#L86-L101 |
53,633 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/RawTextContextUpdater.java | RawTextContextUpdater.processNextToken | private int processNextToken(RawTextNode node, final int offset, String text) {
// Find the transition whose pattern matches earliest in the raw text (and is applicable)
int numCharsConsumed;
Context next;
int earliestStart = Integer.MAX_VALUE;
int earliestEnd = -1;
Transition earliestTransition... | java | private int processNextToken(RawTextNode node, final int offset, String text) {
// Find the transition whose pattern matches earliest in the raw text (and is applicable)
int numCharsConsumed;
Context next;
int earliestStart = Integer.MAX_VALUE;
int earliestEnd = -1;
Transition earliestTransition... | [
"private",
"int",
"processNextToken",
"(",
"RawTextNode",
"node",
",",
"final",
"int",
"offset",
",",
"String",
"text",
")",
"{",
"// Find the transition whose pattern matches earliest in the raw text (and is applicable)",
"int",
"numCharsConsumed",
";",
"Context",
"next",
... | Consume a portion of text and compute the next context. Output is stored in member variables.
@param node The node currently being processed
@param offset The offset into the node where text starts
@param text Non empty.
@return the number of characters consumed | [
"Consume",
"a",
"portion",
"of",
"text",
"and",
"compute",
"the",
"next",
"context",
".",
"Output",
"is",
"stored",
"in",
"member",
"variables",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/RawTextContextUpdater.java#L120-L207 |
53,634 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/RawTextContextUpdater.java | RawTextContextUpdater.getNextUriPart | private static UriPart getNextUriPart(
RawTextNode node, int offset, UriPart uriPart, char matchChar) {
// This switch statement is designed to process a URI in order via a sequence of fall throughs.
switch (uriPart) {
case MAYBE_SCHEME:
case MAYBE_VARIABLE_SCHEME:
// From the RFC: htt... | java | private static UriPart getNextUriPart(
RawTextNode node, int offset, UriPart uriPart, char matchChar) {
// This switch statement is designed to process a URI in order via a sequence of fall throughs.
switch (uriPart) {
case MAYBE_SCHEME:
case MAYBE_VARIABLE_SCHEME:
// From the RFC: htt... | [
"private",
"static",
"UriPart",
"getNextUriPart",
"(",
"RawTextNode",
"node",
",",
"int",
"offset",
",",
"UriPart",
"uriPart",
",",
"char",
"matchChar",
")",
"{",
"// This switch statement is designed to process a URI in order via a sequence of fall throughs.",
"switch",
"(",... | Matching at the end is lowest possible precedence. | [
"Matching",
"at",
"the",
"end",
"is",
"lowest",
"possible",
"precedence",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/RawTextContextUpdater.java#L356-L446 |
53,635 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Expression.java | Expression.fromExpr | public static Expression fromExpr(JsExpr expr, Iterable<GoogRequire> requires) {
return Leaf.create(expr, /* isCheap= */ false, requires);
} | java | public static Expression fromExpr(JsExpr expr, Iterable<GoogRequire> requires) {
return Leaf.create(expr, /* isCheap= */ false, requires);
} | [
"public",
"static",
"Expression",
"fromExpr",
"(",
"JsExpr",
"expr",
",",
"Iterable",
"<",
"GoogRequire",
">",
"requires",
")",
"{",
"return",
"Leaf",
".",
"create",
"(",
"expr",
",",
"/* isCheap= */",
"false",
",",
"requires",
")",
";",
"}"
] | Creates a new code chunk from the given expression. The expression's precedence is preserved. | [
"Creates",
"a",
"new",
"code",
"chunk",
"from",
"the",
"given",
"expression",
".",
"The",
"expression",
"s",
"precedence",
"is",
"preserved",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Expression.java#L73-L75 |
53,636 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Expression.java | Expression.regexLiteral | public static Expression regexLiteral(String contents) {
int firstSlash = contents.indexOf('/');
int lastSlash = contents.lastIndexOf('/');
checkArgument(
firstSlash < lastSlash && firstSlash != -1,
"expected regex to start with a '/' and have a second '/' near the end, got %s",
cont... | java | public static Expression regexLiteral(String contents) {
int firstSlash = contents.indexOf('/');
int lastSlash = contents.lastIndexOf('/');
checkArgument(
firstSlash < lastSlash && firstSlash != -1,
"expected regex to start with a '/' and have a second '/' near the end, got %s",
cont... | [
"public",
"static",
"Expression",
"regexLiteral",
"(",
"String",
"contents",
")",
"{",
"int",
"firstSlash",
"=",
"contents",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"lastSlash",
"=",
"contents",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"check... | Creates a code chunk representing a JavaScript regular expression literal.
@param contents The regex literal (including the opening and closing slashes). | [
"Creates",
"a",
"code",
"chunk",
"representing",
"a",
"JavaScript",
"regular",
"expression",
"literal",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Expression.java#L144-L152 |
53,637 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Expression.java | Expression.number | public static Expression number(long value) {
Preconditions.checkArgument(
IntegerNode.isInRange(value), "Number is outside JS safe integer range: %s", value);
return Leaf.create(Long.toString(value), /* isCheap= */ true);
} | java | public static Expression number(long value) {
Preconditions.checkArgument(
IntegerNode.isInRange(value), "Number is outside JS safe integer range: %s", value);
return Leaf.create(Long.toString(value), /* isCheap= */ true);
} | [
"public",
"static",
"Expression",
"number",
"(",
"long",
"value",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"IntegerNode",
".",
"isInRange",
"(",
"value",
")",
",",
"\"Number is outside JS safe integer range: %s\"",
",",
"value",
")",
";",
"return",
"L... | Creates a code chunk representing a JavaScript number literal. | [
"Creates",
"a",
"code",
"chunk",
"representing",
"a",
"JavaScript",
"number",
"literal",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Expression.java#L155-L159 |
53,638 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Expression.java | Expression.function | public static Expression function(JsDoc parameters, Statement body) {
return FunctionDeclaration.create(parameters, body);
} | java | public static Expression function(JsDoc parameters, Statement body) {
return FunctionDeclaration.create(parameters, body);
} | [
"public",
"static",
"Expression",
"function",
"(",
"JsDoc",
"parameters",
",",
"Statement",
"body",
")",
"{",
"return",
"FunctionDeclaration",
".",
"create",
"(",
"parameters",
",",
"body",
")",
";",
"}"
] | Creates a code chunk representing an anonymous function literal. | [
"Creates",
"a",
"code",
"chunk",
"representing",
"an",
"anonymous",
"function",
"literal",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Expression.java#L167-L169 |
53,639 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Expression.java | Expression.arrowFunction | public static Expression arrowFunction(JsDoc parameters, Statement body) {
return FunctionDeclaration.createArrowFunction(parameters, body);
} | java | public static Expression arrowFunction(JsDoc parameters, Statement body) {
return FunctionDeclaration.createArrowFunction(parameters, body);
} | [
"public",
"static",
"Expression",
"arrowFunction",
"(",
"JsDoc",
"parameters",
",",
"Statement",
"body",
")",
"{",
"return",
"FunctionDeclaration",
".",
"createArrowFunction",
"(",
"parameters",
",",
"body",
")",
";",
"}"
] | Creates a code chunk representing an arrow function. | [
"Creates",
"a",
"code",
"chunk",
"representing",
"an",
"arrow",
"function",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Expression.java#L172-L174 |
53,640 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Expression.java | Expression.operation | public static Expression operation(Operator op, List<Expression> operands) {
Preconditions.checkArgument(operands.size() == op.getNumOperands());
Preconditions.checkArgument(
op != Operator.AND && op != Operator.OR && op != Operator.CONDITIONAL);
switch (op.getNumOperands()) {
case 1:
... | java | public static Expression operation(Operator op, List<Expression> operands) {
Preconditions.checkArgument(operands.size() == op.getNumOperands());
Preconditions.checkArgument(
op != Operator.AND && op != Operator.OR && op != Operator.CONDITIONAL);
switch (op.getNumOperands()) {
case 1:
... | [
"public",
"static",
"Expression",
"operation",
"(",
"Operator",
"op",
",",
"List",
"<",
"Expression",
">",
"operands",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"operands",
".",
"size",
"(",
")",
"==",
"op",
".",
"getNumOperands",
"(",
")",
")"... | Creates a code chunk representing the given Soy operator applied to the given operands.
<p>Cannot be used for {@link Operator#AND}, {@link Operator#OR}, or {@link
Operator#CONDITIONAL}, as they require access to a {@link Generator} to generate temporary
variables for short-circuiting. Use {@link Expression#and}, {@lin... | [
"Creates",
"a",
"code",
"chunk",
"representing",
"the",
"given",
"Soy",
"operator",
"applied",
"to",
"the",
"given",
"operands",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Expression.java#L198-L210 |
53,641 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Expression.java | Expression.arrayLiteral | public static Expression arrayLiteral(Iterable<? extends Expression> elements) {
return ArrayLiteral.create(ImmutableList.copyOf(elements));
} | java | public static Expression arrayLiteral(Iterable<? extends Expression> elements) {
return ArrayLiteral.create(ImmutableList.copyOf(elements));
} | [
"public",
"static",
"Expression",
"arrayLiteral",
"(",
"Iterable",
"<",
"?",
"extends",
"Expression",
">",
"elements",
")",
"{",
"return",
"ArrayLiteral",
".",
"create",
"(",
"ImmutableList",
".",
"copyOf",
"(",
"elements",
")",
")",
";",
"}"
] | Creates a code chunk representing a javascript array literal. | [
"Creates",
"a",
"code",
"chunk",
"representing",
"a",
"javascript",
"array",
"literal",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Expression.java#L213-L215 |
53,642 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Expression.java | Expression.withInitialStatements | public final Expression withInitialStatements(Iterable<? extends Statement> initialStatements) {
// If there are no new initial statements, return the current chunk.
if (Iterables.isEmpty(initialStatements)) {
return this;
}
// Otherwise, return a code chunk that includes all of the dependent code... | java | public final Expression withInitialStatements(Iterable<? extends Statement> initialStatements) {
// If there are no new initial statements, return the current chunk.
if (Iterables.isEmpty(initialStatements)) {
return this;
}
// Otherwise, return a code chunk that includes all of the dependent code... | [
"public",
"final",
"Expression",
"withInitialStatements",
"(",
"Iterable",
"<",
"?",
"extends",
"Statement",
">",
"initialStatements",
")",
"{",
"// If there are no new initial statements, return the current chunk.",
"if",
"(",
"Iterables",
".",
"isEmpty",
"(",
"initialStat... | Returns a chunk whose output expression is the same as this chunk's, but which includes the
given initial statements.
<p>This method is designed for interoperability with parts of the JS codegen system that do not
understand code chunks. For example, when applying plugin functions, {@link
com.google.template.soy.jssrc... | [
"Returns",
"a",
"chunk",
"whose",
"output",
"expression",
"is",
"the",
"same",
"as",
"this",
"chunk",
"s",
"but",
"which",
"includes",
"the",
"given",
"initial",
"statements",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Expression.java#L384-L391 |
53,643 | google/closure-templates | java/src/com/google/template/soy/passes/htmlmatcher/HtmlMatcherTagNode.java | HtmlMatcherTagNode.getTagKind | public TagKind getTagKind() {
if (htmlTagNode instanceof HtmlOpenTagNode) {
HtmlOpenTagNode openTagNode = (HtmlOpenTagNode) htmlTagNode;
if (openTagNode.isSelfClosing() || openTagNode.getTagName().isDefinitelyVoid()) {
return TagKind.VOID_TAG;
}
return TagKind.OPEN_TAG;
} else {
... | java | public TagKind getTagKind() {
if (htmlTagNode instanceof HtmlOpenTagNode) {
HtmlOpenTagNode openTagNode = (HtmlOpenTagNode) htmlTagNode;
if (openTagNode.isSelfClosing() || openTagNode.getTagName().isDefinitelyVoid()) {
return TagKind.VOID_TAG;
}
return TagKind.OPEN_TAG;
} else {
... | [
"public",
"TagKind",
"getTagKind",
"(",
")",
"{",
"if",
"(",
"htmlTagNode",
"instanceof",
"HtmlOpenTagNode",
")",
"{",
"HtmlOpenTagNode",
"openTagNode",
"=",
"(",
"HtmlOpenTagNode",
")",
"htmlTagNode",
";",
"if",
"(",
"openTagNode",
".",
"isSelfClosing",
"(",
")... | Returns the tag kind. | [
"Returns",
"the",
"tag",
"kind",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/htmlmatcher/HtmlMatcherTagNode.java#L60-L70 |
53,644 | google/closure-templates | java/src/com/google/template/soy/types/UnionType.java | UnionType.of | public static SoyType of(Collection<SoyType> members) {
// sort and flatten the set of types
ImmutableSortedSet.Builder<SoyType> builder = ImmutableSortedSet.orderedBy(MEMBER_ORDER);
for (SoyType type : members) {
// simplify unions containing these types
if (type.getKind() == Kind.UNKNOWN
... | java | public static SoyType of(Collection<SoyType> members) {
// sort and flatten the set of types
ImmutableSortedSet.Builder<SoyType> builder = ImmutableSortedSet.orderedBy(MEMBER_ORDER);
for (SoyType type : members) {
// simplify unions containing these types
if (type.getKind() == Kind.UNKNOWN
... | [
"public",
"static",
"SoyType",
"of",
"(",
"Collection",
"<",
"SoyType",
">",
"members",
")",
"{",
"// sort and flatten the set of types",
"ImmutableSortedSet",
".",
"Builder",
"<",
"SoyType",
">",
"builder",
"=",
"ImmutableSortedSet",
".",
"orderedBy",
"(",
"MEMBER_... | Create a union from a collection of types.
@param members Member types of the union.
@return Union of those types. If there is exactly one distinct type in members, then this will
not be a UnionType. | [
"Create",
"a",
"union",
"from",
"a",
"collection",
"of",
"types",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/UnionType.java#L74-L95 |
53,645 | google/closure-templates | java/src/com/google/template/soy/types/UnionType.java | UnionType.isNullable | public boolean isNullable() {
return members.stream().anyMatch(t -> t.getKind() == SoyType.Kind.NULL);
} | java | public boolean isNullable() {
return members.stream().anyMatch(t -> t.getKind() == SoyType.Kind.NULL);
} | [
"public",
"boolean",
"isNullable",
"(",
")",
"{",
"return",
"members",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"t",
"->",
"t",
".",
"getKind",
"(",
")",
"==",
"SoyType",
".",
"Kind",
".",
"NULL",
")",
";",
"}"
] | Returns true if the union includes the null type. | [
"Returns",
"true",
"if",
"the",
"union",
"includes",
"the",
"null",
"type",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/UnionType.java#L120-L122 |
53,646 | google/closure-templates | java/src/com/google/template/soy/types/UnionType.java | UnionType.removeNullability | public SoyType removeNullability() {
if (isNullable()) {
return of(
members.stream()
.filter(t -> t.getKind() != SoyType.Kind.NULL)
.collect(Collectors.toList()));
}
return this;
} | java | public SoyType removeNullability() {
if (isNullable()) {
return of(
members.stream()
.filter(t -> t.getKind() != SoyType.Kind.NULL)
.collect(Collectors.toList()));
}
return this;
} | [
"public",
"SoyType",
"removeNullability",
"(",
")",
"{",
"if",
"(",
"isNullable",
"(",
")",
")",
"{",
"return",
"of",
"(",
"members",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"t",
"->",
"t",
".",
"getKind",
"(",
")",
"!=",
"SoyType",
".",
"Kind... | Returns a Soy type that is equivalent to this one but with 'null' removed. | [
"Returns",
"a",
"Soy",
"type",
"that",
"is",
"equivalent",
"to",
"this",
"one",
"but",
"with",
"null",
"removed",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/UnionType.java#L125-L133 |
53,647 | google/closure-templates | java/src/com/google/template/soy/basetree/MixinParentNode.java | MixinParentNode.addChild | public void addChild(N child) {
checkNotNull(child);
tryRemoveFromOldParent(child);
children.add(child);
child.setParent(master);
} | java | public void addChild(N child) {
checkNotNull(child);
tryRemoveFromOldParent(child);
children.add(child);
child.setParent(master);
} | [
"public",
"void",
"addChild",
"(",
"N",
"child",
")",
"{",
"checkNotNull",
"(",
"child",
")",
";",
"tryRemoveFromOldParent",
"(",
"child",
")",
";",
"children",
".",
"add",
"(",
"child",
")",
";",
"child",
".",
"setParent",
"(",
"master",
")",
";",
"}"... | Adds the given child.
@param child The child to add. | [
"Adds",
"the",
"given",
"child",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basetree/MixinParentNode.java#L118-L123 |
53,648 | google/closure-templates | java/src/com/google/template/soy/basetree/MixinParentNode.java | MixinParentNode.removeChild | public void removeChild(int index) {
N child = children.remove(index);
child.setParent(null);
} | java | public void removeChild(int index) {
N child = children.remove(index);
child.setParent(null);
} | [
"public",
"void",
"removeChild",
"(",
"int",
"index",
")",
"{",
"N",
"child",
"=",
"children",
".",
"remove",
"(",
"index",
")",
";",
"child",
".",
"setParent",
"(",
"null",
")",
";",
"}"
] | Removes the child at the given index.
@param index The index of the child to remove. | [
"Removes",
"the",
"child",
"at",
"the",
"given",
"index",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basetree/MixinParentNode.java#L143-L146 |
53,649 | google/closure-templates | java/src/com/google/template/soy/basetree/MixinParentNode.java | MixinParentNode.replaceChild | public void replaceChild(int index, N newChild) {
checkNotNull(newChild);
tryRemoveFromOldParent(newChild);
N oldChild = children.set(index, newChild);
oldChild.setParent(null);
newChild.setParent(master);
} | java | public void replaceChild(int index, N newChild) {
checkNotNull(newChild);
tryRemoveFromOldParent(newChild);
N oldChild = children.set(index, newChild);
oldChild.setParent(null);
newChild.setParent(master);
} | [
"public",
"void",
"replaceChild",
"(",
"int",
"index",
",",
"N",
"newChild",
")",
"{",
"checkNotNull",
"(",
"newChild",
")",
";",
"tryRemoveFromOldParent",
"(",
"newChild",
")",
";",
"N",
"oldChild",
"=",
"children",
".",
"set",
"(",
"index",
",",
"newChil... | Replaces the child at the given index with the given new child.
@param index The index of the child to replace.
@param newChild The new child. | [
"Replaces",
"the",
"child",
"at",
"the",
"given",
"index",
"with",
"the",
"given",
"new",
"child",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basetree/MixinParentNode.java#L164-L170 |
53,650 | google/closure-templates | java/src/com/google/template/soy/basetree/MixinParentNode.java | MixinParentNode.clearChildren | public void clearChildren() {
for (int i = 0; i < children.size(); i++) {
children.get(i).setParent(null);
}
children.clear();
} | java | public void clearChildren() {
for (int i = 0; i < children.size(); i++) {
children.get(i).setParent(null);
}
children.clear();
} | [
"public",
"void",
"clearChildren",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"children",
".",
"get",
"(",
"i",
")",
".",
"setParent",
"(",
"null",
")",
";",
"}... | Clears the list of children. | [
"Clears",
"the",
"list",
"of",
"children",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basetree/MixinParentNode.java#L183-L188 |
53,651 | google/closure-templates | java/src/com/google/template/soy/basetree/MixinParentNode.java | MixinParentNode.addChildren | @SuppressWarnings("unchecked")
public void addChildren(List<? extends N> children) {
// NOTE: if the input list comes from another node, this could cause
// ConcurrentModificationExceptions as nodes are moved from one parent to another. To avoid
// this we make a copy of the input list.
for (Node chi... | java | @SuppressWarnings("unchecked")
public void addChildren(List<? extends N> children) {
// NOTE: if the input list comes from another node, this could cause
// ConcurrentModificationExceptions as nodes are moved from one parent to another. To avoid
// this we make a copy of the input list.
for (Node chi... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"addChildren",
"(",
"List",
"<",
"?",
"extends",
"N",
">",
"children",
")",
"{",
"// NOTE: if the input list comes from another node, this could cause",
"// ConcurrentModificationExceptions as nodes are moved... | Adds the given children.
@param children The children to add. | [
"Adds",
"the",
"given",
"children",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basetree/MixinParentNode.java#L195-L203 |
53,652 | google/closure-templates | java/src/com/google/template/soy/basetree/MixinParentNode.java | MixinParentNode.appendSourceStringForChildren | public void appendSourceStringForChildren(StringBuilder sb) {
for (N child : children) {
sb.append(child.toSourceString());
}
} | java | public void appendSourceStringForChildren(StringBuilder sb) {
for (N child : children) {
sb.append(child.toSourceString());
}
} | [
"public",
"void",
"appendSourceStringForChildren",
"(",
"StringBuilder",
"sb",
")",
"{",
"for",
"(",
"N",
"child",
":",
"children",
")",
"{",
"sb",
".",
"append",
"(",
"child",
".",
"toSourceString",
"(",
")",
")",
";",
"}",
"}"
] | Appends the source strings for all the children to the given StringBuilder.
@param sb The StringBuilder to which to append the children's source strings. | [
"Appends",
"the",
"source",
"strings",
"for",
"all",
"the",
"children",
"to",
"the",
"given",
"StringBuilder",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basetree/MixinParentNode.java#L229-L233 |
53,653 | google/closure-templates | java/src/com/google/template/soy/soytree/TemplateNodeBuilder.java | TemplateNodeBuilder.setId | public T setId(int id) {
Preconditions.checkState(this.id == null);
this.id = id;
return (T) this;
} | java | public T setId(int id) {
Preconditions.checkState(this.id == null);
this.id = id;
return (T) this;
} | [
"public",
"T",
"setId",
"(",
"int",
"id",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"this",
".",
"id",
"==",
"null",
")",
";",
"this",
".",
"id",
"=",
"id",
";",
"return",
"(",
"T",
")",
"this",
";",
"}"
] | Sets the id for the node to be built.
@return This builder. | [
"Sets",
"the",
"id",
"for",
"the",
"node",
"to",
"be",
"built",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TemplateNodeBuilder.java#L125-L129 |
53,654 | google/closure-templates | java/src/com/google/template/soy/soytree/TemplateNodeBuilder.java | TemplateNodeBuilder.setSoyDoc | public T setSoyDoc(String soyDoc, SourceLocation soyDocLocation) {
Preconditions.checkState(this.soyDoc == null);
Preconditions.checkState(cmdText != null);
int paramOffset = soyDoc.indexOf("@param");
if (paramOffset != -1) {
errorReporter.report(
new RawTextNode(-1, soyDoc, soyDocLocati... | java | public T setSoyDoc(String soyDoc, SourceLocation soyDocLocation) {
Preconditions.checkState(this.soyDoc == null);
Preconditions.checkState(cmdText != null);
int paramOffset = soyDoc.indexOf("@param");
if (paramOffset != -1) {
errorReporter.report(
new RawTextNode(-1, soyDoc, soyDocLocati... | [
"public",
"T",
"setSoyDoc",
"(",
"String",
"soyDoc",
",",
"SourceLocation",
"soyDocLocation",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"this",
".",
"soyDoc",
"==",
"null",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"cmdText",
"!=",
"null",
... | Sets the SoyDoc for the node to be built.
@return This builder. | [
"Sets",
"the",
"SoyDoc",
"for",
"the",
"node",
"to",
"be",
"built",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TemplateNodeBuilder.java#L193-L208 |
53,655 | google/closure-templates | java/src/com/google/template/soy/soytree/TemplateNodeBuilder.java | TemplateNodeBuilder.addParams | public T addParams(Iterable<? extends TemplateParam> newParams) {
Set<String> seenParamKeys = new HashSet<>();
if (this.params == null) {
this.params = ImmutableList.copyOf(newParams);
} else {
for (TemplateParam oldParam : this.params) {
seenParamKeys.add(oldParam.name());
}
... | java | public T addParams(Iterable<? extends TemplateParam> newParams) {
Set<String> seenParamKeys = new HashSet<>();
if (this.params == null) {
this.params = ImmutableList.copyOf(newParams);
} else {
for (TemplateParam oldParam : this.params) {
seenParamKeys.add(oldParam.name());
}
... | [
"public",
"T",
"addParams",
"(",
"Iterable",
"<",
"?",
"extends",
"TemplateParam",
">",
"newParams",
")",
"{",
"Set",
"<",
"String",
">",
"seenParamKeys",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"this",
".",
"params",
"==",
"null",
")",
... | This method is intended to be called at most once for header params.
@param newParams The params to add. | [
"This",
"method",
"is",
"intended",
"to",
"be",
"called",
"at",
"most",
"once",
"for",
"header",
"params",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TemplateNodeBuilder.java#L215-L238 |
53,656 | google/closure-templates | java/src/com/google/template/soy/soytree/SoyTreeUtils.java | SoyTreeUtils.getAllNodesOfType | public static <T extends Node> ImmutableList<T> getAllNodesOfType(
Node rootSoyNode, final Class<T> classObject) {
return getAllMatchingNodesOfType(rootSoyNode, classObject, arg -> true);
} | java | public static <T extends Node> ImmutableList<T> getAllNodesOfType(
Node rootSoyNode, final Class<T> classObject) {
return getAllMatchingNodesOfType(rootSoyNode, classObject, arg -> true);
} | [
"public",
"static",
"<",
"T",
"extends",
"Node",
">",
"ImmutableList",
"<",
"T",
">",
"getAllNodesOfType",
"(",
"Node",
"rootSoyNode",
",",
"final",
"Class",
"<",
"T",
">",
"classObject",
")",
"{",
"return",
"getAllMatchingNodesOfType",
"(",
"rootSoyNode",
","... | Retrieves all nodes in a tree that are an instance of a particular class.
@param <T> The type of node to retrieve.
@param rootSoyNode The parse tree to search.
@param classObject The class whose instances to search for, including subclasses.
@return The nodes in the order they appear. | [
"Retrieves",
"all",
"nodes",
"in",
"a",
"tree",
"that",
"are",
"an",
"instance",
"of",
"a",
"particular",
"class",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/SoyTreeUtils.java#L136-L139 |
53,657 | google/closure-templates | java/src/com/google/template/soy/soytree/SoyTreeUtils.java | SoyTreeUtils.getAllMatchingNodesOfType | private static <T extends Node> ImmutableList<T> getAllMatchingNodesOfType(
Node rootSoyNode, final Class<T> classObject, final Predicate<T> filter) {
final ImmutableList.Builder<T> matchedNodesBuilder = ImmutableList.builder();
// optimization to avoid navigating into expr trees if we can't possibly matc... | java | private static <T extends Node> ImmutableList<T> getAllMatchingNodesOfType(
Node rootSoyNode, final Class<T> classObject, final Predicate<T> filter) {
final ImmutableList.Builder<T> matchedNodesBuilder = ImmutableList.builder();
// optimization to avoid navigating into expr trees if we can't possibly matc... | [
"private",
"static",
"<",
"T",
"extends",
"Node",
">",
"ImmutableList",
"<",
"T",
">",
"getAllMatchingNodesOfType",
"(",
"Node",
"rootSoyNode",
",",
"final",
"Class",
"<",
"T",
">",
"classObject",
",",
"final",
"Predicate",
"<",
"T",
">",
"filter",
")",
"{... | Retrieves all nodes in a tree that are an instance of a particular class and match the given
predicate. | [
"Retrieves",
"all",
"nodes",
"in",
"a",
"tree",
"that",
"are",
"an",
"instance",
"of",
"a",
"particular",
"class",
"and",
"match",
"the",
"given",
"predicate",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/SoyTreeUtils.java#L145-L168 |
53,658 | google/closure-templates | java/src/com/google/template/soy/soytree/SoyTreeUtils.java | SoyTreeUtils.execOnAllV2Exprs | public static <R> void execOnAllV2Exprs(
SoyNode node, final AbstractNodeVisitor<ExprNode, R> exprNodeVisitor) {
visitAllNodes(
node,
new NodeVisitor<Node, VisitDirective>() {
@Override
public VisitDirective exec(Node node) {
if (node instanceof ExprHolderNode) ... | java | public static <R> void execOnAllV2Exprs(
SoyNode node, final AbstractNodeVisitor<ExprNode, R> exprNodeVisitor) {
visitAllNodes(
node,
new NodeVisitor<Node, VisitDirective>() {
@Override
public VisitDirective exec(Node node) {
if (node instanceof ExprHolderNode) ... | [
"public",
"static",
"<",
"R",
">",
"void",
"execOnAllV2Exprs",
"(",
"SoyNode",
"node",
",",
"final",
"AbstractNodeVisitor",
"<",
"ExprNode",
",",
"R",
">",
"exprNodeVisitor",
")",
"{",
"visitAllNodes",
"(",
"node",
",",
"new",
"NodeVisitor",
"<",
"Node",
","... | Given a Soy node and a visitor for expression trees, traverses the subtree of the node and
executes the visitor on all expressions held by nodes in the subtree.
<p>Only processes expressions in V2 syntax. Ignores all expressions in V1 syntax.
@param <R> The ExprNode visitor's return type.
@param node The root of the ... | [
"Given",
"a",
"Soy",
"node",
"and",
"a",
"visitor",
"for",
"expression",
"trees",
"traverses",
"the",
"subtree",
"of",
"the",
"node",
"and",
"executes",
"the",
"visitor",
"on",
"all",
"expressions",
"held",
"by",
"nodes",
"in",
"the",
"subtree",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/SoyTreeUtils.java#L242-L259 |
53,659 | google/closure-templates | java/src/com/google/template/soy/soytree/TagName.java | TagName.checkCloseTagClosesOptional | public static boolean checkCloseTagClosesOptional(TagName closeTag, TagName optionalOpenTag) {
// TODO(b/120994894): Replace this with checkArgument() when HtmlTagEntry can be replaced.
if (!optionalOpenTag.isStatic() || !optionalOpenTag.isDefinitelyOptional()) {
return false;
}
if (!closeTag.isSt... | java | public static boolean checkCloseTagClosesOptional(TagName closeTag, TagName optionalOpenTag) {
// TODO(b/120994894): Replace this with checkArgument() when HtmlTagEntry can be replaced.
if (!optionalOpenTag.isStatic() || !optionalOpenTag.isDefinitelyOptional()) {
return false;
}
if (!closeTag.isSt... | [
"public",
"static",
"boolean",
"checkCloseTagClosesOptional",
"(",
"TagName",
"closeTag",
",",
"TagName",
"optionalOpenTag",
")",
"{",
"// TODO(b/120994894): Replace this with checkArgument() when HtmlTagEntry can be replaced.",
"if",
"(",
"!",
"optionalOpenTag",
".",
"isStatic",... | Checks if the an open tag can be auto-closed by a following close tag which does not have the
same tag name as the open tag.
<p>We throws an {@code IllegalArgumentException} if two inputs have the same tag names, since
this should never happen (should be handled by previous logic in {@code
StrictHtmlValidationPass}).
... | [
"Checks",
"if",
"the",
"an",
"open",
"tag",
"can",
"be",
"auto",
"-",
"closed",
"by",
"a",
"following",
"close",
"tag",
"which",
"does",
"not",
"have",
"the",
"same",
"tag",
"name",
"as",
"the",
"open",
"tag",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TagName.java#L276-L291 |
53,660 | google/closure-templates | java/src/com/google/template/soy/soytree/TagName.java | TagName.checkOpenTagClosesOptional | public static boolean checkOpenTagClosesOptional(TagName openTag, TagName optionalOpenTag) {
checkArgument(optionalOpenTag.isDefinitelyOptional(), "Open tag is not optional.");
if (!(openTag.isStatic() && optionalOpenTag.isStatic())) {
return false;
}
String optionalTagName = optionalOpenTag.getSt... | java | public static boolean checkOpenTagClosesOptional(TagName openTag, TagName optionalOpenTag) {
checkArgument(optionalOpenTag.isDefinitelyOptional(), "Open tag is not optional.");
if (!(openTag.isStatic() && optionalOpenTag.isStatic())) {
return false;
}
String optionalTagName = optionalOpenTag.getSt... | [
"public",
"static",
"boolean",
"checkOpenTagClosesOptional",
"(",
"TagName",
"openTag",
",",
"TagName",
"optionalOpenTag",
")",
"{",
"checkArgument",
"(",
"optionalOpenTag",
".",
"isDefinitelyOptional",
"(",
")",
",",
"\"Open tag is not optional.\"",
")",
";",
"if",
"... | Checks if the given open tag can implicitly close the given optional tag.
<p>This implements the content model described in
https://www.w3.org/TR/html5/syntax.html#optional-tags.
<p><b>Note:</b>If {@code this} is a dynamic tag, then this test alsways returns {@code false}
because the tag name can't be determined at p... | [
"Checks",
"if",
"the",
"given",
"open",
"tag",
"can",
"implicitly",
"close",
"the",
"given",
"optional",
"tag",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TagName.java#L314-L322 |
53,661 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/SwitchBuilder.java | SwitchBuilder.addCase | public SwitchBuilder addCase(Expression caseLabel, Statement body) {
clauses.add(new Switch.CaseClause(ImmutableList.of(caseLabel), body));
return this;
} | java | public SwitchBuilder addCase(Expression caseLabel, Statement body) {
clauses.add(new Switch.CaseClause(ImmutableList.of(caseLabel), body));
return this;
} | [
"public",
"SwitchBuilder",
"addCase",
"(",
"Expression",
"caseLabel",
",",
"Statement",
"body",
")",
"{",
"clauses",
".",
"add",
"(",
"new",
"Switch",
".",
"CaseClause",
"(",
"ImmutableList",
".",
"of",
"(",
"caseLabel",
")",
",",
"body",
")",
")",
";",
... | Adds a case clause to this switch statement. | [
"Adds",
"a",
"case",
"clause",
"to",
"this",
"switch",
"statement",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/SwitchBuilder.java#L44-L47 |
53,662 | google/closure-templates | java/src/com/google/template/soy/soytree/CommandTagAttribute.java | CommandTagAttribute.valueAsExpr | public ExprNode valueAsExpr(ErrorReporter reporter) {
checkState(value == null);
if (valueExprList.size() > 1) {
reporter.report(
valueExprList.get(1).getSourceLocation(), EXPECTED_A_SINGLE_EXPRESSION, key.identifier());
// Return the first expr to avoid an NPE in CallNode ctor.
retu... | java | public ExprNode valueAsExpr(ErrorReporter reporter) {
checkState(value == null);
if (valueExprList.size() > 1) {
reporter.report(
valueExprList.get(1).getSourceLocation(), EXPECTED_A_SINGLE_EXPRESSION, key.identifier());
// Return the first expr to avoid an NPE in CallNode ctor.
retu... | [
"public",
"ExprNode",
"valueAsExpr",
"(",
"ErrorReporter",
"reporter",
")",
"{",
"checkState",
"(",
"value",
"==",
"null",
")",
";",
"if",
"(",
"valueExprList",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"reporter",
".",
"report",
"(",
"valueExprList",
"... | Returns the value as an expression. Only call on an expression attribute. | [
"Returns",
"the",
"value",
"as",
"an",
"expression",
".",
"Only",
"call",
"on",
"an",
"expression",
"attribute",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/CommandTagAttribute.java#L262-L271 |
53,663 | google/closure-templates | java/src/com/google/template/soy/soytree/MsgSubstUnitBaseVarNameUtils.java | MsgSubstUnitBaseVarNameUtils.genNoncollidingBaseNamesForExprs | public static List<String> genNoncollidingBaseNamesForExprs(
List<ExprNode> exprNodes, String fallbackBaseName, ErrorReporter errorReporter) {
int numExprs = exprNodes.size();
// --- Compute candidate base names for each expression. ---
List<List<String>> candidateBaseNameLists = Lists.newArrayListW... | java | public static List<String> genNoncollidingBaseNamesForExprs(
List<ExprNode> exprNodes, String fallbackBaseName, ErrorReporter errorReporter) {
int numExprs = exprNodes.size();
// --- Compute candidate base names for each expression. ---
List<List<String>> candidateBaseNameLists = Lists.newArrayListW... | [
"public",
"static",
"List",
"<",
"String",
">",
"genNoncollidingBaseNamesForExprs",
"(",
"List",
"<",
"ExprNode",
">",
"exprNodes",
",",
"String",
"fallbackBaseName",
",",
"ErrorReporter",
"errorReporter",
")",
"{",
"int",
"numExprs",
"=",
"exprNodes",
".",
"size"... | Generates base names for all the expressions in a list, where for each expression, we use the
shortest candidate base name that does not collide with any of the candidate base names
generated from other expressions in the list. Two candidate base names are considered to
collide if they are identical or if one is a suff... | [
"Generates",
"base",
"names",
"for",
"all",
"the",
"expressions",
"in",
"a",
"list",
"where",
"for",
"each",
"expression",
"we",
"use",
"the",
"shortest",
"candidate",
"base",
"name",
"that",
"does",
"not",
"collide",
"with",
"any",
"of",
"the",
"candidate",... | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/MsgSubstUnitBaseVarNameUtils.java#L148-L220 |
53,664 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/ConditionalExpressionBuilder.java | ConditionalExpressionBuilder.build | @CheckReturnValue
public Expression build(CodeChunk.Generator codeGenerator) {
ImmutableList<IfThenPair<Expression>> pairs = conditions.build();
Expression ternary = tryCreateTernary(pairs);
if (ternary != null) {
return ternary;
}
// Otherwise we need to introduce a temporary and assign to ... | java | @CheckReturnValue
public Expression build(CodeChunk.Generator codeGenerator) {
ImmutableList<IfThenPair<Expression>> pairs = conditions.build();
Expression ternary = tryCreateTernary(pairs);
if (ternary != null) {
return ternary;
}
// Otherwise we need to introduce a temporary and assign to ... | [
"@",
"CheckReturnValue",
"public",
"Expression",
"build",
"(",
"CodeChunk",
".",
"Generator",
"codeGenerator",
")",
"{",
"ImmutableList",
"<",
"IfThenPair",
"<",
"Expression",
">>",
"pairs",
"=",
"conditions",
".",
"build",
"(",
")",
";",
"Expression",
"ternary"... | Finishes building this conditional. | [
"Finishes",
"building",
"this",
"conditional",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/ConditionalExpressionBuilder.java#L73-L96 |
53,665 | google/closure-templates | java/src/com/google/template/soy/soyparse/RawTextBuilder.java | RawTextBuilder.addBasic | void addBasic(Token token) {
if (basicStart == -1) {
basicStart = buffer.length();
basicStartOfWhitespace = -1;
basicHasNewline = false;
}
switch (token.kind) {
case SoyFileParserConstants.TOKEN_WS:
if (token.image.indexOf('\r') != -1 || token.image.indexOf('\n') != -1) {
... | java | void addBasic(Token token) {
if (basicStart == -1) {
basicStart = buffer.length();
basicStartOfWhitespace = -1;
basicHasNewline = false;
}
switch (token.kind) {
case SoyFileParserConstants.TOKEN_WS:
if (token.image.indexOf('\r') != -1 || token.image.indexOf('\n') != -1) {
... | [
"void",
"addBasic",
"(",
"Token",
"token",
")",
"{",
"if",
"(",
"basicStart",
"==",
"-",
"1",
")",
"{",
"basicStart",
"=",
"buffer",
".",
"length",
"(",
")",
";",
"basicStartOfWhitespace",
"=",
"-",
"1",
";",
"basicHasNewline",
"=",
"false",
";",
"}",
... | Append a basic token. 'Basic' tokens are text literals. | [
"Append",
"a",
"basic",
"token",
".",
"Basic",
"tokens",
"are",
"text",
"literals",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/RawTextBuilder.java#L92-L117 |
53,666 | google/closure-templates | java/src/com/google/template/soy/soyparse/RawTextBuilder.java | RawTextBuilder.append | private void append(Token token, String content) {
if (content.isEmpty()) {
throw new IllegalStateException(
String.format(
"shouldn't append empty content: %s @ %s",
SoyFileParserConstants.tokenImage[token.kind], Tokens.createSrcLoc(fileName, token)));
}
// add a... | java | private void append(Token token, String content) {
if (content.isEmpty()) {
throw new IllegalStateException(
String.format(
"shouldn't append empty content: %s @ %s",
SoyFileParserConstants.tokenImage[token.kind], Tokens.createSrcLoc(fileName, token)));
}
// add a... | [
"private",
"void",
"append",
"(",
"Token",
"token",
",",
"String",
"content",
")",
"{",
"if",
"(",
"content",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"\"shouldn't append empty content: %s ... | updates the location with the given tokens location. | [
"updates",
"the",
"location",
"with",
"the",
"given",
"tokens",
"location",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/RawTextBuilder.java#L174-L210 |
53,667 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/shared/Names.java | Names.javaClassNameFromSoyTemplateName | public static String javaClassNameFromSoyTemplateName(String soyTemplate) {
checkArgument(
BaseUtils.isDottedIdentifier(soyTemplate), "%s is not a valid template name.", soyTemplate);
return CLASS_PREFIX + soyTemplate;
} | java | public static String javaClassNameFromSoyTemplateName(String soyTemplate) {
checkArgument(
BaseUtils.isDottedIdentifier(soyTemplate), "%s is not a valid template name.", soyTemplate);
return CLASS_PREFIX + soyTemplate;
} | [
"public",
"static",
"String",
"javaClassNameFromSoyTemplateName",
"(",
"String",
"soyTemplate",
")",
"{",
"checkArgument",
"(",
"BaseUtils",
".",
"isDottedIdentifier",
"(",
"soyTemplate",
")",
",",
"\"%s is not a valid template name.\"",
",",
"soyTemplate",
")",
";",
"r... | Translate a user controlled Soy name to a form that is safe to encode in a java class, method
or field name.
<p>Soy identifiers are very simple, they are restricted to the following regex: {@code
[a-zA-Z_]([a-zA-Z_0-9])*}. So a template name is just one or more identifiers separated by
{@code .} characters. To escape ... | [
"Translate",
"a",
"user",
"controlled",
"Soy",
"name",
"to",
"a",
"form",
"that",
"is",
"safe",
"to",
"encode",
"in",
"a",
"java",
"class",
"method",
"or",
"field",
"name",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/shared/Names.java#L48-L52 |
53,668 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/shared/Names.java | Names.javaFileName | public static String javaFileName(String soyNamespace, String fileName) {
checkArgument(
BaseUtils.isDottedIdentifier(soyNamespace),
"%s is not a valid soy namspace name.",
soyNamespace);
return (CLASS_PREFIX + soyNamespace).replace('.', '/') + '/' + fileName;
} | java | public static String javaFileName(String soyNamespace, String fileName) {
checkArgument(
BaseUtils.isDottedIdentifier(soyNamespace),
"%s is not a valid soy namspace name.",
soyNamespace);
return (CLASS_PREFIX + soyNamespace).replace('.', '/') + '/' + fileName;
} | [
"public",
"static",
"String",
"javaFileName",
"(",
"String",
"soyNamespace",
",",
"String",
"fileName",
")",
"{",
"checkArgument",
"(",
"BaseUtils",
".",
"isDottedIdentifier",
"(",
"soyNamespace",
")",
",",
"\"%s is not a valid soy namspace name.\"",
",",
"soyNamespace"... | Given the soy namespace and file name returns the path where the corresponding resource should
be stored. | [
"Given",
"the",
"soy",
"namespace",
"and",
"file",
"name",
"returns",
"the",
"path",
"where",
"the",
"corresponding",
"resource",
"should",
"be",
"stored",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/shared/Names.java#L58-L64 |
53,669 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/shared/Names.java | Names.rewriteStackTrace | public static void rewriteStackTrace(Throwable throwable) {
StackTraceElement[] stack = throwable.getStackTrace();
for (int i = 0; i < stack.length; i++) {
StackTraceElement curr = stack[i];
if (curr.getClassName().startsWith(CLASS_PREFIX)) {
stack[i] =
new StackTraceElement(
... | java | public static void rewriteStackTrace(Throwable throwable) {
StackTraceElement[] stack = throwable.getStackTrace();
for (int i = 0; i < stack.length; i++) {
StackTraceElement curr = stack[i];
if (curr.getClassName().startsWith(CLASS_PREFIX)) {
stack[i] =
new StackTraceElement(
... | [
"public",
"static",
"void",
"rewriteStackTrace",
"(",
"Throwable",
"throwable",
")",
"{",
"StackTraceElement",
"[",
"]",
"stack",
"=",
"throwable",
".",
"getStackTrace",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"stack",
".",
"lengt... | Rewrites the given stack trace by replacing all references to generated jbcsrc types with the
original template names. | [
"Rewrites",
"the",
"given",
"stack",
"trace",
"by",
"replacing",
"all",
"references",
"to",
"generated",
"jbcsrc",
"types",
"with",
"the",
"original",
"template",
"names",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/shared/Names.java#L82-L97 |
53,670 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/V1JsExprTranslator.java | V1JsExprTranslator.translateVar | private static String translateVar(SoyToJsVariableMappings variableMappings, Matcher matcher) {
Preconditions.checkArgument(matcher.matches());
String firstPart = matcher.group(1);
StringBuilder exprTextSb = new StringBuilder();
// ------ Translate the first key, which may be a variable or a data key ... | java | private static String translateVar(SoyToJsVariableMappings variableMappings, Matcher matcher) {
Preconditions.checkArgument(matcher.matches());
String firstPart = matcher.group(1);
StringBuilder exprTextSb = new StringBuilder();
// ------ Translate the first key, which may be a variable or a data key ... | [
"private",
"static",
"String",
"translateVar",
"(",
"SoyToJsVariableMappings",
"variableMappings",
",",
"Matcher",
"matcher",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
";",
"String",
"firstPart",
"=",
"matcher"... | Helper function to translate a variable or data reference.
<p>Examples:
<pre>
$boo --> opt_data.boo (var ref)
</pre>
@param variableMappings The current replacement JS expressions for the local variables (and
foreach-loop special functions) current in scope.
@param matcher Matcher formed from {@link V1JsExp... | [
"Helper",
"function",
"to",
"translate",
"a",
"variable",
"or",
"data",
"reference",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/V1JsExprTranslator.java#L143-L160 |
53,671 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsType.java | JsType.typeExprForRecordMember | public String typeExprForRecordMember(boolean isOptional) {
if (typeExpressions.size() > 1 || isOptional) {
// needs parens
return "("
+ typeExpr()
+ (isOptional && !typeExpressions.contains("undefined") ? "|undefined" : "")
+ ")";
}
return typeExpr();
} | java | public String typeExprForRecordMember(boolean isOptional) {
if (typeExpressions.size() > 1 || isOptional) {
// needs parens
return "("
+ typeExpr()
+ (isOptional && !typeExpressions.contains("undefined") ? "|undefined" : "")
+ ")";
}
return typeExpr();
} | [
"public",
"String",
"typeExprForRecordMember",
"(",
"boolean",
"isOptional",
")",
"{",
"if",
"(",
"typeExpressions",
".",
"size",
"(",
")",
">",
"1",
"||",
"isOptional",
")",
"{",
"// needs parens",
"return",
"\"(\"",
"+",
"typeExpr",
"(",
")",
"+",
"(",
"... | Returns a type expression for a record member. In some cases this requires additional parens. | [
"Returns",
"a",
"type",
"expression",
"for",
"a",
"record",
"member",
".",
"In",
"some",
"cases",
"this",
"requires",
"additional",
"parens",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsType.java#L508-L517 |
53,672 | google/closure-templates | java/src/com/google/template/soy/data/internal/DictImpl.java | DictImpl.forProviderMap | public static DictImpl forProviderMap(
Map<String, ? extends SoyValueProvider> providerMap, RuntimeMapTypeTracker.Type mapType) {
return new DictImpl(providerMap, mapType);
} | java | public static DictImpl forProviderMap(
Map<String, ? extends SoyValueProvider> providerMap, RuntimeMapTypeTracker.Type mapType) {
return new DictImpl(providerMap, mapType);
} | [
"public",
"static",
"DictImpl",
"forProviderMap",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"SoyValueProvider",
">",
"providerMap",
",",
"RuntimeMapTypeTracker",
".",
"Type",
"mapType",
")",
"{",
"return",
"new",
"DictImpl",
"(",
"providerMap",
",",
"mapTy... | Creates a SoyDict implementation for a particular underlying provider map.
<p>The map may be mutable, but will not be mutated by the DictImpl. | [
"Creates",
"a",
"SoyDict",
"implementation",
"for",
"a",
"particular",
"underlying",
"provider",
"map",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/internal/DictImpl.java#L85-L88 |
53,673 | google/closure-templates | java/src/com/google/template/soy/sharedpasses/render/RenderException.java | RenderException.concatWithJavaStackTrace | private StackTraceElement[] concatWithJavaStackTrace(StackTraceElement[] javaStackTrace) {
if (soyStackTrace.isEmpty()) {
return javaStackTrace;
}
StackTraceElement[] finalStackTrace =
new StackTraceElement[soyStackTrace.size() + javaStackTrace.length];
soyStackTrace.toArray(finalStackTra... | java | private StackTraceElement[] concatWithJavaStackTrace(StackTraceElement[] javaStackTrace) {
if (soyStackTrace.isEmpty()) {
return javaStackTrace;
}
StackTraceElement[] finalStackTrace =
new StackTraceElement[soyStackTrace.size() + javaStackTrace.length];
soyStackTrace.toArray(finalStackTra... | [
"private",
"StackTraceElement",
"[",
"]",
"concatWithJavaStackTrace",
"(",
"StackTraceElement",
"[",
"]",
"javaStackTrace",
")",
"{",
"if",
"(",
"soyStackTrace",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"javaStackTrace",
";",
"}",
"StackTraceElement",
"[",
... | Prepend the soy stack trace to the given standard java stack trace.
@param javaStackTrace The java stack trace to prepend. This should come from
Throwable#getStackTrace()
@return The combined stack trace to use. Callers should call Throwable#setStackTrace() to
override another Throwable's stack trace. | [
"Prepend",
"the",
"soy",
"stack",
"trace",
"to",
"the",
"given",
"standard",
"java",
"stack",
"trace",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/RenderException.java#L103-L114 |
53,674 | google/closure-templates | java/src/com/google/template/soy/data/restricted/CollectionData.java | CollectionData.put | public void put(Object... data) {
// TODO: Perhaps change to only convert varargs to Map, and do put(Map) elsewhere.
if (data.length % 2 != 0) {
throw new SoyDataException(
"Varargs to put(...) must have an even number of arguments (key-value pairs).");
}
for (int i = 0; i < data.length... | java | public void put(Object... data) {
// TODO: Perhaps change to only convert varargs to Map, and do put(Map) elsewhere.
if (data.length % 2 != 0) {
throw new SoyDataException(
"Varargs to put(...) must have an even number of arguments (key-value pairs).");
}
for (int i = 0; i < data.length... | [
"public",
"void",
"put",
"(",
"Object",
"...",
"data",
")",
"{",
"// TODO: Perhaps change to only convert varargs to Map, and do put(Map) elsewhere.",
"if",
"(",
"data",
".",
"length",
"%",
"2",
"!=",
"0",
")",
"{",
"throw",
"new",
"SoyDataException",
"(",
"\"Vararg... | Convenience function to put multiple mappings in one call.
@param data The mappings to put, as alternating keys/values. Indices 0, 2, 4, ... must be valid
key strings. Indices 1, 3, 5, ... must be valid Soy data values.
@throws SoyDataException When attempting to add an invalid varargs list or a mapping containing
an ... | [
"Convenience",
"function",
"to",
"put",
"multiple",
"mappings",
"in",
"one",
"call",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/restricted/CollectionData.java#L47-L64 |
53,675 | google/closure-templates | java/src/com/google/template/soy/data/restricted/CollectionData.java | CollectionData.remove | public void remove(String keyStr) {
List<String> keys = split(keyStr, '.');
int numKeys = keys.size();
CollectionData collectionData = this;
for (int i = 0; i <= numKeys - 2; ++i) {
SoyData soyData = collectionData.getSingle(keys.get(i));
if (!(soyData instanceof CollectionData)) {
... | java | public void remove(String keyStr) {
List<String> keys = split(keyStr, '.');
int numKeys = keys.size();
CollectionData collectionData = this;
for (int i = 0; i <= numKeys - 2; ++i) {
SoyData soyData = collectionData.getSingle(keys.get(i));
if (!(soyData instanceof CollectionData)) {
... | [
"public",
"void",
"remove",
"(",
"String",
"keyStr",
")",
"{",
"List",
"<",
"String",
">",
"keys",
"=",
"split",
"(",
"keyStr",
",",
"'",
"'",
")",
";",
"int",
"numKeys",
"=",
"keys",
".",
"size",
"(",
")",
";",
"CollectionData",
"collectionData",
"=... | Removes the data at the specified key string.
@param keyStr One or more map keys and/or list indices (separated by '.' if multiple parts).
Indicates the path to the location within this data tree. | [
"Removes",
"the",
"data",
"at",
"the",
"specified",
"key",
"string",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/restricted/CollectionData.java#L164-L179 |
53,676 | google/closure-templates | java/src/com/google/template/soy/data/restricted/CollectionData.java | CollectionData.split | private static List<String> split(String str, char delim) {
List<String> result = Lists.newArrayList();
int currPartStart = 0;
while (true) {
int currPartEnd = str.indexOf(delim, currPartStart);
if (currPartEnd == -1) {
result.add(str.substring(currPartStart));
break;
} e... | java | private static List<String> split(String str, char delim) {
List<String> result = Lists.newArrayList();
int currPartStart = 0;
while (true) {
int currPartEnd = str.indexOf(delim, currPartStart);
if (currPartEnd == -1) {
result.add(str.substring(currPartStart));
break;
} e... | [
"private",
"static",
"List",
"<",
"String",
">",
"split",
"(",
"String",
"str",
",",
"char",
"delim",
")",
"{",
"List",
"<",
"String",
">",
"result",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"int",
"currPartStart",
"=",
"0",
";",
"while",
"(... | Splits a string into tokens at the specified delimiter.
@param str The string to split. Must not be null.
@param delim The delimiter character.
@return A list of tokens. Will not return null. | [
"Splits",
"a",
"string",
"into",
"tokens",
"at",
"the",
"specified",
"delimiter",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/restricted/CollectionData.java#L369-L386 |
53,677 | google/closure-templates | java/src/com/google/template/soy/types/SoyTypes.java | SoyTypes.isNumericPrimitive | public static boolean isNumericPrimitive(SoyType type) {
SoyType.Kind kind = type.getKind();
if (NUMERIC_PRIMITIVES.contains(kind)) {
return true;
}
return type.isAssignableFrom(NUMBER_TYPE) || NUMBER_TYPE.isAssignableFrom(type);
} | java | public static boolean isNumericPrimitive(SoyType type) {
SoyType.Kind kind = type.getKind();
if (NUMERIC_PRIMITIVES.contains(kind)) {
return true;
}
return type.isAssignableFrom(NUMBER_TYPE) || NUMBER_TYPE.isAssignableFrom(type);
} | [
"public",
"static",
"boolean",
"isNumericPrimitive",
"(",
"SoyType",
"type",
")",
"{",
"SoyType",
".",
"Kind",
"kind",
"=",
"type",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"NUMERIC_PRIMITIVES",
".",
"contains",
"(",
"kind",
")",
")",
"{",
"return",
"tr... | Returns true if the input type is a numeric primitive type, such as int, float, proto enum, and
number. | [
"Returns",
"true",
"if",
"the",
"input",
"type",
"is",
"a",
"numeric",
"primitive",
"type",
"such",
"as",
"int",
"float",
"proto",
"enum",
"and",
"number",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypes.java#L62-L68 |
53,678 | google/closure-templates | java/src/com/google/template/soy/types/SoyTypes.java | SoyTypes.tryRemoveNull | public static SoyType tryRemoveNull(SoyType soyType) {
if (soyType == NullType.getInstance()) {
return NullType.getInstance();
}
return removeNull(soyType);
} | java | public static SoyType tryRemoveNull(SoyType soyType) {
if (soyType == NullType.getInstance()) {
return NullType.getInstance();
}
return removeNull(soyType);
} | [
"public",
"static",
"SoyType",
"tryRemoveNull",
"(",
"SoyType",
"soyType",
")",
"{",
"if",
"(",
"soyType",
"==",
"NullType",
".",
"getInstance",
"(",
")",
")",
"{",
"return",
"NullType",
".",
"getInstance",
"(",
")",
";",
"}",
"return",
"removeNull",
"(",
... | If the type is nullable, makes it non-nullable.
<p>If the type is the null type, then it returns the null type. | [
"If",
"the",
"type",
"is",
"nullable",
"makes",
"it",
"non",
"-",
"nullable",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypes.java#L83-L88 |
53,679 | google/closure-templates | java/src/com/google/template/soy/types/SoyTypes.java | SoyTypes.computeLowestCommonType | public static SoyType computeLowestCommonType(
SoyTypeRegistry typeRegistry, SoyType t0, SoyType t1) {
if (t0 == ErrorType.getInstance() || t1 == ErrorType.getInstance()) {
return ErrorType.getInstance();
}
if (t0.isAssignableFrom(t1)) {
return t0;
} else if (t1.isAssignableFrom(t0)) {... | java | public static SoyType computeLowestCommonType(
SoyTypeRegistry typeRegistry, SoyType t0, SoyType t1) {
if (t0 == ErrorType.getInstance() || t1 == ErrorType.getInstance()) {
return ErrorType.getInstance();
}
if (t0.isAssignableFrom(t1)) {
return t0;
} else if (t1.isAssignableFrom(t0)) {... | [
"public",
"static",
"SoyType",
"computeLowestCommonType",
"(",
"SoyTypeRegistry",
"typeRegistry",
",",
"SoyType",
"t0",
",",
"SoyType",
"t1",
")",
"{",
"if",
"(",
"t0",
"==",
"ErrorType",
".",
"getInstance",
"(",
")",
"||",
"t1",
"==",
"ErrorType",
".",
"get... | Compute the most specific type that is assignable from both t0 and t1.
@param typeRegistry Type registry.
@param t0 A type.
@param t1 Another type.
@return A type that is assignable from both t0 and t1. | [
"Compute",
"the",
"most",
"specific",
"type",
"that",
"is",
"assignable",
"from",
"both",
"t0",
"and",
"t1",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypes.java#L114-L127 |
53,680 | google/closure-templates | java/src/com/google/template/soy/types/SoyTypes.java | SoyTypes.computeLowestCommonType | public static SoyType computeLowestCommonType(
SoyTypeRegistry typeRegistry, Collection<SoyType> types) {
SoyType result = null;
for (SoyType type : types) {
result = (result == null) ? type : computeLowestCommonType(typeRegistry, result, type);
}
return result;
} | java | public static SoyType computeLowestCommonType(
SoyTypeRegistry typeRegistry, Collection<SoyType> types) {
SoyType result = null;
for (SoyType type : types) {
result = (result == null) ? type : computeLowestCommonType(typeRegistry, result, type);
}
return result;
} | [
"public",
"static",
"SoyType",
"computeLowestCommonType",
"(",
"SoyTypeRegistry",
"typeRegistry",
",",
"Collection",
"<",
"SoyType",
">",
"types",
")",
"{",
"SoyType",
"result",
"=",
"null",
";",
"for",
"(",
"SoyType",
"type",
":",
"types",
")",
"{",
"result",... | Compute the most specific type that is assignable from all types within a collection.
@param typeRegistry Type registry.
@param types List of types.
@return A type that is assignable from all of the listed types. | [
"Compute",
"the",
"most",
"specific",
"type",
"that",
"is",
"assignable",
"from",
"all",
"types",
"within",
"a",
"collection",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypes.java#L136-L143 |
53,681 | google/closure-templates | java/src/com/google/template/soy/types/SoyTypes.java | SoyTypes.computeLowestCommonTypeArithmetic | public static Optional<SoyType> computeLowestCommonTypeArithmetic(SoyType t0, SoyType t1) {
// If either of the types is an error type, return the error type
if (t0.getKind() == Kind.ERROR || t1.getKind() == Kind.ERROR) {
return Optional.of(ErrorType.getInstance());
}
// If either of the types isn... | java | public static Optional<SoyType> computeLowestCommonTypeArithmetic(SoyType t0, SoyType t1) {
// If either of the types is an error type, return the error type
if (t0.getKind() == Kind.ERROR || t1.getKind() == Kind.ERROR) {
return Optional.of(ErrorType.getInstance());
}
// If either of the types isn... | [
"public",
"static",
"Optional",
"<",
"SoyType",
">",
"computeLowestCommonTypeArithmetic",
"(",
"SoyType",
"t0",
",",
"SoyType",
"t1",
")",
"{",
"// If either of the types is an error type, return the error type",
"if",
"(",
"t0",
".",
"getKind",
"(",
")",
"==",
"Kind"... | Compute the most specific type that is assignable from both t0 and t1, taking into account
arithmetic promotions - that is, converting int to float if needed.
@param t0 A type.
@param t1 Another type.
@return A type that is assignable from both t0 and t1 or absent if the types are not arithmetic
meaning a subtype of '... | [
"Compute",
"the",
"most",
"specific",
"type",
"that",
"is",
"assignable",
"from",
"both",
"t0",
"and",
"t1",
"taking",
"into",
"account",
"arithmetic",
"promotions",
"-",
"that",
"is",
"converting",
"int",
"to",
"float",
"if",
"needed",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypes.java#L154-L176 |
53,682 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/DetachState.java | DetachState.detachForCall | Statement detachForCall(final Expression callRender) {
checkArgument(callRender.resultType().equals(RENDER_RESULT_TYPE));
final Label reattachRender = new Label();
final SaveRestoreState saveRestoreState = variables.saveRestoreState();
// We pass NULL statement for the restore logic since we handle that... | java | Statement detachForCall(final Expression callRender) {
checkArgument(callRender.resultType().equals(RENDER_RESULT_TYPE));
final Label reattachRender = new Label();
final SaveRestoreState saveRestoreState = variables.saveRestoreState();
// We pass NULL statement for the restore logic since we handle that... | [
"Statement",
"detachForCall",
"(",
"final",
"Expression",
"callRender",
")",
"{",
"checkArgument",
"(",
"callRender",
".",
"resultType",
"(",
")",
".",
"equals",
"(",
"RENDER_RESULT_TYPE",
")",
")",
";",
"final",
"Label",
"reattachRender",
"=",
"new",
"Label",
... | Generate detach logic for calls.
<p>Calls are a little different due to a desire to minimize the cost of detaches. We assume
that if a given call site detaches once, it is more likely to detach multiple times. So we
generate code that looks like:
<pre>{@code
RenderResult initialResult = template.render(appendable, re... | [
"Generate",
"detach",
"logic",
"for",
"calls",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/DetachState.java#L256-L294 |
53,683 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/DetachState.java | DetachState.generateReattachTable | Statement generateReattachTable() {
final Expression readField = stateField.accessor(thisExpr);
final Statement defaultCase =
Statement.throwExpression(MethodRef.RUNTIME_UNEXPECTED_STATE_ERROR.invoke(readField));
return new Statement() {
@Override
protected void doGen(final CodeBuilder a... | java | Statement generateReattachTable() {
final Expression readField = stateField.accessor(thisExpr);
final Statement defaultCase =
Statement.throwExpression(MethodRef.RUNTIME_UNEXPECTED_STATE_ERROR.invoke(readField));
return new Statement() {
@Override
protected void doGen(final CodeBuilder a... | [
"Statement",
"generateReattachTable",
"(",
")",
"{",
"final",
"Expression",
"readField",
"=",
"stateField",
".",
"accessor",
"(",
"thisExpr",
")",
";",
"final",
"Statement",
"defaultCase",
"=",
"Statement",
".",
"throwExpression",
"(",
"MethodRef",
".",
"RUNTIME_U... | Returns a statement that generates the reattach jump table.
<p>Note: This statement should be the <em>first</em> statement in any detachable method. | [
"Returns",
"a",
"statement",
"that",
"generates",
"the",
"reattach",
"jump",
"table",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/DetachState.java#L301-L346 |
53,684 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/DetachState.java | DetachState.addState | private int addState(Label reattachPoint, Statement restore) {
ReattachState create = ReattachState.create(reattachPoint, restore);
reattaches.add(create);
int state = reattaches.size() - 1; // the index of the ReattachState in the list
return state;
} | java | private int addState(Label reattachPoint, Statement restore) {
ReattachState create = ReattachState.create(reattachPoint, restore);
reattaches.add(create);
int state = reattaches.size() - 1; // the index of the ReattachState in the list
return state;
} | [
"private",
"int",
"addState",
"(",
"Label",
"reattachPoint",
",",
"Statement",
"restore",
")",
"{",
"ReattachState",
"create",
"=",
"ReattachState",
".",
"create",
"(",
"reattachPoint",
",",
"restore",
")",
";",
"reattaches",
".",
"add",
"(",
"create",
")",
... | Add a new state item and return the state. | [
"Add",
"a",
"new",
"state",
"item",
"and",
"return",
"the",
"state",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/DetachState.java#L349-L354 |
53,685 | google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Operation.java | Operation.shouldProtect | private boolean shouldProtect(Expression operand, OperandPosition operandPosition) {
if (operand instanceof Operation) {
Operation operation = (Operation) operand;
return operation.precedence() < this.precedence()
|| (operation.precedence() == this.precedence()
&& operandPosition... | java | private boolean shouldProtect(Expression operand, OperandPosition operandPosition) {
if (operand instanceof Operation) {
Operation operation = (Operation) operand;
return operation.precedence() < this.precedence()
|| (operation.precedence() == this.precedence()
&& operandPosition... | [
"private",
"boolean",
"shouldProtect",
"(",
"Expression",
"operand",
",",
"OperandPosition",
"operandPosition",
")",
"{",
"if",
"(",
"operand",
"instanceof",
"Operation",
")",
"{",
"Operation",
"operation",
"=",
"(",
"Operation",
")",
"operand",
";",
"return",
"... | An operand needs to be protected with parens if
<ul>
<li>its {@link #precedence} is lower than the operator's precedence, or
<li>its precedence is the same as the operator's, it is {@link Associativity#LEFT left
associative}, and it appears to the right of the operator, or
<li>its precedence is the same as the operato... | [
"An",
"operand",
"needs",
"to",
"be",
"protected",
"with",
"parens",
"if"
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Operation.java#L64-L77 |
53,686 | google/closure-templates | java/src/com/google/template/soy/sharedpasses/opti/SimplifyVisitor.java | SimplifyVisitor.create | public static SimplifyVisitor create(
IdGenerator idGenerator, ImmutableList<SoyFileNode> sourceFiles) {
return new SimplifyVisitor(
idGenerator, sourceFiles, new SimplifyExprVisitor(), new PreevalVisitorFactory());
} | java | public static SimplifyVisitor create(
IdGenerator idGenerator, ImmutableList<SoyFileNode> sourceFiles) {
return new SimplifyVisitor(
idGenerator, sourceFiles, new SimplifyExprVisitor(), new PreevalVisitorFactory());
} | [
"public",
"static",
"SimplifyVisitor",
"create",
"(",
"IdGenerator",
"idGenerator",
",",
"ImmutableList",
"<",
"SoyFileNode",
">",
"sourceFiles",
")",
"{",
"return",
"new",
"SimplifyVisitor",
"(",
"idGenerator",
",",
"sourceFiles",
",",
"new",
"SimplifyExprVisitor",
... | Creates a new simplify visitor. | [
"Creates",
"a",
"new",
"simplify",
"visitor",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/opti/SimplifyVisitor.java#L58-L62 |
53,687 | google/closure-templates | java/src/com/google/template/soy/msgs/internal/SoyMsgIdComputer.java | SoyMsgIdComputer.buildMsgContentStrForMsgIdComputation | @VisibleForTesting
static String buildMsgContentStrForMsgIdComputation(
ImmutableList<SoyMsgPart> msgParts, boolean doUseBracedPhs) {
msgParts = IcuSyntaxUtils.convertMsgPartsToEmbeddedIcuSyntax(msgParts);
StringBuilder msgStrSb = new StringBuilder();
for (SoyMsgPart msgPart : msgParts) {
... | java | @VisibleForTesting
static String buildMsgContentStrForMsgIdComputation(
ImmutableList<SoyMsgPart> msgParts, boolean doUseBracedPhs) {
msgParts = IcuSyntaxUtils.convertMsgPartsToEmbeddedIcuSyntax(msgParts);
StringBuilder msgStrSb = new StringBuilder();
for (SoyMsgPart msgPart : msgParts) {
... | [
"@",
"VisibleForTesting",
"static",
"String",
"buildMsgContentStrForMsgIdComputation",
"(",
"ImmutableList",
"<",
"SoyMsgPart",
">",
"msgParts",
",",
"boolean",
"doUseBracedPhs",
")",
"{",
"msgParts",
"=",
"IcuSyntaxUtils",
".",
"convertMsgPartsToEmbeddedIcuSyntax",
"(",
... | Private helper to build the canonical message content string that should be used for msg id
computation.
<p>Note: For people who know what "presentation" means in this context, the result string
should be exactly the presentation string.
@param msgParts The parts of the message.
@param doUseBracedPhs Whether to use b... | [
"Private",
"helper",
"to",
"build",
"the",
"canonical",
"message",
"content",
"string",
"that",
"should",
"be",
"used",
"for",
"msg",
"id",
"computation",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/internal/SoyMsgIdComputer.java#L129-L157 |
53,688 | google/closure-templates | java/src/com/google/template/soy/soyparse/ParseErrors.java | ParseErrors.formatParseExceptionDetails | private static String formatParseExceptionDetails(
String errorToken, List<String> expectedTokens) {
// quotes/normalize the expected tokens before rendering, just in case after normalization some
// can be deduplicated.
ImmutableSet.Builder<String> normalizedTokensBuilder = ImmutableSet.builder();
... | java | private static String formatParseExceptionDetails(
String errorToken, List<String> expectedTokens) {
// quotes/normalize the expected tokens before rendering, just in case after normalization some
// can be deduplicated.
ImmutableSet.Builder<String> normalizedTokensBuilder = ImmutableSet.builder();
... | [
"private",
"static",
"String",
"formatParseExceptionDetails",
"(",
"String",
"errorToken",
",",
"List",
"<",
"String",
">",
"expectedTokens",
")",
"{",
"// quotes/normalize the expected tokens before rendering, just in case after normalization some",
"// can be deduplicated.",
"Imm... | A helper method for formatting javacc ParseExceptions.
@param errorToken The piece of text that we were unable to parse.
@param expectedTokens The set of formatted tokens that we were expecting next. | [
"A",
"helper",
"method",
"for",
"formatting",
"javacc",
"ParseExceptions",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/ParseErrors.java#L287-L317 |
53,689 | google/closure-templates | java/src/com/google/template/soy/sharedpasses/render/EvalVisitor.java | EvalVisitor.maybeMarkBadProtoAccess | private static void maybeMarkBadProtoAccess(ExprNode expr, SoyValue value) {
if (value instanceof SoyProtoValue) {
((SoyProtoValue) value).setAccessLocationKey(expr.getSourceLocation());
}
} | java | private static void maybeMarkBadProtoAccess(ExprNode expr, SoyValue value) {
if (value instanceof SoyProtoValue) {
((SoyProtoValue) value).setAccessLocationKey(expr.getSourceLocation());
}
} | [
"private",
"static",
"void",
"maybeMarkBadProtoAccess",
"(",
"ExprNode",
"expr",
",",
"SoyValue",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"SoyProtoValue",
")",
"{",
"(",
"(",
"SoyProtoValue",
")",
"value",
")",
".",
"setAccessLocationKey",
"(",
"e... | If the value is a proto, then set the current access location since we are about to access it
incorrectly. | [
"If",
"the",
"value",
"is",
"a",
"proto",
"then",
"set",
"the",
"current",
"access",
"location",
"since",
"we",
"are",
"about",
"to",
"access",
"it",
"incorrectly",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/EvalVisitor.java#L481-L485 |
53,690 | google/closure-templates | java/src/com/google/template/soy/sharedpasses/render/EvalVisitor.java | EvalVisitor.isNullOrUndefinedBase | private static boolean isNullOrUndefinedBase(SoyValue base) {
return base == null
|| base instanceof NullData
|| base instanceof UndefinedData
|| base == NullSafetySentinel.INSTANCE;
} | java | private static boolean isNullOrUndefinedBase(SoyValue base) {
return base == null
|| base instanceof NullData
|| base instanceof UndefinedData
|| base == NullSafetySentinel.INSTANCE;
} | [
"private",
"static",
"boolean",
"isNullOrUndefinedBase",
"(",
"SoyValue",
"base",
")",
"{",
"return",
"base",
"==",
"null",
"||",
"base",
"instanceof",
"NullData",
"||",
"base",
"instanceof",
"UndefinedData",
"||",
"base",
"==",
"NullSafetySentinel",
".",
"INSTANC... | Returns true if the base SoyValue of a data access chain is null or undefined. | [
"Returns",
"true",
"if",
"the",
"base",
"SoyValue",
"of",
"a",
"data",
"access",
"chain",
"is",
"null",
"or",
"undefined",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/EvalVisitor.java#L488-L493 |
53,691 | google/closure-templates | java/src/com/google/template/soy/sharedpasses/opti/SimplifyExprVisitor.java | SimplifyExprVisitor.visitFieldAccessNode | @Override
protected void visitFieldAccessNode(FieldAccessNode node) {
// simplify children first
visitChildren(node);
ExprNode baseExpr = node.getChild(0);
if (baseExpr instanceof RecordLiteralNode) {
RecordLiteralNode recordLiteral = (RecordLiteralNode) baseExpr;
for (int i = 0; i < recor... | java | @Override
protected void visitFieldAccessNode(FieldAccessNode node) {
// simplify children first
visitChildren(node);
ExprNode baseExpr = node.getChild(0);
if (baseExpr instanceof RecordLiteralNode) {
RecordLiteralNode recordLiteral = (RecordLiteralNode) baseExpr;
for (int i = 0; i < recor... | [
"@",
"Override",
"protected",
"void",
"visitFieldAccessNode",
"(",
"FieldAccessNode",
"node",
")",
"{",
"// simplify children first",
"visitChildren",
"(",
"node",
")",
";",
"ExprNode",
"baseExpr",
"=",
"node",
".",
"getChild",
"(",
"0",
")",
";",
"if",
"(",
"... | this code since it desugars into a record literal. | [
"this",
"code",
"since",
"it",
"desugars",
"into",
"a",
"record",
"literal",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/opti/SimplifyExprVisitor.java#L148-L178 |
53,692 | google/closure-templates | java/src/com/google/template/soy/sharedpasses/opti/SimplifyExprVisitor.java | SimplifyExprVisitor.attemptPreeval | private void attemptPreeval(ExprNode node) {
// Note that we need to catch RenderException because preevaluation may fail, e.g. when
// (a) the expression uses a bidi function that needs bidiGlobalDir to be in scope, but the
// apiCallScope is not currently active,
// (b) the expression uses an ext... | java | private void attemptPreeval(ExprNode node) {
// Note that we need to catch RenderException because preevaluation may fail, e.g. when
// (a) the expression uses a bidi function that needs bidiGlobalDir to be in scope, but the
// apiCallScope is not currently active,
// (b) the expression uses an ext... | [
"private",
"void",
"attemptPreeval",
"(",
"ExprNode",
"node",
")",
"{",
"// Note that we need to catch RenderException because preevaluation may fail, e.g. when",
"// (a) the expression uses a bidi function that needs bidiGlobalDir to be in scope, but the",
"// apiCallScope is not currently ... | Attempts to preevaluate a node. If successful, the node is replaced with a new constant node in
the tree. If unsuccessful, the tree is not changed. | [
"Attempts",
"to",
"preevaluate",
"a",
"node",
".",
"If",
"successful",
"the",
"node",
"is",
"replaced",
"with",
"a",
"new",
"constant",
"node",
"in",
"the",
"tree",
".",
"If",
"unsuccessful",
"the",
"tree",
"is",
"not",
"changed",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/opti/SimplifyExprVisitor.java#L262-L282 |
53,693 | google/closure-templates | java/src/com/google/template/soy/sharedpasses/opti/SimplifyExprVisitor.java | SimplifyExprVisitor.getConstantOrNull | static SoyValue getConstantOrNull(ExprNode expr) {
switch (expr.getKind()) {
case NULL_NODE:
return NullData.INSTANCE;
case BOOLEAN_NODE:
return BooleanData.forValue(((BooleanNode) expr).getValue());
case INTEGER_NODE:
return IntegerData.forValue(((IntegerNode) expr).getVa... | java | static SoyValue getConstantOrNull(ExprNode expr) {
switch (expr.getKind()) {
case NULL_NODE:
return NullData.INSTANCE;
case BOOLEAN_NODE:
return BooleanData.forValue(((BooleanNode) expr).getValue());
case INTEGER_NODE:
return IntegerData.forValue(((IntegerNode) expr).getVa... | [
"static",
"SoyValue",
"getConstantOrNull",
"(",
"ExprNode",
"expr",
")",
"{",
"switch",
"(",
"expr",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"NULL_NODE",
":",
"return",
"NullData",
".",
"INSTANCE",
";",
"case",
"BOOLEAN_NODE",
":",
"return",
"BooleanData... | Returns the value of the given expression if it's constant, else returns null. | [
"Returns",
"the",
"value",
"of",
"the",
"given",
"expression",
"if",
"it",
"s",
"constant",
"else",
"returns",
"null",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/opti/SimplifyExprVisitor.java#L290-L312 |
53,694 | google/closure-templates | java/src/com/google/template/soy/internal/proto/FieldVisitor.java | FieldVisitor.visitField | public static <T> T visitField(FieldDescriptor fieldDescriptor, FieldVisitor<T> visitor) {
// NOTE: map fields are technically repeated, so check isMap first.
if (fieldDescriptor.isMapField()) {
List<FieldDescriptor> mapFields = fieldDescriptor.getMessageType().getFields();
checkState(mapFields.size... | java | public static <T> T visitField(FieldDescriptor fieldDescriptor, FieldVisitor<T> visitor) {
// NOTE: map fields are technically repeated, so check isMap first.
if (fieldDescriptor.isMapField()) {
List<FieldDescriptor> mapFields = fieldDescriptor.getMessageType().getFields();
checkState(mapFields.size... | [
"public",
"static",
"<",
"T",
">",
"T",
"visitField",
"(",
"FieldDescriptor",
"fieldDescriptor",
",",
"FieldVisitor",
"<",
"T",
">",
"visitor",
")",
"{",
"// NOTE: map fields are technically repeated, so check isMap first.",
"if",
"(",
"fieldDescriptor",
".",
"isMapFiel... | Applies the visitor to the given field. | [
"Applies",
"the",
"visitor",
"to",
"the",
"given",
"field",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/FieldVisitor.java#L36-L50 |
53,695 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java | JbcSrcJavaValue.error | static JbcSrcJavaValue error(Expression expr, JbcSrcValueErrorReporter reporter) {
return new JbcSrcJavaValue(
expr,
/* method= */ null,
/* allowedType= */ null,
/* constantNull= */ false,
/* error= */ true,
reporter);
} | java | static JbcSrcJavaValue error(Expression expr, JbcSrcValueErrorReporter reporter) {
return new JbcSrcJavaValue(
expr,
/* method= */ null,
/* allowedType= */ null,
/* constantNull= */ false,
/* error= */ true,
reporter);
} | [
"static",
"JbcSrcJavaValue",
"error",
"(",
"Expression",
"expr",
",",
"JbcSrcValueErrorReporter",
"reporter",
")",
"{",
"return",
"new",
"JbcSrcJavaValue",
"(",
"expr",
",",
"/* method= */",
"null",
",",
"/* allowedType= */",
"null",
",",
"/* constantNull= */",
"false... | Constructs a JbcSrcJavaValue that represents an error. | [
"Constructs",
"a",
"JbcSrcJavaValue",
"that",
"represents",
"an",
"error",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java#L39-L47 |
53,696 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java | JbcSrcJavaValue.of | static JbcSrcJavaValue of(Expression expr, JbcSrcValueErrorReporter reporter) {
if (expr instanceof SoyExpression) {
return new JbcSrcJavaValue(
expr,
/* method= */ null,
/* allowedType= */ ((SoyExpression) expr).soyType(),
/* constantNull= */ false,
/* error=... | java | static JbcSrcJavaValue of(Expression expr, JbcSrcValueErrorReporter reporter) {
if (expr instanceof SoyExpression) {
return new JbcSrcJavaValue(
expr,
/* method= */ null,
/* allowedType= */ ((SoyExpression) expr).soyType(),
/* constantNull= */ false,
/* error=... | [
"static",
"JbcSrcJavaValue",
"of",
"(",
"Expression",
"expr",
",",
"JbcSrcValueErrorReporter",
"reporter",
")",
"{",
"if",
"(",
"expr",
"instanceof",
"SoyExpression",
")",
"{",
"return",
"new",
"JbcSrcJavaValue",
"(",
"expr",
",",
"/* method= */",
"null",
",",
"... | Constructs a JbcSrcJavaValue based on the Expression. | [
"Constructs",
"a",
"JbcSrcJavaValue",
"based",
"on",
"the",
"Expression",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java#L50-L67 |
53,697 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java | JbcSrcJavaValue.of | static JbcSrcJavaValue of(Expression expr, Method method, JbcSrcValueErrorReporter reporter) {
checkNotNull(method);
if (expr instanceof SoyExpression) {
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ ((SoyExpression) expr).soyType(),
/* constantNull= ... | java | static JbcSrcJavaValue of(Expression expr, Method method, JbcSrcValueErrorReporter reporter) {
checkNotNull(method);
if (expr instanceof SoyExpression) {
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ ((SoyExpression) expr).soyType(),
/* constantNull= ... | [
"static",
"JbcSrcJavaValue",
"of",
"(",
"Expression",
"expr",
",",
"Method",
"method",
",",
"JbcSrcValueErrorReporter",
"reporter",
")",
"{",
"checkNotNull",
"(",
"method",
")",
";",
"if",
"(",
"expr",
"instanceof",
"SoyExpression",
")",
"{",
"return",
"new",
... | Constructs a JbcSrcJavaValue based on the Expression. The method is used to display helpful
error messages to the user if necessary. It is not invoked. | [
"Constructs",
"a",
"JbcSrcJavaValue",
"based",
"on",
"the",
"Expression",
".",
"The",
"method",
"is",
"used",
"to",
"display",
"helpful",
"error",
"messages",
"to",
"the",
"user",
"if",
"necessary",
".",
"It",
"is",
"not",
"invoked",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java#L73-L91 |
53,698 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java | JbcSrcJavaValue.of | static JbcSrcJavaValue of(
SoyExpression expr, SoyType allowedType, JbcSrcValueErrorReporter reporter) {
return new JbcSrcJavaValue(
expr,
/* method= */ null,
checkNotNull(allowedType),
/* constantNull= */ false,
/* error= */ false,
reporter);
} | java | static JbcSrcJavaValue of(
SoyExpression expr, SoyType allowedType, JbcSrcValueErrorReporter reporter) {
return new JbcSrcJavaValue(
expr,
/* method= */ null,
checkNotNull(allowedType),
/* constantNull= */ false,
/* error= */ false,
reporter);
} | [
"static",
"JbcSrcJavaValue",
"of",
"(",
"SoyExpression",
"expr",
",",
"SoyType",
"allowedType",
",",
"JbcSrcValueErrorReporter",
"reporter",
")",
"{",
"return",
"new",
"JbcSrcJavaValue",
"(",
"expr",
",",
"/* method= */",
"null",
",",
"checkNotNull",
"(",
"allowedTy... | Constructs a JbcSrcJavaValue based on the Expression, with the given SoyType as allowed types.
The SoyType is expected to be based on the function signature, so can be broader than the soy
type of the expression itself. The expression is expected to be assignable to the type. | [
"Constructs",
"a",
"JbcSrcJavaValue",
"based",
"on",
"the",
"Expression",
"with",
"the",
"given",
"SoyType",
"as",
"allowed",
"types",
".",
"The",
"SoyType",
"is",
"expected",
"to",
"be",
"based",
"on",
"the",
"function",
"signature",
"so",
"can",
"be",
"bro... | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java#L98-L107 |
53,699 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java | BytecodeUtils.classFromAsmType | public static Class<?> classFromAsmType(Type type) {
Optional<Class<?>> maybeClass = objectTypeToClassCache.getUnchecked(type);
if (!maybeClass.isPresent()) {
throw new IllegalArgumentException("Could not load: " + type);
}
return maybeClass.get();
} | java | public static Class<?> classFromAsmType(Type type) {
Optional<Class<?>> maybeClass = objectTypeToClassCache.getUnchecked(type);
if (!maybeClass.isPresent()) {
throw new IllegalArgumentException("Could not load: " + type);
}
return maybeClass.get();
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"classFromAsmType",
"(",
"Type",
"type",
")",
"{",
"Optional",
"<",
"Class",
"<",
"?",
">",
">",
"maybeClass",
"=",
"objectTypeToClassCache",
".",
"getUnchecked",
"(",
"type",
")",
";",
"if",
"(",
"!",
"maybeCl... | Returns the runtime class represented by the given type.
@throws IllegalArgumentException if the class cannot be found. It is expected that this method
will only be called for types that have a runtime on the compilers classpath. | [
"Returns",
"the",
"runtime",
"class",
"represented",
"by",
"the",
"given",
"type",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L220-L226 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.