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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
24,400 | google/closure-compiler | src/com/google/javascript/jscomp/DisambiguateProperties.java | DisambiguateProperties.recordInterfaces | private void recordInterfaces(FunctionType constructor, JSType relatedType, Property p) {
Iterable<ObjectType> interfaces = ancestorInterfaces.get(constructor);
if (interfaces == null) {
interfaces = constructor.getAncestorInterfaces();
ancestorInterfaces.put(constructor, interfaces);
}
for ... | java | private void recordInterfaces(FunctionType constructor, JSType relatedType, Property p) {
Iterable<ObjectType> interfaces = ancestorInterfaces.get(constructor);
if (interfaces == null) {
interfaces = constructor.getAncestorInterfaces();
ancestorInterfaces.put(constructor, interfaces);
}
for ... | [
"private",
"void",
"recordInterfaces",
"(",
"FunctionType",
"constructor",
",",
"JSType",
"relatedType",
",",
"Property",
"p",
")",
"{",
"Iterable",
"<",
"ObjectType",
">",
"interfaces",
"=",
"ancestorInterfaces",
".",
"get",
"(",
"constructor",
")",
";",
"if",
... | Records that this property could be referenced from any interface that this type inherits from.
<p>If the property p is defined only on a subtype of constructor, then this method has no
effect. But we tried modifying getTypeWithProperty to tell us when the returned type is a
subtype, and then skip those calls to recor... | [
"Records",
"that",
"this",
"property",
"could",
"be",
"referenced",
"from",
"any",
"interface",
"that",
"this",
"type",
"inherits",
"from",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DisambiguateProperties.java#L1099-L1115 |
24,401 | google/closure-compiler | src/com/google/javascript/jscomp/PureFunctionIdentifier.java | PureFunctionIdentifier.populateFunctionDefinitions | private void populateFunctionDefinitions(String name, List<Node> references) {
AmbiguatedFunctionSummary summaryForName = checkNotNull(summariesByName.get(name));
// Make sure we get absolutely every R-value assigned to `name` or at the very least detect
// there are some we're missing. Overlooking a singl... | java | private void populateFunctionDefinitions(String name, List<Node> references) {
AmbiguatedFunctionSummary summaryForName = checkNotNull(summariesByName.get(name));
// Make sure we get absolutely every R-value assigned to `name` or at the very least detect
// there are some we're missing. Overlooking a singl... | [
"private",
"void",
"populateFunctionDefinitions",
"(",
"String",
"name",
",",
"List",
"<",
"Node",
">",
"references",
")",
"{",
"AmbiguatedFunctionSummary",
"summaryForName",
"=",
"checkNotNull",
"(",
"summariesByName",
".",
"get",
"(",
"name",
")",
")",
";",
"/... | For a name and its set of references, record the set of functions that may define that name or
blacklist the name if there are unclear definitions.
@param name A variable or property name,
@param references The set of all nodes representing R- and L-value references to {@code name}. | [
"For",
"a",
"name",
"and",
"its",
"set",
"of",
"references",
"record",
"the",
"set",
"of",
"functions",
"that",
"may",
"define",
"that",
"name",
"or",
"blacklist",
"the",
"name",
"if",
"there",
"are",
"unclear",
"definitions",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PureFunctionIdentifier.java#L417-L460 |
24,402 | google/closure-compiler | src/com/google/javascript/jscomp/PureFunctionIdentifier.java | ExternFunctionAnnotationAnalyzer.updateSideEffectsForExternFunction | private void updateSideEffectsForExternFunction(
Node externFunction, AmbiguatedFunctionSummary summary) {
checkArgument(externFunction.isFunction());
checkArgument(externFunction.isFromExterns());
JSDocInfo info = NodeUtil.getBestJSDocInfo(externFunction);
// Handle externs.
JSTy... | java | private void updateSideEffectsForExternFunction(
Node externFunction, AmbiguatedFunctionSummary summary) {
checkArgument(externFunction.isFunction());
checkArgument(externFunction.isFromExterns());
JSDocInfo info = NodeUtil.getBestJSDocInfo(externFunction);
// Handle externs.
JSTy... | [
"private",
"void",
"updateSideEffectsForExternFunction",
"(",
"Node",
"externFunction",
",",
"AmbiguatedFunctionSummary",
"summary",
")",
"{",
"checkArgument",
"(",
"externFunction",
".",
"isFunction",
"(",
")",
")",
";",
"checkArgument",
"(",
"externFunction",
".",
"... | Update function for @nosideeffects annotations. | [
"Update",
"function",
"for"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PureFunctionIdentifier.java#L569-L605 |
24,403 | google/closure-compiler | src/com/google/javascript/jscomp/PureFunctionIdentifier.java | FunctionBodyAnalyzer.visitLhsNodes | private void visitLhsNodes(
AmbiguatedFunctionSummary sideEffectInfo,
Scope scope,
Node enclosingFunction,
List<Node> lhsNodes,
Predicate<Node> hasLocalRhs) {
for (Node lhs : lhsNodes) {
if (NodeUtil.isGet(lhs)) {
if (lhs.getFirstChild().isThis()) {
... | java | private void visitLhsNodes(
AmbiguatedFunctionSummary sideEffectInfo,
Scope scope,
Node enclosingFunction,
List<Node> lhsNodes,
Predicate<Node> hasLocalRhs) {
for (Node lhs : lhsNodes) {
if (NodeUtil.isGet(lhs)) {
if (lhs.getFirstChild().isThis()) {
... | [
"private",
"void",
"visitLhsNodes",
"(",
"AmbiguatedFunctionSummary",
"sideEffectInfo",
",",
"Scope",
"scope",
",",
"Node",
"enclosingFunction",
",",
"List",
"<",
"Node",
">",
"lhsNodes",
",",
"Predicate",
"<",
"Node",
">",
"hasLocalRhs",
")",
"{",
"for",
"(",
... | Record information about the side effects caused by assigning a value to a given LHS.
<p>If the operation modifies this or taints global state, mark the enclosing function as
having those side effects.
@param sideEffectInfo Function side effect record to be updated
@param scope variable scope in which the variable as... | [
"Record",
"information",
"about",
"the",
"side",
"effects",
"caused",
"by",
"assigning",
"a",
"value",
"to",
"a",
"given",
"LHS",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PureFunctionIdentifier.java#L922-L963 |
24,404 | google/closure-compiler | src/com/google/javascript/jscomp/PureFunctionIdentifier.java | FunctionBodyAnalyzer.visitCall | private void visitCall(AmbiguatedFunctionSummary callerInfo, Node invocation) {
// Handle special cases (Math, RegExp)
// TODO: This logic can probably be replaced with @nosideeffects annotations in externs.
if (invocation.isCall() && !NodeUtil.functionCallHasSideEffects(invocation, compiler)) {
... | java | private void visitCall(AmbiguatedFunctionSummary callerInfo, Node invocation) {
// Handle special cases (Math, RegExp)
// TODO: This logic can probably be replaced with @nosideeffects annotations in externs.
if (invocation.isCall() && !NodeUtil.functionCallHasSideEffects(invocation, compiler)) {
... | [
"private",
"void",
"visitCall",
"(",
"AmbiguatedFunctionSummary",
"callerInfo",
",",
"Node",
"invocation",
")",
"{",
"// Handle special cases (Math, RegExp)",
"// TODO: This logic can probably be replaced with @nosideeffects annotations in externs.",
"if",
"(",
"invocation",
".",
"... | Record information about a call site. | [
"Record",
"information",
"about",
"a",
"call",
"site",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PureFunctionIdentifier.java#L966-L988 |
24,405 | google/closure-compiler | src/com/google/javascript/jscomp/PureFunctionIdentifier.java | SideEffectPropagation.propagate | boolean propagate(AmbiguatedFunctionSummary callee, AmbiguatedFunctionSummary caller) {
int initialCallerFlags = caller.bitmask;
if (callerIsAlias) {
caller.setMask(callee.bitmask);
return caller.bitmask != initialCallerFlags;
}
if (callee.mutatesGlobalState()) {
// If ... | java | boolean propagate(AmbiguatedFunctionSummary callee, AmbiguatedFunctionSummary caller) {
int initialCallerFlags = caller.bitmask;
if (callerIsAlias) {
caller.setMask(callee.bitmask);
return caller.bitmask != initialCallerFlags;
}
if (callee.mutatesGlobalState()) {
// If ... | [
"boolean",
"propagate",
"(",
"AmbiguatedFunctionSummary",
"callee",
",",
"AmbiguatedFunctionSummary",
"caller",
")",
"{",
"int",
"initialCallerFlags",
"=",
"caller",
".",
"bitmask",
";",
"if",
"(",
"callerIsAlias",
")",
"{",
"caller",
".",
"setMask",
"(",
"callee"... | Propagate the side effects from the callee to the caller.
@param callee propagate from
@param caller propagate to
@return Returns true if the propagation changed the side effects on the caller. | [
"Propagate",
"the",
"side",
"effects",
"from",
"the",
"callee",
"to",
"the",
"caller",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PureFunctionIdentifier.java#L1111-L1143 |
24,406 | google/closure-compiler | src/com/google/javascript/rhino/jstype/TemplateTypeMapReplacer.java | TemplateTypeMapReplacer.hasVisitedType | @SuppressWarnings("ReferenceEquality")
private boolean hasVisitedType(TemplateType type) {
for (TemplateType visitedType : visitedTypes) {
if (visitedType == type) {
return true;
}
}
return false;
} | java | @SuppressWarnings("ReferenceEquality")
private boolean hasVisitedType(TemplateType type) {
for (TemplateType visitedType : visitedTypes) {
if (visitedType == type) {
return true;
}
}
return false;
} | [
"@",
"SuppressWarnings",
"(",
"\"ReferenceEquality\"",
")",
"private",
"boolean",
"hasVisitedType",
"(",
"TemplateType",
"type",
")",
"{",
"for",
"(",
"TemplateType",
"visitedType",
":",
"visitedTypes",
")",
"{",
"if",
"(",
"visitedType",
"==",
"type",
")",
"{",... | Checks if the specified type has already been visited during the Visitor's
traversal of a JSType. | [
"Checks",
"if",
"the",
"specified",
"type",
"has",
"already",
"been",
"visited",
"during",
"the",
"Visitor",
"s",
"traversal",
"of",
"a",
"JSType",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMapReplacer.java#L144-L152 |
24,407 | google/closure-compiler | src/com/google/javascript/jscomp/WhitelistWarningsGuard.java | WhitelistWarningsGuard.normalizeWhitelist | protected Set<String> normalizeWhitelist(Set<String> whitelist) {
Set<String> result = new HashSet<>();
for (String line : whitelist) {
String trimmed = line.trim();
if (trimmed.isEmpty() || trimmed.charAt(0) == '#') {
// strip out empty lines and comments.
continue;
}
/... | java | protected Set<String> normalizeWhitelist(Set<String> whitelist) {
Set<String> result = new HashSet<>();
for (String line : whitelist) {
String trimmed = line.trim();
if (trimmed.isEmpty() || trimmed.charAt(0) == '#') {
// strip out empty lines and comments.
continue;
}
/... | [
"protected",
"Set",
"<",
"String",
">",
"normalizeWhitelist",
"(",
"Set",
"<",
"String",
">",
"whitelist",
")",
"{",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"line",
":",
"whitelist",
")",
... | Loads legacy warnings list from the set of strings. During development line
numbers are changed very often - we just cut them and compare without ones.
@return known legacy warnings without line numbers. | [
"Loads",
"legacy",
"warnings",
"list",
"from",
"the",
"set",
"of",
"strings",
".",
"During",
"development",
"line",
"numbers",
"are",
"changed",
"very",
"often",
"-",
"we",
"just",
"cut",
"them",
"and",
"compare",
"without",
"ones",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/WhitelistWarningsGuard.java#L86-L99 |
24,408 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.removeType | public void removeType(StaticScope scope, String name) {
scopedNameTable.remove(getRootNodeForScope(getLookupScope(scope, name)), name);
} | java | public void removeType(StaticScope scope, String name) {
scopedNameTable.remove(getRootNodeForScope(getLookupScope(scope, name)), name);
} | [
"public",
"void",
"removeType",
"(",
"StaticScope",
"scope",
",",
"String",
"name",
")",
"{",
"scopedNameTable",
".",
"remove",
"(",
"getRootNodeForScope",
"(",
"getLookupScope",
"(",
"scope",
",",
"name",
")",
")",
",",
"name",
")",
";",
"}"
] | Removes a type by name.
@param name The name string. | [
"Removes",
"a",
"type",
"by",
"name",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L870-L872 |
24,409 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.isObjectLiteralThatCanBeSkipped | private static boolean isObjectLiteralThatCanBeSkipped(JSType t) {
t = t.restrictByNotNullOrUndefined();
return t.isRecordType() || t.isLiteralObject();
} | java | private static boolean isObjectLiteralThatCanBeSkipped(JSType t) {
t = t.restrictByNotNullOrUndefined();
return t.isRecordType() || t.isLiteralObject();
} | [
"private",
"static",
"boolean",
"isObjectLiteralThatCanBeSkipped",
"(",
"JSType",
"t",
")",
"{",
"t",
"=",
"t",
".",
"restrictByNotNullOrUndefined",
"(",
")",
";",
"return",
"t",
".",
"isRecordType",
"(",
")",
"||",
"t",
".",
"isLiteralObject",
"(",
")",
";"... | we don't need to store these properties in the propertyIndex separately. | [
"we",
"don",
"t",
"need",
"to",
"store",
"these",
"properties",
"in",
"the",
"propertyIndex",
"separately",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L881-L884 |
24,410 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.canPropertyBeDefined | public PropDefinitionKind canPropertyBeDefined(JSType type, String propertyName) {
if (type.isStruct()) {
// We are stricter about "struct" types and only allow access to
// properties that to the best of our knowledge are available at creation
// time and specifically not properties only defined ... | java | public PropDefinitionKind canPropertyBeDefined(JSType type, String propertyName) {
if (type.isStruct()) {
// We are stricter about "struct" types and only allow access to
// properties that to the best of our knowledge are available at creation
// time and specifically not properties only defined ... | [
"public",
"PropDefinitionKind",
"canPropertyBeDefined",
"(",
"JSType",
"type",
",",
"String",
"propertyName",
")",
"{",
"if",
"(",
"type",
".",
"isStruct",
"(",
")",
")",
"{",
"// We are stricter about \"struct\" types and only allow access to",
"// properties that to the b... | Returns whether the given property can possibly be set on the given type. | [
"Returns",
"whether",
"the",
"given",
"property",
"can",
"possibly",
"be",
"set",
"on",
"the",
"given",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L998-L1059 |
24,411 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.findCommonSuperObject | ObjectType findCommonSuperObject(ObjectType a, ObjectType b) {
List<ObjectType> stackA = getSuperStack(a);
List<ObjectType> stackB = getSuperStack(b);
ObjectType result = getNativeObjectType(JSTypeNative.OBJECT_TYPE);
while (!stackA.isEmpty() && !stackB.isEmpty()) {
ObjectType currentA = stackA.r... | java | ObjectType findCommonSuperObject(ObjectType a, ObjectType b) {
List<ObjectType> stackA = getSuperStack(a);
List<ObjectType> stackB = getSuperStack(b);
ObjectType result = getNativeObjectType(JSTypeNative.OBJECT_TYPE);
while (!stackA.isEmpty() && !stackB.isEmpty()) {
ObjectType currentA = stackA.r... | [
"ObjectType",
"findCommonSuperObject",
"(",
"ObjectType",
"a",
",",
"ObjectType",
"b",
")",
"{",
"List",
"<",
"ObjectType",
">",
"stackA",
"=",
"getSuperStack",
"(",
"a",
")",
";",
"List",
"<",
"ObjectType",
">",
"stackB",
"=",
"getSuperStack",
"(",
"b",
"... | Finds the common supertype of the two given object types. | [
"Finds",
"the",
"common",
"supertype",
"of",
"the",
"two",
"given",
"object",
"types",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1083-L1098 |
24,412 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.overwriteDeclaredType | public void overwriteDeclaredType(StaticScope scope, String name, JSType type) {
checkState(isDeclaredForScope(scope, name), "missing name %s", name);
reregister(scope, type, name);
} | java | public void overwriteDeclaredType(StaticScope scope, String name, JSType type) {
checkState(isDeclaredForScope(scope, name), "missing name %s", name);
reregister(scope, type, name);
} | [
"public",
"void",
"overwriteDeclaredType",
"(",
"StaticScope",
"scope",
",",
"String",
"name",
",",
"JSType",
"type",
")",
"{",
"checkState",
"(",
"isDeclaredForScope",
"(",
"scope",
",",
"name",
")",
",",
"\"missing name %s\"",
",",
"name",
")",
";",
"reregis... | Overrides a declared global type name. Throws an exception if this type name hasn't been
declared yet. | [
"Overrides",
"a",
"declared",
"global",
"type",
"name",
".",
"Throws",
"an",
"exception",
"if",
"this",
"type",
"name",
"hasn",
"t",
"been",
"declared",
"yet",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1179-L1182 |
24,413 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.getType | public JSType getType(
StaticTypedScope scope, String jsTypeName, String sourceName, int lineno, int charno) {
return getType(scope, jsTypeName, sourceName, lineno, charno, true);
} | java | public JSType getType(
StaticTypedScope scope, String jsTypeName, String sourceName, int lineno, int charno) {
return getType(scope, jsTypeName, sourceName, lineno, charno, true);
} | [
"public",
"JSType",
"getType",
"(",
"StaticTypedScope",
"scope",
",",
"String",
"jsTypeName",
",",
"String",
"sourceName",
",",
"int",
"lineno",
",",
"int",
"charno",
")",
"{",
"return",
"getType",
"(",
"scope",
",",
"jsTypeName",
",",
"sourceName",
",",
"li... | Looks up a type by name. To allow for forward references to types, an unrecognized string has
to be bound to a NamedType object that will be resolved later.
@param scope A scope for doing type name resolution.
@param jsTypeName The name string.
@param sourceName The name of the source file where this reference appears... | [
"Looks",
"up",
"a",
"type",
"by",
"name",
".",
"To",
"allow",
"for",
"forward",
"references",
"to",
"types",
"an",
"unrecognized",
"string",
"has",
"to",
"be",
"bound",
"to",
"a",
"NamedType",
"object",
"that",
"will",
"be",
"resolved",
"later",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1361-L1364 |
24,414 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.resolveTypes | public void resolveTypes() {
for (NamedType type : unresolvedNamedTypes) {
type.resolve(reporter);
}
unresolvedNamedTypes.clear();
// By default, the global "this" type is just an anonymous object.
// If the user has defined a Window type, make the Window the
// implicit prototype of "th... | java | public void resolveTypes() {
for (NamedType type : unresolvedNamedTypes) {
type.resolve(reporter);
}
unresolvedNamedTypes.clear();
// By default, the global "this" type is just an anonymous object.
// If the user has defined a Window type, make the Window the
// implicit prototype of "th... | [
"public",
"void",
"resolveTypes",
"(",
")",
"{",
"for",
"(",
"NamedType",
"type",
":",
"unresolvedNamedTypes",
")",
"{",
"type",
".",
"resolve",
"(",
"reporter",
")",
";",
"}",
"unresolvedNamedTypes",
".",
"clear",
"(",
")",
";",
"// By default, the global \"t... | Resolve all the unresolved types in the given scope. | [
"Resolve",
"all",
"the",
"unresolved",
"types",
"in",
"the",
"given",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1444-L1466 |
24,415 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createOptionalType | public JSType createOptionalType(JSType type) {
if (type instanceof UnknownType || type.isAllType()) {
return type;
} else {
return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE));
}
} | java | public JSType createOptionalType(JSType type) {
if (type instanceof UnknownType || type.isAllType()) {
return type;
} else {
return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE));
}
} | [
"public",
"JSType",
"createOptionalType",
"(",
"JSType",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"UnknownType",
"||",
"type",
".",
"isAllType",
"(",
")",
")",
"{",
"return",
"type",
";",
"}",
"else",
"{",
"return",
"createUnionType",
"(",
"type"... | Creates a type representing optional values of the given type.
@return the union of the type and the void type | [
"Creates",
"a",
"type",
"representing",
"optional",
"values",
"of",
"the",
"given",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1476-L1482 |
24,416 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createOptionalNullableType | public JSType createOptionalNullableType(JSType type) {
return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE),
getNativeType(JSTypeNative.NULL_TYPE));
} | java | public JSType createOptionalNullableType(JSType type) {
return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE),
getNativeType(JSTypeNative.NULL_TYPE));
} | [
"public",
"JSType",
"createOptionalNullableType",
"(",
"JSType",
"type",
")",
"{",
"return",
"createUnionType",
"(",
"type",
",",
"getNativeType",
"(",
"JSTypeNative",
".",
"VOID_TYPE",
")",
",",
"getNativeType",
"(",
"JSTypeNative",
".",
"NULL_TYPE",
")",
")",
... | Creates a nullable and undefine-able value of the given type.
@return The union of the type and null and undefined. | [
"Creates",
"a",
"nullable",
"and",
"undefine",
"-",
"able",
"value",
"of",
"the",
"given",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1510-L1513 |
24,417 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createUnionType | public JSType createUnionType(JSType... variants) {
UnionTypeBuilder builder = UnionTypeBuilder.create(this);
for (JSType type : variants) {
builder.addAlternate(type);
}
return builder.build();
} | java | public JSType createUnionType(JSType... variants) {
UnionTypeBuilder builder = UnionTypeBuilder.create(this);
for (JSType type : variants) {
builder.addAlternate(type);
}
return builder.build();
} | [
"public",
"JSType",
"createUnionType",
"(",
"JSType",
"...",
"variants",
")",
"{",
"UnionTypeBuilder",
"builder",
"=",
"UnionTypeBuilder",
".",
"create",
"(",
"this",
")",
";",
"for",
"(",
"JSType",
"type",
":",
"variants",
")",
"{",
"builder",
".",
"addAlte... | Creates a union type whose variants are the arguments. | [
"Creates",
"a",
"union",
"type",
"whose",
"variants",
"are",
"the",
"arguments",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1518-L1524 |
24,418 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createUnionType | public JSType createUnionType(JSTypeNative... variants) {
UnionTypeBuilder builder = UnionTypeBuilder.create(this);
for (JSTypeNative typeId : variants) {
builder.addAlternate(getNativeType(typeId));
}
return builder.build();
} | java | public JSType createUnionType(JSTypeNative... variants) {
UnionTypeBuilder builder = UnionTypeBuilder.create(this);
for (JSTypeNative typeId : variants) {
builder.addAlternate(getNativeType(typeId));
}
return builder.build();
} | [
"public",
"JSType",
"createUnionType",
"(",
"JSTypeNative",
"...",
"variants",
")",
"{",
"UnionTypeBuilder",
"builder",
"=",
"UnionTypeBuilder",
".",
"create",
"(",
"this",
")",
";",
"for",
"(",
"JSTypeNative",
"typeId",
":",
"variants",
")",
"{",
"builder",
"... | Creates a union type whose variants are the built-in types specified
by the arguments. | [
"Creates",
"a",
"union",
"type",
"whose",
"variants",
"are",
"the",
"built",
"-",
"in",
"types",
"specified",
"by",
"the",
"arguments",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1534-L1540 |
24,419 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createEnumType | public EnumType createEnumType(String name, Node source, JSType elementsType) {
return new EnumType(this, name, source, elementsType);
} | java | public EnumType createEnumType(String name, Node source, JSType elementsType) {
return new EnumType(this, name, source, elementsType);
} | [
"public",
"EnumType",
"createEnumType",
"(",
"String",
"name",
",",
"Node",
"source",
",",
"JSType",
"elementsType",
")",
"{",
"return",
"new",
"EnumType",
"(",
"this",
",",
"name",
",",
"source",
",",
"elementsType",
")",
";",
"}"
] | Creates an enum type.
@param name The human-readable name associated with the enum, or null if unknown. | [
"Creates",
"an",
"enum",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1547-L1549 |
24,420 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createFunctionType | public FunctionType createFunctionType(
JSType returnType, JSType... parameterTypes) {
return createFunctionType(returnType, createParameters(parameterTypes));
} | java | public FunctionType createFunctionType(
JSType returnType, JSType... parameterTypes) {
return createFunctionType(returnType, createParameters(parameterTypes));
} | [
"public",
"FunctionType",
"createFunctionType",
"(",
"JSType",
"returnType",
",",
"JSType",
"...",
"parameterTypes",
")",
"{",
"return",
"createFunctionType",
"(",
"returnType",
",",
"createParameters",
"(",
"parameterTypes",
")",
")",
";",
"}"
] | Creates a function type.
@param returnType the function's return type
@param parameterTypes the parameters' types | [
"Creates",
"a",
"function",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1589-L1592 |
24,421 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createParameters | private Node createParameters(boolean lastVarArgs, JSType... parameterTypes) {
FunctionParamBuilder builder = new FunctionParamBuilder(this);
int max = parameterTypes.length - 1;
for (int i = 0; i <= max; i++) {
if (lastVarArgs && i == max) {
builder.addVarArgs(parameterTypes[i]);
} else... | java | private Node createParameters(boolean lastVarArgs, JSType... parameterTypes) {
FunctionParamBuilder builder = new FunctionParamBuilder(this);
int max = parameterTypes.length - 1;
for (int i = 0; i <= max; i++) {
if (lastVarArgs && i == max) {
builder.addVarArgs(parameterTypes[i]);
} else... | [
"private",
"Node",
"createParameters",
"(",
"boolean",
"lastVarArgs",
",",
"JSType",
"...",
"parameterTypes",
")",
"{",
"FunctionParamBuilder",
"builder",
"=",
"new",
"FunctionParamBuilder",
"(",
"this",
")",
";",
"int",
"max",
"=",
"parameterTypes",
".",
"length"... | Creates a tree hierarchy representing a typed argument list.
@param lastVarArgs whether the last type should considered as a variable length argument.
@param parameterTypes the parameter types. The last element of this array is considered a
variable length argument is {@code lastVarArgs} is {@code true}.
@return a tre... | [
"Creates",
"a",
"tree",
"hierarchy",
"representing",
"a",
"typed",
"argument",
"list",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1665-L1676 |
24,422 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createOptionalParameters | public Node createOptionalParameters(JSType... parameterTypes) {
FunctionParamBuilder builder = new FunctionParamBuilder(this);
builder.addOptionalParams(parameterTypes);
return builder.build();
} | java | public Node createOptionalParameters(JSType... parameterTypes) {
FunctionParamBuilder builder = new FunctionParamBuilder(this);
builder.addOptionalParams(parameterTypes);
return builder.build();
} | [
"public",
"Node",
"createOptionalParameters",
"(",
"JSType",
"...",
"parameterTypes",
")",
"{",
"FunctionParamBuilder",
"builder",
"=",
"new",
"FunctionParamBuilder",
"(",
"this",
")",
";",
"builder",
".",
"addOptionalParams",
"(",
"parameterTypes",
")",
";",
"retur... | Creates a tree hierarchy representing a typed parameter list in which
every parameter is optional. | [
"Creates",
"a",
"tree",
"hierarchy",
"representing",
"a",
"typed",
"parameter",
"list",
"in",
"which",
"every",
"parameter",
"is",
"optional",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1694-L1698 |
24,423 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createFunctionTypeWithNewReturnType | public FunctionType createFunctionTypeWithNewReturnType(
FunctionType existingFunctionType, JSType returnType) {
return FunctionType.builder(this)
.copyFromOtherFunction(existingFunctionType)
.withReturnType(returnType)
.build();
} | java | public FunctionType createFunctionTypeWithNewReturnType(
FunctionType existingFunctionType, JSType returnType) {
return FunctionType.builder(this)
.copyFromOtherFunction(existingFunctionType)
.withReturnType(returnType)
.build();
} | [
"public",
"FunctionType",
"createFunctionTypeWithNewReturnType",
"(",
"FunctionType",
"existingFunctionType",
",",
"JSType",
"returnType",
")",
"{",
"return",
"FunctionType",
".",
"builder",
"(",
"this",
")",
".",
"copyFromOtherFunction",
"(",
"existingFunctionType",
")",... | Creates a new function type based on an existing function type but
with a new return type.
@param existingFunctionType the existing function type.
@param returnType the new return type. | [
"Creates",
"a",
"new",
"function",
"type",
"based",
"on",
"an",
"existing",
"function",
"type",
"but",
"with",
"a",
"new",
"return",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1706-L1712 |
24,424 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createAnonymousObjectType | public ObjectType createAnonymousObjectType(JSDocInfo info) {
PrototypeObjectType type = new PrototypeObjectType(
this, null, null, true /* anonymousType */);
type.setPrettyPrint(true);
type.setJSDocInfo(info);
return type;
} | java | public ObjectType createAnonymousObjectType(JSDocInfo info) {
PrototypeObjectType type = new PrototypeObjectType(
this, null, null, true /* anonymousType */);
type.setPrettyPrint(true);
type.setJSDocInfo(info);
return type;
} | [
"public",
"ObjectType",
"createAnonymousObjectType",
"(",
"JSDocInfo",
"info",
")",
"{",
"PrototypeObjectType",
"type",
"=",
"new",
"PrototypeObjectType",
"(",
"this",
",",
"null",
",",
"null",
",",
"true",
"/* anonymousType */",
")",
";",
"type",
".",
"setPrettyP... | Create an anonymous object type.
@param info Used to mark object literals as structs; can be {@code null} | [
"Create",
"an",
"anonymous",
"object",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1764-L1770 |
24,425 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createConstructorType | public FunctionType createConstructorType(
String name,
Node source,
Node parameters,
JSType returnType,
ImmutableList<TemplateType> templateKeys,
boolean isAbstract) {
checkArgument(source == null || source.isFunction() || source.isClass());
return FunctionType.builder(this)... | java | public FunctionType createConstructorType(
String name,
Node source,
Node parameters,
JSType returnType,
ImmutableList<TemplateType> templateKeys,
boolean isAbstract) {
checkArgument(source == null || source.isFunction() || source.isClass());
return FunctionType.builder(this)... | [
"public",
"FunctionType",
"createConstructorType",
"(",
"String",
"name",
",",
"Node",
"source",
",",
"Node",
"parameters",
",",
"JSType",
"returnType",
",",
"ImmutableList",
"<",
"TemplateType",
">",
"templateKeys",
",",
"boolean",
"isAbstract",
")",
"{",
"checkA... | Creates a constructor function type.
@param name the function's name or {@code null} to indicate that the function is anonymous.
@param source the node defining this function. Its type ({@link Node#getToken()} ()}) must be
{@link Token#FUNCTION}.
@param parameters the function's parameters or {@code null} to indicate ... | [
"Creates",
"a",
"constructor",
"function",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1799-L1816 |
24,426 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createInterfaceType | public FunctionType createInterfaceType(
String name, Node source, ImmutableList<TemplateType> templateKeys, boolean struct) {
FunctionType fn =
FunctionType.builder(this)
.forInterface()
.withName(name)
.withSourceNode(source)
.withEmptyParams()
... | java | public FunctionType createInterfaceType(
String name, Node source, ImmutableList<TemplateType> templateKeys, boolean struct) {
FunctionType fn =
FunctionType.builder(this)
.forInterface()
.withName(name)
.withSourceNode(source)
.withEmptyParams()
... | [
"public",
"FunctionType",
"createInterfaceType",
"(",
"String",
"name",
",",
"Node",
"source",
",",
"ImmutableList",
"<",
"TemplateType",
">",
"templateKeys",
",",
"boolean",
"struct",
")",
"{",
"FunctionType",
"fn",
"=",
"FunctionType",
".",
"builder",
"(",
"th... | Creates an interface function type.
@param name the function's name
@param source the node defining this function. Its type ({@link Node#getToken()}) must be
{@link Token#FUNCTION}.
@param templateKeys the templatized types for the interface. | [
"Creates",
"an",
"interface",
"function",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1826-L1840 |
24,427 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createTemplateTypeMap | public TemplateTypeMap createTemplateTypeMap(
ImmutableList<TemplateType> templateKeys,
ImmutableList<JSType> templateValues) {
if (templateKeys == null) {
templateKeys = ImmutableList.of();
}
if (templateValues == null) {
templateValues = ImmutableList.of();
}
return (templa... | java | public TemplateTypeMap createTemplateTypeMap(
ImmutableList<TemplateType> templateKeys,
ImmutableList<JSType> templateValues) {
if (templateKeys == null) {
templateKeys = ImmutableList.of();
}
if (templateValues == null) {
templateValues = ImmutableList.of();
}
return (templa... | [
"public",
"TemplateTypeMap",
"createTemplateTypeMap",
"(",
"ImmutableList",
"<",
"TemplateType",
">",
"templateKeys",
",",
"ImmutableList",
"<",
"JSType",
">",
"templateValues",
")",
"{",
"if",
"(",
"templateKeys",
"==",
"null",
")",
"{",
"templateKeys",
"=",
"Imm... | Creates a template type map from the specified list of template keys and
template value types. | [
"Creates",
"a",
"template",
"type",
"map",
"from",
"the",
"specified",
"list",
"of",
"template",
"keys",
"and",
"template",
"value",
"types",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1855-L1867 |
24,428 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createNamedType | @VisibleForTesting
public NamedType createNamedType(
StaticTypedScope scope, String reference, String sourceName, int lineno, int charno) {
return new NamedType(scope, this, reference, sourceName, lineno, charno);
} | java | @VisibleForTesting
public NamedType createNamedType(
StaticTypedScope scope, String reference, String sourceName, int lineno, int charno) {
return new NamedType(scope, this, reference, sourceName, lineno, charno);
} | [
"@",
"VisibleForTesting",
"public",
"NamedType",
"createNamedType",
"(",
"StaticTypedScope",
"scope",
",",
"String",
"reference",
",",
"String",
"sourceName",
",",
"int",
"lineno",
",",
"int",
"charno",
")",
"{",
"return",
"new",
"NamedType",
"(",
"scope",
",",
... | Creates a named type. | [
"Creates",
"a",
"named",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1934-L1938 |
24,429 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createTypeFromCommentNode | @SuppressWarnings("unchecked")
public JSType createTypeFromCommentNode(Node n, String sourceName, StaticTypedScope scope) {
return createFromTypeNodesInternal(n, sourceName, scope, true);
} | java | @SuppressWarnings("unchecked")
public JSType createTypeFromCommentNode(Node n, String sourceName, StaticTypedScope scope) {
return createFromTypeNodesInternal(n, sourceName, scope, true);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"JSType",
"createTypeFromCommentNode",
"(",
"Node",
"n",
",",
"String",
"sourceName",
",",
"StaticTypedScope",
"scope",
")",
"{",
"return",
"createFromTypeNodesInternal",
"(",
"n",
",",
"sourceName",
",",... | Creates a JSType from the nodes representing a type.
@param n The node with type info.
@param sourceName The source file name.
@param scope A scope for doing type name lookups. | [
"Creates",
"a",
"JSType",
"from",
"the",
"nodes",
"representing",
"a",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1971-L1974 |
24,430 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createRecordTypeFromNodes | private JSType createRecordTypeFromNodes(Node n, String sourceName, StaticTypedScope scope) {
RecordTypeBuilder builder = new RecordTypeBuilder(this);
// For each of the fields in the record type.
for (Node fieldTypeNode = n.getFirstChild();
fieldTypeNode != null;
fieldTypeNode = fieldTy... | java | private JSType createRecordTypeFromNodes(Node n, String sourceName, StaticTypedScope scope) {
RecordTypeBuilder builder = new RecordTypeBuilder(this);
// For each of the fields in the record type.
for (Node fieldTypeNode = n.getFirstChild();
fieldTypeNode != null;
fieldTypeNode = fieldTy... | [
"private",
"JSType",
"createRecordTypeFromNodes",
"(",
"Node",
"n",
",",
"String",
"sourceName",
",",
"StaticTypedScope",
"scope",
")",
"{",
"RecordTypeBuilder",
"builder",
"=",
"new",
"RecordTypeBuilder",
"(",
"this",
")",
";",
"// For each of the fields in the record ... | Creates a RecordType from the nodes representing said record type.
@param n The node with type info.
@param sourceName The source file name.
@param scope A scope for doing type name lookups. | [
"Creates",
"a",
"RecordType",
"from",
"the",
"nodes",
"representing",
"said",
"record",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L2208-L2251 |
24,431 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.registerTemplateTypeNamesInScope | public void registerTemplateTypeNamesInScope(Iterable<TemplateType> keys, Node scopeRoot) {
for (TemplateType key : keys) {
scopedNameTable.put(scopeRoot, key.getReferenceName(), key);
}
} | java | public void registerTemplateTypeNamesInScope(Iterable<TemplateType> keys, Node scopeRoot) {
for (TemplateType key : keys) {
scopedNameTable.put(scopeRoot, key.getReferenceName(), key);
}
} | [
"public",
"void",
"registerTemplateTypeNamesInScope",
"(",
"Iterable",
"<",
"TemplateType",
">",
"keys",
",",
"Node",
"scopeRoot",
")",
"{",
"for",
"(",
"TemplateType",
"key",
":",
"keys",
")",
"{",
"scopedNameTable",
".",
"put",
"(",
"scopeRoot",
",",
"key",
... | Registers template types on the given scope root. This takes a Node rather than a
StaticScope because at the time it is called, the scope has not yet been created. | [
"Registers",
"template",
"types",
"on",
"the",
"given",
"scope",
"root",
".",
"This",
"takes",
"a",
"Node",
"rather",
"than",
"a",
"StaticScope",
"because",
"at",
"the",
"time",
"it",
"is",
"called",
"the",
"scope",
"has",
"not",
"yet",
"been",
"created",
... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L2257-L2261 |
24,432 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createScopeWithTemplates | public StaticTypedScope createScopeWithTemplates(
StaticTypedScope scope, Iterable<TemplateType> templates) {
return new SyntheticTemplateScope(scope, templates);
} | java | public StaticTypedScope createScopeWithTemplates(
StaticTypedScope scope, Iterable<TemplateType> templates) {
return new SyntheticTemplateScope(scope, templates);
} | [
"public",
"StaticTypedScope",
"createScopeWithTemplates",
"(",
"StaticTypedScope",
"scope",
",",
"Iterable",
"<",
"TemplateType",
">",
"templates",
")",
"{",
"return",
"new",
"SyntheticTemplateScope",
"(",
"scope",
",",
"templates",
")",
";",
"}"
] | Returns a new scope that includes the given template names for type resolution
purposes. | [
"Returns",
"a",
"new",
"scope",
"that",
"includes",
"the",
"given",
"template",
"names",
"for",
"type",
"resolution",
"purposes",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L2267-L2270 |
24,433 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.saveContents | @SuppressWarnings("unchecked")
@GwtIncompatible("ObjectOutputStream")
public void saveContents(ObjectOutputStream out) throws IOException {
out.writeObject(eachRefTypeIndexedByProperty);
out.writeObject(interfaceToImplementors);
out.writeObject(typesIndexedByProperty);
} | java | @SuppressWarnings("unchecked")
@GwtIncompatible("ObjectOutputStream")
public void saveContents(ObjectOutputStream out) throws IOException {
out.writeObject(eachRefTypeIndexedByProperty);
out.writeObject(interfaceToImplementors);
out.writeObject(typesIndexedByProperty);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"GwtIncompatible",
"(",
"\"ObjectOutputStream\"",
")",
"public",
"void",
"saveContents",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeObject",
"(",
"eachRefTypeIndexedBy... | Saves the derived state.
Note: This should be only used when serializing the compiler state and needs to be done at the
end, after serializing CompilerState. | [
"Saves",
"the",
"derived",
"state",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L2332-L2338 |
24,434 | google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.restoreContents | @SuppressWarnings("unchecked")
@GwtIncompatible("ObjectInputStream")
public void restoreContents(ObjectInputStream in) throws IOException, ClassNotFoundException {
eachRefTypeIndexedByProperty = (Map<String, Map<String, ObjectType>>) in.readObject();
interfaceToImplementors = (Multimap<String, FunctionType>... | java | @SuppressWarnings("unchecked")
@GwtIncompatible("ObjectInputStream")
public void restoreContents(ObjectInputStream in) throws IOException, ClassNotFoundException {
eachRefTypeIndexedByProperty = (Map<String, Map<String, ObjectType>>) in.readObject();
interfaceToImplementors = (Multimap<String, FunctionType>... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"GwtIncompatible",
"(",
"\"ObjectInputStream\"",
")",
"public",
"void",
"restoreContents",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"eachRefTypeIndexedByPrope... | Restores the derived state.
Note: This should be only used when deserializing the compiler state and needs to be done at
the end, after deserializing CompilerState. | [
"Restores",
"the",
"derived",
"state",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L2346-L2352 |
24,435 | google/closure-compiler | src/com/google/javascript/jscomp/PolymerPassSuppressBehaviors.java | PolymerPassSuppressBehaviors.suppressBehavior | private void suppressBehavior(Node behaviorValue, Node reportNode) {
if (behaviorValue == null) {
compiler.report(JSError.make(reportNode, PolymerPassErrors.POLYMER_UNQUALIFIED_BEHAVIOR));
return;
}
if (behaviorValue.isArrayLit()) {
for (Node child : behaviorValue.children()) {
su... | java | private void suppressBehavior(Node behaviorValue, Node reportNode) {
if (behaviorValue == null) {
compiler.report(JSError.make(reportNode, PolymerPassErrors.POLYMER_UNQUALIFIED_BEHAVIOR));
return;
}
if (behaviorValue.isArrayLit()) {
for (Node child : behaviorValue.children()) {
su... | [
"private",
"void",
"suppressBehavior",
"(",
"Node",
"behaviorValue",
",",
"Node",
"reportNode",
")",
"{",
"if",
"(",
"behaviorValue",
"==",
"null",
")",
"{",
"compiler",
".",
"report",
"(",
"JSError",
".",
"make",
"(",
"reportNode",
",",
"PolymerPassErrors",
... | Strip property type annotations and add suppressions on functions. | [
"Strip",
"property",
"type",
"annotations",
"and",
"add",
"suppressions",
"on",
"functions",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerPassSuppressBehaviors.java#L58-L72 |
24,436 | google/closure-compiler | src/com/google/debugging/sourcemap/Base64VLQ.java | Base64VLQ.encode | public static void encode(Appendable out, int value)
throws IOException {
value = toVLQSigned(value);
do {
int digit = value & VLQ_BASE_MASK;
value >>>= VLQ_BASE_SHIFT;
if (value > 0) {
digit |= VLQ_CONTINUATION_BIT;
}
out.append(Base64.toBase64(digit));
} while (... | java | public static void encode(Appendable out, int value)
throws IOException {
value = toVLQSigned(value);
do {
int digit = value & VLQ_BASE_MASK;
value >>>= VLQ_BASE_SHIFT;
if (value > 0) {
digit |= VLQ_CONTINUATION_BIT;
}
out.append(Base64.toBase64(digit));
} while (... | [
"public",
"static",
"void",
"encode",
"(",
"Appendable",
"out",
",",
"int",
"value",
")",
"throws",
"IOException",
"{",
"value",
"=",
"toVLQSigned",
"(",
"value",
")",
";",
"do",
"{",
"int",
"digit",
"=",
"value",
"&",
"VLQ_BASE_MASK",
";",
"value",
">>>... | Writes a VLQ encoded value to the provide appendable.
@throws IOException | [
"Writes",
"a",
"VLQ",
"encoded",
"value",
"to",
"the",
"provide",
"appendable",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/debugging/sourcemap/Base64VLQ.java#L72-L83 |
24,437 | google/closure-compiler | src/com/google/debugging/sourcemap/Base64VLQ.java | Base64VLQ.decode | public static int decode(CharIterator in) {
int result = 0;
boolean continuation;
int shift = 0;
do {
char c = in.next();
int digit = Base64.fromBase64(c);
continuation = (digit & VLQ_CONTINUATION_BIT) != 0;
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
... | java | public static int decode(CharIterator in) {
int result = 0;
boolean continuation;
int shift = 0;
do {
char c = in.next();
int digit = Base64.fromBase64(c);
continuation = (digit & VLQ_CONTINUATION_BIT) != 0;
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
... | [
"public",
"static",
"int",
"decode",
"(",
"CharIterator",
"in",
")",
"{",
"int",
"result",
"=",
"0",
";",
"boolean",
"continuation",
";",
"int",
"shift",
"=",
"0",
";",
"do",
"{",
"char",
"c",
"=",
"in",
".",
"next",
"(",
")",
";",
"int",
"digit",
... | Decodes the next VLQValue from the provided CharIterator. | [
"Decodes",
"the",
"next",
"VLQValue",
"from",
"the",
"provided",
"CharIterator",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/debugging/sourcemap/Base64VLQ.java#L98-L112 |
24,438 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.getAllSymbolsSorted | public List<Symbol> getAllSymbolsSorted() {
List<Symbol> sortedSymbols = getNaturalSymbolOrdering().sortedCopy(symbols.values());
return sortedSymbols;
} | java | public List<Symbol> getAllSymbolsSorted() {
List<Symbol> sortedSymbols = getNaturalSymbolOrdering().sortedCopy(symbols.values());
return sortedSymbols;
} | [
"public",
"List",
"<",
"Symbol",
">",
"getAllSymbolsSorted",
"(",
")",
"{",
"List",
"<",
"Symbol",
">",
"sortedSymbols",
"=",
"getNaturalSymbolOrdering",
"(",
")",
".",
"sortedCopy",
"(",
"symbols",
".",
"values",
"(",
")",
")",
";",
"return",
"sortedSymbols... | Get the symbols in their natural ordering. Always returns a mutable list. | [
"Get",
"the",
"symbols",
"in",
"their",
"natural",
"ordering",
".",
"Always",
"returns",
"a",
"mutable",
"list",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L145-L148 |
24,439 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.getSymbolForScope | public Symbol getSymbolForScope(SymbolScope scope) {
if (scope.getSymbolForScope() == null) {
scope.setSymbolForScope(findSymbolForScope(scope));
}
return scope.getSymbolForScope();
} | java | public Symbol getSymbolForScope(SymbolScope scope) {
if (scope.getSymbolForScope() == null) {
scope.setSymbolForScope(findSymbolForScope(scope));
}
return scope.getSymbolForScope();
} | [
"public",
"Symbol",
"getSymbolForScope",
"(",
"SymbolScope",
"scope",
")",
"{",
"if",
"(",
"scope",
".",
"getSymbolForScope",
"(",
")",
"==",
"null",
")",
"{",
"scope",
".",
"setSymbolForScope",
"(",
"findSymbolForScope",
"(",
"scope",
")",
")",
";",
"}",
... | All local scopes are associated with a function, and some functions are associated with a
symbol. Returns the symbol associated with the given scope. | [
"All",
"local",
"scopes",
"are",
"associated",
"with",
"a",
"function",
"and",
"some",
"functions",
"are",
"associated",
"with",
"a",
"symbol",
".",
"Returns",
"the",
"symbol",
"associated",
"with",
"the",
"given",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L246-L251 |
24,440 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.findSymbolForScope | private Symbol findSymbolForScope(SymbolScope scope) {
Node rootNode = scope.getRootNode();
if (rootNode.getParent() == null) {
return globalScope.getSlot(GLOBAL_THIS);
}
if (!rootNode.isFunction()) {
return null;
}
String name = NodeUtil.getBestLValueName(NodeUtil.getBestLValue(ro... | java | private Symbol findSymbolForScope(SymbolScope scope) {
Node rootNode = scope.getRootNode();
if (rootNode.getParent() == null) {
return globalScope.getSlot(GLOBAL_THIS);
}
if (!rootNode.isFunction()) {
return null;
}
String name = NodeUtil.getBestLValueName(NodeUtil.getBestLValue(ro... | [
"private",
"Symbol",
"findSymbolForScope",
"(",
"SymbolScope",
"scope",
")",
"{",
"Node",
"rootNode",
"=",
"scope",
".",
"getRootNode",
"(",
")",
";",
"if",
"(",
"rootNode",
".",
"getParent",
"(",
")",
"==",
"null",
")",
"{",
"return",
"globalScope",
".",
... | Find the symbol associated with the given scope. Notice that we won't always be able to figure
out this association dynamically, so sometimes we'll just create the association when we create
the scope. | [
"Find",
"the",
"symbol",
"associated",
"with",
"the",
"given",
"scope",
".",
"Notice",
"that",
"we",
"won",
"t",
"always",
"be",
"able",
"to",
"figure",
"out",
"this",
"association",
"dynamically",
"so",
"sometimes",
"we",
"ll",
"just",
"create",
"the",
"a... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L258-L270 |
24,441 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.getSymbolDeclaredBy | public Symbol getSymbolDeclaredBy(FunctionType fn) {
checkState(fn.isConstructor() || fn.isInterface());
ObjectType instanceType = fn.getInstanceType();
return getSymbolForName(fn.getSource(), instanceType.getReferenceName());
} | java | public Symbol getSymbolDeclaredBy(FunctionType fn) {
checkState(fn.isConstructor() || fn.isInterface());
ObjectType instanceType = fn.getInstanceType();
return getSymbolForName(fn.getSource(), instanceType.getReferenceName());
} | [
"public",
"Symbol",
"getSymbolDeclaredBy",
"(",
"FunctionType",
"fn",
")",
"{",
"checkState",
"(",
"fn",
".",
"isConstructor",
"(",
")",
"||",
"fn",
".",
"isInterface",
"(",
")",
")",
";",
"ObjectType",
"instanceType",
"=",
"fn",
".",
"getInstanceType",
"(",... | Gets the symbol for the given constructor or interface. | [
"Gets",
"the",
"symbol",
"for",
"the",
"given",
"constructor",
"or",
"interface",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L288-L292 |
24,442 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.getSymbolForInstancesOf | public Symbol getSymbolForInstancesOf(Symbol sym) {
FunctionType fn = sym.getFunctionType();
if (fn != null && fn.isNominalConstructor()) {
return getSymbolForInstancesOf(fn);
}
return null;
} | java | public Symbol getSymbolForInstancesOf(Symbol sym) {
FunctionType fn = sym.getFunctionType();
if (fn != null && fn.isNominalConstructor()) {
return getSymbolForInstancesOf(fn);
}
return null;
} | [
"public",
"Symbol",
"getSymbolForInstancesOf",
"(",
"Symbol",
"sym",
")",
"{",
"FunctionType",
"fn",
"=",
"sym",
".",
"getFunctionType",
"(",
")",
";",
"if",
"(",
"fn",
"!=",
"null",
"&&",
"fn",
".",
"isNominalConstructor",
"(",
")",
")",
"{",
"return",
... | Gets the symbol for the prototype if this is the symbol for a constructor or interface. | [
"Gets",
"the",
"symbol",
"for",
"the",
"prototype",
"if",
"this",
"is",
"the",
"symbol",
"for",
"a",
"constructor",
"or",
"interface",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L300-L306 |
24,443 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.getSymbolForInstancesOf | public Symbol getSymbolForInstancesOf(FunctionType fn) {
checkState(fn.isConstructor() || fn.isInterface());
ObjectType pType = fn.getPrototype();
return getSymbolForName(fn.getSource(), pType.getReferenceName());
} | java | public Symbol getSymbolForInstancesOf(FunctionType fn) {
checkState(fn.isConstructor() || fn.isInterface());
ObjectType pType = fn.getPrototype();
return getSymbolForName(fn.getSource(), pType.getReferenceName());
} | [
"public",
"Symbol",
"getSymbolForInstancesOf",
"(",
"FunctionType",
"fn",
")",
"{",
"checkState",
"(",
"fn",
".",
"isConstructor",
"(",
")",
"||",
"fn",
".",
"isInterface",
"(",
")",
")",
";",
"ObjectType",
"pType",
"=",
"fn",
".",
"getPrototype",
"(",
")"... | Gets the symbol for the prototype of the given constructor or interface. | [
"Gets",
"the",
"symbol",
"for",
"the",
"prototype",
"of",
"the",
"given",
"constructor",
"or",
"interface",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L309-L313 |
24,444 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.getAllSymbolsForType | public List<Symbol> getAllSymbolsForType(JSType type) {
if (type == null) {
return ImmutableList.of();
}
UnionType unionType = type.toMaybeUnionType();
if (unionType != null) {
List<Symbol> result = new ArrayList<>(2);
for (JSType alt : unionType.getAlternates()) {
// Our type... | java | public List<Symbol> getAllSymbolsForType(JSType type) {
if (type == null) {
return ImmutableList.of();
}
UnionType unionType = type.toMaybeUnionType();
if (unionType != null) {
List<Symbol> result = new ArrayList<>(2);
for (JSType alt : unionType.getAlternates()) {
// Our type... | [
"public",
"List",
"<",
"Symbol",
">",
"getAllSymbolsForType",
"(",
"JSType",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"ImmutableList",
".",
"of",
"(",
")",
";",
"}",
"UnionType",
"unionType",
"=",
"type",
".",
"toMaybeUnionT... | Gets all symbols associated with the given type. For union types, this may be multiple symbols.
For instance types, this will return the constructor of that instance. | [
"Gets",
"all",
"symbols",
"associated",
"with",
"the",
"given",
"type",
".",
"For",
"union",
"types",
"this",
"may",
"be",
"multiple",
"symbols",
".",
"For",
"instance",
"types",
"this",
"will",
"return",
"the",
"constructor",
"of",
"that",
"instance",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L331-L350 |
24,445 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.getSymbolForTypeHelper | private Symbol getSymbolForTypeHelper(JSType type, boolean linkToCtor) {
if (type == null) {
return null;
}
if (type.isGlobalThisType()) {
return globalScope.getSlot(GLOBAL_THIS);
} else if (type.isNominalConstructor()) {
return linkToCtor
? globalScope.getSlot("Function")
... | java | private Symbol getSymbolForTypeHelper(JSType type, boolean linkToCtor) {
if (type == null) {
return null;
}
if (type.isGlobalThisType()) {
return globalScope.getSlot(GLOBAL_THIS);
} else if (type.isNominalConstructor()) {
return linkToCtor
? globalScope.getSlot("Function")
... | [
"private",
"Symbol",
"getSymbolForTypeHelper",
"(",
"JSType",
"type",
",",
"boolean",
"linkToCtor",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"type",
".",
"isGlobalThisType",
"(",
")",
")",
"{",
"return",... | Gets all symbols associated with the given type. If there is more that one symbol associated
with the given type, return null.
@param type The type.
@param linkToCtor If true, we should link instance types back to their constructor function. If
false, we should link instance types back to their prototype. See the comm... | [
"Gets",
"all",
"symbols",
"associated",
"with",
"the",
"given",
"type",
".",
"If",
"there",
"is",
"more",
"that",
"one",
"symbol",
"associated",
"with",
"the",
"given",
"type",
"return",
"null",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L362-L391 |
24,446 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.findScopes | void findScopes(Node externs, Node root) {
NodeTraversal.traverseRoots(
compiler,
new NodeTraversal.AbstractScopedCallback() {
@Override
public void enterScope(NodeTraversal t) {
createScopeFrom(t.getScope());
}
@Override
public void vis... | java | void findScopes(Node externs, Node root) {
NodeTraversal.traverseRoots(
compiler,
new NodeTraversal.AbstractScopedCallback() {
@Override
public void enterScope(NodeTraversal t) {
createScopeFrom(t.getScope());
}
@Override
public void vis... | [
"void",
"findScopes",
"(",
"Node",
"externs",
",",
"Node",
"root",
")",
"{",
"NodeTraversal",
".",
"traverseRoots",
"(",
"compiler",
",",
"new",
"NodeTraversal",
".",
"AbstractScopedCallback",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"enterScope",
"("... | Finds all the scopes and adds them to this symbol table. | [
"Finds",
"all",
"the",
"scopes",
"and",
"adds",
"them",
"to",
"this",
"symbol",
"table",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L445-L459 |
24,447 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.addAnonymousFunctions | public void addAnonymousFunctions() {
TreeSet<SymbolScope> scopes = new TreeSet<>(lexicalScopeOrdering);
for (SymbolScope scope : getAllScopes()) {
if (scope.isLexicalScope()) {
scopes.add(scope);
}
}
for (SymbolScope scope : scopes) {
addAnonymousFunctionsInScope(scope);
... | java | public void addAnonymousFunctions() {
TreeSet<SymbolScope> scopes = new TreeSet<>(lexicalScopeOrdering);
for (SymbolScope scope : getAllScopes()) {
if (scope.isLexicalScope()) {
scopes.add(scope);
}
}
for (SymbolScope scope : scopes) {
addAnonymousFunctionsInScope(scope);
... | [
"public",
"void",
"addAnonymousFunctions",
"(",
")",
"{",
"TreeSet",
"<",
"SymbolScope",
">",
"scopes",
"=",
"new",
"TreeSet",
"<>",
"(",
"lexicalScopeOrdering",
")",
";",
"for",
"(",
"SymbolScope",
"scope",
":",
"getAllScopes",
"(",
")",
")",
"{",
"if",
"... | Finds anonymous functions in local scopes, and gives them names and symbols. They will show up
as local variables with names "function%0", "function%1", etc. | [
"Finds",
"anonymous",
"functions",
"in",
"local",
"scopes",
"and",
"gives",
"them",
"names",
"and",
"symbols",
".",
"They",
"will",
"show",
"up",
"as",
"local",
"variables",
"with",
"names",
"function%0",
"function%1",
"etc",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L470-L481 |
24,448 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.isAnySymbolDeclared | private Symbol isAnySymbolDeclared(String name, Node declNode, SymbolScope scope) {
Symbol sym = symbols.get(declNode, name);
if (sym == null) {
// Sometimes, our symbol tables will disagree on where the
// declaration node should be. In the rare case where this happens,
// trust the existing ... | java | private Symbol isAnySymbolDeclared(String name, Node declNode, SymbolScope scope) {
Symbol sym = symbols.get(declNode, name);
if (sym == null) {
// Sometimes, our symbol tables will disagree on where the
// declaration node should be. In the rare case where this happens,
// trust the existing ... | [
"private",
"Symbol",
"isAnySymbolDeclared",
"(",
"String",
"name",
",",
"Node",
"declNode",
",",
"SymbolScope",
"scope",
")",
"{",
"Symbol",
"sym",
"=",
"symbols",
".",
"get",
"(",
"declNode",
",",
"name",
")",
";",
"if",
"(",
"sym",
"==",
"null",
")",
... | Checks if any symbol is already declared at the given node and scope for the given name. If so,
returns it. | [
"Checks",
"if",
"any",
"symbol",
"is",
"already",
"declared",
"at",
"the",
"given",
"node",
"and",
"scope",
"for",
"the",
"given",
"name",
".",
"If",
"so",
"returns",
"it",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L562-L572 |
24,449 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.findBestDeclToAdd | private <S extends StaticSlot, R extends StaticRef> StaticRef findBestDeclToAdd(
StaticSymbolTable<S, R> otherSymbolTable, S slot) {
StaticRef decl = slot.getDeclaration();
if (isGoodRefToAdd(decl)) {
return decl;
}
for (R ref : otherSymbolTable.getReferences(slot)) {
if (isGoodRefToA... | java | private <S extends StaticSlot, R extends StaticRef> StaticRef findBestDeclToAdd(
StaticSymbolTable<S, R> otherSymbolTable, S slot) {
StaticRef decl = slot.getDeclaration();
if (isGoodRefToAdd(decl)) {
return decl;
}
for (R ref : otherSymbolTable.getReferences(slot)) {
if (isGoodRefToA... | [
"private",
"<",
"S",
"extends",
"StaticSlot",
",",
"R",
"extends",
"StaticRef",
">",
"StaticRef",
"findBestDeclToAdd",
"(",
"StaticSymbolTable",
"<",
"S",
",",
"R",
">",
"otherSymbolTable",
",",
"S",
"slot",
")",
"{",
"StaticRef",
"decl",
"=",
"slot",
".",
... | Helper for addSymbolsFrom, to determine the best declaration spot. | [
"Helper",
"for",
"addSymbolsFrom",
"to",
"determine",
"the",
"best",
"declaration",
"spot",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L575-L589 |
24,450 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.mergeSymbol | private void mergeSymbol(Symbol from, Symbol to) {
for (Node nodeToMove : from.references.keySet()) {
if (!nodeToMove.equals(from.getDeclarationNode())) {
to.defineReferenceAt(nodeToMove);
}
}
removeSymbol(from);
} | java | private void mergeSymbol(Symbol from, Symbol to) {
for (Node nodeToMove : from.references.keySet()) {
if (!nodeToMove.equals(from.getDeclarationNode())) {
to.defineReferenceAt(nodeToMove);
}
}
removeSymbol(from);
} | [
"private",
"void",
"mergeSymbol",
"(",
"Symbol",
"from",
",",
"Symbol",
"to",
")",
"{",
"for",
"(",
"Node",
"nodeToMove",
":",
"from",
".",
"references",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"!",
"nodeToMove",
".",
"equals",
"(",
"from",
"."... | Merges 'from' symbol to 'to' symbol by moving all references to point to the 'to' symbol and
removing 'from' symbol. | [
"Merges",
"from",
"symbol",
"to",
"to",
"symbol",
"by",
"moving",
"all",
"references",
"to",
"point",
"to",
"the",
"to",
"symbol",
"and",
"removing",
"from",
"symbol",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L653-L660 |
24,451 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.pruneOrphanedNames | void pruneOrphanedNames() {
nextSymbol:
for (Symbol s : getAllSymbols()) {
if (s.isProperty()) {
continue;
}
String currentName = s.getName();
int dot = -1;
while (-1 != (dot = currentName.lastIndexOf('.'))) {
currentName = currentName.substring(0, dot);
S... | java | void pruneOrphanedNames() {
nextSymbol:
for (Symbol s : getAllSymbols()) {
if (s.isProperty()) {
continue;
}
String currentName = s.getName();
int dot = -1;
while (-1 != (dot = currentName.lastIndexOf('.'))) {
currentName = currentName.substring(0, dot);
S... | [
"void",
"pruneOrphanedNames",
"(",
")",
"{",
"nextSymbol",
":",
"for",
"(",
"Symbol",
"s",
":",
"getAllSymbols",
"(",
")",
")",
"{",
"if",
"(",
"s",
".",
"isProperty",
"(",
")",
")",
"{",
"continue",
";",
"}",
"String",
"currentName",
"=",
"s",
".",
... | Removes symbols where the namespace they're on has been removed.
<p>After filling property scopes, we may have two symbols represented in different ways. For
example, "A.superClass_.foo" and B.prototype.foo".
<p>This resolves that ambiguity by pruning the duplicates. If we have a lexical symbol with a
constructor in ... | [
"Removes",
"symbols",
"where",
"the",
"namespace",
"they",
"re",
"on",
"has",
"been",
"removed",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L900-L923 |
24,452 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.fillJSDocInfo | void fillJSDocInfo(Node externs, Node root) {
NodeTraversal.traverseRoots(
compiler, new JSDocInfoCollector(compiler.getTypeRegistry()), externs, root);
// Create references to parameters in the JSDoc.
for (Symbol sym : getAllSymbols()) {
JSDocInfo info = sym.getJSDocInfo();
if (info ==... | java | void fillJSDocInfo(Node externs, Node root) {
NodeTraversal.traverseRoots(
compiler, new JSDocInfoCollector(compiler.getTypeRegistry()), externs, root);
// Create references to parameters in the JSDoc.
for (Symbol sym : getAllSymbols()) {
JSDocInfo info = sym.getJSDocInfo();
if (info ==... | [
"void",
"fillJSDocInfo",
"(",
"Node",
"externs",
",",
"Node",
"root",
")",
"{",
"NodeTraversal",
".",
"traverseRoots",
"(",
"compiler",
",",
"new",
"JSDocInfoCollector",
"(",
"compiler",
".",
"getTypeRegistry",
"(",
")",
")",
",",
"externs",
",",
"root",
")"... | Index JSDocInfo. | [
"Index",
"JSDocInfo",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L944-L993 |
24,453 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.fillSymbolVisibility | void fillSymbolVisibility(Node externs, Node root) {
CollectFileOverviewVisibility collectPass = new CollectFileOverviewVisibility(compiler);
collectPass.process(externs, root);
ImmutableMap<StaticSourceFile, Visibility> visibilityMap =
collectPass.getFileOverviewVisibilityMap();
NodeTraversal.... | java | void fillSymbolVisibility(Node externs, Node root) {
CollectFileOverviewVisibility collectPass = new CollectFileOverviewVisibility(compiler);
collectPass.process(externs, root);
ImmutableMap<StaticSourceFile, Visibility> visibilityMap =
collectPass.getFileOverviewVisibilityMap();
NodeTraversal.... | [
"void",
"fillSymbolVisibility",
"(",
"Node",
"externs",
",",
"Node",
"root",
")",
"{",
"CollectFileOverviewVisibility",
"collectPass",
"=",
"new",
"CollectFileOverviewVisibility",
"(",
"compiler",
")",
";",
"collectPass",
".",
"process",
"(",
"externs",
",",
"root",... | Records the visibility of each symbol. | [
"Records",
"the",
"visibility",
"of",
"each",
"symbol",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L996-L1007 |
24,454 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.createPropertyScopeFor | @SuppressWarnings("ReferenceEquality")
private void createPropertyScopeFor(Symbol s) {
// In order to build a property scope for s, we will need to build
// a property scope for all its implicit prototypes first. This means
// that sometimes we will already have built its property scope
// for a previ... | java | @SuppressWarnings("ReferenceEquality")
private void createPropertyScopeFor(Symbol s) {
// In order to build a property scope for s, we will need to build
// a property scope for all its implicit prototypes first. This means
// that sometimes we will already have built its property scope
// for a previ... | [
"@",
"SuppressWarnings",
"(",
"\"ReferenceEquality\"",
")",
"private",
"void",
"createPropertyScopeFor",
"(",
"Symbol",
"s",
")",
"{",
"// In order to build a property scope for s, we will need to build",
"// a property scope for all its implicit prototypes first. This means",
"// that... | This function uses == to compare types to be exact same instances. | [
"This",
"function",
"uses",
"==",
"to",
"compare",
"types",
"to",
"be",
"exact",
"same",
"instances",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L1019-L1093 |
24,455 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.maybeGetParentPropertyScope | @Nullable
private SymbolScope maybeGetParentPropertyScope(ObjectType symbolObjectType) {
ObjectType proto = symbolObjectType.getImplicitPrototype();
if (proto == null || proto == symbolObjectType) {
return null;
}
final Symbol parentSymbol;
if (isEs6ClassConstructor(proto)) {
// given ... | java | @Nullable
private SymbolScope maybeGetParentPropertyScope(ObjectType symbolObjectType) {
ObjectType proto = symbolObjectType.getImplicitPrototype();
if (proto == null || proto == symbolObjectType) {
return null;
}
final Symbol parentSymbol;
if (isEs6ClassConstructor(proto)) {
// given ... | [
"@",
"Nullable",
"private",
"SymbolScope",
"maybeGetParentPropertyScope",
"(",
"ObjectType",
"symbolObjectType",
")",
"{",
"ObjectType",
"proto",
"=",
"symbolObjectType",
".",
"getImplicitPrototype",
"(",
")",
";",
"if",
"(",
"proto",
"==",
"null",
"||",
"proto",
... | If this type has an implicit prototype set, returns the SymbolScope corresponding to the
properties of the implicit prototype. Otherwise returns null.
<p>Note that currently we only handle cases where the implicit prototype is a) a class or b) is
an instance object. | [
"If",
"this",
"type",
"has",
"an",
"implicit",
"prototype",
"set",
"returns",
"the",
"SymbolScope",
"corresponding",
"to",
"the",
"properties",
"of",
"the",
"implicit",
"prototype",
".",
"Otherwise",
"returns",
"null",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L1102-L1127 |
24,456 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.fillSuperReferences | void fillSuperReferences(Node externs, Node root) {
NodeTraversal.Callback collectSuper =
new AbstractPostOrderCallback() {
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
// Process only 'super' nodes with types.
if (!n.isSuper() || n.getJSTyp... | java | void fillSuperReferences(Node externs, Node root) {
NodeTraversal.Callback collectSuper =
new AbstractPostOrderCallback() {
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
// Process only 'super' nodes with types.
if (!n.isSuper() || n.getJSTyp... | [
"void",
"fillSuperReferences",
"(",
"Node",
"externs",
",",
"Node",
"root",
")",
"{",
"NodeTraversal",
".",
"Callback",
"collectSuper",
"=",
"new",
"AbstractPostOrderCallback",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"visit",
"(",
"NodeTraversal",
"t",... | Fill in references to "super" variables. | [
"Fill",
"in",
"references",
"to",
"super",
"variables",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L1141-L1157 |
24,457 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.isSymbolDuplicatedExternOnWindow | private boolean isSymbolDuplicatedExternOnWindow(Symbol symbol) {
Node node = symbol.getDeclarationNode();
// Check that node is of type "window.foo";
return !node.isIndexable()
&& node.isGetProp()
&& node.getFirstChild().isName()
&& node.getFirstChild().getString().equals("window");... | java | private boolean isSymbolDuplicatedExternOnWindow(Symbol symbol) {
Node node = symbol.getDeclarationNode();
// Check that node is of type "window.foo";
return !node.isIndexable()
&& node.isGetProp()
&& node.getFirstChild().isName()
&& node.getFirstChild().getString().equals("window");... | [
"private",
"boolean",
"isSymbolDuplicatedExternOnWindow",
"(",
"Symbol",
"symbol",
")",
"{",
"Node",
"node",
"=",
"symbol",
".",
"getDeclarationNode",
"(",
")",
";",
"// Check that node is of type \"window.foo\";",
"return",
"!",
"node",
".",
"isIndexable",
"(",
")",
... | Heuristic method to check whether symbol was created by DeclaredGlobalExternsOnWindow.java
pass. | [
"Heuristic",
"method",
"to",
"check",
"whether",
"symbol",
"was",
"created",
"by",
"DeclaredGlobalExternsOnWindow",
".",
"java",
"pass",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L1175-L1182 |
24,458 | google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.getLexicalScopeDepth | private int getLexicalScopeDepth(SymbolScope scope) {
if (scope.isLexicalScope() || scope.isDocScope()) {
return scope.getScopeDepth();
} else {
checkState(scope.isPropertyScope());
Symbol sym = scope.getSymbolForScope();
checkNotNull(sym);
return getLexicalScopeDepth(getScope(sym)... | java | private int getLexicalScopeDepth(SymbolScope scope) {
if (scope.isLexicalScope() || scope.isDocScope()) {
return scope.getScopeDepth();
} else {
checkState(scope.isPropertyScope());
Symbol sym = scope.getSymbolForScope();
checkNotNull(sym);
return getLexicalScopeDepth(getScope(sym)... | [
"private",
"int",
"getLexicalScopeDepth",
"(",
"SymbolScope",
"scope",
")",
"{",
"if",
"(",
"scope",
".",
"isLexicalScope",
"(",
")",
"||",
"scope",
".",
"isDocScope",
"(",
")",
")",
"{",
"return",
"scope",
".",
"getScopeDepth",
"(",
")",
";",
"}",
"else... | For a lexical scope, just returns the normal scope depth.
<p>For a property scope, returns the number of scopes we have to search to find the nearest
lexical scope, plus that lexical scope's depth.
<p>For a doc info scope, returns 0. | [
"For",
"a",
"lexical",
"scope",
"just",
"returns",
"the",
"normal",
"scope",
"depth",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L2070-L2079 |
24,459 | google/closure-compiler | src/com/google/javascript/jscomp/Normalize.java | Normalize.removeDuplicateDeclarations | private void removeDuplicateDeclarations(Node externs, Node root) {
Callback tickler = new ScopeTicklingCallback();
ScopeCreator scopeCreator =
new Es6SyntacticScopeCreator(compiler, new DuplicateDeclarationHandler());
NodeTraversal t = new NodeTraversal(compiler, tickler, scopeCreator);
t.trave... | java | private void removeDuplicateDeclarations(Node externs, Node root) {
Callback tickler = new ScopeTicklingCallback();
ScopeCreator scopeCreator =
new Es6SyntacticScopeCreator(compiler, new DuplicateDeclarationHandler());
NodeTraversal t = new NodeTraversal(compiler, tickler, scopeCreator);
t.trave... | [
"private",
"void",
"removeDuplicateDeclarations",
"(",
"Node",
"externs",
",",
"Node",
"root",
")",
"{",
"Callback",
"tickler",
"=",
"new",
"ScopeTicklingCallback",
"(",
")",
";",
"ScopeCreator",
"scopeCreator",
"=",
"new",
"Es6SyntacticScopeCreator",
"(",
"compiler... | Remove duplicate VAR declarations. | [
"Remove",
"duplicate",
"VAR",
"declarations",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Normalize.java#L793-L799 |
24,460 | google/closure-compiler | src/com/google/javascript/jscomp/OptimizeReturns.java | OptimizeReturns.isRemovableValue | private boolean isRemovableValue(Node n) {
switch (n.getToken()) {
case TEMPLATELIT:
case ARRAYLIT:
for (Node child = n.getFirstChild(); child != null; child = child.getNext()) {
if ((!child.isEmpty()) && !isRemovableValue(child)) {
return false;
}
}
... | java | private boolean isRemovableValue(Node n) {
switch (n.getToken()) {
case TEMPLATELIT:
case ARRAYLIT:
for (Node child = n.getFirstChild(); child != null; child = child.getNext()) {
if ((!child.isEmpty()) && !isRemovableValue(child)) {
return false;
}
}
... | [
"private",
"boolean",
"isRemovableValue",
"(",
"Node",
"n",
")",
"{",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"TEMPLATELIT",
":",
"case",
"ARRAYLIT",
":",
"for",
"(",
"Node",
"child",
"=",
"n",
".",
"getFirstChild",
"(",
")",
... | So we don't need to update the graph. | [
"So",
"we",
"don",
"t",
"need",
"to",
"update",
"the",
"graph",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/OptimizeReturns.java#L206-L235 |
24,461 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.warnAboutNamespaceAliasing | private void warnAboutNamespaceAliasing(Name nameObj, Ref ref) {
compiler.report(JSError.make(ref.getNode(), UNSAFE_NAMESPACE_WARNING, nameObj.getFullName()));
} | java | private void warnAboutNamespaceAliasing(Name nameObj, Ref ref) {
compiler.report(JSError.make(ref.getNode(), UNSAFE_NAMESPACE_WARNING, nameObj.getFullName()));
} | [
"private",
"void",
"warnAboutNamespaceAliasing",
"(",
"Name",
"nameObj",
",",
"Ref",
"ref",
")",
"{",
"compiler",
".",
"report",
"(",
"JSError",
".",
"make",
"(",
"ref",
".",
"getNode",
"(",
")",
",",
"UNSAFE_NAMESPACE_WARNING",
",",
"nameObj",
".",
"getFull... | Reports a warning because a namespace was aliased.
@param nameObj A namespace that is being aliased
@param ref The reference that forced the alias | [
"Reports",
"a",
"warning",
"because",
"a",
"namespace",
"was",
"aliased",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L224-L226 |
24,462 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.warnAboutNamespaceRedefinition | private void warnAboutNamespaceRedefinition(Name nameObj, Ref ref) {
compiler.report(
JSError.make(ref.getNode(), NAMESPACE_REDEFINED_WARNING, nameObj.getFullName()));
} | java | private void warnAboutNamespaceRedefinition(Name nameObj, Ref ref) {
compiler.report(
JSError.make(ref.getNode(), NAMESPACE_REDEFINED_WARNING, nameObj.getFullName()));
} | [
"private",
"void",
"warnAboutNamespaceRedefinition",
"(",
"Name",
"nameObj",
",",
"Ref",
"ref",
")",
"{",
"compiler",
".",
"report",
"(",
"JSError",
".",
"make",
"(",
"ref",
".",
"getNode",
"(",
")",
",",
"NAMESPACE_REDEFINED_WARNING",
",",
"nameObj",
".",
"... | Reports a warning because a namespace was redefined.
@param nameObj A namespace that is being redefined
@param ref The reference that set the namespace | [
"Reports",
"a",
"warning",
"because",
"a",
"namespace",
"was",
"redefined",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L234-L237 |
24,463 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.flattenReferencesToCollapsibleDescendantNames | private void flattenReferencesToCollapsibleDescendantNames(
Name n, String alias) {
if (n.props == null || n.isCollapsingExplicitlyDenied()) {
return;
}
for (Name p : n.props) {
String propAlias = appendPropForAlias(alias, p.getBaseName());
boolean isAllowedToCollapse =
p... | java | private void flattenReferencesToCollapsibleDescendantNames(
Name n, String alias) {
if (n.props == null || n.isCollapsingExplicitlyDenied()) {
return;
}
for (Name p : n.props) {
String propAlias = appendPropForAlias(alias, p.getBaseName());
boolean isAllowedToCollapse =
p... | [
"private",
"void",
"flattenReferencesToCollapsibleDescendantNames",
"(",
"Name",
"n",
",",
"String",
"alias",
")",
"{",
"if",
"(",
"n",
".",
"props",
"==",
"null",
"||",
"n",
".",
"isCollapsingExplicitlyDenied",
"(",
")",
")",
"{",
"return",
";",
"}",
"for",... | Flattens all references to collapsible properties of a global name except
their initial definitions. Recurs on subnames.
@param n An object representing a global name
@param alias The flattened name for {@code n} | [
"Flattens",
"all",
"references",
"to",
"collapsible",
"properties",
"of",
"a",
"global",
"name",
"except",
"their",
"initial",
"definitions",
".",
"Recurs",
"on",
"subnames",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L246-L268 |
24,464 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.flattenSimpleStubDeclaration | private void flattenSimpleStubDeclaration(Name name, String alias) {
Ref ref = Iterables.getOnlyElement(name.getRefs());
Node nameNode = NodeUtil.newName(compiler, alias, ref.getNode(), name.getFullName());
Node varNode = IR.var(nameNode).useSourceInfoIfMissingFrom(nameNode);
checkState(ref.getNode().g... | java | private void flattenSimpleStubDeclaration(Name name, String alias) {
Ref ref = Iterables.getOnlyElement(name.getRefs());
Node nameNode = NodeUtil.newName(compiler, alias, ref.getNode(), name.getFullName());
Node varNode = IR.var(nameNode).useSourceInfoIfMissingFrom(nameNode);
checkState(ref.getNode().g... | [
"private",
"void",
"flattenSimpleStubDeclaration",
"(",
"Name",
"name",
",",
"String",
"alias",
")",
"{",
"Ref",
"ref",
"=",
"Iterables",
".",
"getOnlyElement",
"(",
"name",
".",
"getRefs",
"(",
")",
")",
";",
"Node",
"nameNode",
"=",
"NodeUtil",
".",
"new... | Flattens a stub declaration.
This is mostly a hack to support legacy users. | [
"Flattens",
"a",
"stub",
"declaration",
".",
"This",
"is",
"mostly",
"a",
"hack",
"to",
"support",
"legacy",
"users",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L274-L284 |
24,465 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.flattenReferencesTo | private void flattenReferencesTo(Name n, String alias) {
String originalName = n.getFullName();
for (Ref r : n.getRefs()) {
if (r == n.getDeclaration()) {
// Declarations are handled separately.
continue;
}
Node rParent = r.getNode().getParent();
// There are two cases wh... | java | private void flattenReferencesTo(Name n, String alias) {
String originalName = n.getFullName();
for (Ref r : n.getRefs()) {
if (r == n.getDeclaration()) {
// Declarations are handled separately.
continue;
}
Node rParent = r.getNode().getParent();
// There are two cases wh... | [
"private",
"void",
"flattenReferencesTo",
"(",
"Name",
"n",
",",
"String",
"alias",
")",
"{",
"String",
"originalName",
"=",
"n",
".",
"getFullName",
"(",
")",
";",
"for",
"(",
"Ref",
"r",
":",
"n",
".",
"getRefs",
"(",
")",
")",
"{",
"if",
"(",
"r... | Flattens all references to a collapsible property of a global name except
its initial definition.
@param n A global property name (e.g. "a.b" or "a.b.c.d")
@param alias The flattened name (e.g. "a$b" or "a$b$c$d") | [
"Flattens",
"all",
"references",
"to",
"a",
"collapsible",
"property",
"of",
"a",
"global",
"name",
"except",
"its",
"initial",
"definition",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L293-L324 |
24,466 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.flattenPrefixes | private void flattenPrefixes(String alias, Name n, int depth) {
// Only flatten the prefix of a name declaration if the name being
// initialized is fully qualified (i.e. not an object literal key).
String originalName = n.getFullName();
Ref decl = n.getDeclaration();
if (decl != null && decl.getNod... | java | private void flattenPrefixes(String alias, Name n, int depth) {
// Only flatten the prefix of a name declaration if the name being
// initialized is fully qualified (i.e. not an object literal key).
String originalName = n.getFullName();
Ref decl = n.getDeclaration();
if (decl != null && decl.getNod... | [
"private",
"void",
"flattenPrefixes",
"(",
"String",
"alias",
",",
"Name",
"n",
",",
"int",
"depth",
")",
"{",
"// Only flatten the prefix of a name declaration if the name being",
"// initialized is fully qualified (i.e. not an object literal key).",
"String",
"originalName",
"=... | Flattens all occurrences of a name as a prefix of subnames beginning
with a particular subname.
@param n A global property name (e.g. "a.b.c.d")
@param alias A flattened prefix name (e.g. "a$b")
@param depth The difference in depth between the property name and
the prefix name (e.g. 2) | [
"Flattens",
"all",
"occurrences",
"of",
"a",
"name",
"as",
"a",
"prefix",
"of",
"subnames",
"beginning",
"with",
"a",
"particular",
"subname",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L335-L362 |
24,467 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.flattenNameRefAtDepth | private void flattenNameRefAtDepth(String alias, Node n, int depth,
String originalName) {
// This method has to work for both GETPROP chains and, in rare cases,
// OBJLIT keys, possibly nested. That's why we check for children before
// proceeding. In the OBJLIT case, we don't need to do anything.
... | java | private void flattenNameRefAtDepth(String alias, Node n, int depth,
String originalName) {
// This method has to work for both GETPROP chains and, in rare cases,
// OBJLIT keys, possibly nested. That's why we check for children before
// proceeding. In the OBJLIT case, we don't need to do anything.
... | [
"private",
"void",
"flattenNameRefAtDepth",
"(",
"String",
"alias",
",",
"Node",
"n",
",",
"int",
"depth",
",",
"String",
"originalName",
")",
"{",
"// This method has to work for both GETPROP chains and, in rare cases,",
"// OBJLIT keys, possibly nested. That's why we check for ... | Flattens a particular prefix of a single name reference.
@param alias A flattened prefix name (e.g. "a$b")
@param n The node corresponding to a subproperty name (e.g. "a.b.c.d")
@param depth The difference in depth between the property name and
the prefix name (e.g. 2)
@param originalName String version of the propert... | [
"Flattens",
"a",
"particular",
"prefix",
"of",
"a",
"single",
"name",
"reference",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L373-L390 |
24,468 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.collapseDeclarationOfNameAndDescendants | private void collapseDeclarationOfNameAndDescendants(Name n, String alias) {
boolean canCollapseChildNames = n.canCollapseUnannotatedChildNames();
// Handle this name first so that nested object literals get unrolled.
if (canCollapse(n)) {
updateGlobalNameDeclaration(n, alias, canCollapseChildNames);... | java | private void collapseDeclarationOfNameAndDescendants(Name n, String alias) {
boolean canCollapseChildNames = n.canCollapseUnannotatedChildNames();
// Handle this name first so that nested object literals get unrolled.
if (canCollapse(n)) {
updateGlobalNameDeclaration(n, alias, canCollapseChildNames);... | [
"private",
"void",
"collapseDeclarationOfNameAndDescendants",
"(",
"Name",
"n",
",",
"String",
"alias",
")",
"{",
"boolean",
"canCollapseChildNames",
"=",
"n",
".",
"canCollapseUnannotatedChildNames",
"(",
")",
";",
"// Handle this name first so that nested object literals ge... | Collapses definitions of the collapsible properties of a global name.
Recurs on subnames that also represent JavaScript objects with
collapsible properties.
@param n A node representing a global name
@param alias The flattened name for {@code n} | [
"Collapses",
"definitions",
"of",
"the",
"collapsible",
"properties",
"of",
"a",
"global",
"name",
".",
"Recurs",
"on",
"subnames",
"that",
"also",
"represent",
"JavaScript",
"objects",
"with",
"collapsible",
"properties",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L438-L452 |
24,469 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.checkForHosedThisReferences | private void checkForHosedThisReferences(Node function, JSDocInfo docInfo,
final Name name) {
// A function is getting collapsed. Make sure that if it refers to "this",
// it must be a constructor, interface, record, arrow function, or documented with @this.
boolean isAllowedToReferenceThis =
... | java | private void checkForHosedThisReferences(Node function, JSDocInfo docInfo,
final Name name) {
// A function is getting collapsed. Make sure that if it refers to "this",
// it must be a constructor, interface, record, arrow function, or documented with @this.
boolean isAllowedToReferenceThis =
... | [
"private",
"void",
"checkForHosedThisReferences",
"(",
"Node",
"function",
",",
"JSDocInfo",
"docInfo",
",",
"final",
"Name",
"name",
")",
"{",
"// A function is getting collapsed. Make sure that if it refers to \"this\",",
"// it must be a constructor, interface, record, arrow funct... | Warns about any references to "this" in the given FUNCTION. The function
is getting collapsed, so the references will change. | [
"Warns",
"about",
"any",
"references",
"to",
"this",
"in",
"the",
"given",
"FUNCTION",
".",
"The",
"function",
"is",
"getting",
"collapsed",
"so",
"the",
"references",
"will",
"change",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L643-L662 |
24,470 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.declareVariablesForObjLitValues | private void declareVariablesForObjLitValues(
Name objlitName,
String alias,
Node objlit,
Node varNode,
Node nameToAddAfter,
Node varParent) {
int arbitraryNameCounter = 0;
boolean discardKeys = !objlitName.shouldKeepKeys();
for (Node key = objlit.getFirstChild(), nextKe... | java | private void declareVariablesForObjLitValues(
Name objlitName,
String alias,
Node objlit,
Node varNode,
Node nameToAddAfter,
Node varParent) {
int arbitraryNameCounter = 0;
boolean discardKeys = !objlitName.shouldKeepKeys();
for (Node key = objlit.getFirstChild(), nextKe... | [
"private",
"void",
"declareVariablesForObjLitValues",
"(",
"Name",
"objlitName",
",",
"String",
"alias",
",",
"Node",
"objlit",
",",
"Node",
"varNode",
",",
"Node",
"nameToAddAfter",
",",
"Node",
"varParent",
")",
"{",
"int",
"arbitraryNameCounter",
"=",
"0",
";... | Declares global variables to serve as aliases for the values in an object literal, optionally
removing all of the object literal's keys and values.
@param alias The object literal's flattened name (e.g. "a$b$c")
@param objlit The OBJLIT node
@param varNode The VAR node to which new global variables should be added as ... | [
"Declares",
"global",
"variables",
"to",
"serve",
"as",
"aliases",
"for",
"the",
"values",
"in",
"an",
"object",
"literal",
"optionally",
"removing",
"all",
"of",
"the",
"object",
"literal",
"s",
"keys",
"and",
"values",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L786-L878 |
24,471 | google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.addStubsForUndeclaredProperties | private void addStubsForUndeclaredProperties(Name n, String alias, Node parent, Node addAfter) {
checkState(n.canCollapseUnannotatedChildNames(), n);
checkArgument(NodeUtil.isStatementBlock(parent), parent);
checkNotNull(addAfter);
if (n.props == null) {
return;
}
for (Name p : n.props) {
... | java | private void addStubsForUndeclaredProperties(Name n, String alias, Node parent, Node addAfter) {
checkState(n.canCollapseUnannotatedChildNames(), n);
checkArgument(NodeUtil.isStatementBlock(parent), parent);
checkNotNull(addAfter);
if (n.props == null) {
return;
}
for (Name p : n.props) {
... | [
"private",
"void",
"addStubsForUndeclaredProperties",
"(",
"Name",
"n",
",",
"String",
"alias",
",",
"Node",
"parent",
",",
"Node",
"addAfter",
")",
"{",
"checkState",
"(",
"n",
".",
"canCollapseUnannotatedChildNames",
"(",
")",
",",
"n",
")",
";",
"checkArgum... | Adds global variable "stubs" for any properties of a global name that are only set in a local
scope or read but never set.
@param n An object representing a global name (e.g. "a", "a.b.c")
@param alias The flattened name of the object whose properties we are adding stubs for (e.g.
"a$b$c")
@param parent The node to wh... | [
"Adds",
"global",
"variable",
"stubs",
"for",
"any",
"properties",
"of",
"a",
"global",
"name",
"that",
"are",
"only",
"set",
"in",
"a",
"local",
"scope",
"or",
"read",
"but",
"never",
"set",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L890-L913 |
24,472 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractPeepholeOptimization.java | AbstractPeepholeOptimization.report | protected void report(DiagnosticType diagnostic, Node n) {
JSError error = JSError.make(n, diagnostic, n.toString());
compiler.report(error);
} | java | protected void report(DiagnosticType diagnostic, Node n) {
JSError error = JSError.make(n, diagnostic, n.toString());
compiler.report(error);
} | [
"protected",
"void",
"report",
"(",
"DiagnosticType",
"diagnostic",
",",
"Node",
"n",
")",
"{",
"JSError",
"error",
"=",
"JSError",
".",
"make",
"(",
"n",
",",
"diagnostic",
",",
"n",
".",
"toString",
"(",
")",
")",
";",
"compiler",
".",
"report",
"(",... | Helper method for reporting an error to the compiler when applying a
peephole optimization.
@param diagnostic The error type
@param n The node for which the error should be reported | [
"Helper",
"method",
"for",
"reporting",
"an",
"error",
"to",
"the",
"compiler",
"when",
"applying",
"a",
"peephole",
"optimization",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractPeepholeOptimization.java#L53-L56 |
24,473 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractPeepholeOptimization.java | AbstractPeepholeOptimization.areNodesEqualForInlining | protected boolean areNodesEqualForInlining(Node n1, Node n2) {
/* Our implementation delegates to the compiler. We provide this
* method because we don't want to expose Compiler to PeepholeOptimizations.
*/
checkNotNull(compiler);
return compiler.areNodesEqualForInlining(n1, n2);
} | java | protected boolean areNodesEqualForInlining(Node n1, Node n2) {
/* Our implementation delegates to the compiler. We provide this
* method because we don't want to expose Compiler to PeepholeOptimizations.
*/
checkNotNull(compiler);
return compiler.areNodesEqualForInlining(n1, n2);
} | [
"protected",
"boolean",
"areNodesEqualForInlining",
"(",
"Node",
"n1",
",",
"Node",
"n2",
")",
"{",
"/* Our implementation delegates to the compiler. We provide this\n * method because we don't want to expose Compiler to PeepholeOptimizations.\n */",
"checkNotNull",
"(",
"compile... | Are the nodes equal for the purpose of inlining?
If type aware optimizations are on, type equality is checked. | [
"Are",
"the",
"nodes",
"equal",
"for",
"the",
"purpose",
"of",
"inlining?",
"If",
"type",
"aware",
"optimizations",
"are",
"on",
"type",
"equality",
"is",
"checked",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractPeepholeOptimization.java#L62-L68 |
24,474 | google/closure-compiler | src/com/google/javascript/jscomp/gwt/client/Es6ClassConverterJsDocHelper.java | Es6ClassConverterJsDocHelper.getClassJsDoc | @JsMethod(name = "getClassJsDoc", namespace = "jscomp")
public static String getClassJsDoc(String jsDoc) {
if (Strings.isNullOrEmpty(jsDoc)) {
return null;
}
Config config =
Config.builder()
.setLanguageMode(LanguageMode.ECMASCRIPT3)
.setStrictMode(Config.StrictMode.S... | java | @JsMethod(name = "getClassJsDoc", namespace = "jscomp")
public static String getClassJsDoc(String jsDoc) {
if (Strings.isNullOrEmpty(jsDoc)) {
return null;
}
Config config =
Config.builder()
.setLanguageMode(LanguageMode.ECMASCRIPT3)
.setStrictMode(Config.StrictMode.S... | [
"@",
"JsMethod",
"(",
"name",
"=",
"\"getClassJsDoc\"",
",",
"namespace",
"=",
"\"jscomp\"",
")",
"public",
"static",
"String",
"getClassJsDoc",
"(",
"String",
"jsDoc",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"jsDoc",
")",
")",
"{",
"ret... | Gets JS Doc that should be retained on a class. Used to upgrade ES5 to ES6 classes and separate
class from constructor comments. | [
"Gets",
"JS",
"Doc",
"that",
"should",
"be",
"retained",
"on",
"a",
"class",
".",
"Used",
"to",
"upgrade",
"ES5",
"to",
"ES6",
"classes",
"and",
"separate",
"class",
"from",
"constructor",
"comments",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/gwt/client/Es6ClassConverterJsDocHelper.java#L57-L88 |
24,475 | google/closure-compiler | src/com/google/javascript/jscomp/gwt/client/Es6ClassConverterJsDocHelper.java | Es6ClassConverterJsDocHelper.getConstructorJsDoc | @JsMethod(name = "getConstructorJsDoc", namespace = "jscomp")
public static String getConstructorJsDoc(String jsDoc) {
if (Strings.isNullOrEmpty(jsDoc)) {
return null;
}
Config config =
Config.builder()
.setLanguageMode(LanguageMode.ECMASCRIPT3)
.setStrictMode(Config.... | java | @JsMethod(name = "getConstructorJsDoc", namespace = "jscomp")
public static String getConstructorJsDoc(String jsDoc) {
if (Strings.isNullOrEmpty(jsDoc)) {
return null;
}
Config config =
Config.builder()
.setLanguageMode(LanguageMode.ECMASCRIPT3)
.setStrictMode(Config.... | [
"@",
"JsMethod",
"(",
"name",
"=",
"\"getConstructorJsDoc\"",
",",
"namespace",
"=",
"\"jscomp\"",
")",
"public",
"static",
"String",
"getConstructorJsDoc",
"(",
"String",
"jsDoc",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"jsDoc",
")",
")",
... | Gets JS Doc that should be moved to a constructor. Used to upgrade ES5 to ES6 classes and
separate class from constructor comments. | [
"Gets",
"JS",
"Doc",
"that",
"should",
"be",
"moved",
"to",
"a",
"constructor",
".",
"Used",
"to",
"upgrade",
"ES5",
"to",
"ES6",
"classes",
"and",
"separate",
"class",
"from",
"constructor",
"comments",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/gwt/client/Es6ClassConverterJsDocHelper.java#L94-L123 |
24,476 | google/closure-compiler | src/com/google/javascript/jscomp/CompilerInput.java | CompilerInput.getRequires | @Override
public ImmutableList<Require> getRequires() {
if (hasFullParseDependencyInfo) {
return ImmutableList.copyOf(orderedRequires);
}
return getDependencyInfo().getRequires();
} | java | @Override
public ImmutableList<Require> getRequires() {
if (hasFullParseDependencyInfo) {
return ImmutableList.copyOf(orderedRequires);
}
return getDependencyInfo().getRequires();
} | [
"@",
"Override",
"public",
"ImmutableList",
"<",
"Require",
">",
"getRequires",
"(",
")",
"{",
"if",
"(",
"hasFullParseDependencyInfo",
")",
"{",
"return",
"ImmutableList",
".",
"copyOf",
"(",
"orderedRequires",
")",
";",
"}",
"return",
"getDependencyInfo",
"(",... | Gets a list of types depended on by this input. | [
"Gets",
"a",
"list",
"of",
"types",
"depended",
"on",
"by",
"this",
"input",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CompilerInput.java#L161-L168 |
24,477 | google/closure-compiler | src/com/google/javascript/jscomp/CompilerInput.java | CompilerInput.getKnownRequires | ImmutableCollection<Require> getKnownRequires() {
return concat(
dependencyInfo != null ? dependencyInfo.getRequires() : ImmutableList.of(), extraRequires);
} | java | ImmutableCollection<Require> getKnownRequires() {
return concat(
dependencyInfo != null ? dependencyInfo.getRequires() : ImmutableList.of(), extraRequires);
} | [
"ImmutableCollection",
"<",
"Require",
">",
"getKnownRequires",
"(",
")",
"{",
"return",
"concat",
"(",
"dependencyInfo",
"!=",
"null",
"?",
"dependencyInfo",
".",
"getRequires",
"(",
")",
":",
"ImmutableList",
".",
"of",
"(",
")",
",",
"extraRequires",
")",
... | Gets a list of namespaces and paths depended on by this input, but does not attempt to
regenerate the dependency information. Typically this occurs from module rewriting. | [
"Gets",
"a",
"list",
"of",
"namespaces",
"and",
"paths",
"depended",
"on",
"by",
"this",
"input",
"but",
"does",
"not",
"attempt",
"to",
"regenerate",
"the",
"dependency",
"information",
".",
"Typically",
"this",
"occurs",
"from",
"module",
"rewriting",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CompilerInput.java#L179-L182 |
24,478 | google/closure-compiler | src/com/google/javascript/jscomp/CompilerInput.java | CompilerInput.getKnownProvides | ImmutableCollection<String> getKnownProvides() {
return concat(
dependencyInfo != null ? dependencyInfo.getProvides() : ImmutableList.<String>of(),
extraProvides);
} | java | ImmutableCollection<String> getKnownProvides() {
return concat(
dependencyInfo != null ? dependencyInfo.getProvides() : ImmutableList.<String>of(),
extraProvides);
} | [
"ImmutableCollection",
"<",
"String",
">",
"getKnownProvides",
"(",
")",
"{",
"return",
"concat",
"(",
"dependencyInfo",
"!=",
"null",
"?",
"dependencyInfo",
".",
"getProvides",
"(",
")",
":",
"ImmutableList",
".",
"<",
"String",
">",
"of",
"(",
")",
",",
... | Gets a list of types provided, but does not attempt to
regenerate the dependency information. Typically this occurs
from module rewriting. | [
"Gets",
"a",
"list",
"of",
"types",
"provided",
"but",
"does",
"not",
"attempt",
"to",
"regenerate",
"the",
"dependency",
"information",
".",
"Typically",
"this",
"occurs",
"from",
"module",
"rewriting",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CompilerInput.java#L209-L213 |
24,479 | google/closure-compiler | src/com/google/javascript/jscomp/CompilerInput.java | CompilerInput.addOrderedRequire | public boolean addOrderedRequire(Require require) {
if (!orderedRequires.contains(require)) {
orderedRequires.add(require);
return true;
}
return false;
} | java | public boolean addOrderedRequire(Require require) {
if (!orderedRequires.contains(require)) {
orderedRequires.add(require);
return true;
}
return false;
} | [
"public",
"boolean",
"addOrderedRequire",
"(",
"Require",
"require",
")",
"{",
"if",
"(",
"!",
"orderedRequires",
".",
"contains",
"(",
"require",
")",
")",
"{",
"orderedRequires",
".",
"add",
"(",
"require",
")",
";",
"return",
"true",
";",
"}",
"return",... | Registers a type that this input depends on in the order seen in the file. | [
"Registers",
"a",
"type",
"that",
"this",
"input",
"depends",
"on",
"in",
"the",
"order",
"seen",
"in",
"the",
"file",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CompilerInput.java#L224-L230 |
24,480 | google/closure-compiler | src/com/google/javascript/jscomp/CompilerInput.java | CompilerInput.addDynamicRequire | public boolean addDynamicRequire(String require) {
if (!dynamicRequires.contains(require)) {
dynamicRequires.add(require);
return true;
}
return false;
} | java | public boolean addDynamicRequire(String require) {
if (!dynamicRequires.contains(require)) {
dynamicRequires.add(require);
return true;
}
return false;
} | [
"public",
"boolean",
"addDynamicRequire",
"(",
"String",
"require",
")",
"{",
"if",
"(",
"!",
"dynamicRequires",
".",
"contains",
"(",
"require",
")",
")",
"{",
"dynamicRequires",
".",
"add",
"(",
"require",
")",
";",
"return",
"true",
";",
"}",
"return",
... | Registers a type that this input depends on in the order seen in the file. The type was loaded
dynamically so while it is part of the dependency graph, it does not need sorted before this
input. | [
"Registers",
"a",
"type",
"that",
"this",
"input",
"depends",
"on",
"in",
"the",
"order",
"seen",
"in",
"the",
"file",
".",
"The",
"type",
"was",
"loaded",
"dynamically",
"so",
"while",
"it",
"is",
"part",
"of",
"the",
"dependency",
"graph",
"it",
"does"... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CompilerInput.java#L246-L252 |
24,481 | google/closure-compiler | src/com/google/javascript/jscomp/CompilerInput.java | CompilerInput.getDependencyInfo | DependencyInfo getDependencyInfo() {
if (dependencyInfo == null) {
dependencyInfo = generateDependencyInfo();
}
if (!extraRequires.isEmpty() || !extraProvides.isEmpty()) {
dependencyInfo =
SimpleDependencyInfo.builder(getName(), getName())
.setProvides(concat(dependencyIn... | java | DependencyInfo getDependencyInfo() {
if (dependencyInfo == null) {
dependencyInfo = generateDependencyInfo();
}
if (!extraRequires.isEmpty() || !extraProvides.isEmpty()) {
dependencyInfo =
SimpleDependencyInfo.builder(getName(), getName())
.setProvides(concat(dependencyIn... | [
"DependencyInfo",
"getDependencyInfo",
"(",
")",
"{",
"if",
"(",
"dependencyInfo",
"==",
"null",
")",
"{",
"dependencyInfo",
"=",
"generateDependencyInfo",
"(",
")",
";",
"}",
"if",
"(",
"!",
"extraRequires",
".",
"isEmpty",
"(",
")",
"||",
"!",
"extraProvid... | Returns the DependencyInfo object, generating it lazily if necessary. | [
"Returns",
"the",
"DependencyInfo",
"object",
"generating",
"it",
"lazily",
"if",
"necessary",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CompilerInput.java#L272-L290 |
24,482 | google/closure-compiler | src/com/google/javascript/jscomp/CompilerInput.java | CompilerInput.setModule | public void setModule(JSModule module) {
// An input may only belong to one module.
checkArgument(module == null || this.module == null || this.module == module);
this.module = module;
} | java | public void setModule(JSModule module) {
// An input may only belong to one module.
checkArgument(module == null || this.module == null || this.module == module);
this.module = module;
} | [
"public",
"void",
"setModule",
"(",
"JSModule",
"module",
")",
"{",
"// An input may only belong to one module.",
"checkArgument",
"(",
"module",
"==",
"null",
"||",
"this",
".",
"module",
"==",
"null",
"||",
"this",
".",
"module",
"==",
"module",
")",
";",
"t... | Sets the module to which the input belongs. | [
"Sets",
"the",
"module",
"to",
"which",
"the",
"input",
"belongs",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CompilerInput.java#L516-L520 |
24,483 | google/closure-compiler | src/com/google/javascript/jscomp/Es6ConvertSuperConstructorCalls.java | Es6ConvertSuperConstructorCalls.isUnextendableNativeClass | private boolean isUnextendableNativeClass(NodeTraversal t, String className) {
// This list originally taken from the list of built-in objects at
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
// as of 2016-10-22.
// - Intl.* classes were left out, because it doesn't seem worth the... | java | private boolean isUnextendableNativeClass(NodeTraversal t, String className) {
// This list originally taken from the list of built-in objects at
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
// as of 2016-10-22.
// - Intl.* classes were left out, because it doesn't seem worth the... | [
"private",
"boolean",
"isUnextendableNativeClass",
"(",
"NodeTraversal",
"t",
",",
"String",
"className",
")",
"{",
"// This list originally taken from the list of built-in objects at",
"// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference",
"// as of 2016-10-22.",
"// - ... | Is the given class a native class for which we cannot properly transpile extension?
@param t
@param className | [
"Is",
"the",
"given",
"class",
"a",
"native",
"class",
"for",
"which",
"we",
"cannot",
"properly",
"transpile",
"extension?"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6ConvertSuperConstructorCalls.java#L434-L474 |
24,484 | google/closure-compiler | src/com/google/javascript/jscomp/Es6ConvertSuperConstructorCalls.java | Es6ConvertSuperConstructorCalls.isDefinedInSources | private boolean isDefinedInSources(NodeTraversal t, String varName) {
Var objectVar = t.getScope().getVar(varName);
return objectVar != null && !objectVar.isExtern();
} | java | private boolean isDefinedInSources(NodeTraversal t, String varName) {
Var objectVar = t.getScope().getVar(varName);
return objectVar != null && !objectVar.isExtern();
} | [
"private",
"boolean",
"isDefinedInSources",
"(",
"NodeTraversal",
"t",
",",
"String",
"varName",
")",
"{",
"Var",
"objectVar",
"=",
"t",
".",
"getScope",
"(",
")",
".",
"getVar",
"(",
"varName",
")",
";",
"return",
"objectVar",
"!=",
"null",
"&&",
"!",
"... | Is a variable with the given name defined in the source code being compiled?
<p>Please note that the call to {@code t.getScope()} is expensive, so we should avoid
calling this method when possible.
@param t
@param varName | [
"Is",
"a",
"variable",
"with",
"the",
"given",
"name",
"defined",
"in",
"the",
"source",
"code",
"being",
"compiled?"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6ConvertSuperConstructorCalls.java#L484-L487 |
24,485 | google/closure-compiler | src/com/google/javascript/jscomp/MinimizedCondition.java | MinimizedCondition.fromConditionNode | static MinimizedCondition fromConditionNode(Node n) {
checkState(n.getParent() != null);
switch (n.getToken()) {
case NOT:
case AND:
case OR:
case HOOK:
case COMMA:
return computeMinimizedCondition(n);
default:
return unoptimized(n);
}
} | java | static MinimizedCondition fromConditionNode(Node n) {
checkState(n.getParent() != null);
switch (n.getToken()) {
case NOT:
case AND:
case OR:
case HOOK:
case COMMA:
return computeMinimizedCondition(n);
default:
return unoptimized(n);
}
} | [
"static",
"MinimizedCondition",
"fromConditionNode",
"(",
"Node",
"n",
")",
"{",
"checkState",
"(",
"n",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
";",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"NOT",
":",
"case",
"AND",
"... | Returns a MinimizedCondition that represents the condition node after
minimization. | [
"Returns",
"a",
"MinimizedCondition",
"that",
"represents",
"the",
"condition",
"node",
"after",
"minimization",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MinimizedCondition.java#L65-L77 |
24,486 | google/closure-compiler | src/com/google/javascript/jscomp/MinimizedCondition.java | MinimizedCondition.pickBest | static MeasuredNode pickBest(MeasuredNode a, MeasuredNode b) {
if (a.length == b.length) {
return (b.isChanged()) ? a : b;
}
return (a.length < b.length) ? a : b;
} | java | static MeasuredNode pickBest(MeasuredNode a, MeasuredNode b) {
if (a.length == b.length) {
return (b.isChanged()) ? a : b;
}
return (a.length < b.length) ? a : b;
} | [
"static",
"MeasuredNode",
"pickBest",
"(",
"MeasuredNode",
"a",
",",
"MeasuredNode",
"b",
")",
"{",
"if",
"(",
"a",
".",
"length",
"==",
"b",
".",
"length",
")",
"{",
"return",
"(",
"b",
".",
"isChanged",
"(",
")",
")",
"?",
"a",
":",
"b",
";",
"... | return the best, prefer unchanged | [
"return",
"the",
"best",
"prefer",
"unchanged"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MinimizedCondition.java#L128-L134 |
24,487 | google/closure-compiler | src/com/google/javascript/jscomp/MinimizedCondition.java | MinimizedCondition.computeMinimizedCondition | private static MinimizedCondition computeMinimizedCondition(Node n) {
switch (n.getToken()) {
case NOT: {
MinimizedCondition subtree = computeMinimizedCondition(n.getFirstChild());
MeasuredNode positive = pickBest(
MeasuredNode.addNode(n, subtree.positive),
subtree.nega... | java | private static MinimizedCondition computeMinimizedCondition(Node n) {
switch (n.getToken()) {
case NOT: {
MinimizedCondition subtree = computeMinimizedCondition(n.getFirstChild());
MeasuredNode positive = pickBest(
MeasuredNode.addNode(n, subtree.positive),
subtree.nega... | [
"private",
"static",
"MinimizedCondition",
"computeMinimizedCondition",
"(",
"Node",
"n",
")",
"{",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"NOT",
":",
"{",
"MinimizedCondition",
"subtree",
"=",
"computeMinimizedCondition",
"(",
"n",
"... | Minimize the condition at the given node.
@param n the conditional expression tree to minimize.
@return a MinimizedCondition object representing that tree. | [
"Minimize",
"the",
"condition",
"at",
"the",
"given",
"node",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MinimizedCondition.java#L142-L212 |
24,488 | google/closure-compiler | src/com/google/javascript/jscomp/Es6ToEs3Util.java | Es6ToEs3Util.withType | static Node withType(Node n, JSType t) {
if (t != null) {
n.setJSType(t);
}
return n;
} | java | static Node withType(Node n, JSType t) {
if (t != null) {
n.setJSType(t);
}
return n;
} | [
"static",
"Node",
"withType",
"(",
"Node",
"n",
",",
"JSType",
"t",
")",
"{",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"n",
".",
"setJSType",
"(",
"t",
")",
";",
"}",
"return",
"n",
";",
"}"
] | Adds the type t to Node n, and returns n. Does nothing if t is null. | [
"Adds",
"the",
"type",
"t",
"to",
"Node",
"n",
"and",
"returns",
"n",
".",
"Does",
"nothing",
"if",
"t",
"is",
"null",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6ToEs3Util.java#L97-L102 |
24,489 | google/closure-compiler | src/com/google/javascript/jscomp/Es6ToEs3Util.java | Es6ToEs3Util.createType | static JSType createType(boolean shouldCreate, JSTypeRegistry registry, JSTypeNative typeName) {
if (!shouldCreate) {
return null;
}
return registry.getNativeType(typeName);
} | java | static JSType createType(boolean shouldCreate, JSTypeRegistry registry, JSTypeNative typeName) {
if (!shouldCreate) {
return null;
}
return registry.getNativeType(typeName);
} | [
"static",
"JSType",
"createType",
"(",
"boolean",
"shouldCreate",
",",
"JSTypeRegistry",
"registry",
",",
"JSTypeNative",
"typeName",
")",
"{",
"if",
"(",
"!",
"shouldCreate",
")",
"{",
"return",
"null",
";",
"}",
"return",
"registry",
".",
"getNativeType",
"(... | Returns the JSType as specified by the typeName.
Returns null if shouldCreate is false. | [
"Returns",
"the",
"JSType",
"as",
"specified",
"by",
"the",
"typeName",
".",
"Returns",
"null",
"if",
"shouldCreate",
"is",
"false",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6ToEs3Util.java#L108-L113 |
24,490 | google/closure-compiler | src/com/google/javascript/jscomp/Es6ToEs3Util.java | Es6ToEs3Util.createGenericType | static JSType createGenericType(
boolean shouldCreate, JSTypeRegistry registry, JSTypeNative typeName, JSType typeArg) {
if (!shouldCreate) {
return null;
}
ObjectType genericType = (ObjectType) (registry.getNativeType(typeName));
ObjectType uninstantiated = genericType.getRawType();
ret... | java | static JSType createGenericType(
boolean shouldCreate, JSTypeRegistry registry, JSTypeNative typeName, JSType typeArg) {
if (!shouldCreate) {
return null;
}
ObjectType genericType = (ObjectType) (registry.getNativeType(typeName));
ObjectType uninstantiated = genericType.getRawType();
ret... | [
"static",
"JSType",
"createGenericType",
"(",
"boolean",
"shouldCreate",
",",
"JSTypeRegistry",
"registry",
",",
"JSTypeNative",
"typeName",
",",
"JSType",
"typeArg",
")",
"{",
"if",
"(",
"!",
"shouldCreate",
")",
"{",
"return",
"null",
";",
"}",
"ObjectType",
... | Returns the JSType as specified by the typeName and instantiated by the typeArg.
Returns null if shouldCreate is false. | [
"Returns",
"the",
"JSType",
"as",
"specified",
"by",
"the",
"typeName",
"and",
"instantiated",
"by",
"the",
"typeArg",
".",
"Returns",
"null",
"if",
"shouldCreate",
"is",
"false",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6ToEs3Util.java#L119-L127 |
24,491 | google/closure-compiler | src/com/google/javascript/jscomp/MaybeReachingVariableUse.java | MaybeReachingVariableUse.addToUseIfLocal | private void addToUseIfLocal(String name, Node node, ReachingUses use) {
Var var = allVarsInFn.get(name);
if (var == null) {
return;
}
if (!escaped.contains(var)) {
use.mayUseMap.put(var, node);
}
} | java | private void addToUseIfLocal(String name, Node node, ReachingUses use) {
Var var = allVarsInFn.get(name);
if (var == null) {
return;
}
if (!escaped.contains(var)) {
use.mayUseMap.put(var, node);
}
} | [
"private",
"void",
"addToUseIfLocal",
"(",
"String",
"name",
",",
"Node",
"node",
",",
"ReachingUses",
"use",
")",
"{",
"Var",
"var",
"=",
"allVarsInFn",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"var",
"==",
"null",
")",
"{",
"return",
";",
"}",... | Sets the variable for the given name to the node value in the upward
exposed lattice. Do nothing if the variable name is one of the escaped
variable. | [
"Sets",
"the",
"variable",
"for",
"the",
"given",
"name",
"to",
"the",
"node",
"value",
"in",
"the",
"upward",
"exposed",
"lattice",
".",
"Do",
"nothing",
"if",
"the",
"variable",
"name",
"is",
"one",
"of",
"the",
"escaped",
"variable",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MaybeReachingVariableUse.java#L308-L316 |
24,492 | google/closure-compiler | src/com/google/javascript/jscomp/MaybeReachingVariableUse.java | MaybeReachingVariableUse.removeFromUseIfLocal | private void removeFromUseIfLocal(String name, ReachingUses use) {
Var var = allVarsInFn.get(name);
if (var == null) {
return;
}
if (!escaped.contains(var)) {
use.mayUseMap.removeAll(var);
}
} | java | private void removeFromUseIfLocal(String name, ReachingUses use) {
Var var = allVarsInFn.get(name);
if (var == null) {
return;
}
if (!escaped.contains(var)) {
use.mayUseMap.removeAll(var);
}
} | [
"private",
"void",
"removeFromUseIfLocal",
"(",
"String",
"name",
",",
"ReachingUses",
"use",
")",
"{",
"Var",
"var",
"=",
"allVarsInFn",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"var",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",... | Removes the variable for the given name from the node value in the upward
exposed lattice. Do nothing if the variable name is one of the escaped
variable. | [
"Removes",
"the",
"variable",
"for",
"the",
"given",
"name",
"from",
"the",
"node",
"value",
"in",
"the",
"upward",
"exposed",
"lattice",
".",
"Do",
"nothing",
"if",
"the",
"variable",
"name",
"is",
"one",
"of",
"the",
"escaped",
"variable",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MaybeReachingVariableUse.java#L323-L331 |
24,493 | google/closure-compiler | src/com/google/javascript/jscomp/Promises.java | Promises.getTemplateTypeOfThenable | static final JSType getTemplateTypeOfThenable(JSTypeRegistry registry, JSType maybeThenable) {
return maybeThenable
// Without ".restrictByNotNullOrUndefined" we'd get the unknown type for "?IThenable<null>"
.restrictByNotNullOrUndefined()
.getInstantiatedTypeArgument(registry.getNativeType(... | java | static final JSType getTemplateTypeOfThenable(JSTypeRegistry registry, JSType maybeThenable) {
return maybeThenable
// Without ".restrictByNotNullOrUndefined" we'd get the unknown type for "?IThenable<null>"
.restrictByNotNullOrUndefined()
.getInstantiatedTypeArgument(registry.getNativeType(... | [
"static",
"final",
"JSType",
"getTemplateTypeOfThenable",
"(",
"JSTypeRegistry",
"registry",
",",
"JSType",
"maybeThenable",
")",
"{",
"return",
"maybeThenable",
"// Without \".restrictByNotNullOrUndefined\" we'd get the unknown type for \"?IThenable<null>\"",
".",
"restrictByNotNull... | If this object is known to be an IThenable, returns the type it resolves to.
<p>Returns unknown otherwise.
<p>(This is different from {@code getResolvedType}, which will attempt to model the then type
of an expression after calling Promise.resolve() on it. | [
"If",
"this",
"object",
"is",
"known",
"to",
"be",
"an",
"IThenable",
"returns",
"the",
"type",
"it",
"resolves",
"to",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Promises.java#L46-L51 |
24,494 | google/closure-compiler | src/com/google/javascript/jscomp/Promises.java | Promises.wrapInIThenable | static final JSType wrapInIThenable(JSTypeRegistry registry, JSType maybeThenable) {
// Unwrap for simplicity first in the event it is a thenable.
JSType unwrapped = getResolvedType(registry, maybeThenable);
return registry.createTemplatizedType(
registry.getNativeObjectType(JSTypeNative.I_THENABLE_... | java | static final JSType wrapInIThenable(JSTypeRegistry registry, JSType maybeThenable) {
// Unwrap for simplicity first in the event it is a thenable.
JSType unwrapped = getResolvedType(registry, maybeThenable);
return registry.createTemplatizedType(
registry.getNativeObjectType(JSTypeNative.I_THENABLE_... | [
"static",
"final",
"JSType",
"wrapInIThenable",
"(",
"JSTypeRegistry",
"registry",
",",
"JSType",
"maybeThenable",
")",
"{",
"// Unwrap for simplicity first in the event it is a thenable.",
"JSType",
"unwrapped",
"=",
"getResolvedType",
"(",
"registry",
",",
"maybeThenable",
... | Wraps the given type in an IThenable.
<p>If the given type is already IThenable it is first unwrapped. For example:
<p>{@code number} becomes {@code IThenable<number>}
<p>{@code IThenable<number>} becomes {@code IThenable<number>}
<p>{@code Promise<number>} becomes {@code IThenable<number>}
<p>{@code IThenable<num... | [
"Wraps",
"the",
"given",
"type",
"in",
"an",
"IThenable",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Promises.java#L119-L124 |
24,495 | google/closure-compiler | src/com/google/javascript/jscomp/gwt/linker/MinimalLinker.java | MinimalLinker.formatOutput | private static String formatOutput(String js, boolean export) {
StringBuilder output = new StringBuilder();
// Shadow window so that non-browser environments can pass their own global object here.
output.append("(function(window){");
// If $wnd is set to this, then JSInterop's normal export will run, ... | java | private static String formatOutput(String js, boolean export) {
StringBuilder output = new StringBuilder();
// Shadow window so that non-browser environments can pass their own global object here.
output.append("(function(window){");
// If $wnd is set to this, then JSInterop's normal export will run, ... | [
"private",
"static",
"String",
"formatOutput",
"(",
"String",
"js",
",",
"boolean",
"export",
")",
"{",
"StringBuilder",
"output",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// Shadow window so that non-browser environments can pass their own global object here.",
"output... | Formats the application's JS code for output.
@param js Code to format.
@param export Whether to export via JSInterop.
@return Formatted, linked code. | [
"Formats",
"the",
"application",
"s",
"JS",
"code",
"for",
"output",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/gwt/linker/MinimalLinker.java#L67-L98 |
24,496 | google/closure-compiler | src/com/google/javascript/jscomp/regex/CharRanges.java | CharRanges.withRanges | public static CharRanges withRanges(int... ranges) {
if ((ranges.length & 1) != 0) { throw new IllegalArgumentException(); }
for (int i = 1; i < ranges.length; ++i) {
if (ranges[i] <= ranges[i - 1]) {
throw new IllegalArgumentException(ranges[i] + " > " + ranges[i - 1]);
}
}
return n... | java | public static CharRanges withRanges(int... ranges) {
if ((ranges.length & 1) != 0) { throw new IllegalArgumentException(); }
for (int i = 1; i < ranges.length; ++i) {
if (ranges[i] <= ranges[i - 1]) {
throw new IllegalArgumentException(ranges[i] + " > " + ranges[i - 1]);
}
}
return n... | [
"public",
"static",
"CharRanges",
"withRanges",
"(",
"int",
"...",
"ranges",
")",
"{",
"if",
"(",
"(",
"ranges",
".",
"length",
"&",
"1",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"for",
"(",
"int",
"i"... | Returns an instance containing the given ranges.
@param ranges An even-length ordered sequence of non-overlapping,
non-contiguous, [inclusive start, exclusive end) ranges. | [
"Returns",
"an",
"instance",
"containing",
"the",
"given",
"ranges",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/regex/CharRanges.java#L61-L69 |
24,497 | google/closure-compiler | src/com/google/javascript/jscomp/XtbMessageBundle.java | XtbMessageBundle.isStartOfIcuMessage | static boolean isStartOfIcuMessage(String part) {
// ICU messages start with a '{' followed by an identifier, followed by a ',' and then 'plural'
// or 'select' follows by another comma.
// the 'startsWith' check is redundant but should allow us to skip using the matcher
if (!part.startsWith("{")) {
... | java | static boolean isStartOfIcuMessage(String part) {
// ICU messages start with a '{' followed by an identifier, followed by a ',' and then 'plural'
// or 'select' follows by another comma.
// the 'startsWith' check is redundant but should allow us to skip using the matcher
if (!part.startsWith("{")) {
... | [
"static",
"boolean",
"isStartOfIcuMessage",
"(",
"String",
"part",
")",
"{",
"// ICU messages start with a '{' followed by an identifier, followed by a ',' and then 'plural'",
"// or 'select' follows by another comma.",
"// the 'startsWith' check is redundant but should allow us to skip using th... | Detects an ICU-formatted plural or select message. Any placeholders occurring inside these
messages must be rewritten in ICU format. | [
"Detects",
"an",
"ICU",
"-",
"formatted",
"plural",
"or",
"select",
"message",
".",
"Any",
"placeholders",
"occurring",
"inside",
"these",
"messages",
"must",
"be",
"rewritten",
"in",
"ICU",
"format",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/XtbMessageBundle.java#L56-L72 |
24,498 | google/closure-compiler | src/com/google/javascript/jscomp/XtbMessageBundle.java | XtbMessageBundle.createSAXParser | private static SAXParser createSAXParser()
throws ParserConfigurationException, SAXException {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(false);
factory.setXIncludeAware(false);
factory.setFeature(
"http://xml.org/sax/features/external-general-entitie... | java | private static SAXParser createSAXParser()
throws ParserConfigurationException, SAXException {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(false);
factory.setXIncludeAware(false);
factory.setFeature(
"http://xml.org/sax/features/external-general-entitie... | [
"private",
"static",
"SAXParser",
"createSAXParser",
"(",
")",
"throws",
"ParserConfigurationException",
",",
"SAXException",
"{",
"SAXParserFactory",
"factory",
"=",
"SAXParserFactory",
".",
"newInstance",
"(",
")",
";",
"factory",
".",
"setValidating",
"(",
"false",... | Inlined from guava-internal. | [
"Inlined",
"from",
"guava",
"-",
"internal",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/XtbMessageBundle.java#L113-L131 |
24,499 | google/closure-compiler | src/com/google/javascript/jscomp/deps/ModuleResolver.java | ModuleResolver.locate | @Nullable
protected String locate(String scriptAddress, String name) {
String canonicalizedPath = canonicalizePath(scriptAddress, name);
String normalizedPath = canonicalizedPath;
if (ModuleLoader.isAmbiguousIdentifier(canonicalizedPath)) {
normalizedPath = ModuleLoader.MODULE_SLASH + canonicalized... | java | @Nullable
protected String locate(String scriptAddress, String name) {
String canonicalizedPath = canonicalizePath(scriptAddress, name);
String normalizedPath = canonicalizedPath;
if (ModuleLoader.isAmbiguousIdentifier(canonicalizedPath)) {
normalizedPath = ModuleLoader.MODULE_SLASH + canonicalized... | [
"@",
"Nullable",
"protected",
"String",
"locate",
"(",
"String",
"scriptAddress",
",",
"String",
"name",
")",
"{",
"String",
"canonicalizedPath",
"=",
"canonicalizePath",
"(",
"scriptAddress",
",",
"name",
")",
";",
"String",
"normalizedPath",
"=",
"canonicalizedP... | Locates the module with the given name, but returns null if there is no JS file in the expected
location. | [
"Locates",
"the",
"module",
"with",
"the",
"given",
"name",
"but",
"returns",
"null",
"if",
"there",
"is",
"no",
"JS",
"file",
"in",
"the",
"expected",
"location",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/ModuleResolver.java#L76-L103 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.