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,900 | google/closure-compiler | src/com/google/javascript/jscomp/ReplaceStrings.java | ReplaceStrings.parseConfiguration | private void parseConfiguration(List<String> functionsToInspect) {
for (String function : functionsToInspect) {
Config config = parseConfiguration(function);
functions.put(config.name, config);
String method = getMethodFromDeclarationName(config.name);
if (method != null) {
methods.... | java | private void parseConfiguration(List<String> functionsToInspect) {
for (String function : functionsToInspect) {
Config config = parseConfiguration(function);
functions.put(config.name, config);
String method = getMethodFromDeclarationName(config.name);
if (method != null) {
methods.... | [
"private",
"void",
"parseConfiguration",
"(",
"List",
"<",
"String",
">",
"functionsToInspect",
")",
"{",
"for",
"(",
"String",
"function",
":",
"functionsToInspect",
")",
"{",
"Config",
"config",
"=",
"parseConfiguration",
"(",
"function",
")",
";",
"functions"... | Build the data structures need by this pass from the provided list of functions and methods. | [
"Build",
"the",
"data",
"structures",
"need",
"by",
"this",
"pass",
"from",
"the",
"provided",
"list",
"of",
"functions",
"and",
"methods",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ReplaceStrings.java#L461-L471 |
24,901 | google/closure-compiler | src/com/google/javascript/jscomp/ReplaceStrings.java | ReplaceStrings.createNameGenerator | private static DefaultNameGenerator createNameGenerator(Iterable<String> reserved) {
final String namePrefix = "";
final char[] reservedChars = new char[0];
return new DefaultNameGenerator(ImmutableSet.copyOf(reserved), namePrefix, reservedChars);
} | java | private static DefaultNameGenerator createNameGenerator(Iterable<String> reserved) {
final String namePrefix = "";
final char[] reservedChars = new char[0];
return new DefaultNameGenerator(ImmutableSet.copyOf(reserved), namePrefix, reservedChars);
} | [
"private",
"static",
"DefaultNameGenerator",
"createNameGenerator",
"(",
"Iterable",
"<",
"String",
">",
"reserved",
")",
"{",
"final",
"String",
"namePrefix",
"=",
"\"\"",
";",
"final",
"char",
"[",
"]",
"reservedChars",
"=",
"new",
"char",
"[",
"0",
"]",
"... | Use a name generate to create names so the names overlap with the names used for variable and
properties. | [
"Use",
"a",
"name",
"generate",
"to",
"create",
"names",
"so",
"the",
"names",
"overlap",
"with",
"the",
"names",
"used",
"for",
"variable",
"and",
"properties",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ReplaceStrings.java#L523-L527 |
24,902 | google/closure-compiler | src/com/google/javascript/jscomp/ClosureCodingConvention.java | ClosureCodingConvention.typeofClassDefiningName | private static SubclassType typeofClassDefiningName(Node callName) {
// Check if the method name matches one of the class-defining methods.
String methodName = null;
if (callName.isGetProp()) {
methodName = callName.getLastChild().getString();
} else if (callName.isName()) {
String name = ca... | java | private static SubclassType typeofClassDefiningName(Node callName) {
// Check if the method name matches one of the class-defining methods.
String methodName = null;
if (callName.isGetProp()) {
methodName = callName.getLastChild().getString();
} else if (callName.isName()) {
String name = ca... | [
"private",
"static",
"SubclassType",
"typeofClassDefiningName",
"(",
"Node",
"callName",
")",
"{",
"// Check if the method name matches one of the class-defining methods.",
"String",
"methodName",
"=",
"null",
";",
"if",
"(",
"callName",
".",
"isGetProp",
"(",
")",
")",
... | Determines whether the given node is a class-defining name, like
"inherits" or "mixin."
@return The type of class-defining name, or null. | [
"Determines",
"whether",
"the",
"given",
"node",
"is",
"a",
"class",
"-",
"defining",
"name",
"like",
"inherits",
"or",
"mixin",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureCodingConvention.java#L156-L177 |
24,903 | google/closure-compiler | src/com/google/javascript/rhino/jstype/UnionTypeBuilder.java | UnionTypeBuilder.addAlternates | public UnionTypeBuilder addAlternates(ImmutableList<JSType> list) {
for (int i = 0; i < list.size(); i++) {
addAlternate(list.get(i));
}
return this;
} | java | public UnionTypeBuilder addAlternates(ImmutableList<JSType> list) {
for (int i = 0; i < list.size(); i++) {
addAlternate(list.get(i));
}
return this;
} | [
"public",
"UnionTypeBuilder",
"addAlternates",
"(",
"ImmutableList",
"<",
"JSType",
">",
"list",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"addAlternate",
"(",
"list",
".",
"... | adding a union as an alternate. | [
"adding",
"a",
"union",
"as",
"an",
"alternate",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/UnionTypeBuilder.java#L162-L167 |
24,904 | google/closure-compiler | src/com/google/javascript/rhino/jstype/UnionTypeBuilder.java | UnionTypeBuilder.reduceAlternatesWithoutUnion | private JSType reduceAlternatesWithoutUnion() {
JSType wildcard = getNativeWildcardType();
if (wildcard != null) {
return containsVoidType ? null : wildcard;
}
int size = alternates.size();
if (size > maxUnionSize) {
return registry.getNativeType(UNKNOWN_TYPE);
} else if (size > 1) {... | java | private JSType reduceAlternatesWithoutUnion() {
JSType wildcard = getNativeWildcardType();
if (wildcard != null) {
return containsVoidType ? null : wildcard;
}
int size = alternates.size();
if (size > maxUnionSize) {
return registry.getNativeType(UNKNOWN_TYPE);
} else if (size > 1) {... | [
"private",
"JSType",
"reduceAlternatesWithoutUnion",
"(",
")",
"{",
"JSType",
"wildcard",
"=",
"getNativeWildcardType",
"(",
")",
";",
"if",
"(",
"wildcard",
"!=",
"null",
")",
"{",
"return",
"containsVoidType",
"?",
"null",
":",
"wildcard",
";",
"}",
"int",
... | Reduce the alternates into a non-union type.
If the alternates can't be accurately represented with a non-union
type, return null. | [
"Reduce",
"the",
"alternates",
"into",
"a",
"non",
"-",
"union",
"type",
".",
"If",
"the",
"alternates",
"can",
"t",
"be",
"accurately",
"represented",
"with",
"a",
"non",
"-",
"union",
"type",
"return",
"null",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/UnionTypeBuilder.java#L351-L366 |
24,905 | google/closure-compiler | src/com/google/javascript/rhino/jstype/UnionTypeBuilder.java | UnionTypeBuilder.getNativeWildcardType | private JSType getNativeWildcardType() {
if (isAllType) {
return registry.getNativeType(ALL_TYPE);
} else if (isNativeUnknownType) {
if (areAllUnknownsChecked) {
return registry.getNativeType(CHECKED_UNKNOWN_TYPE);
} else {
return registry.getNativeType(UNKNOWN_TYPE);
}
... | java | private JSType getNativeWildcardType() {
if (isAllType) {
return registry.getNativeType(ALL_TYPE);
} else if (isNativeUnknownType) {
if (areAllUnknownsChecked) {
return registry.getNativeType(CHECKED_UNKNOWN_TYPE);
} else {
return registry.getNativeType(UNKNOWN_TYPE);
}
... | [
"private",
"JSType",
"getNativeWildcardType",
"(",
")",
"{",
"if",
"(",
"isAllType",
")",
"{",
"return",
"registry",
".",
"getNativeType",
"(",
"ALL_TYPE",
")",
";",
"}",
"else",
"if",
"(",
"isNativeUnknownType",
")",
"{",
"if",
"(",
"areAllUnknownsChecked",
... | Returns ALL_TYPE, UNKNOWN_TYPE, or CHECKED_UNKNOWN_TYPE, as specified by the flags, or null | [
"Returns",
"ALL_TYPE",
"UNKNOWN_TYPE",
"or",
"CHECKED_UNKNOWN_TYPE",
"as",
"specified",
"by",
"the",
"flags",
"or",
"null"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/UnionTypeBuilder.java#L369-L380 |
24,906 | google/closure-compiler | src/com/google/javascript/rhino/jstype/UnionTypeBuilder.java | UnionTypeBuilder.build | public JSType build() {
if (result == null) {
result = reduceAlternatesWithoutUnion();
if (result == null) {
result = new UnionType(registry, ImmutableList.copyOf(getAlternates()));
}
}
return result;
} | java | public JSType build() {
if (result == null) {
result = reduceAlternatesWithoutUnion();
if (result == null) {
result = new UnionType(registry, ImmutableList.copyOf(getAlternates()));
}
}
return result;
} | [
"public",
"JSType",
"build",
"(",
")",
"{",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"reduceAlternatesWithoutUnion",
"(",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"UnionType",
"(",
"registry",
",",... | Creates a union.
@return A UnionType if it has two or more alternates, the
only alternate if it has one and otherwise {@code NO_TYPE}. | [
"Creates",
"a",
"union",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/UnionTypeBuilder.java#L387-L395 |
24,907 | google/closure-compiler | src/com/google/javascript/jscomp/ClosureOptimizePrimitives.java | ClosureOptimizePrimitives.canOptimizeObjectCreate | private boolean canOptimizeObjectCreate(Node firstParam) {
Node curParam = firstParam;
while (curParam != null) {
if (!isOptimizableKey(curParam)) {
return false;
}
curParam = curParam.getNext();
// Check for an odd number of parameters.
if (curParam == null) {
ret... | java | private boolean canOptimizeObjectCreate(Node firstParam) {
Node curParam = firstParam;
while (curParam != null) {
if (!isOptimizableKey(curParam)) {
return false;
}
curParam = curParam.getNext();
// Check for an odd number of parameters.
if (curParam == null) {
ret... | [
"private",
"boolean",
"canOptimizeObjectCreate",
"(",
"Node",
"firstParam",
")",
"{",
"Node",
"curParam",
"=",
"firstParam",
";",
"while",
"(",
"curParam",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"isOptimizableKey",
"(",
"curParam",
")",
")",
"{",
"return",
... | Returns whether the given call to goog.object.create can be converted to an
object literal. | [
"Returns",
"whether",
"the",
"given",
"call",
"to",
"goog",
".",
"object",
".",
"create",
"can",
"be",
"converted",
"to",
"an",
"object",
"literal",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureOptimizePrimitives.java#L150-L165 |
24,908 | google/closure-compiler | src/com/google/javascript/jscomp/ClosureOptimizePrimitives.java | ClosureOptimizePrimitives.canOptimizeObjectCreateSet | private boolean canOptimizeObjectCreateSet(Node firstParam) {
if (firstParam != null
&& firstParam.getNext() == null
&& !(firstParam.isNumber() || firstParam.isString())) {
// if there is only one argument, and it's an array, then the method uses the array elements
// as keys. Don't opti... | java | private boolean canOptimizeObjectCreateSet(Node firstParam) {
if (firstParam != null
&& firstParam.getNext() == null
&& !(firstParam.isNumber() || firstParam.isString())) {
// if there is only one argument, and it's an array, then the method uses the array elements
// as keys. Don't opti... | [
"private",
"boolean",
"canOptimizeObjectCreateSet",
"(",
"Node",
"firstParam",
")",
"{",
"if",
"(",
"firstParam",
"!=",
"null",
"&&",
"firstParam",
".",
"getNext",
"(",
")",
"==",
"null",
"&&",
"!",
"(",
"firstParam",
".",
"isNumber",
"(",
")",
"||",
"firs... | Returns whether the given call to goog.object.createSet can be converted to an object literal. | [
"Returns",
"whether",
"the",
"given",
"call",
"to",
"goog",
".",
"object",
".",
"createSet",
"can",
"be",
"converted",
"to",
"an",
"object",
"literal",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureOptimizePrimitives.java#L192-L220 |
24,909 | google/closure-compiler | src/com/google/javascript/jscomp/ClosureOptimizePrimitives.java | ClosureOptimizePrimitives.maybeProcessDomTagName | private void maybeProcessDomTagName(Node n) {
if (NodeUtil.isLValue(n)) {
return;
}
String prefix = "goog$dom$TagName$";
String tagName;
if (n.isName() && n.getString().startsWith(prefix)) {
tagName = n.getString().substring(prefix.length());
} else if (n.isGetProp() && !n.getParent(... | java | private void maybeProcessDomTagName(Node n) {
if (NodeUtil.isLValue(n)) {
return;
}
String prefix = "goog$dom$TagName$";
String tagName;
if (n.isName() && n.getString().startsWith(prefix)) {
tagName = n.getString().substring(prefix.length());
} else if (n.isGetProp() && !n.getParent(... | [
"private",
"void",
"maybeProcessDomTagName",
"(",
"Node",
"n",
")",
"{",
"if",
"(",
"NodeUtil",
".",
"isLValue",
"(",
"n",
")",
")",
"{",
"return",
";",
"}",
"String",
"prefix",
"=",
"\"goog$dom$TagName$\"",
";",
"String",
"tagName",
";",
"if",
"(",
"n",... | Converts the given node to string if it is safe to do so. | [
"Converts",
"the",
"given",
"node",
"to",
"string",
"if",
"it",
"is",
"safe",
"to",
"do",
"so",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureOptimizePrimitives.java#L248-L266 |
24,910 | google/closure-compiler | src/com/google/javascript/jscomp/ModuleRenaming.java | ModuleRenaming.getGlobalNameOfEsModuleLocalVariable | static String getGlobalNameOfEsModuleLocalVariable(
ModuleMetadata moduleMetadata, String variableName) {
return variableName + "$$" + getGlobalName(moduleMetadata, /* googNamespace= */ null);
} | java | static String getGlobalNameOfEsModuleLocalVariable(
ModuleMetadata moduleMetadata, String variableName) {
return variableName + "$$" + getGlobalName(moduleMetadata, /* googNamespace= */ null);
} | [
"static",
"String",
"getGlobalNameOfEsModuleLocalVariable",
"(",
"ModuleMetadata",
"moduleMetadata",
",",
"String",
"variableName",
")",
"{",
"return",
"variableName",
"+",
"\"$$\"",
"+",
"getGlobalName",
"(",
"moduleMetadata",
",",
"/* googNamespace= */",
"null",
")",
... | Returns the global name of a variable declared in an ES module. | [
"Returns",
"the",
"global",
"name",
"of",
"a",
"variable",
"declared",
"in",
"an",
"ES",
"module",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ModuleRenaming.java#L42-L45 |
24,911 | google/closure-compiler | src/com/google/javascript/jscomp/ModuleRenaming.java | ModuleRenaming.getGlobalName | static String getGlobalName(Export export) {
if (export.moduleMetadata().isEs6Module()) {
if (export.localName().equals(Export.DEFAULT_EXPORT_NAME)) {
return getGlobalNameOfAnonymousDefaultExport(export.moduleMetadata());
}
return getGlobalNameOfEsModuleLocalVariable(export.moduleMetadata(... | java | static String getGlobalName(Export export) {
if (export.moduleMetadata().isEs6Module()) {
if (export.localName().equals(Export.DEFAULT_EXPORT_NAME)) {
return getGlobalNameOfAnonymousDefaultExport(export.moduleMetadata());
}
return getGlobalNameOfEsModuleLocalVariable(export.moduleMetadata(... | [
"static",
"String",
"getGlobalName",
"(",
"Export",
"export",
")",
"{",
"if",
"(",
"export",
".",
"moduleMetadata",
"(",
")",
".",
"isEs6Module",
"(",
")",
")",
"{",
"if",
"(",
"export",
".",
"localName",
"(",
")",
".",
"equals",
"(",
"Export",
".",
... | Returns the post-transpilation, globalized name of the export. | [
"Returns",
"the",
"post",
"-",
"transpilation",
"globalized",
"name",
"of",
"the",
"export",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ModuleRenaming.java#L76-L86 |
24,912 | google/closure-compiler | src/com/google/javascript/jscomp/ModuleRenaming.java | ModuleRenaming.getGlobalName | static String getGlobalName(Binding binding) {
if (binding.isModuleNamespace()) {
return getGlobalName(binding.metadata(), binding.closureNamespace());
}
return getGlobalName(binding.originatingExport());
} | java | static String getGlobalName(Binding binding) {
if (binding.isModuleNamespace()) {
return getGlobalName(binding.metadata(), binding.closureNamespace());
}
return getGlobalName(binding.originatingExport());
} | [
"static",
"String",
"getGlobalName",
"(",
"Binding",
"binding",
")",
"{",
"if",
"(",
"binding",
".",
"isModuleNamespace",
"(",
")",
")",
"{",
"return",
"getGlobalName",
"(",
"binding",
".",
"metadata",
"(",
")",
",",
"binding",
".",
"closureNamespace",
"(",
... | Returns the post-transpilation, globalized name of the binding. | [
"Returns",
"the",
"post",
"-",
"transpilation",
"globalized",
"name",
"of",
"the",
"binding",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ModuleRenaming.java#L89-L94 |
24,913 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.anything | public static Matcher anything() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return true;
}
};
} | java | public static Matcher anything() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return true;
}
};
} | [
"public",
"static",
"Matcher",
"anything",
"(",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"return",
"true",
";",
"}",
"}",
";",
... | Returns a Matcher that matches every node. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"every",
"node",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L37-L43 |
24,914 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.allOf | public static Matcher allOf(final Matcher... matchers) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
for (Matcher m : matchers) {
if (!m.matches(node, metadata)) {
return false;
}
}
return true;
}
... | java | public static Matcher allOf(final Matcher... matchers) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
for (Matcher m : matchers) {
if (!m.matches(node, metadata)) {
return false;
}
}
return true;
}
... | [
"public",
"static",
"Matcher",
"allOf",
"(",
"final",
"Matcher",
"...",
"matchers",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"for",... | Returns a Matcher that returns true only if all of the provided
matchers match. | [
"Returns",
"a",
"Matcher",
"that",
"returns",
"true",
"only",
"if",
"all",
"of",
"the",
"provided",
"matchers",
"match",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L49-L60 |
24,915 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.not | public static Matcher not(final Matcher matcher) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return !matcher.matches(node, metadata);
}
};
} | java | public static Matcher not(final Matcher matcher) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return !matcher.matches(node, metadata);
}
};
} | [
"public",
"static",
"Matcher",
"not",
"(",
"final",
"Matcher",
"matcher",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"return",
"!",
... | Returns a Matcher that matches the opposite of the provided matcher. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"the",
"opposite",
"of",
"the",
"provided",
"matcher",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L81-L87 |
24,916 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.constructor | public static Matcher constructor(final String name) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
JSDocInfo info = node.getJSDocInfo();
if (info != null && info.isConstructor()) {
Node firstChild = node.getFirstChild();
// TO... | java | public static Matcher constructor(final String name) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
JSDocInfo info = node.getJSDocInfo();
if (info != null && info.isConstructor()) {
Node firstChild = node.getFirstChild();
// TO... | [
"public",
"static",
"Matcher",
"constructor",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"JSDocInfo",
... | Returns a matcher that matches constructor definitions of the specified
name.
@param name The name of the class constructor to match. | [
"Returns",
"a",
"matcher",
"that",
"matches",
"constructor",
"definitions",
"of",
"the",
"specified",
"name",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L101-L123 |
24,917 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.newClass | public static Matcher newClass() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isNew();
}
};
} | java | public static Matcher newClass() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isNew();
}
};
} | [
"public",
"static",
"Matcher",
"newClass",
"(",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"return",
"node",
".",
"isNew",
"(",
")"... | Returns a Matcher that matches constructing new objects. This will match
the NEW node of the JS Compiler AST. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"constructing",
"new",
"objects",
".",
"This",
"will",
"match",
"the",
"NEW",
"node",
"of",
"the",
"JS",
"Compiler",
"AST",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L129-L135 |
24,918 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.newClass | public static Matcher newClass(final String className) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
if (!node.isNew()) {
return false;
}
JSType providedJsType = getJsType(metadata, className);
if (providedJsType == null... | java | public static Matcher newClass(final String className) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
if (!node.isNew()) {
return false;
}
JSType providedJsType = getJsType(metadata, className);
if (providedJsType == null... | [
"public",
"static",
"Matcher",
"newClass",
"(",
"final",
"String",
"className",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"if",
"(",... | Returns a Matcher that matches constructing objects of the provided class
name. This will match the NEW node of the JS Compiler AST.
@param className The name of the class to return matching NEW nodes. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"constructing",
"objects",
"of",
"the",
"provided",
"class",
"name",
".",
"This",
"will",
"match",
"the",
"NEW",
"node",
"of",
"the",
"JS",
"Compiler",
"AST",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L142-L161 |
24,919 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.functionCall | public static Matcher functionCall(final String name) {
return new Matcher() {
@Override
public boolean matches(Node node, NodeMetadata metadata) {
// TODO(mknichel): Handle the case when functions are applied through .call or .apply.
return node.isCall() && propertyAccess(name).matches(... | java | public static Matcher functionCall(final String name) {
return new Matcher() {
@Override
public boolean matches(Node node, NodeMetadata metadata) {
// TODO(mknichel): Handle the case when functions are applied through .call or .apply.
return node.isCall() && propertyAccess(name).matches(... | [
"public",
"static",
"Matcher",
"functionCall",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"// TODO(mkni... | Returns a Matcher that matches all nodes that are function calls that match the provided name.
@param name The name of the function to match. For non-static functions, this must be the fully
qualified name that includes the type of the object. For instance: {@code
ns.AppContext.prototype.get} will match {@code appCont... | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"all",
"nodes",
"that",
"are",
"function",
"calls",
"that",
"match",
"the",
"provided",
"name",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L178-L186 |
24,920 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.functionCallWithNumArgs | public static Matcher functionCallWithNumArgs(final int numArgs) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isCall() && (node.getChildCount() - 1) == numArgs;
}
};
} | java | public static Matcher functionCallWithNumArgs(final int numArgs) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isCall() && (node.getChildCount() - 1) == numArgs;
}
};
} | [
"public",
"static",
"Matcher",
"functionCallWithNumArgs",
"(",
"final",
"int",
"numArgs",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"r... | Returns a Matcher that matches any function call that has the given
number of arguments. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"any",
"function",
"call",
"that",
"has",
"the",
"given",
"number",
"of",
"arguments",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L192-L198 |
24,921 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.functionCallWithNumArgs | public static Matcher functionCallWithNumArgs(final String name, final int numArgs) {
return allOf(functionCallWithNumArgs(numArgs), functionCall(name));
} | java | public static Matcher functionCallWithNumArgs(final String name, final int numArgs) {
return allOf(functionCallWithNumArgs(numArgs), functionCall(name));
} | [
"public",
"static",
"Matcher",
"functionCallWithNumArgs",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"numArgs",
")",
"{",
"return",
"allOf",
"(",
"functionCallWithNumArgs",
"(",
"numArgs",
")",
",",
"functionCall",
"(",
"name",
")",
")",
";",
"}"
] | Returns a Matcher that matches any function call that has the given
number of arguments and the given name.
@param name The name of the function to match. For non-static functions,
this must be the fully qualified name that includes the type of the
object. For instance: {@code ns.AppContext.prototype.get} will match
{@... | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"any",
"function",
"call",
"that",
"has",
"the",
"given",
"number",
"of",
"arguments",
"and",
"the",
"given",
"name",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L209-L211 |
24,922 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.propertyAccess | public static Matcher propertyAccess(final String name) {
return new Matcher() {
@Override
public boolean matches(Node node, NodeMetadata metadata) {
if (node.isGetProp()) {
if (name == null) {
return true;
}
if (node.matchesQualifiedName(name)) {
... | java | public static Matcher propertyAccess(final String name) {
return new Matcher() {
@Override
public boolean matches(Node node, NodeMetadata metadata) {
if (node.isGetProp()) {
if (name == null) {
return true;
}
if (node.matchesQualifiedName(name)) {
... | [
"public",
"static",
"Matcher",
"propertyAccess",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"if",
"("... | Returns a Matcher that matches nodes representing a GETPROP access of
an object property.
@param name The name of the property to match. For non-static properties,
this must be the fully qualified name that includes the type of the
object. For instance: {@code ns.AppContext.prototype.root}
will match {@code appContext.... | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"nodes",
"representing",
"a",
"GETPROP",
"access",
"of",
"an",
"object",
"property",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L252-L269 |
24,923 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.enumDefinition | public static Matcher enumDefinition() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
JSType jsType = node.getJSType();
return jsType != null && jsType.isEnumType();
}
};
} | java | public static Matcher enumDefinition() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
JSType jsType = node.getJSType();
return jsType != null && jsType.isEnumType();
}
};
} | [
"public",
"static",
"Matcher",
"enumDefinition",
"(",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"JSType",
"jsType",
"=",
"node",
"."... | Returns a Matcher that matches definitions of any enum. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"definitions",
"of",
"any",
"enum",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L274-L281 |
24,924 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.enumDefinitionOfType | public static Matcher enumDefinitionOfType(final String type) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
JSType providedJsType = getJsType(metadata, type);
if (providedJsType == null) {
return false;
}
providedJsType ... | java | public static Matcher enumDefinitionOfType(final String type) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
JSType providedJsType = getJsType(metadata, type);
if (providedJsType == null) {
return false;
}
providedJsType ... | [
"public",
"static",
"Matcher",
"enumDefinitionOfType",
"(",
"final",
"String",
"type",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"JSTy... | Returns a Matcher that matches definitions of an enum of the given type. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"definitions",
"of",
"an",
"enum",
"of",
"the",
"given",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L286-L300 |
24,925 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.assignmentWithRhs | public static Matcher assignmentWithRhs(final Matcher rhsMatcher) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isAssign() && rhsMatcher.matches(node.getLastChild(), metadata);
}
};
} | java | public static Matcher assignmentWithRhs(final Matcher rhsMatcher) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isAssign() && rhsMatcher.matches(node.getLastChild(), metadata);
}
};
} | [
"public",
"static",
"Matcher",
"assignmentWithRhs",
"(",
"final",
"Matcher",
"rhsMatcher",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"... | Returns a Matcher that matches an ASSIGN node where the RHS of the assignment matches the given
rhsMatcher. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"an",
"ASSIGN",
"node",
"where",
"the",
"RHS",
"of",
"the",
"assignment",
"matches",
"the",
"given",
"rhsMatcher",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L306-L312 |
24,926 | google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.constructorPropertyDeclaration | public static Matcher constructorPropertyDeclaration() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
// This will match against code that looks like:
// /** @constructor */
// function constructor() {
// this.variable = 3;
... | java | public static Matcher constructorPropertyDeclaration() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
// This will match against code that looks like:
// /** @constructor */
// function constructor() {
// this.variable = 3;
... | [
"public",
"static",
"Matcher",
"constructorPropertyDeclaration",
"(",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"// This will match against ... | Returns a Matcher that matches against properties that are declared in the constructor. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"against",
"properties",
"that",
"are",
"declared",
"in",
"the",
"constructor",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L362-L387 |
24,927 | google/closure-compiler | src/com/google/javascript/jscomp/deps/ModuleLoader.java | ModuleLoader.createRootPaths | private static ImmutableList<String> createRootPaths(
Iterable<String> roots, PathResolver resolver, PathEscaper escaper) {
// Sort longest length to shortest so that paths are applied most specific to least.
Set<String> builder =
new TreeSet<>(
Comparator.comparingInt(String::length).... | java | private static ImmutableList<String> createRootPaths(
Iterable<String> roots, PathResolver resolver, PathEscaper escaper) {
// Sort longest length to shortest so that paths are applied most specific to least.
Set<String> builder =
new TreeSet<>(
Comparator.comparingInt(String::length).... | [
"private",
"static",
"ImmutableList",
"<",
"String",
">",
"createRootPaths",
"(",
"Iterable",
"<",
"String",
">",
"roots",
",",
"PathResolver",
"resolver",
",",
"PathEscaper",
"escaper",
")",
"{",
"// Sort longest length to shortest so that paths are applied most specific t... | Normalizes the given root paths, which are path prefixes to be removed from a module path when
resolved. | [
"Normalizes",
"the",
"given",
"root",
"paths",
"which",
"are",
"path",
"prefixes",
"to",
"be",
"removed",
"from",
"a",
"module",
"path",
"when",
"resolved",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/ModuleLoader.java#L240-L254 |
24,928 | google/closure-compiler | src/com/google/javascript/jscomp/deps/ModuleLoader.java | ModuleLoader.normalize | static String normalize(String path, Iterable<String> moduleRootPaths) {
String normalizedPath = path;
if (isAmbiguousIdentifier(normalizedPath)) {
normalizedPath = MODULE_SLASH + normalizedPath;
}
// Find a moduleRoot that this URI is under. If none, use as is.
for (String moduleRoot : modul... | java | static String normalize(String path, Iterable<String> moduleRootPaths) {
String normalizedPath = path;
if (isAmbiguousIdentifier(normalizedPath)) {
normalizedPath = MODULE_SLASH + normalizedPath;
}
// Find a moduleRoot that this URI is under. If none, use as is.
for (String moduleRoot : modul... | [
"static",
"String",
"normalize",
"(",
"String",
"path",
",",
"Iterable",
"<",
"String",
">",
"moduleRootPaths",
")",
"{",
"String",
"normalizedPath",
"=",
"path",
";",
"if",
"(",
"isAmbiguousIdentifier",
"(",
"normalizedPath",
")",
")",
"{",
"normalizedPath",
... | Normalizes the name and resolves it against the module roots. | [
"Normalizes",
"the",
"name",
"and",
"resolves",
"it",
"against",
"the",
"module",
"roots",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/ModuleLoader.java#L282-L301 |
24,929 | google/closure-compiler | src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java | FixedPointGraphTraversal.newTraversal | public static <NODE, EDGE> FixedPointGraphTraversal<NODE, EDGE> newTraversal(
EdgeCallback<NODE, EDGE> callback) {
return new FixedPointGraphTraversal<>(callback);
} | java | public static <NODE, EDGE> FixedPointGraphTraversal<NODE, EDGE> newTraversal(
EdgeCallback<NODE, EDGE> callback) {
return new FixedPointGraphTraversal<>(callback);
} | [
"public",
"static",
"<",
"NODE",
",",
"EDGE",
">",
"FixedPointGraphTraversal",
"<",
"NODE",
",",
"EDGE",
">",
"newTraversal",
"(",
"EdgeCallback",
"<",
"NODE",
",",
"EDGE",
">",
"callback",
")",
"{",
"return",
"new",
"FixedPointGraphTraversal",
"<>",
"(",
"c... | Helper method for creating new traversals. | [
"Helper",
"method",
"for",
"creating",
"new",
"traversals",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java#L58-L61 |
24,930 | google/closure-compiler | src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java | FixedPointGraphTraversal.computeFixedPoint | public void computeFixedPoint(DiGraph<N, E> graph) {
Set<N> nodes = new LinkedHashSet<>();
for (DiGraphNode<N, E> node : graph.getDirectedGraphNodes()) {
nodes.add(node.getValue());
}
computeFixedPoint(graph, nodes);
} | java | public void computeFixedPoint(DiGraph<N, E> graph) {
Set<N> nodes = new LinkedHashSet<>();
for (DiGraphNode<N, E> node : graph.getDirectedGraphNodes()) {
nodes.add(node.getValue());
}
computeFixedPoint(graph, nodes);
} | [
"public",
"void",
"computeFixedPoint",
"(",
"DiGraph",
"<",
"N",
",",
"E",
">",
"graph",
")",
"{",
"Set",
"<",
"N",
">",
"nodes",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"DiGraphNode",
"<",
"N",
",",
"E",
">",
"node",
":",
"... | Compute a fixed point for the given graph.
@param graph The graph to traverse. | [
"Compute",
"a",
"fixed",
"point",
"for",
"the",
"given",
"graph",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java#L67-L73 |
24,931 | google/closure-compiler | src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java | FixedPointGraphTraversal.computeFixedPoint | public void computeFixedPoint(DiGraph<N, E> graph, N entry) {
Set<N> entrySet = new LinkedHashSet<>();
entrySet.add(entry);
computeFixedPoint(graph, entrySet);
} | java | public void computeFixedPoint(DiGraph<N, E> graph, N entry) {
Set<N> entrySet = new LinkedHashSet<>();
entrySet.add(entry);
computeFixedPoint(graph, entrySet);
} | [
"public",
"void",
"computeFixedPoint",
"(",
"DiGraph",
"<",
"N",
",",
"E",
">",
"graph",
",",
"N",
"entry",
")",
"{",
"Set",
"<",
"N",
">",
"entrySet",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"entrySet",
".",
"add",
"(",
"entry",
")",
";"... | Compute a fixed point for the given graph, entering from the given node.
@param graph The graph to traverse.
@param entry The node to begin traversing from. | [
"Compute",
"a",
"fixed",
"point",
"for",
"the",
"given",
"graph",
"entering",
"from",
"the",
"given",
"node",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java#L80-L84 |
24,932 | google/closure-compiler | src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java | FixedPointGraphTraversal.computeFixedPoint | public void computeFixedPoint(DiGraph<N, E> graph, Set<N> entrySet) {
int cycleCount = 0;
long nodeCount = graph.getNodeCount();
// Choose a bail-out heuristically in case the computation
// doesn't converge.
long maxIterations = Math.max(nodeCount * nodeCount * nodeCount, 100);
// Use a Linke... | java | public void computeFixedPoint(DiGraph<N, E> graph, Set<N> entrySet) {
int cycleCount = 0;
long nodeCount = graph.getNodeCount();
// Choose a bail-out heuristically in case the computation
// doesn't converge.
long maxIterations = Math.max(nodeCount * nodeCount * nodeCount, 100);
// Use a Linke... | [
"public",
"void",
"computeFixedPoint",
"(",
"DiGraph",
"<",
"N",
",",
"E",
">",
"graph",
",",
"Set",
"<",
"N",
">",
"entrySet",
")",
"{",
"int",
"cycleCount",
"=",
"0",
";",
"long",
"nodeCount",
"=",
"graph",
".",
"getNodeCount",
"(",
")",
";",
"// C... | Compute a fixed point for the given graph, entering from the given nodes.
@param graph The graph to traverse.
@param entrySet The nodes to begin traversing from. | [
"Compute",
"a",
"fixed",
"point",
"for",
"the",
"given",
"graph",
"entering",
"from",
"the",
"given",
"nodes",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java#L91-L124 |
24,933 | google/closure-compiler | src/com/google/javascript/jscomp/MinimizeExitPoints.java | MinimizeExitPoints.moveAllFollowing | private static void moveAllFollowing(
Node start, Node srcParent, Node destParent) {
for (Node n = start.getNext(); n != null; n = start.getNext()) {
boolean isFunctionDeclaration = NodeUtil.isFunctionDeclaration(n);
srcParent.removeChild(n);
if (isFunctionDeclaration) {
destParent.a... | java | private static void moveAllFollowing(
Node start, Node srcParent, Node destParent) {
for (Node n = start.getNext(); n != null; n = start.getNext()) {
boolean isFunctionDeclaration = NodeUtil.isFunctionDeclaration(n);
srcParent.removeChild(n);
if (isFunctionDeclaration) {
destParent.a... | [
"private",
"static",
"void",
"moveAllFollowing",
"(",
"Node",
"start",
",",
"Node",
"srcParent",
",",
"Node",
"destParent",
")",
"{",
"for",
"(",
"Node",
"n",
"=",
"start",
".",
"getNext",
"(",
")",
";",
"n",
"!=",
"null",
";",
"n",
"=",
"start",
"."... | Move all the child nodes following start in srcParent to the end of
destParent's child list.
@param start The start point in the srcParent child list.
@param srcParent The parent node of start.
@param destParent The destination node. | [
"Move",
"all",
"the",
"child",
"nodes",
"following",
"start",
"in",
"srcParent",
"to",
"the",
"end",
"of",
"destParent",
"s",
"child",
"list",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MinimizeExitPoints.java#L345-L356 |
24,934 | google/closure-compiler | src/com/google/javascript/jscomp/MinimizeExitPoints.java | MinimizeExitPoints.hasBlockScopedVarsFollowing | private static boolean hasBlockScopedVarsFollowing(Node start) {
for (Node n = start.getNext(); n != null; n = n.getNext()) {
if (n.isLet() || n.isConst()) {
return true;
}
}
return false;
} | java | private static boolean hasBlockScopedVarsFollowing(Node start) {
for (Node n = start.getNext(); n != null; n = n.getNext()) {
if (n.isLet() || n.isConst()) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"hasBlockScopedVarsFollowing",
"(",
"Node",
"start",
")",
"{",
"for",
"(",
"Node",
"n",
"=",
"start",
".",
"getNext",
"(",
")",
";",
"n",
"!=",
"null",
";",
"n",
"=",
"n",
".",
"getNext",
"(",
")",
")",
"{",
"if",
"(... | Detect any block-scoped declarations that are younger siblings of the given starting point.
@param start The start point | [
"Detect",
"any",
"block",
"-",
"scoped",
"declarations",
"that",
"are",
"younger",
"siblings",
"of",
"the",
"given",
"starting",
"point",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MinimizeExitPoints.java#L385-L392 |
24,935 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.traverse | public void traverse(Node root) {
try {
initTraversal(root);
curNode = root;
pushScope(root);
// null parent ensures that the shallow callbacks will traverse root
traverseBranch(root, null);
popScope();
} catch (Error | Exception unexpectedException) {
throwUnexpectedEx... | java | public void traverse(Node root) {
try {
initTraversal(root);
curNode = root;
pushScope(root);
// null parent ensures that the shallow callbacks will traverse root
traverseBranch(root, null);
popScope();
} catch (Error | Exception unexpectedException) {
throwUnexpectedEx... | [
"public",
"void",
"traverse",
"(",
"Node",
"root",
")",
"{",
"try",
"{",
"initTraversal",
"(",
"root",
")",
";",
"curNode",
"=",
"root",
";",
"pushScope",
"(",
"root",
")",
";",
"// null parent ensures that the shallow callbacks will traverse root",
"traverseBranch"... | Traverses a parse tree recursively. | [
"Traverses",
"a",
"parse",
"tree",
"recursively",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L365-L376 |
24,936 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.traverse | public static void traverse(AbstractCompiler compiler, Node root, Callback cb) {
NodeTraversal t = new NodeTraversal(compiler, cb, new Es6SyntacticScopeCreator(compiler));
t.traverse(root);
} | java | public static void traverse(AbstractCompiler compiler, Node root, Callback cb) {
NodeTraversal t = new NodeTraversal(compiler, cb, new Es6SyntacticScopeCreator(compiler));
t.traverse(root);
} | [
"public",
"static",
"void",
"traverse",
"(",
"AbstractCompiler",
"compiler",
",",
"Node",
"root",
",",
"Callback",
"cb",
")",
"{",
"NodeTraversal",
"t",
"=",
"new",
"NodeTraversal",
"(",
"compiler",
",",
"cb",
",",
"new",
"Es6SyntacticScopeCreator",
"(",
"comp... | Traverses using the ES6SyntacticScopeCreator | [
"Traverses",
"using",
"the",
"ES6SyntacticScopeCreator"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L379-L382 |
24,937 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.traversePostOrder | public static void traversePostOrder(
AbstractCompiler compiler, Node root, AbstractPostOrderCallbackInterface cb) {
traverse(compiler, root, makePostOrderCallback(cb));
} | java | public static void traversePostOrder(
AbstractCompiler compiler, Node root, AbstractPostOrderCallbackInterface cb) {
traverse(compiler, root, makePostOrderCallback(cb));
} | [
"public",
"static",
"void",
"traversePostOrder",
"(",
"AbstractCompiler",
"compiler",
",",
"Node",
"root",
",",
"AbstractPostOrderCallbackInterface",
"cb",
")",
"{",
"traverse",
"(",
"compiler",
",",
"root",
",",
"makePostOrderCallback",
"(",
"cb",
")",
")",
";",
... | Traverses in post order. | [
"Traverses",
"in",
"post",
"order",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L385-L388 |
24,938 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.traverseFunctionOutOfBand | public void traverseFunctionOutOfBand(Node node, AbstractScope<?, ?> scope) {
checkNotNull(scope);
checkState(node.isFunction(), node);
checkNotNull(scope.getRootNode());
initTraversal(node);
curNode = node.getParent();
pushScope(scope, true /* quietly */);
traverseBranch(node, curNode);
... | java | public void traverseFunctionOutOfBand(Node node, AbstractScope<?, ?> scope) {
checkNotNull(scope);
checkState(node.isFunction(), node);
checkNotNull(scope.getRootNode());
initTraversal(node);
curNode = node.getParent();
pushScope(scope, true /* quietly */);
traverseBranch(node, curNode);
... | [
"public",
"void",
"traverseFunctionOutOfBand",
"(",
"Node",
"node",
",",
"AbstractScope",
"<",
"?",
",",
"?",
">",
"scope",
")",
"{",
"checkNotNull",
"(",
"scope",
")",
";",
"checkState",
"(",
"node",
".",
"isFunction",
"(",
")",
",",
"node",
")",
";",
... | Traverse a function out-of-band of normal traversal.
@param node The function node.
@param scope The scope the function is contained in. Does not fire enter/exit
callback events for this scope. | [
"Traverse",
"a",
"function",
"out",
"-",
"of",
"-",
"band",
"of",
"normal",
"traversal",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L661-L670 |
24,939 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.getLineNumber | public int getLineNumber() {
Node cur = curNode;
while (cur != null) {
int line = cur.getLineno();
if (line >= 0) {
return line;
}
cur = cur.getParent();
}
return 0;
} | java | public int getLineNumber() {
Node cur = curNode;
while (cur != null) {
int line = cur.getLineno();
if (line >= 0) {
return line;
}
cur = cur.getParent();
}
return 0;
} | [
"public",
"int",
"getLineNumber",
"(",
")",
"{",
"Node",
"cur",
"=",
"curNode",
";",
"while",
"(",
"cur",
"!=",
"null",
")",
"{",
"int",
"line",
"=",
"cur",
".",
"getLineno",
"(",
")",
";",
"if",
"(",
"line",
">=",
"0",
")",
"{",
"return",
"line"... | Gets the current line number, or zero if it cannot be determined. The line
number is retrieved lazily as a running time optimization. | [
"Gets",
"the",
"current",
"line",
"number",
"or",
"zero",
"if",
"it",
"cannot",
"be",
"determined",
".",
"The",
"line",
"number",
"is",
"retrieved",
"lazily",
"as",
"a",
"running",
"time",
"optimization",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L703-L713 |
24,940 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.getCharno | public int getCharno() {
Node cur = curNode;
while (cur != null) {
int line = cur.getCharno();
if (line >= 0) {
return line;
}
cur = cur.getParent();
}
return 0;
} | java | public int getCharno() {
Node cur = curNode;
while (cur != null) {
int line = cur.getCharno();
if (line >= 0) {
return line;
}
cur = cur.getParent();
}
return 0;
} | [
"public",
"int",
"getCharno",
"(",
")",
"{",
"Node",
"cur",
"=",
"curNode",
";",
"while",
"(",
"cur",
"!=",
"null",
")",
"{",
"int",
"line",
"=",
"cur",
".",
"getCharno",
"(",
")",
";",
"if",
"(",
"line",
">=",
"0",
")",
"{",
"return",
"line",
... | Gets the current char number, or zero if it cannot be determined. The line
number is retrieved lazily as a running time optimization. | [
"Gets",
"the",
"current",
"char",
"number",
"or",
"zero",
"if",
"it",
"cannot",
"be",
"determined",
".",
"The",
"line",
"number",
"is",
"retrieved",
"lazily",
"as",
"a",
"running",
"time",
"optimization",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L719-L729 |
24,941 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.getInput | public CompilerInput getInput() {
if (compilerInput == null && inputId != null) {
compilerInput = compiler.getInput(inputId);
}
return compilerInput;
} | java | public CompilerInput getInput() {
if (compilerInput == null && inputId != null) {
compilerInput = compiler.getInput(inputId);
}
return compilerInput;
} | [
"public",
"CompilerInput",
"getInput",
"(",
")",
"{",
"if",
"(",
"compilerInput",
"==",
"null",
"&&",
"inputId",
"!=",
"null",
")",
"{",
"compilerInput",
"=",
"compiler",
".",
"getInput",
"(",
"inputId",
")",
";",
"}",
"return",
"compilerInput",
";",
"}"
] | Gets the current input source. | [
"Gets",
"the",
"current",
"input",
"source",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L743-L748 |
24,942 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.getModule | public JSModule getModule() {
CompilerInput input = getInput();
return input == null ? null : input.getModule();
} | java | public JSModule getModule() {
CompilerInput input = getInput();
return input == null ? null : input.getModule();
} | [
"public",
"JSModule",
"getModule",
"(",
")",
"{",
"CompilerInput",
"input",
"=",
"getInput",
"(",
")",
";",
"return",
"input",
"==",
"null",
"?",
"null",
":",
"input",
".",
"getModule",
"(",
")",
";",
"}"
] | Gets the current input module. | [
"Gets",
"the",
"current",
"input",
"module",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L753-L756 |
24,943 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.handleModule | private void handleModule(Node n, Node parent) {
pushScope(n);
curNode = n;
if (callback.shouldTraverse(this, n, parent)) {
curNode = n;
traverseChildren(n);
callback.visit(this, n, parent);
}
popScope();
} | java | private void handleModule(Node n, Node parent) {
pushScope(n);
curNode = n;
if (callback.shouldTraverse(this, n, parent)) {
curNode = n;
traverseChildren(n);
callback.visit(this, n, parent);
}
popScope();
} | [
"private",
"void",
"handleModule",
"(",
"Node",
"n",
",",
"Node",
"parent",
")",
"{",
"pushScope",
"(",
"n",
")",
";",
"curNode",
"=",
"n",
";",
"if",
"(",
"callback",
".",
"shouldTraverse",
"(",
"this",
",",
"n",
",",
"parent",
")",
")",
"{",
"cur... | Traverses a module. | [
"Traverses",
"a",
"module",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L824-L833 |
24,944 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.traverseBranch | private void traverseBranch(Node n, Node parent) {
switch (n.getToken()) {
case SCRIPT:
handleScript(n, parent);
return;
case FUNCTION:
handleFunction(n, parent);
return;
case MODULE_BODY:
handleModule(n, parent);
return;
default:
break... | java | private void traverseBranch(Node n, Node parent) {
switch (n.getToken()) {
case SCRIPT:
handleScript(n, parent);
return;
case FUNCTION:
handleFunction(n, parent);
return;
case MODULE_BODY:
handleModule(n, parent);
return;
default:
break... | [
"private",
"void",
"traverseBranch",
"(",
"Node",
"n",
",",
"Node",
"parent",
")",
"{",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"SCRIPT",
":",
"handleScript",
"(",
"n",
",",
"parent",
")",
";",
"return",
";",
"case",
"FUNCTIO... | Traverses a branch. | [
"Traverses",
"a",
"branch",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L836-L868 |
24,945 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.traverseFunction | private void traverseFunction(Node n, Node parent) {
final Node fnName = n.getFirstChild();
// NOTE: If a function declaration is the root of a traversal, then we will treat it as a
// function expression (since 'parent' is null, even though 'n' actually has a parent node) and
// traverse the function n... | java | private void traverseFunction(Node n, Node parent) {
final Node fnName = n.getFirstChild();
// NOTE: If a function declaration is the root of a traversal, then we will treat it as a
// function expression (since 'parent' is null, even though 'n' actually has a parent node) and
// traverse the function n... | [
"private",
"void",
"traverseFunction",
"(",
"Node",
"n",
",",
"Node",
"parent",
")",
"{",
"final",
"Node",
"fnName",
"=",
"n",
".",
"getFirstChild",
"(",
")",
";",
"// NOTE: If a function declaration is the root of a traversal, then we will treat it as a",
"// function ex... | Traverses a function. | [
"Traverses",
"a",
"function",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L871-L909 |
24,946 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.traverseClassMembers | private void traverseClassMembers(Node n) {
for (Node child = n.getFirstChild(); child != null;) {
Node next = child.getNext(); // see traverseChildren
if (child.isComputedProp()) {
curNode = n;
if (callback.shouldTraverse(this, child, n)) {
traverseBranch(child.getLastChild(),... | java | private void traverseClassMembers(Node n) {
for (Node child = n.getFirstChild(); child != null;) {
Node next = child.getNext(); // see traverseChildren
if (child.isComputedProp()) {
curNode = n;
if (callback.shouldTraverse(this, child, n)) {
traverseBranch(child.getLastChild(),... | [
"private",
"void",
"traverseClassMembers",
"(",
"Node",
"n",
")",
"{",
"for",
"(",
"Node",
"child",
"=",
"n",
".",
"getFirstChild",
"(",
")",
";",
"child",
"!=",
"null",
";",
")",
"{",
"Node",
"next",
"=",
"child",
".",
"getNext",
"(",
")",
";",
"/... | Traverse class members, excluding keys of computed props. | [
"Traverse",
"class",
"members",
"excluding",
"keys",
"of",
"computed",
"props",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L957-L972 |
24,947 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.getAbstractScope | public AbstractScope<?, ?> getAbstractScope() {
AbstractScope<?, ?> scope = scopes.peek();
// NOTE(dylandavidson): Use for-each loop to avoid slow ArrayList#get performance.
for (Node scopeRoot : scopeRoots) {
scope = scopeCreator.createScope(scopeRoot, scope);
scopes.push(scope);
}
sco... | java | public AbstractScope<?, ?> getAbstractScope() {
AbstractScope<?, ?> scope = scopes.peek();
// NOTE(dylandavidson): Use for-each loop to avoid slow ArrayList#get performance.
for (Node scopeRoot : scopeRoots) {
scope = scopeCreator.createScope(scopeRoot, scope);
scopes.push(scope);
}
sco... | [
"public",
"AbstractScope",
"<",
"?",
",",
"?",
">",
"getAbstractScope",
"(",
")",
"{",
"AbstractScope",
"<",
"?",
",",
"?",
">",
"scope",
"=",
"scopes",
".",
"peek",
"(",
")",
";",
"// NOTE(dylandavidson): Use for-each loop to avoid slow ArrayList#get performance.",... | Gets the current scope. | [
"Gets",
"the",
"current",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L1060-L1070 |
24,948 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.instantiateScopes | private AbstractScope<?, ?> instantiateScopes(int count) {
checkArgument(count <= scopeRoots.size());
AbstractScope<?, ?> scope = scopes.peek();
for (int i = 0; i < count; i++) {
scope = scopeCreator.createScope(scopeRoots.get(i), scope);
scopes.push(scope);
}
scopeRoots.subList(0, coun... | java | private AbstractScope<?, ?> instantiateScopes(int count) {
checkArgument(count <= scopeRoots.size());
AbstractScope<?, ?> scope = scopes.peek();
for (int i = 0; i < count; i++) {
scope = scopeCreator.createScope(scopeRoots.get(i), scope);
scopes.push(scope);
}
scopeRoots.subList(0, coun... | [
"private",
"AbstractScope",
"<",
"?",
",",
"?",
">",
"instantiateScopes",
"(",
"int",
"count",
")",
"{",
"checkArgument",
"(",
"count",
"<=",
"scopeRoots",
".",
"size",
"(",
")",
")",
";",
"AbstractScope",
"<",
"?",
",",
"?",
">",
"scope",
"=",
"scopes... | Instantiate some, but not necessarily all, scopes from stored roots.
<p>NodeTraversal instantiates scopes lazily when getScope() or similar is called, by iterating
over a stored list of not-yet-instantiated scopeRoots. When a not-yet-instantiated parent
scope is requested, it doesn't make sense to instantiate <i>all<... | [
"Instantiate",
"some",
"but",
"not",
"necessarily",
"all",
"scopes",
"from",
"stored",
"roots",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L1082-L1092 |
24,949 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.getControlFlowGraph | @SuppressWarnings("unchecked") // The type is always ControlFlowGraph<Node>
public ControlFlowGraph<Node> getControlFlowGraph() {
ControlFlowGraph<Node> result;
Object o = cfgs.peek();
if (o instanceof Node) {
Node cfgRoot = (Node) o;
ControlFlowAnalysis cfa = new ControlFlowAnalysis(compiler... | java | @SuppressWarnings("unchecked") // The type is always ControlFlowGraph<Node>
public ControlFlowGraph<Node> getControlFlowGraph() {
ControlFlowGraph<Node> result;
Object o = cfgs.peek();
if (o instanceof Node) {
Node cfgRoot = (Node) o;
ControlFlowAnalysis cfa = new ControlFlowAnalysis(compiler... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// The type is always ControlFlowGraph<Node>",
"public",
"ControlFlowGraph",
"<",
"Node",
">",
"getControlFlowGraph",
"(",
")",
"{",
"ControlFlowGraph",
"<",
"Node",
">",
"result",
";",
"Object",
"o",
"=",
"cfgs",
... | Gets the control flow graph for the current JS scope. | [
"Gets",
"the",
"control",
"flow",
"graph",
"for",
"the",
"current",
"JS",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L1149-L1164 |
24,950 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.getScopeRoot | public Node getScopeRoot() {
int roots = scopeRoots.size();
if (roots > 0) {
return scopeRoots.get(roots - 1);
} else {
AbstractScope<?, ?> s = scopes.peek();
return s != null ? s.getRootNode() : null;
}
} | java | public Node getScopeRoot() {
int roots = scopeRoots.size();
if (roots > 0) {
return scopeRoots.get(roots - 1);
} else {
AbstractScope<?, ?> s = scopes.peek();
return s != null ? s.getRootNode() : null;
}
} | [
"public",
"Node",
"getScopeRoot",
"(",
")",
"{",
"int",
"roots",
"=",
"scopeRoots",
".",
"size",
"(",
")",
";",
"if",
"(",
"roots",
">",
"0",
")",
"{",
"return",
"scopeRoots",
".",
"get",
"(",
"roots",
"-",
"1",
")",
";",
"}",
"else",
"{",
"Abstr... | Returns the current scope's root. | [
"Returns",
"the",
"current",
"scope",
"s",
"root",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L1167-L1175 |
24,951 | google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.initScopeRoots | private void initScopeRoots(Node n) {
Deque<Node> queuedScopeRoots = new ArrayDeque<>();
while (n != null) {
if (isScopeRoot(n)) {
queuedScopeRoots.addFirst(n);
}
n = n.getParent();
}
for (Node queuedScopeRoot : queuedScopeRoots) {
pushScope(queuedScopeRoot);
}
} | java | private void initScopeRoots(Node n) {
Deque<Node> queuedScopeRoots = new ArrayDeque<>();
while (n != null) {
if (isScopeRoot(n)) {
queuedScopeRoots.addFirst(n);
}
n = n.getParent();
}
for (Node queuedScopeRoot : queuedScopeRoots) {
pushScope(queuedScopeRoot);
}
} | [
"private",
"void",
"initScopeRoots",
"(",
"Node",
"n",
")",
"{",
"Deque",
"<",
"Node",
">",
"queuedScopeRoots",
"=",
"new",
"ArrayDeque",
"<>",
"(",
")",
";",
"while",
"(",
"n",
"!=",
"null",
")",
"{",
"if",
"(",
"isScopeRoot",
"(",
"n",
")",
")",
... | Prefills the scopeRoots stack up to a given spot in the AST. Allows for starting traversal at
any spot while still having correct scope state. | [
"Prefills",
"the",
"scopeRoots",
"stack",
"up",
"to",
"a",
"given",
"spot",
"in",
"the",
"AST",
".",
"Allows",
"for",
"starting",
"traversal",
"at",
"any",
"spot",
"while",
"still",
"having",
"correct",
"scope",
"state",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L1313-L1324 |
24,952 | google/closure-compiler | src/com/google/javascript/rhino/jstype/EnumElementType.java | EnumElementType.meet | JSType meet(JSType that) {
JSType meetPrimitive = primitiveType.getGreatestSubtype(that);
if (meetPrimitive.isEmptyType()) {
return null;
} else {
return new EnumElementType(registry, meetPrimitive, name, getEnumType());
}
} | java | JSType meet(JSType that) {
JSType meetPrimitive = primitiveType.getGreatestSubtype(that);
if (meetPrimitive.isEmptyType()) {
return null;
} else {
return new EnumElementType(registry, meetPrimitive, name, getEnumType());
}
} | [
"JSType",
"meet",
"(",
"JSType",
"that",
")",
"{",
"JSType",
"meetPrimitive",
"=",
"primitiveType",
".",
"getGreatestSubtype",
"(",
"that",
")",
";",
"if",
"(",
"meetPrimitive",
".",
"isEmptyType",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
... | Returns the infimum of a enum element type and another type, or null
if the infimum is empty.
This can be a little bit weird. For example, suppose you have an enum
of {(string|number)}, and you want the greatest subtype of the enum
and a {number}.
The infimum is non-empty. But at the same time, we don't really have
a... | [
"Returns",
"the",
"infimum",
"of",
"a",
"enum",
"element",
"type",
"and",
"another",
"type",
"or",
"null",
"if",
"the",
"infimum",
"is",
"empty",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/EnumElementType.java#L238-L245 |
24,953 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.getGlobalScope | public final S getGlobalScope() {
S result = thisScope();
while (result.getParent() != null) {
result = result.getParent();
}
return result;
} | java | public final S getGlobalScope() {
S result = thisScope();
while (result.getParent() != null) {
result = result.getParent();
}
return result;
} | [
"public",
"final",
"S",
"getGlobalScope",
"(",
")",
"{",
"S",
"result",
"=",
"thisScope",
"(",
")",
";",
"while",
"(",
"result",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"result",
"=",
"result",
".",
"getParent",
"(",
")",
";",
"}",
"ret... | Walks up the tree to find the global scope. | [
"Walks",
"up",
"the",
"tree",
"to",
"find",
"the",
"global",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L115-L121 |
24,954 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.undeclare | final void undeclare(V var) {
checkState(var.scope == this);
checkState(vars.get(var.name).equals(var));
undeclareInteral(var);
} | java | final void undeclare(V var) {
checkState(var.scope == this);
checkState(vars.get(var.name).equals(var));
undeclareInteral(var);
} | [
"final",
"void",
"undeclare",
"(",
"V",
"var",
")",
"{",
"checkState",
"(",
"var",
".",
"scope",
"==",
"this",
")",
";",
"checkState",
"(",
"vars",
".",
"get",
"(",
"var",
".",
"name",
")",
".",
"equals",
"(",
"var",
")",
")",
";",
"undeclareIntera... | Undeclares a variable, to be used when the compiler optimizes out
a variable and removes it from the scope. | [
"Undeclares",
"a",
"variable",
"to",
"be",
"used",
"when",
"the",
"compiler",
"optimizes",
"out",
"a",
"variable",
"and",
"removes",
"it",
"from",
"the",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L134-L138 |
24,955 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.getVar | public V getVar(String name) {
ImplicitVar implicit = name != null ? ImplicitVar.of(name) : null;
if (implicit != null) {
return getImplicitVar(implicit, true);
}
S scope = thisScope();
while (scope != null) {
V var = scope.getOwnSlot(name);
if (var != null) {
return var;
... | java | public V getVar(String name) {
ImplicitVar implicit = name != null ? ImplicitVar.of(name) : null;
if (implicit != null) {
return getImplicitVar(implicit, true);
}
S scope = thisScope();
while (scope != null) {
V var = scope.getOwnSlot(name);
if (var != null) {
return var;
... | [
"public",
"V",
"getVar",
"(",
"String",
"name",
")",
"{",
"ImplicitVar",
"implicit",
"=",
"name",
"!=",
"null",
"?",
"ImplicitVar",
".",
"of",
"(",
"name",
")",
":",
"null",
";",
"if",
"(",
"implicit",
"!=",
"null",
")",
"{",
"return",
"getImplicitVar"... | Non-final for jsdev tests | [
"Non",
"-",
"final",
"for",
"jsdev",
"tests"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L171-L186 |
24,956 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.getImplicitVar | private final V getImplicitVar(ImplicitVar var, boolean allowDeclaredVars) {
S scope = thisScope();
while (scope != null) {
if (var.isMadeByScope(scope)) {
V result = ((AbstractScope<S, V>) scope).implicitVars.get(var);
if (result == null) {
((AbstractScope<S, V>) scope).implicit... | java | private final V getImplicitVar(ImplicitVar var, boolean allowDeclaredVars) {
S scope = thisScope();
while (scope != null) {
if (var.isMadeByScope(scope)) {
V result = ((AbstractScope<S, V>) scope).implicitVars.get(var);
if (result == null) {
((AbstractScope<S, V>) scope).implicit... | [
"private",
"final",
"V",
"getImplicitVar",
"(",
"ImplicitVar",
"var",
",",
"boolean",
"allowDeclaredVars",
")",
"{",
"S",
"scope",
"=",
"thisScope",
"(",
")",
";",
"while",
"(",
"scope",
"!=",
"null",
")",
"{",
"if",
"(",
"var",
".",
"isMadeByScope",
"("... | Get a unique Var object of the given implicit var type. | [
"Get",
"a",
"unique",
"Var",
"object",
"of",
"the",
"given",
"implicit",
"var",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L196-L214 |
24,957 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.hasSlot | public final boolean hasSlot(String name) {
S scope = thisScope();
while (scope != null) {
if (scope.hasOwnSlot(name)) {
return true;
}
scope = scope.getParent();
}
return false;
} | java | public final boolean hasSlot(String name) {
S scope = thisScope();
while (scope != null) {
if (scope.hasOwnSlot(name)) {
return true;
}
scope = scope.getParent();
}
return false;
} | [
"public",
"final",
"boolean",
"hasSlot",
"(",
"String",
"name",
")",
"{",
"S",
"scope",
"=",
"thisScope",
"(",
")",
";",
"while",
"(",
"scope",
"!=",
"null",
")",
"{",
"if",
"(",
"scope",
".",
"hasOwnSlot",
"(",
"name",
")",
")",
"{",
"return",
"tr... | Returns true if a variable is declared in this or any parent scope. | [
"Returns",
"true",
"if",
"a",
"variable",
"is",
"declared",
"in",
"this",
"or",
"any",
"parent",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L222-L231 |
24,958 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.canDeclare | final boolean canDeclare(String name) {
return !hasOwnSlot(name)
&& (!isFunctionBlockScope()
|| !getParent().hasOwnSlot(name)
|| isBleedingFunctionName(name));
} | java | final boolean canDeclare(String name) {
return !hasOwnSlot(name)
&& (!isFunctionBlockScope()
|| !getParent().hasOwnSlot(name)
|| isBleedingFunctionName(name));
} | [
"final",
"boolean",
"canDeclare",
"(",
"String",
"name",
")",
"{",
"return",
"!",
"hasOwnSlot",
"(",
"name",
")",
"&&",
"(",
"!",
"isFunctionBlockScope",
"(",
")",
"||",
"!",
"getParent",
"(",
")",
".",
"hasOwnSlot",
"(",
"name",
")",
"||",
"isBleedingFu... | Returns true if the name can be declared on this scope without causing illegal shadowing.
Specifically, this is aware of the connection between function container scopes and function
block scopes and returns false for redeclaring parameters on the block scope. | [
"Returns",
"true",
"if",
"the",
"name",
"can",
"be",
"declared",
"on",
"this",
"scope",
"without",
"causing",
"illegal",
"shadowing",
".",
"Specifically",
"this",
"is",
"aware",
"of",
"the",
"connection",
"between",
"function",
"container",
"scopes",
"and",
"f... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L238-L243 |
24,959 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.isBleedingFunctionName | private boolean isBleedingFunctionName(String name) {
V var = getVar(name);
return var != null && var.getNode().getParent().isFunction();
} | java | private boolean isBleedingFunctionName(String name) {
V var = getVar(name);
return var != null && var.getNode().getParent().isFunction();
} | [
"private",
"boolean",
"isBleedingFunctionName",
"(",
"String",
"name",
")",
"{",
"V",
"var",
"=",
"getVar",
"(",
"name",
")",
";",
"return",
"var",
"!=",
"null",
"&&",
"var",
".",
"getNode",
"(",
")",
".",
"getParent",
"(",
")",
".",
"isFunction",
"(",... | Returns true if the given name is a bleeding function name in this scope. Local variables in
the function block are not allowed to shadow parameters, but they are allowed to shadow a
bleeding function name. | [
"Returns",
"true",
"if",
"the",
"given",
"name",
"is",
"a",
"bleeding",
"function",
"name",
"in",
"this",
"scope",
".",
"Local",
"variables",
"in",
"the",
"function",
"block",
"are",
"not",
"allowed",
"to",
"shadow",
"parameters",
"but",
"they",
"are",
"al... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L250-L253 |
24,960 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.getClosestHoistScope | public final S getClosestHoistScope() {
S current = thisScope();
while (current != null) {
if (current.isHoistScope()) {
return current;
}
current = current.getParent();
}
return null;
} | java | public final S getClosestHoistScope() {
S current = thisScope();
while (current != null) {
if (current.isHoistScope()) {
return current;
}
current = current.getParent();
}
return null;
} | [
"public",
"final",
"S",
"getClosestHoistScope",
"(",
")",
"{",
"S",
"current",
"=",
"thisScope",
"(",
")",
";",
"while",
"(",
"current",
"!=",
"null",
")",
"{",
"if",
"(",
"current",
".",
"isHoistScope",
"(",
")",
")",
"{",
"return",
"current",
";",
... | If a var were declared in this scope, return the scope it would be hoisted to.
<p>For function scopes, we return back the scope itself, since even though there is no way to
declare a var inside function parameters, it would make even less sense to say that such
declarations would be "hoisted" somewhere else. | [
"If",
"a",
"var",
"were",
"declared",
"in",
"this",
"scope",
"return",
"the",
"scope",
"it",
"would",
"be",
"hoisted",
"to",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L359-L368 |
24,961 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.getClosestContainerScope | public final S getClosestContainerScope() {
S scope = getClosestHoistScope();
if (scope.isBlockScope()) {
scope = scope.getParent();
checkState(!scope.isBlockScope());
}
return scope;
} | java | public final S getClosestContainerScope() {
S scope = getClosestHoistScope();
if (scope.isBlockScope()) {
scope = scope.getParent();
checkState(!scope.isBlockScope());
}
return scope;
} | [
"public",
"final",
"S",
"getClosestContainerScope",
"(",
")",
"{",
"S",
"scope",
"=",
"getClosestHoistScope",
"(",
")",
";",
"if",
"(",
"scope",
".",
"isBlockScope",
"(",
")",
")",
"{",
"scope",
"=",
"scope",
".",
"getParent",
"(",
")",
";",
"checkState"... | Returns the closest container scope. This is equivalent to what the current scope would have
been for non-ES6 scope creators, and is thus useful for migrating code to use block scopes. | [
"Returns",
"the",
"closest",
"container",
"scope",
".",
"This",
"is",
"equivalent",
"to",
"what",
"the",
"current",
"scope",
"would",
"have",
"been",
"for",
"non",
"-",
"ES6",
"scope",
"creators",
"and",
"is",
"thus",
"useful",
"for",
"migrating",
"code",
... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L374-L381 |
24,962 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.checkChildScope | final void checkChildScope(S parent) {
checkNotNull(parent);
checkArgument(NodeUtil.createsScope(rootNode), rootNode);
checkArgument(
rootNode != parent.getRootNode(),
"rootNode should not be the parent's root node: %s", rootNode);
} | java | final void checkChildScope(S parent) {
checkNotNull(parent);
checkArgument(NodeUtil.createsScope(rootNode), rootNode);
checkArgument(
rootNode != parent.getRootNode(),
"rootNode should not be the parent's root node: %s", rootNode);
} | [
"final",
"void",
"checkChildScope",
"(",
"S",
"parent",
")",
"{",
"checkNotNull",
"(",
"parent",
")",
";",
"checkArgument",
"(",
"NodeUtil",
".",
"createsScope",
"(",
"rootNode",
")",
",",
"rootNode",
")",
";",
"checkArgument",
"(",
"rootNode",
"!=",
"parent... | Performs simple validity checks on when constructing a child scope. | [
"Performs",
"simple",
"validity",
"checks",
"on",
"when",
"constructing",
"a",
"child",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L392-L398 |
24,963 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.checkRootScope | final void checkRootScope() {
// TODO(tbreisacher): Can we tighten this to just NodeUtil.createsScope?
checkArgument(
NodeUtil.createsScope(rootNode) || rootNode.isScript() || rootNode.isRoot(), rootNode);
} | java | final void checkRootScope() {
// TODO(tbreisacher): Can we tighten this to just NodeUtil.createsScope?
checkArgument(
NodeUtil.createsScope(rootNode) || rootNode.isScript() || rootNode.isRoot(), rootNode);
} | [
"final",
"void",
"checkRootScope",
"(",
")",
"{",
"// TODO(tbreisacher): Can we tighten this to just NodeUtil.createsScope?",
"checkArgument",
"(",
"NodeUtil",
".",
"createsScope",
"(",
"rootNode",
")",
"||",
"rootNode",
".",
"isScript",
"(",
")",
"||",
"rootNode",
".",... | Performs simple validity checks on when constructing a root scope. | [
"Performs",
"simple",
"validity",
"checks",
"on",
"when",
"constructing",
"a",
"root",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L401-L405 |
24,964 | google/closure-compiler | src/com/google/javascript/jscomp/AbstractScope.java | AbstractScope.getCommonParent | S getCommonParent(S other) {
S left = thisScope();
S right = other;
while (left != null && right != null && left != right) {
int leftDepth = left.getDepth();
int rightDepth = right.getDepth();
if (leftDepth >= rightDepth) {
left = left.getParent();
}
if (leftDepth <= ri... | java | S getCommonParent(S other) {
S left = thisScope();
S right = other;
while (left != null && right != null && left != right) {
int leftDepth = left.getDepth();
int rightDepth = right.getDepth();
if (leftDepth >= rightDepth) {
left = left.getParent();
}
if (leftDepth <= ri... | [
"S",
"getCommonParent",
"(",
"S",
"other",
")",
"{",
"S",
"left",
"=",
"thisScope",
"(",
")",
";",
"S",
"right",
"=",
"other",
";",
"while",
"(",
"left",
"!=",
"null",
"&&",
"right",
"!=",
"null",
"&&",
"left",
"!=",
"right",
")",
"{",
"int",
"le... | Returns the nearest common parent between two scopes. | [
"Returns",
"the",
"nearest",
"common",
"parent",
"between",
"two",
"scopes",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractScope.java#L408-L424 |
24,965 | google/closure-compiler | src/com/google/javascript/jscomp/ExploitAssigns.java | ExploitAssigns.collapseAssign | private void collapseAssign(Node assign, Node expr, Node exprParent) {
Node leftValue = assign.getFirstChild();
Node rightValue = leftValue.getNext();
if (leftValue.isDestructuringPattern()) {
// We don't collapse expressions containing these because they can have side effects:
// - Reassigni... | java | private void collapseAssign(Node assign, Node expr, Node exprParent) {
Node leftValue = assign.getFirstChild();
Node rightValue = leftValue.getNext();
if (leftValue.isDestructuringPattern()) {
// We don't collapse expressions containing these because they can have side effects:
// - Reassigni... | [
"private",
"void",
"collapseAssign",
"(",
"Node",
"assign",
",",
"Node",
"expr",
",",
"Node",
"exprParent",
")",
"{",
"Node",
"leftValue",
"=",
"assign",
".",
"getFirstChild",
"(",
")",
";",
"Node",
"rightValue",
"=",
"leftValue",
".",
"getNext",
"(",
")",... | Try to collapse the given assign into subsequent expressions. | [
"Try",
"to",
"collapse",
"the",
"given",
"assign",
"into",
"subsequent",
"expressions",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExploitAssigns.java#L43-L64 |
24,966 | google/closure-compiler | src/com/google/javascript/jscomp/ExploitAssigns.java | ExploitAssigns.isCollapsibleValue | private static boolean isCollapsibleValue(Node value, boolean isLValue) {
switch (value.getToken()) {
case GETPROP:
// Do not collapse GETPROPs on arbitrary objects, because
// they may be implemented setter functions, and oftentimes
// setter functions fail on native objects. This is ... | java | private static boolean isCollapsibleValue(Node value, boolean isLValue) {
switch (value.getToken()) {
case GETPROP:
// Do not collapse GETPROPs on arbitrary objects, because
// they may be implemented setter functions, and oftentimes
// setter functions fail on native objects. This is ... | [
"private",
"static",
"boolean",
"isCollapsibleValue",
"(",
"Node",
"value",
",",
"boolean",
"isLValue",
")",
"{",
"switch",
"(",
"value",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"GETPROP",
":",
"// Do not collapse GETPROPs on arbitrary objects, because",
"// th... | Determines whether we know enough about the given value to be able
to collapse it into subsequent expressions.
For example, we can collapse booleans and variable names:
<code>
x = 3; y = x; // y = x = 3;
a = true; b = true; // b = a = true;
<code>
But we won't try to collapse complex expressions.
@param value The val... | [
"Determines",
"whether",
"we",
"know",
"enough",
"about",
"the",
"given",
"value",
"to",
"be",
"able",
"to",
"collapse",
"it",
"into",
"subsequent",
"expressions",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExploitAssigns.java#L80-L95 |
24,967 | google/closure-compiler | src/com/google/javascript/jscomp/ExploitAssigns.java | ExploitAssigns.collapseAssignEqualTo | private boolean collapseAssignEqualTo(Node expr, Node exprParent, Node value) {
Node assign = expr.getFirstChild();
Node parent = exprParent;
Node next = expr.getNext();
while (next != null) {
switch (next.getToken()) {
case AND:
case OR:
case HOOK:
case IF:
... | java | private boolean collapseAssignEqualTo(Node expr, Node exprParent, Node value) {
Node assign = expr.getFirstChild();
Node parent = exprParent;
Node next = expr.getNext();
while (next != null) {
switch (next.getToken()) {
case AND:
case OR:
case HOOK:
case IF:
... | [
"private",
"boolean",
"collapseAssignEqualTo",
"(",
"Node",
"expr",
",",
"Node",
"exprParent",
",",
"Node",
"value",
")",
"{",
"Node",
"assign",
"=",
"expr",
".",
"getFirstChild",
"(",
")",
";",
"Node",
"parent",
"=",
"exprParent",
";",
"Node",
"next",
"="... | Collapse the given assign expression into the expression directly following it, if possible.
@param expr The expression that may be moved.
@param exprParent The parent of {@code expr}.
@param value The value of this expression, expressed as a node. Each expression may have
multiple values, so this function may be call... | [
"Collapse",
"the",
"given",
"assign",
"expression",
"into",
"the",
"expression",
"directly",
"following",
"it",
"if",
"possible",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExploitAssigns.java#L109-L200 |
24,968 | google/closure-compiler | src/com/google/javascript/jscomp/ExploitAssigns.java | ExploitAssigns.isSafeReplacement | private boolean isSafeReplacement(Node node, Node replacement) {
// No checks are needed for simple names.
if (node.isName()) {
return true;
}
checkArgument(node.isGetProp());
while (node.isGetProp()) {
node = node.getFirstChild();
}
return !(node.isName() && isNameAssignedTo(no... | java | private boolean isSafeReplacement(Node node, Node replacement) {
// No checks are needed for simple names.
if (node.isName()) {
return true;
}
checkArgument(node.isGetProp());
while (node.isGetProp()) {
node = node.getFirstChild();
}
return !(node.isName() && isNameAssignedTo(no... | [
"private",
"boolean",
"isSafeReplacement",
"(",
"Node",
"node",
",",
"Node",
"replacement",
")",
"{",
"// No checks are needed for simple names.",
"if",
"(",
"node",
".",
"isName",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"checkArgument",
"(",
"node",
"... | Checks name referenced in node to determine if it might have
changed.
@return Whether the replacement can be made. | [
"Checks",
"name",
"referenced",
"in",
"node",
"to",
"determine",
"if",
"it",
"might",
"have",
"changed",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExploitAssigns.java#L207-L219 |
24,969 | google/closure-compiler | src/com/google/javascript/jscomp/regex/RegExpTree.java | RegExpTree.matchesWholeInput | public static boolean matchesWholeInput(RegExpTree t, String flags) {
if (flags.indexOf('m') >= 0) { return false; }
if (!(t instanceof Concatenation)) {
return false;
}
Concatenation c = (Concatenation) t;
if (c.elements.isEmpty()) { return false; }
RegExpTree first = c.elements.get(0),... | java | public static boolean matchesWholeInput(RegExpTree t, String flags) {
if (flags.indexOf('m') >= 0) { return false; }
if (!(t instanceof Concatenation)) {
return false;
}
Concatenation c = (Concatenation) t;
if (c.elements.isEmpty()) { return false; }
RegExpTree first = c.elements.get(0),... | [
"public",
"static",
"boolean",
"matchesWholeInput",
"(",
"RegExpTree",
"t",
",",
"String",
"flags",
")",
"{",
"if",
"(",
"flags",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"(",
"t",
"insta... | True if, but not necessarily always when the, given regular expression
must match the whole input or none of it. | [
"True",
"if",
"but",
"not",
"necessarily",
"always",
"when",
"the",
"given",
"regular",
"expression",
"must",
"match",
"the",
"whole",
"input",
"or",
"none",
"of",
"it",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/regex/RegExpTree.java#L759-L771 |
24,970 | google/closure-compiler | src/com/google/javascript/jscomp/DefaultPassConfig.java | DefaultPassConfig.getMainOptimizationLoop | private List<PassFactory> getMainOptimizationLoop() {
List<PassFactory> passes = new ArrayList<>();
if (options.inlineGetters) {
passes.add(inlineSimpleMethods);
}
passes.addAll(getCodeRemovingPasses());
if (options.getInlineFunctionsLevel() != Reach.NONE) {
passes.add(inlineFunctions)... | java | private List<PassFactory> getMainOptimizationLoop() {
List<PassFactory> passes = new ArrayList<>();
if (options.inlineGetters) {
passes.add(inlineSimpleMethods);
}
passes.addAll(getCodeRemovingPasses());
if (options.getInlineFunctionsLevel() != Reach.NONE) {
passes.add(inlineFunctions)... | [
"private",
"List",
"<",
"PassFactory",
">",
"getMainOptimizationLoop",
"(",
")",
"{",
"List",
"<",
"PassFactory",
">",
"passes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"options",
".",
"inlineGetters",
")",
"{",
"passes",
".",
"add",
"("... | Creates the passes for the main optimization loop. | [
"Creates",
"the",
"passes",
"for",
"the",
"main",
"optimization",
"loop",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultPassConfig.java#L865-L906 |
24,971 | google/closure-compiler | src/com/google/javascript/jscomp/DefaultPassConfig.java | DefaultPassConfig.getCodeRemovingPasses | private List<PassFactory> getCodeRemovingPasses() {
List<PassFactory> passes = new ArrayList<>();
if (options.collapseObjectLiterals) {
passes.add(collapseObjectLiterals);
}
if (options.inlineVariables || options.inlineLocalVariables) {
passes.add(inlineVariables);
} else if (options.in... | java | private List<PassFactory> getCodeRemovingPasses() {
List<PassFactory> passes = new ArrayList<>();
if (options.collapseObjectLiterals) {
passes.add(collapseObjectLiterals);
}
if (options.inlineVariables || options.inlineLocalVariables) {
passes.add(inlineVariables);
} else if (options.in... | [
"private",
"List",
"<",
"PassFactory",
">",
"getCodeRemovingPasses",
"(",
")",
"{",
"List",
"<",
"PassFactory",
">",
"passes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"options",
".",
"collapseObjectLiterals",
")",
"{",
"passes",
".",
"add"... | Creates several passes aimed at removing code. | [
"Creates",
"several",
"passes",
"aimed",
"at",
"removing",
"code",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultPassConfig.java#L909-L935 |
24,972 | google/closure-compiler | src/com/google/javascript/jscomp/DefaultPassConfig.java | DefaultPassConfig.assertAllOneTimePasses | private static void assertAllOneTimePasses(List<PassFactory> passes) {
for (PassFactory pass : passes) {
checkState(pass.isOneTimePass());
}
} | java | private static void assertAllOneTimePasses(List<PassFactory> passes) {
for (PassFactory pass : passes) {
checkState(pass.isOneTimePass());
}
} | [
"private",
"static",
"void",
"assertAllOneTimePasses",
"(",
"List",
"<",
"PassFactory",
">",
"passes",
")",
"{",
"for",
"(",
"PassFactory",
"pass",
":",
"passes",
")",
"{",
"checkState",
"(",
"pass",
".",
"isOneTimePass",
"(",
")",
")",
";",
"}",
"}"
] | Verify that all the passes are one-time passes. | [
"Verify",
"that",
"all",
"the",
"passes",
"are",
"one",
"-",
"time",
"passes",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultPassConfig.java#L1003-L1007 |
24,973 | google/closure-compiler | src/com/google/javascript/jscomp/DefaultPassConfig.java | DefaultPassConfig.assertAllLoopablePasses | private static void assertAllLoopablePasses(List<PassFactory> passes) {
for (PassFactory pass : passes) {
checkState(!pass.isOneTimePass());
}
} | java | private static void assertAllLoopablePasses(List<PassFactory> passes) {
for (PassFactory pass : passes) {
checkState(!pass.isOneTimePass());
}
} | [
"private",
"static",
"void",
"assertAllLoopablePasses",
"(",
"List",
"<",
"PassFactory",
">",
"passes",
")",
"{",
"for",
"(",
"PassFactory",
"pass",
":",
"passes",
")",
"{",
"checkState",
"(",
"!",
"pass",
".",
"isOneTimePass",
"(",
")",
")",
";",
"}",
"... | Verify that all the passes are multi-run passes. | [
"Verify",
"that",
"all",
"the",
"passes",
"are",
"multi",
"-",
"run",
"passes",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultPassConfig.java#L1010-L1014 |
24,974 | google/closure-compiler | src/com/google/javascript/jscomp/DefaultPassConfig.java | DefaultPassConfig.createPeepholeOptimizationsPass | private static CompilerPass createPeepholeOptimizationsPass(
AbstractCompiler compiler, String passName) {
final boolean late = false;
final boolean useTypesForOptimization = compiler.getOptions().useTypesForLocalOptimization;
List<AbstractPeepholeOptimization> optimizations = new ArrayList<>();
o... | java | private static CompilerPass createPeepholeOptimizationsPass(
AbstractCompiler compiler, String passName) {
final boolean late = false;
final boolean useTypesForOptimization = compiler.getOptions().useTypesForLocalOptimization;
List<AbstractPeepholeOptimization> optimizations = new ArrayList<>();
o... | [
"private",
"static",
"CompilerPass",
"createPeepholeOptimizationsPass",
"(",
"AbstractCompiler",
"compiler",
",",
"String",
"passName",
")",
"{",
"final",
"boolean",
"late",
"=",
"false",
";",
"final",
"boolean",
"useTypesForOptimization",
"=",
"compiler",
".",
"getOp... | Various peephole optimizations. | [
"Various",
"peephole",
"optimizations",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultPassConfig.java#L1702-L1719 |
24,975 | google/closure-compiler | src/com/google/javascript/jscomp/DefaultPassConfig.java | DefaultPassConfig.runInSerial | private static CompilerPass runInSerial(
final Collection<CompilerPass> passes) {
return new CompilerPass() {
@Override public void process(Node externs, Node root) {
for (CompilerPass pass : passes) {
pass.process(externs, root);
}
}
};
} | java | private static CompilerPass runInSerial(
final Collection<CompilerPass> passes) {
return new CompilerPass() {
@Override public void process(Node externs, Node root) {
for (CompilerPass pass : passes) {
pass.process(externs, root);
}
}
};
} | [
"private",
"static",
"CompilerPass",
"runInSerial",
"(",
"final",
"Collection",
"<",
"CompilerPass",
">",
"passes",
")",
"{",
"return",
"new",
"CompilerPass",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"process",
"(",
"Node",
"externs",
",",
"Node",
"... | Create a compiler pass that runs the given passes in serial. | [
"Create",
"a",
"compiler",
"pass",
"that",
"runs",
"the",
"given",
"passes",
"in",
"serial",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultPassConfig.java#L3190-L3199 |
24,976 | google/closure-compiler | src/com/google/javascript/jscomp/deps/DepsFileParser.java | DepsFileParser.parseFile | public List<DependencyInfo> parseFile(String filePath) throws IOException {
return parseFileReader(filePath, Files.newReader(new File(filePath), StandardCharsets.UTF_8));
} | java | public List<DependencyInfo> parseFile(String filePath) throws IOException {
return parseFileReader(filePath, Files.newReader(new File(filePath), StandardCharsets.UTF_8));
} | [
"public",
"List",
"<",
"DependencyInfo",
">",
"parseFile",
"(",
"String",
"filePath",
")",
"throws",
"IOException",
"{",
"return",
"parseFileReader",
"(",
"filePath",
",",
"Files",
".",
"newReader",
"(",
"new",
"File",
"(",
"filePath",
")",
",",
"StandardChars... | Parses the given file and returns a list of dependency information that it
contained.
@param filePath Path to the file to parse.
@return A list of DependencyInfo objects.
@throws IOException Thrown if the file could not be read. | [
"Parses",
"the",
"given",
"file",
"and",
"returns",
"a",
"list",
"of",
"dependency",
"information",
"that",
"it",
"contained",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsFileParser.java#L105-L107 |
24,977 | google/closure-compiler | src/com/google/javascript/jscomp/deps/DepsFileParser.java | DepsFileParser.parseFile | public List<DependencyInfo> parseFile(String filePath, String fileContents) {
return parseFileReader(filePath, new StringReader(fileContents));
} | java | public List<DependencyInfo> parseFile(String filePath, String fileContents) {
return parseFileReader(filePath, new StringReader(fileContents));
} | [
"public",
"List",
"<",
"DependencyInfo",
">",
"parseFile",
"(",
"String",
"filePath",
",",
"String",
"fileContents",
")",
"{",
"return",
"parseFileReader",
"(",
"filePath",
",",
"new",
"StringReader",
"(",
"fileContents",
")",
")",
";",
"}"
] | Parses the given file and returns a list of dependency information that it
contained.
It uses the passed in fileContents instead of reading the file.
@param filePath Path to the file to parse.
@param fileContents The contents to parse.
@return A list of DependencyInfo objects. | [
"Parses",
"the",
"given",
"file",
"and",
"returns",
"a",
"list",
"of",
"dependency",
"information",
"that",
"it",
"contained",
".",
"It",
"uses",
"the",
"passed",
"in",
"fileContents",
"instead",
"of",
"reading",
"the",
"file",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsFileParser.java#L118-L120 |
24,978 | google/closure-compiler | src/com/google/javascript/jscomp/deps/DepsFileParser.java | DepsFileParser.parseFileReader | public List<DependencyInfo> parseFileReader(String filePath, Reader reader) {
depInfos = new ArrayList<>();
if (logger.isLoggable(Level.FINE)) {
logger.fine("Parsing Dep: " + filePath);
}
doParse(filePath, reader);
return depInfos;
} | java | public List<DependencyInfo> parseFileReader(String filePath, Reader reader) {
depInfos = new ArrayList<>();
if (logger.isLoggable(Level.FINE)) {
logger.fine("Parsing Dep: " + filePath);
}
doParse(filePath, reader);
return depInfos;
} | [
"public",
"List",
"<",
"DependencyInfo",
">",
"parseFileReader",
"(",
"String",
"filePath",
",",
"Reader",
"reader",
")",
"{",
"depInfos",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")... | Parses the file from the given reader and returns a list of
dependency information that it contained.
@param filePath Path to the file to parse.
@param reader A reader for the file.
@return A list of DependencyInfo objects. | [
"Parses",
"the",
"file",
"from",
"the",
"given",
"reader",
"and",
"returns",
"a",
"list",
"of",
"dependency",
"information",
"that",
"it",
"contained",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsFileParser.java#L131-L138 |
24,979 | google/closure-compiler | src/com/google/javascript/jscomp/J2clChecksPass.java | J2clChecksPass.checkReferenceEquality | private void checkReferenceEquality(Node n, String typeName, String fileName) {
if (n.getToken() == Token.SHEQ
|| n.getToken() == Token.EQ
|| n.getToken() == Token.SHNE
|| n.getToken() == Token.NE) {
JSType firstJsType = n.getFirstChild().getJSType();
JSType lastJsType = n.getLas... | java | private void checkReferenceEquality(Node n, String typeName, String fileName) {
if (n.getToken() == Token.SHEQ
|| n.getToken() == Token.EQ
|| n.getToken() == Token.SHNE
|| n.getToken() == Token.NE) {
JSType firstJsType = n.getFirstChild().getJSType();
JSType lastJsType = n.getLas... | [
"private",
"void",
"checkReferenceEquality",
"(",
"Node",
"n",
",",
"String",
"typeName",
",",
"String",
"fileName",
")",
"{",
"if",
"(",
"n",
".",
"getToken",
"(",
")",
"==",
"Token",
".",
"SHEQ",
"||",
"n",
".",
"getToken",
"(",
")",
"==",
"Token",
... | Reports an error if the node is a reference equality check of the specified type. | [
"Reports",
"an",
"error",
"if",
"the",
"node",
"is",
"a",
"reference",
"equality",
"check",
"of",
"the",
"specified",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/J2clChecksPass.java#L56-L69 |
24,980 | google/closure-compiler | src/com/google/javascript/jscomp/Result.java | Result.createResultForStage1 | public static Result createResultForStage1(Result result) {
VariableMap emptyVariableMap = new VariableMap(ImmutableMap.of());
return new Result(
result.errors,
result.warnings,
emptyVariableMap,
emptyVariableMap,
emptyVariableMap,
null,
null,
"",
... | java | public static Result createResultForStage1(Result result) {
VariableMap emptyVariableMap = new VariableMap(ImmutableMap.of());
return new Result(
result.errors,
result.warnings,
emptyVariableMap,
emptyVariableMap,
emptyVariableMap,
null,
null,
"",
... | [
"public",
"static",
"Result",
"createResultForStage1",
"(",
"Result",
"result",
")",
"{",
"VariableMap",
"emptyVariableMap",
"=",
"new",
"VariableMap",
"(",
"ImmutableMap",
".",
"of",
"(",
")",
")",
";",
"return",
"new",
"Result",
"(",
"result",
".",
"errors",... | Returns an almost empty result that is used for multistage compilation.
<p>For multistage compilations, Result for stage1 only cares about errors and warnings. It is
unnecessary to write all of other results in the disk. | [
"Returns",
"an",
"almost",
"empty",
"result",
"that",
"is",
"used",
"for",
"multistage",
"compilation",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Result.java#L99-L113 |
24,981 | google/closure-compiler | src/com/google/javascript/refactoring/RefactoringDriver.java | RefactoringDriver.drive | public List<SuggestedFix> drive(Scanner scanner, Pattern includeFilePattern) {
JsFlumeCallback callback = new JsFlumeCallback(scanner, includeFilePattern);
NodeTraversal.traverse(compiler, rootNode, callback);
List<SuggestedFix> fixes = callback.getFixes();
fixes.addAll(scanner.processAllMatches(callbac... | java | public List<SuggestedFix> drive(Scanner scanner, Pattern includeFilePattern) {
JsFlumeCallback callback = new JsFlumeCallback(scanner, includeFilePattern);
NodeTraversal.traverse(compiler, rootNode, callback);
List<SuggestedFix> fixes = callback.getFixes();
fixes.addAll(scanner.processAllMatches(callbac... | [
"public",
"List",
"<",
"SuggestedFix",
">",
"drive",
"(",
"Scanner",
"scanner",
",",
"Pattern",
"includeFilePattern",
")",
"{",
"JsFlumeCallback",
"callback",
"=",
"new",
"JsFlumeCallback",
"(",
"scanner",
",",
"includeFilePattern",
")",
";",
"NodeTraversal",
".",... | Run a refactoring and return any suggested fixes as a result. | [
"Run",
"a",
"refactoring",
"and",
"return",
"any",
"suggested",
"fixes",
"as",
"a",
"result",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/RefactoringDriver.java#L59-L65 |
24,982 | google/closure-compiler | src/com/google/javascript/refactoring/RefactoringDriver.java | RefactoringDriver.getCompilerOptions | @VisibleForTesting
public static CompilerOptions getCompilerOptions() {
CompilerOptions options = new CompilerOptions();
options.setLanguageIn(LanguageMode.ECMASCRIPT_NEXT);
options.setLanguageOut(LanguageMode.ECMASCRIPT5);
options.setSummaryDetailLevel(0);
options.setDependencyOptions(Dependency... | java | @VisibleForTesting
public static CompilerOptions getCompilerOptions() {
CompilerOptions options = new CompilerOptions();
options.setLanguageIn(LanguageMode.ECMASCRIPT_NEXT);
options.setLanguageOut(LanguageMode.ECMASCRIPT5);
options.setSummaryDetailLevel(0);
options.setDependencyOptions(Dependency... | [
"@",
"VisibleForTesting",
"public",
"static",
"CompilerOptions",
"getCompilerOptions",
"(",
")",
"{",
"CompilerOptions",
"options",
"=",
"new",
"CompilerOptions",
"(",
")",
";",
"options",
".",
"setLanguageIn",
"(",
"LanguageMode",
".",
"ECMASCRIPT_NEXT",
")",
";",
... | don't need to call it directly. | [
"don",
"t",
"need",
"to",
"call",
"it",
"directly",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/RefactoringDriver.java#L86-L113 |
24,983 | google/closure-compiler | src/com/google/javascript/jscomp/InlineSimpleMethods.java | InlineSimpleMethods.isPropertyTree | private static boolean isPropertyTree(Node expectedGetprop) {
if (!expectedGetprop.isGetProp()) {
return false;
}
Node leftChild = expectedGetprop.getFirstChild();
if (!leftChild.isThis() && !isPropertyTree(leftChild)) {
return false;
}
Node retVal = leftChild.getNext();
return... | java | private static boolean isPropertyTree(Node expectedGetprop) {
if (!expectedGetprop.isGetProp()) {
return false;
}
Node leftChild = expectedGetprop.getFirstChild();
if (!leftChild.isThis() && !isPropertyTree(leftChild)) {
return false;
}
Node retVal = leftChild.getNext();
return... | [
"private",
"static",
"boolean",
"isPropertyTree",
"(",
"Node",
"expectedGetprop",
")",
"{",
"if",
"(",
"!",
"expectedGetprop",
".",
"isGetProp",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Node",
"leftChild",
"=",
"expectedGetprop",
".",
"getFirstChild",... | Returns true if the provided node is a getprop for
which the left child is this or a valid property tree
and for which the right side is a string. | [
"Returns",
"true",
"if",
"the",
"provided",
"node",
"is",
"a",
"getprop",
"for",
"which",
"the",
"left",
"child",
"is",
"this",
"or",
"a",
"valid",
"property",
"tree",
"and",
"for",
"which",
"the",
"right",
"side",
"is",
"a",
"string",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L138-L150 |
24,984 | google/closure-compiler | src/com/google/javascript/jscomp/InlineSimpleMethods.java | InlineSimpleMethods.replaceThis | private static void replaceThis(Node expectedGetprop, Node replacement) {
Node leftChild = expectedGetprop.getFirstChild();
if (leftChild.isThis()) {
expectedGetprop.replaceChild(leftChild, replacement);
} else {
replaceThis(leftChild, replacement);
}
} | java | private static void replaceThis(Node expectedGetprop, Node replacement) {
Node leftChild = expectedGetprop.getFirstChild();
if (leftChild.isThis()) {
expectedGetprop.replaceChild(leftChild, replacement);
} else {
replaceThis(leftChild, replacement);
}
} | [
"private",
"static",
"void",
"replaceThis",
"(",
"Node",
"expectedGetprop",
",",
"Node",
"replacement",
")",
"{",
"Node",
"leftChild",
"=",
"expectedGetprop",
".",
"getFirstChild",
"(",
")",
";",
"if",
"(",
"leftChild",
".",
"isThis",
"(",
")",
")",
"{",
"... | Finds the occurrence of "this" in the provided property tree and replaces
it with replacement | [
"Finds",
"the",
"occurrence",
"of",
"this",
"in",
"the",
"provided",
"property",
"tree",
"and",
"replaces",
"it",
"with",
"replacement"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L156-L163 |
24,985 | google/closure-compiler | src/com/google/javascript/jscomp/InlineSimpleMethods.java | InlineSimpleMethods.returnedExpression | private static Node returnedExpression(Node fn) {
Node expectedBlock = NodeUtil.getFunctionBody(fn);
if (!expectedBlock.hasOneChild()) {
return null;
}
Node expectedReturn = expectedBlock.getFirstChild();
if (!expectedReturn.isReturn()) {
return null;
}
if (!expectedReturn.hasO... | java | private static Node returnedExpression(Node fn) {
Node expectedBlock = NodeUtil.getFunctionBody(fn);
if (!expectedBlock.hasOneChild()) {
return null;
}
Node expectedReturn = expectedBlock.getFirstChild();
if (!expectedReturn.isReturn()) {
return null;
}
if (!expectedReturn.hasO... | [
"private",
"static",
"Node",
"returnedExpression",
"(",
"Node",
"fn",
")",
"{",
"Node",
"expectedBlock",
"=",
"NodeUtil",
".",
"getFunctionBody",
"(",
"fn",
")",
";",
"if",
"(",
"!",
"expectedBlock",
".",
"hasOneChild",
"(",
")",
")",
"{",
"return",
"null"... | Return the node that represents the expression returned
by the method, given a FUNCTION node. | [
"Return",
"the",
"node",
"that",
"represents",
"the",
"expression",
"returned",
"by",
"the",
"method",
"given",
"a",
"FUNCTION",
"node",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L169-L185 |
24,986 | google/closure-compiler | src/com/google/javascript/jscomp/InlineSimpleMethods.java | InlineSimpleMethods.inlinePropertyReturn | private void inlinePropertyReturn(Node parent, Node call, Node returnedValue) {
Node getProp = returnedValue.cloneTree();
replaceThis(getProp, call.getFirstChild().removeFirstChild());
parent.replaceChild(call, getProp);
compiler.reportChangeToEnclosingScope(getProp);
} | java | private void inlinePropertyReturn(Node parent, Node call, Node returnedValue) {
Node getProp = returnedValue.cloneTree();
replaceThis(getProp, call.getFirstChild().removeFirstChild());
parent.replaceChild(call, getProp);
compiler.reportChangeToEnclosingScope(getProp);
} | [
"private",
"void",
"inlinePropertyReturn",
"(",
"Node",
"parent",
",",
"Node",
"call",
",",
"Node",
"returnedValue",
")",
"{",
"Node",
"getProp",
"=",
"returnedValue",
".",
"cloneTree",
"(",
")",
";",
"replaceThis",
"(",
"getProp",
",",
"call",
".",
"getFirs... | Replace the provided method call with the tree specified in returnedValue
Parse tree of a call is
name
call
getprop
obj
string | [
"Replace",
"the",
"provided",
"method",
"call",
"with",
"the",
"tree",
"specified",
"in",
"returnedValue"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L220-L225 |
24,987 | google/closure-compiler | src/com/google/javascript/jscomp/InlineSimpleMethods.java | InlineSimpleMethods.inlineConstReturn | private void inlineConstReturn(Node parent, Node call, Node returnedValue) {
Node retValue = returnedValue.cloneTree();
parent.replaceChild(call, retValue);
compiler.reportChangeToEnclosingScope(retValue);
} | java | private void inlineConstReturn(Node parent, Node call, Node returnedValue) {
Node retValue = returnedValue.cloneTree();
parent.replaceChild(call, retValue);
compiler.reportChangeToEnclosingScope(retValue);
} | [
"private",
"void",
"inlineConstReturn",
"(",
"Node",
"parent",
",",
"Node",
"call",
",",
"Node",
"returnedValue",
")",
"{",
"Node",
"retValue",
"=",
"returnedValue",
".",
"cloneTree",
"(",
")",
";",
"parent",
".",
"replaceChild",
"(",
"call",
",",
"retValue"... | Replace the provided object and its method call with the tree specified
in returnedValue. Should be called only if the object reference has
no side effects. | [
"Replace",
"the",
"provided",
"object",
"and",
"its",
"method",
"call",
"with",
"the",
"tree",
"specified",
"in",
"returnedValue",
".",
"Should",
"be",
"called",
"only",
"if",
"the",
"object",
"reference",
"has",
"no",
"side",
"effects",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L232-L236 |
24,988 | google/closure-compiler | src/com/google/javascript/jscomp/InlineSimpleMethods.java | InlineSimpleMethods.inlineEmptyMethod | private void inlineEmptyMethod(NodeTraversal t, Node parent, Node call) {
// If the return value of the method call is read,
// replace it with "void 0". Otherwise, remove the call entirely.
if (NodeUtil.isExprCall(parent)) {
parent.replaceWith(IR.empty());
NodeUtil.markFunctionsDeleted(parent,... | java | private void inlineEmptyMethod(NodeTraversal t, Node parent, Node call) {
// If the return value of the method call is read,
// replace it with "void 0". Otherwise, remove the call entirely.
if (NodeUtil.isExprCall(parent)) {
parent.replaceWith(IR.empty());
NodeUtil.markFunctionsDeleted(parent,... | [
"private",
"void",
"inlineEmptyMethod",
"(",
"NodeTraversal",
"t",
",",
"Node",
"parent",
",",
"Node",
"call",
")",
"{",
"// If the return value of the method call is read,",
"// replace it with \"void 0\". Otherwise, remove the call entirely.",
"if",
"(",
"NodeUtil",
".",
"i... | Remove the provided object and its method call. | [
"Remove",
"the",
"provided",
"object",
"and",
"its",
"method",
"call",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L241-L254 |
24,989 | google/closure-compiler | src/com/google/javascript/jscomp/InlineSimpleMethods.java | InlineSimpleMethods.argsMayHaveSideEffects | private boolean argsMayHaveSideEffects(Node call) {
for (Node currentChild = call.getSecondChild();
currentChild != null;
currentChild = currentChild.getNext()) {
if (NodeUtil.mayHaveSideEffects(currentChild, compiler)) {
return true;
}
}
return false;
} | java | private boolean argsMayHaveSideEffects(Node call) {
for (Node currentChild = call.getSecondChild();
currentChild != null;
currentChild = currentChild.getNext()) {
if (NodeUtil.mayHaveSideEffects(currentChild, compiler)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"argsMayHaveSideEffects",
"(",
"Node",
"call",
")",
"{",
"for",
"(",
"Node",
"currentChild",
"=",
"call",
".",
"getSecondChild",
"(",
")",
";",
"currentChild",
"!=",
"null",
";",
"currentChild",
"=",
"currentChild",
".",
"getNext",
"(",
... | Check whether the given method call's arguments have side effects.
@param call The call node of a method invocation. | [
"Check",
"whether",
"the",
"given",
"method",
"call",
"s",
"arguments",
"have",
"side",
"effects",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L260-L270 |
24,990 | google/closure-compiler | src/com/google/javascript/jscomp/ant/CompileTask.java | CompileTask.setWarning | public void setWarning(String value) {
if ("default".equalsIgnoreCase(value)) {
this.warningLevel = WarningLevel.DEFAULT;
} else if ("quiet".equalsIgnoreCase(value)) {
this.warningLevel = WarningLevel.QUIET;
} else if ("verbose".equalsIgnoreCase(value)) {
this.warningLevel = WarningLevel.V... | java | public void setWarning(String value) {
if ("default".equalsIgnoreCase(value)) {
this.warningLevel = WarningLevel.DEFAULT;
} else if ("quiet".equalsIgnoreCase(value)) {
this.warningLevel = WarningLevel.QUIET;
} else if ("verbose".equalsIgnoreCase(value)) {
this.warningLevel = WarningLevel.V... | [
"public",
"void",
"setWarning",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"\"default\"",
".",
"equalsIgnoreCase",
"(",
"value",
")",
")",
"{",
"this",
".",
"warningLevel",
"=",
"WarningLevel",
".",
"DEFAULT",
";",
"}",
"else",
"if",
"(",
"\"quiet\"",
... | Set the warning level.
@param value The warning level by string name. (default, quiet, verbose). | [
"Set",
"the",
"warning",
"level",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ant/CompileTask.java#L173-L184 |
24,991 | google/closure-compiler | src/com/google/javascript/jscomp/ant/CompileTask.java | CompileTask.setEnvironment | public void setEnvironment(String value) {
switch (value) {
case "BROWSER":
this.environment = CompilerOptions.Environment.BROWSER;
break;
case "CUSTOM":
this.environment = CompilerOptions.Environment.CUSTOM;
break;
default:
throw new BuildException(
... | java | public void setEnvironment(String value) {
switch (value) {
case "BROWSER":
this.environment = CompilerOptions.Environment.BROWSER;
break;
case "CUSTOM":
this.environment = CompilerOptions.Environment.CUSTOM;
break;
default:
throw new BuildException(
... | [
"public",
"void",
"setEnvironment",
"(",
"String",
"value",
")",
"{",
"switch",
"(",
"value",
")",
"{",
"case",
"\"BROWSER\"",
":",
"this",
".",
"environment",
"=",
"CompilerOptions",
".",
"Environment",
".",
"BROWSER",
";",
"break",
";",
"case",
"\"CUSTOM\"... | Set the environment which determines the builtin extern set.
@param value The name of the environment.
(BROWSER, CUSTOM). | [
"Set",
"the",
"environment",
"which",
"determines",
"the",
"builtin",
"extern",
"set",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ant/CompileTask.java#L191-L203 |
24,992 | google/closure-compiler | src/com/google/javascript/jscomp/ant/CompileTask.java | CompileTask.setCompilationLevel | public void setCompilationLevel(String value) {
if ("simple".equalsIgnoreCase(value)) {
this.compilationLevel = CompilationLevel.SIMPLE_OPTIMIZATIONS;
} else if ("advanced".equalsIgnoreCase(value)) {
this.compilationLevel = CompilationLevel.ADVANCED_OPTIMIZATIONS;
} else if ("whitespace".equalsI... | java | public void setCompilationLevel(String value) {
if ("simple".equalsIgnoreCase(value)) {
this.compilationLevel = CompilationLevel.SIMPLE_OPTIMIZATIONS;
} else if ("advanced".equalsIgnoreCase(value)) {
this.compilationLevel = CompilationLevel.ADVANCED_OPTIMIZATIONS;
} else if ("whitespace".equalsI... | [
"public",
"void",
"setCompilationLevel",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"\"simple\"",
".",
"equalsIgnoreCase",
"(",
"value",
")",
")",
"{",
"this",
".",
"compilationLevel",
"=",
"CompilationLevel",
".",
"SIMPLE_OPTIMIZATIONS",
";",
"}",
"else",
"... | Set the compilation level.
@param value The optimization level by string name.
(whitespace, simple, advanced). | [
"Set",
"the",
"compilation",
"level",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ant/CompileTask.java#L218-L229 |
24,993 | google/closure-compiler | src/com/google/javascript/jscomp/ant/CompileTask.java | CompileTask.findJavaScriptFiles | private List<SourceFile> findJavaScriptFiles(ResourceCollection rc) {
List<SourceFile> files = new ArrayList<>();
Iterator<Resource> iter = rc.iterator();
while (iter.hasNext()) {
FileResource fr = (FileResource) iter.next();
// Construct path to file, relative to current working directory.
... | java | private List<SourceFile> findJavaScriptFiles(ResourceCollection rc) {
List<SourceFile> files = new ArrayList<>();
Iterator<Resource> iter = rc.iterator();
while (iter.hasNext()) {
FileResource fr = (FileResource) iter.next();
// Construct path to file, relative to current working directory.
... | [
"private",
"List",
"<",
"SourceFile",
">",
"findJavaScriptFiles",
"(",
"ResourceCollection",
"rc",
")",
"{",
"List",
"<",
"SourceFile",
">",
"files",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Iterator",
"<",
"Resource",
">",
"iter",
"=",
"rc",
".",
... | Translates an Ant resource collection into the file list format that
the compiler expects. | [
"Translates",
"an",
"Ant",
"resource",
"collection",
"into",
"the",
"file",
"list",
"format",
"that",
"the",
"compiler",
"expects",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ant/CompileTask.java#L655-L665 |
24,994 | google/closure-compiler | src/com/google/javascript/jscomp/ant/CompileTask.java | CompileTask.getBuiltinExterns | private List<SourceFile> getBuiltinExterns(CompilerOptions options) {
try {
return CommandLineRunner.getBuiltinExterns(options.getEnvironment());
} catch (IOException e) {
throw new BuildException(e);
}
} | java | private List<SourceFile> getBuiltinExterns(CompilerOptions options) {
try {
return CommandLineRunner.getBuiltinExterns(options.getEnvironment());
} catch (IOException e) {
throw new BuildException(e);
}
} | [
"private",
"List",
"<",
"SourceFile",
">",
"getBuiltinExterns",
"(",
"CompilerOptions",
"options",
")",
"{",
"try",
"{",
"return",
"CommandLineRunner",
".",
"getBuiltinExterns",
"(",
"options",
".",
"getEnvironment",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOE... | Gets the default externs set.
Adapted from {@link CommandLineRunner}. | [
"Gets",
"the",
"default",
"externs",
"set",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ant/CompileTask.java#L672-L678 |
24,995 | google/closure-compiler | src/com/google/javascript/jscomp/ant/CompileTask.java | CompileTask.getLastModifiedTime | private long getLastModifiedTime(List<?> fileLists) {
long lastModified = 0;
for (Object entry : fileLists) {
if (entry instanceof FileList) {
FileList list = (FileList) entry;
for (String fileName : list.getFiles(this.getProject())) {
File path = list.getDir(this.getProject())... | java | private long getLastModifiedTime(List<?> fileLists) {
long lastModified = 0;
for (Object entry : fileLists) {
if (entry instanceof FileList) {
FileList list = (FileList) entry;
for (String fileName : list.getFiles(this.getProject())) {
File path = list.getDir(this.getProject())... | [
"private",
"long",
"getLastModifiedTime",
"(",
"List",
"<",
"?",
">",
"fileLists",
")",
"{",
"long",
"lastModified",
"=",
"0",
";",
"for",
"(",
"Object",
"entry",
":",
"fileLists",
")",
"{",
"if",
"(",
"entry",
"instanceof",
"FileList",
")",
"{",
"FileLi... | Returns the most recent modified timestamp of the file collection.
Note: this must be combined into one method to account for both
Path and FileList erasure types.
@param fileLists Collection of FileList or Path
@return Most recent modified timestamp | [
"Returns",
"the",
"most",
"recent",
"modified",
"timestamp",
"of",
"the",
"file",
"collection",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ant/CompileTask.java#L722-L744 |
24,996 | google/closure-compiler | src/com/google/javascript/jscomp/ant/CompileTask.java | CompileTask.getLastModifiedTime | private static long getLastModifiedTime(File file) {
long fileLastModified = file.lastModified();
// If the file is absent, we don't know if it changed (maybe was deleted),
// so assume it has just changed.
if (fileLastModified == 0) {
fileLastModified = new Date().getTime();
}
return file... | java | private static long getLastModifiedTime(File file) {
long fileLastModified = file.lastModified();
// If the file is absent, we don't know if it changed (maybe was deleted),
// so assume it has just changed.
if (fileLastModified == 0) {
fileLastModified = new Date().getTime();
}
return file... | [
"private",
"static",
"long",
"getLastModifiedTime",
"(",
"File",
"file",
")",
"{",
"long",
"fileLastModified",
"=",
"file",
".",
"lastModified",
"(",
")",
";",
"// If the file is absent, we don't know if it changed (maybe was deleted),",
"// so assume it has just changed.",
"... | Returns the last modified timestamp of the given File. | [
"Returns",
"the",
"last",
"modified",
"timestamp",
"of",
"the",
"given",
"File",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ant/CompileTask.java#L749-L757 |
24,997 | google/closure-compiler | src/com/google/javascript/jscomp/RenameProperties.java | RenameProperties.reusePropertyNames | private void reusePropertyNames(Set<String> reservedNames,
Collection<Property> allProps) {
for (Property prop : allProps) {
// Check if this node can reuse a name from a previous compilation - if
// it can set the newName for the property too.
String prevName = p... | java | private void reusePropertyNames(Set<String> reservedNames,
Collection<Property> allProps) {
for (Property prop : allProps) {
// Check if this node can reuse a name from a previous compilation - if
// it can set the newName for the property too.
String prevName = p... | [
"private",
"void",
"reusePropertyNames",
"(",
"Set",
"<",
"String",
">",
"reservedNames",
",",
"Collection",
"<",
"Property",
">",
"allProps",
")",
"{",
"for",
"(",
"Property",
"prop",
":",
"allProps",
")",
"{",
"// Check if this node can reuse a name from a previou... | Runs through the list of properties and renames as many as possible with
names from the previous compilation. Also, updates reservedNames with the
set of reused names.
@param reservedNames Reserved names to use during renaming.
@param allProps Properties to rename. | [
"Runs",
"through",
"the",
"list",
"of",
"properties",
"and",
"renames",
"as",
"many",
"as",
"possible",
"with",
"names",
"from",
"the",
"previous",
"compilation",
".",
"Also",
"updates",
"reservedNames",
"with",
"the",
"set",
"of",
"reused",
"names",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RenameProperties.java#L268-L284 |
24,998 | google/closure-compiler | src/com/google/javascript/jscomp/RenameProperties.java | RenameProperties.generateNames | private void generateNames(Set<Property> props, Set<String> reservedNames) {
nameGenerator.reset(reservedNames, "", reservedFirstCharacters, reservedNonFirstCharacters);
for (Property p : props) {
if (generatePseudoNames) {
p.newName = "$" + p.oldName + "$";
} else {
// If we haven't... | java | private void generateNames(Set<Property> props, Set<String> reservedNames) {
nameGenerator.reset(reservedNames, "", reservedFirstCharacters, reservedNonFirstCharacters);
for (Property p : props) {
if (generatePseudoNames) {
p.newName = "$" + p.oldName + "$";
} else {
// If we haven't... | [
"private",
"void",
"generateNames",
"(",
"Set",
"<",
"Property",
">",
"props",
",",
"Set",
"<",
"String",
">",
"reservedNames",
")",
"{",
"nameGenerator",
".",
"reset",
"(",
"reservedNames",
",",
"\"\"",
",",
"reservedFirstCharacters",
",",
"reservedNonFirstChar... | Generates new names for properties.
@param props Properties to generate new names for
@param reservedNames A set of names to which properties should not be
renamed | [
"Generates",
"new",
"names",
"for",
"properties",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RenameProperties.java#L293-L306 |
24,999 | google/closure-compiler | src/com/google/javascript/jscomp/Es6ExtractClasses.java | Es6ExtractClasses.addAtConstructor | private void addAtConstructor(Node node) {
JSDocInfoBuilder builder = JSDocInfoBuilder.maybeCopyFrom(node.getJSDocInfo());
builder.recordConstructor();
node.setJSDocInfo(builder.build());
} | java | private void addAtConstructor(Node node) {
JSDocInfoBuilder builder = JSDocInfoBuilder.maybeCopyFrom(node.getJSDocInfo());
builder.recordConstructor();
node.setJSDocInfo(builder.build());
} | [
"private",
"void",
"addAtConstructor",
"(",
"Node",
"node",
")",
"{",
"JSDocInfoBuilder",
"builder",
"=",
"JSDocInfoBuilder",
".",
"maybeCopyFrom",
"(",
"node",
".",
"getJSDocInfo",
"(",
")",
")",
";",
"builder",
".",
"recordConstructor",
"(",
")",
";",
"node"... | Add at-constructor to the JSDoc of the given node.
@param node | [
"Add",
"at",
"-",
"constructor",
"to",
"the",
"JSDoc",
"of",
"the",
"given",
"node",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6ExtractClasses.java#L249-L253 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.