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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
23,800 | square/wire | wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/ProtoParser.java | ProtoParser.stripDefault | private @Nullable String stripDefault(List<OptionElement> options) {
String result = null;
for (Iterator<OptionElement> i = options.iterator(); i.hasNext();) {
OptionElement option = i.next();
if (option.getName().equals("default")) {
i.remove();
result = String.valueOf(option.getVal... | java | private @Nullable String stripDefault(List<OptionElement> options) {
String result = null;
for (Iterator<OptionElement> i = options.iterator(); i.hasNext();) {
OptionElement option = i.next();
if (option.getName().equals("default")) {
i.remove();
result = String.valueOf(option.getVal... | [
"private",
"@",
"Nullable",
"String",
"stripDefault",
"(",
"List",
"<",
"OptionElement",
">",
"options",
")",
"{",
"String",
"result",
"=",
"null",
";",
"for",
"(",
"Iterator",
"<",
"OptionElement",
">",
"i",
"=",
"options",
".",
"iterator",
"(",
")",
";... | Defaults aren't options. This finds an option named "default", removes, and returns it. Returns
null if no default option is present. | [
"Defaults",
"aren",
"t",
"options",
".",
"This",
"finds",
"an",
"option",
"named",
"default",
"removes",
"and",
"returns",
"it",
".",
"Returns",
"null",
"if",
"no",
"default",
"option",
"is",
"present",
"."
] | 4a9a00dfadfc14d6a0780b85810418f9cbc78a49 | https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/ProtoParser.java#L366-L376 |
23,801 | square/wire | wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/ProtoParser.java | ProtoParser.readReserved | private ReservedElement readReserved(Location location, String documentation) {
ImmutableList.Builder<Object> valuesBuilder = ImmutableList.builder();
while (true) {
char c = reader.peekChar();
if (c == '"' || c == '\'') {
valuesBuilder.add(reader.readQuotedString());
} else {
... | java | private ReservedElement readReserved(Location location, String documentation) {
ImmutableList.Builder<Object> valuesBuilder = ImmutableList.builder();
while (true) {
char c = reader.peekChar();
if (c == '"' || c == '\'') {
valuesBuilder.add(reader.readQuotedString());
} else {
... | [
"private",
"ReservedElement",
"readReserved",
"(",
"Location",
"location",
",",
"String",
"documentation",
")",
"{",
"ImmutableList",
".",
"Builder",
"<",
"Object",
">",
"valuesBuilder",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
";",
"while",
"(",
"true",
... | Reads a reserved tags and names list like "reserved 10, 12 to 14, 'foo';". | [
"Reads",
"a",
"reserved",
"tags",
"and",
"names",
"list",
"like",
"reserved",
"10",
"12",
"to",
"14",
"foo",
";",
"."
] | 4a9a00dfadfc14d6a0780b85810418f9cbc78a49 | https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/ProtoParser.java#L437-L468 |
23,802 | square/wire | wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/ProtoParser.java | ProtoParser.readEnumConstant | private EnumConstantElement readEnumConstant(
String documentation, Location location, String label) {
reader.require('=');
int tag = reader.readInt();
List<OptionElement> options = new OptionReader(reader).readOptions();
reader.require(';');
documentation = reader.tryAppendTrailingDocumenta... | java | private EnumConstantElement readEnumConstant(
String documentation, Location location, String label) {
reader.require('=');
int tag = reader.readInt();
List<OptionElement> options = new OptionReader(reader).readOptions();
reader.require(';');
documentation = reader.tryAppendTrailingDocumenta... | [
"private",
"EnumConstantElement",
"readEnumConstant",
"(",
"String",
"documentation",
",",
"Location",
"location",
",",
"String",
"label",
")",
"{",
"reader",
".",
"require",
"(",
"'",
"'",
")",
";",
"int",
"tag",
"=",
"reader",
".",
"readInt",
"(",
")",
"... | Reads an enum constant like "ROCK = 0;". The label is the constant name. | [
"Reads",
"an",
"enum",
"constant",
"like",
"ROCK",
"=",
"0",
";",
".",
"The",
"label",
"is",
"the",
"constant",
"name",
"."
] | 4a9a00dfadfc14d6a0780b85810418f9cbc78a49 | https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/ProtoParser.java#L488-L504 |
23,803 | square/wire | wire-java-generator/src/main/java/com/squareup/wire/java/ProfileLoader.java | ProfileLoader.pathsToAttempt | Multimap<Path, String> pathsToAttempt(Set<Location> protoLocations) {
Multimap<Path, String> result = MultimapBuilder.linkedHashKeys().linkedHashSetValues().build();
for (Location location : protoLocations) {
pathsToAttempt(result, location);
}
return result;
} | java | Multimap<Path, String> pathsToAttempt(Set<Location> protoLocations) {
Multimap<Path, String> result = MultimapBuilder.linkedHashKeys().linkedHashSetValues().build();
for (Location location : protoLocations) {
pathsToAttempt(result, location);
}
return result;
} | [
"Multimap",
"<",
"Path",
",",
"String",
">",
"pathsToAttempt",
"(",
"Set",
"<",
"Location",
">",
"protoLocations",
")",
"{",
"Multimap",
"<",
"Path",
",",
"String",
">",
"result",
"=",
"MultimapBuilder",
".",
"linkedHashKeys",
"(",
")",
".",
"linkedHashSetVa... | Returns a multimap whose keys are base directories and whose values are potential locations of
wire profile files. | [
"Returns",
"a",
"multimap",
"whose",
"keys",
"are",
"base",
"directories",
"and",
"whose",
"values",
"are",
"potential",
"locations",
"of",
"wire",
"profile",
"files",
"."
] | 4a9a00dfadfc14d6a0780b85810418f9cbc78a49 | https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-java-generator/src/main/java/com/squareup/wire/java/ProfileLoader.java#L110-L116 |
23,804 | square/wire | wire-schema/src/main/java/com/squareup/wire/schema/MarkSet.java | MarkSet.mark | boolean mark(ProtoType type) {
if (type == null) throw new NullPointerException("type == null");
if (identifierSet.excludes(type)) return false;
return types.add(type);
} | java | boolean mark(ProtoType type) {
if (type == null) throw new NullPointerException("type == null");
if (identifierSet.excludes(type)) return false;
return types.add(type);
} | [
"boolean",
"mark",
"(",
"ProtoType",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"type == null\"",
")",
";",
"if",
"(",
"identifierSet",
".",
"excludes",
"(",
"type",
")",
")",
"return",
"false",
... | Marks a type as transitively reachable by the includes set. Returns true if the mark is new,
the type will be retained, and its own dependencies should be traversed. | [
"Marks",
"a",
"type",
"as",
"transitively",
"reachable",
"by",
"the",
"includes",
"set",
".",
"Returns",
"true",
"if",
"the",
"mark",
"is",
"new",
"the",
"type",
"will",
"be",
"retained",
"and",
"its",
"own",
"dependencies",
"should",
"be",
"traversed",
".... | 4a9a00dfadfc14d6a0780b85810418f9cbc78a49 | https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/MarkSet.java#L73-L77 |
23,805 | square/wire | wire-schema/src/main/java/com/squareup/wire/schema/MarkSet.java | MarkSet.mark | boolean mark(ProtoMember protoMember) {
if (protoMember == null) throw new NullPointerException("type == null");
if (identifierSet.excludes(protoMember)) return false;
return members.containsKey(protoMember.type())
? members.put(protoMember.type(), protoMember)
: types.add(protoMember.type()... | java | boolean mark(ProtoMember protoMember) {
if (protoMember == null) throw new NullPointerException("type == null");
if (identifierSet.excludes(protoMember)) return false;
return members.containsKey(protoMember.type())
? members.put(protoMember.type(), protoMember)
: types.add(protoMember.type()... | [
"boolean",
"mark",
"(",
"ProtoMember",
"protoMember",
")",
"{",
"if",
"(",
"protoMember",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"type == null\"",
")",
";",
"if",
"(",
"identifierSet",
".",
"excludes",
"(",
"protoMember",
")",
")",
... | Marks a member as transitively reachable by the includes set. Returns true if the mark is new,
the member will be retained, and its own dependencies should be traversed. | [
"Marks",
"a",
"member",
"as",
"transitively",
"reachable",
"by",
"the",
"includes",
"set",
".",
"Returns",
"true",
"if",
"the",
"mark",
"is",
"new",
"the",
"member",
"will",
"be",
"retained",
"and",
"its",
"own",
"dependencies",
"should",
"be",
"traversed",
... | 4a9a00dfadfc14d6a0780b85810418f9cbc78a49 | https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/MarkSet.java#L83-L89 |
23,806 | square/wire | wire-schema/src/main/java/com/squareup/wire/schema/ProtoType.java | ProtoType.enclosingTypeOrPackage | public String enclosingTypeOrPackage() {
int dot = string.lastIndexOf('.');
return dot == -1 ? null : string.substring(0, dot);
} | java | public String enclosingTypeOrPackage() {
int dot = string.lastIndexOf('.');
return dot == -1 ? null : string.substring(0, dot);
} | [
"public",
"String",
"enclosingTypeOrPackage",
"(",
")",
"{",
"int",
"dot",
"=",
"string",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
"dot",
"==",
"-",
"1",
"?",
"null",
":",
"string",
".",
"substring",
"(",
"0",
",",
"dot",
")",
";",
"}... | Returns the enclosing type, or null if this type is not nested in another type. | [
"Returns",
"the",
"enclosing",
"type",
"or",
"null",
"if",
"this",
"type",
"is",
"not",
"nested",
"in",
"another",
"type",
"."
] | 4a9a00dfadfc14d6a0780b85810418f9cbc78a49 | https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/ProtoType.java#L104-L107 |
23,807 | square/wire | wire-schema/src/main/java/com/squareup/wire/schema/Linker.java | Linker.packageName | String packageName() {
for (Object context : contextStack) {
if (context instanceof ProtoFile) return ((ProtoFile) context).packageName();
}
return null;
} | java | String packageName() {
for (Object context : contextStack) {
if (context instanceof ProtoFile) return ((ProtoFile) context).packageName();
}
return null;
} | [
"String",
"packageName",
"(",
")",
"{",
"for",
"(",
"Object",
"context",
":",
"contextStack",
")",
"{",
"if",
"(",
"context",
"instanceof",
"ProtoFile",
")",
"return",
"(",
"(",
"ProtoFile",
")",
"context",
")",
".",
"packageName",
"(",
")",
";",
"}",
... | Returns the current package name from the context stack. | [
"Returns",
"the",
"current",
"package",
"name",
"from",
"the",
"context",
"stack",
"."
] | 4a9a00dfadfc14d6a0780b85810418f9cbc78a49 | https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/Linker.java#L226-L231 |
23,808 | Sayi/poi-tl | src/main/java/com/deepoove/poi/XWPFTemplate.java | XWPFTemplate.compile | public static XWPFTemplate compile(InputStream inputStream, Configure config) {
try {
XWPFTemplate instance = new XWPFTemplate();
instance.config = config;
instance.doc = new NiceXWPFDocument(inputStream);
instance.visitor = new TemplateVisitor(instance.config);
instance.eleTemplates = instance.visitor... | java | public static XWPFTemplate compile(InputStream inputStream, Configure config) {
try {
XWPFTemplate instance = new XWPFTemplate();
instance.config = config;
instance.doc = new NiceXWPFDocument(inputStream);
instance.visitor = new TemplateVisitor(instance.config);
instance.eleTemplates = instance.visitor... | [
"public",
"static",
"XWPFTemplate",
"compile",
"(",
"InputStream",
"inputStream",
",",
"Configure",
"config",
")",
"{",
"try",
"{",
"XWPFTemplate",
"instance",
"=",
"new",
"XWPFTemplate",
"(",
")",
";",
"instance",
".",
"config",
"=",
"config",
";",
"instance"... | template file as InputStream
@param inputStream
@param config
@return
@version 1.2.0 | [
"template",
"file",
"as",
"InputStream"
] | cf502a6aed473c534df4b0cac5e038fcb95d3f06 | https://github.com/Sayi/poi-tl/blob/cf502a6aed473c534df4b0cac5e038fcb95d3f06/src/main/java/com/deepoove/poi/XWPFTemplate.java#L108-L120 |
23,809 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java | GenericResourceRepository.isInvalidEncodedPath | private boolean isInvalidEncodedPath(String path) {
if (path.contains("%")) {
try {
// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8
// chars
String decodedPath = URLDecoder.decode(path, "UTF-8");
if (isInvalidPath(decodedPath)) {
return true;
}
decodedPath = proce... | java | private boolean isInvalidEncodedPath(String path) {
if (path.contains("%")) {
try {
// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8
// chars
String decodedPath = URLDecoder.decode(path, "UTF-8");
if (isInvalidPath(decodedPath)) {
return true;
}
decodedPath = proce... | [
"private",
"boolean",
"isInvalidEncodedPath",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
".",
"contains",
"(",
"\"%\"",
")",
")",
"{",
"try",
"{",
"// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8",
"// chars",
"String",
"decodedPath",
"=... | Check whether the given path contains invalid escape sequences.
@param path the path to validate
@return {@code true} if the path is invalid, {@code false} otherwise | [
"Check",
"whether",
"the",
"given",
"path",
"contains",
"invalid",
"escape",
"sequences",
"."
] | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java#L116-L135 |
23,810 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/GitCredentialsProviderFactory.java | GitCredentialsProviderFactory.createFor | @Deprecated
public CredentialsProvider createFor(String uri, String username, String password,
String passphrase) {
return createFor(uri, username, password, passphrase, false);
} | java | @Deprecated
public CredentialsProvider createFor(String uri, String username, String password,
String passphrase) {
return createFor(uri, username, password, passphrase, false);
} | [
"@",
"Deprecated",
"public",
"CredentialsProvider",
"createFor",
"(",
"String",
"uri",
",",
"String",
"username",
",",
"String",
"password",
",",
"String",
"passphrase",
")",
"{",
"return",
"createFor",
"(",
"uri",
",",
"username",
",",
"password",
",",
"passp... | Search for a credential provider that will handle the specified URI. If not found,
and the username or passphrase has text, then create a default using the provided
username and password or passphrase. Otherwise null.
@param uri the URI of the repository (cannot be null)
@param username the username provided for the re... | [
"Search",
"for",
"a",
"credential",
"provider",
"that",
"will",
"handle",
"the",
"specified",
"URI",
".",
"If",
"not",
"found",
"and",
"the",
"username",
"or",
"passphrase",
"has",
"text",
"then",
"create",
"a",
"default",
"using",
"the",
"provided",
"userna... | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/GitCredentialsProviderFactory.java#L59-L63 |
23,811 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/GitCredentialsProviderFactory.java | GitCredentialsProviderFactory.createFor | public CredentialsProvider createFor(String uri, String username, String password,
String passphrase, boolean skipSslValidation) {
CredentialsProvider provider = null;
if (awsAvailable() && AwsCodeCommitCredentialProvider.canHandle(uri)) {
this.logger
.debug("Constructing AwsCodeCommitCredentialProvider ... | java | public CredentialsProvider createFor(String uri, String username, String password,
String passphrase, boolean skipSslValidation) {
CredentialsProvider provider = null;
if (awsAvailable() && AwsCodeCommitCredentialProvider.canHandle(uri)) {
this.logger
.debug("Constructing AwsCodeCommitCredentialProvider ... | [
"public",
"CredentialsProvider",
"createFor",
"(",
"String",
"uri",
",",
"String",
"username",
",",
"String",
"password",
",",
"String",
"passphrase",
",",
"boolean",
"skipSslValidation",
")",
"{",
"CredentialsProvider",
"provider",
"=",
"null",
";",
"if",
"(",
... | Search for a credential provider that will handle the specified URI. If not found,
and the username or passphrase has text, then create a default using the provided
username and password or passphrase.
If skipSslValidation is true and the URI has an https scheme, the default
credential provider's behaviour is modified... | [
"Search",
"for",
"a",
"credential",
"provider",
"that",
"will",
"handle",
"the",
"specified",
"URI",
".",
"If",
"not",
"found",
"and",
"the",
"username",
"or",
"passphrase",
"has",
"text",
"then",
"create",
"a",
"default",
"using",
"the",
"provided",
"userna... | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/GitCredentialsProviderFactory.java#L82-L117 |
23,812 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java | JGitEnvironmentRepository.refresh | public String refresh(String label) {
Git git = null;
try {
git = createGitClient();
if (shouldPull(git)) {
FetchResult fetchStatus = fetch(git, label);
if (this.deleteUntrackedBranches && fetchStatus != null) {
deleteUntrackedLocalBranches(fetchStatus.getTrackingRefUpdates(),
git);
}
... | java | public String refresh(String label) {
Git git = null;
try {
git = createGitClient();
if (shouldPull(git)) {
FetchResult fetchStatus = fetch(git, label);
if (this.deleteUntrackedBranches && fetchStatus != null) {
deleteUntrackedLocalBranches(fetchStatus.getTrackingRefUpdates(),
git);
}
... | [
"public",
"String",
"refresh",
"(",
"String",
"label",
")",
"{",
"Git",
"git",
"=",
"null",
";",
"try",
"{",
"git",
"=",
"createGitClient",
"(",
")",
";",
"if",
"(",
"shouldPull",
"(",
"git",
")",
")",
"{",
"FetchResult",
"fetchStatus",
"=",
"fetch",
... | Get the working directory ready.
@param label label to refresh
@return head id | [
"Get",
"the",
"working",
"directory",
"ready",
"."
] | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java#L265-L311 |
23,813 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java | JGitEnvironmentRepository.initClonedRepository | private void initClonedRepository() throws GitAPIException, IOException {
if (!getUri().startsWith(FILE_URI_PREFIX)) {
deleteBaseDirIfExists();
Git git = cloneToBasedir();
if (git != null) {
git.close();
}
git = openGitRepository();
if (git != null) {
git.close();
}
}
} | java | private void initClonedRepository() throws GitAPIException, IOException {
if (!getUri().startsWith(FILE_URI_PREFIX)) {
deleteBaseDirIfExists();
Git git = cloneToBasedir();
if (git != null) {
git.close();
}
git = openGitRepository();
if (git != null) {
git.close();
}
}
} | [
"private",
"void",
"initClonedRepository",
"(",
")",
"throws",
"GitAPIException",
",",
"IOException",
"{",
"if",
"(",
"!",
"getUri",
"(",
")",
".",
"startsWith",
"(",
"FILE_URI_PREFIX",
")",
")",
"{",
"deleteBaseDirIfExists",
"(",
")",
";",
"Git",
"git",
"="... | Clones the remote repository and then opens a connection to it.
@throws GitAPIException when cloning fails
@throws IOException when repo opening fails | [
"Clones",
"the",
"remote",
"repository",
"and",
"then",
"opens",
"a",
"connection",
"to",
"it",
"."
] | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java#L337-L350 |
23,814 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java | JGitEnvironmentRepository.deleteUntrackedLocalBranches | private Collection<String> deleteUntrackedLocalBranches(
Collection<TrackingRefUpdate> trackingRefUpdates, Git git) {
if (CollectionUtils.isEmpty(trackingRefUpdates)) {
return Collections.emptyList();
}
Collection<String> branchesToDelete = new ArrayList<>();
for (TrackingRefUpdate trackingRefUpdate : tr... | java | private Collection<String> deleteUntrackedLocalBranches(
Collection<TrackingRefUpdate> trackingRefUpdates, Git git) {
if (CollectionUtils.isEmpty(trackingRefUpdates)) {
return Collections.emptyList();
}
Collection<String> branchesToDelete = new ArrayList<>();
for (TrackingRefUpdate trackingRefUpdate : tr... | [
"private",
"Collection",
"<",
"String",
">",
"deleteUntrackedLocalBranches",
"(",
"Collection",
"<",
"TrackingRefUpdate",
">",
"trackingRefUpdates",
",",
"Git",
"git",
")",
"{",
"if",
"(",
"CollectionUtils",
".",
"isEmpty",
"(",
"trackingRefUpdates",
")",
")",
"{"... | Deletes local branches if corresponding remote branch was removed.
@param trackingRefUpdates list of tracking ref updates
@param git git instance
@return list of deleted branches | [
"Deletes",
"local",
"branches",
"if",
"corresponding",
"remote",
"branch",
"was",
"removed",
"."
] | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java#L358-L392 |
23,815 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java | JGitEnvironmentRepository.copyRepository | private synchronized Git copyRepository() throws IOException, GitAPIException {
deleteBaseDirIfExists();
getBasedir().mkdirs();
Assert.state(getBasedir().exists(), "Could not create basedir: " + getBasedir());
if (getUri().startsWith(FILE_URI_PREFIX)) {
return copyFromLocalRepository();
}
else {
retur... | java | private synchronized Git copyRepository() throws IOException, GitAPIException {
deleteBaseDirIfExists();
getBasedir().mkdirs();
Assert.state(getBasedir().exists(), "Could not create basedir: " + getBasedir());
if (getUri().startsWith(FILE_URI_PREFIX)) {
return copyFromLocalRepository();
}
else {
retur... | [
"private",
"synchronized",
"Git",
"copyRepository",
"(",
")",
"throws",
"IOException",
",",
"GitAPIException",
"{",
"deleteBaseDirIfExists",
"(",
")",
";",
"getBasedir",
"(",
")",
".",
"mkdirs",
"(",
")",
";",
"Assert",
".",
"state",
"(",
"getBasedir",
"(",
... | request). | [
"request",
")",
"."
] | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepository.java#L556-L566 |
23,816 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/AwsCodeCommitCredentialProvider.java | AwsCodeCommitCredentialProvider.canonicalRequestDigest | private static byte[] canonicalRequestDigest(URIish uri)
throws NoSuchAlgorithmException {
StringBuilder canonicalRequest = new StringBuilder();
canonicalRequest.append("GIT\n") // codecommit uses GIT as the request method
.append(uri.getPath()).append("\n") // URI request path
.append("\n") // Query str... | java | private static byte[] canonicalRequestDigest(URIish uri)
throws NoSuchAlgorithmException {
StringBuilder canonicalRequest = new StringBuilder();
canonicalRequest.append("GIT\n") // codecommit uses GIT as the request method
.append(uri.getPath()).append("\n") // URI request path
.append("\n") // Query str... | [
"private",
"static",
"byte",
"[",
"]",
"canonicalRequestDigest",
"(",
"URIish",
"uri",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"StringBuilder",
"canonicalRequest",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"canonicalRequest",
".",
"append",
"(",
"\"GIT\\n\... | Creates a message digest.
@param uri uri to process
@return a message digest
@throws NoSuchAlgorithmException when the SHA 256 algorithm is not found | [
"Creates",
"a",
"message",
"digest",
"."
] | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/AwsCodeCommitCredentialProvider.java#L160-L180 |
23,817 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/AwsCodeCommitCredentialProvider.java | AwsCodeCommitCredentialProvider.get | @Override
public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem {
String codeCommitPassword;
String awsAccessKey;
String awsSecretKey;
try {
AWSCredentials awsCredentials = retrieveAwsCredentials();
StringBuilder awsKey = new StringBuilder();
awsKey.append(awsCred... | java | @Override
public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem {
String codeCommitPassword;
String awsAccessKey;
String awsSecretKey;
try {
AWSCredentials awsCredentials = retrieveAwsCredentials();
StringBuilder awsKey = new StringBuilder();
awsKey.append(awsCred... | [
"@",
"Override",
"public",
"boolean",
"get",
"(",
"URIish",
"uri",
",",
"CredentialItem",
"...",
"items",
")",
"throws",
"UnsupportedCredentialItem",
"{",
"String",
"codeCommitPassword",
";",
"String",
"awsAccessKey",
";",
"String",
"awsSecretKey",
";",
"try",
"{"... | Get the username and password to use for the given uri.
@see org.eclipse.jgit.transport.CredentialsProvider#get(org.eclipse.jgit.transport.URIish,
org.eclipse.jgit.transport.CredentialItem[]) | [
"Get",
"the",
"username",
"and",
"password",
"to",
"use",
"for",
"the",
"given",
"uri",
"."
] | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/AwsCodeCommitCredentialProvider.java#L284-L337 |
23,818 | spring-cloud/spring-cloud-config | spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/PassphraseCredentialsProvider.java | PassphraseCredentialsProvider.get | @Override
public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem {
for (final CredentialItem item : items) {
if (item instanceof CredentialItem.StringType
&& item.getPromptText().startsWith(PROMPT)) {
((CredentialItem.StringType) item).setValue(this.passphrase);
c... | java | @Override
public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem {
for (final CredentialItem item : items) {
if (item instanceof CredentialItem.StringType
&& item.getPromptText().startsWith(PROMPT)) {
((CredentialItem.StringType) item).setValue(this.passphrase);
c... | [
"@",
"Override",
"public",
"boolean",
"get",
"(",
"URIish",
"uri",
",",
"CredentialItem",
"...",
"items",
")",
"throws",
"UnsupportedCredentialItem",
"{",
"for",
"(",
"final",
"CredentialItem",
"item",
":",
"items",
")",
"{",
"if",
"(",
"item",
"instanceof",
... | Ask for the credential items to be populated with the passphrase.
@param uri the URI of the remote resource that needs authentication.
@param items the items the application requires to complete authentication.
@return {@code true} if the request was successful and values were supplied;
{@code false} if the user cancel... | [
"Ask",
"for",
"the",
"credential",
"items",
"to",
"be",
"populated",
"with",
"the",
"passphrase",
"."
] | 6b99631f78bac4e1b521d2cc126c8b2da45d1f1f | https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/PassphraseCredentialsProvider.java#L83-L96 |
23,819 | google/closure-compiler | src/com/google/javascript/jscomp/GuardedCallback.java | GuardedCallback.isGuarded | boolean isGuarded(T resource) {
// Check if this polyfill is already guarded. If so, return true right away.
if (guarded.contains(resource)) {
return true;
}
// If not, see if this is itself a feature check guard. This is
// defined as a usage of the polyfill in such a way that throws
/... | java | boolean isGuarded(T resource) {
// Check if this polyfill is already guarded. If so, return true right away.
if (guarded.contains(resource)) {
return true;
}
// If not, see if this is itself a feature check guard. This is
// defined as a usage of the polyfill in such a way that throws
/... | [
"boolean",
"isGuarded",
"(",
"T",
"resource",
")",
"{",
"// Check if this polyfill is already guarded. If so, return true right away.",
"if",
"(",
"guarded",
".",
"contains",
"(",
"resource",
")",
")",
"{",
"return",
"true",
";",
"}",
"// If not, see if this is itself a ... | Determines if the given resource is guarded, either intrinsically or
conditionally. If the former, any ancestor conditional nodes are
registered as feature-testing the resource. | [
"Determines",
"if",
"the",
"given",
"resource",
"is",
"guarded",
"either",
"intrinsically",
"or",
"conditionally",
".",
"If",
"the",
"former",
"any",
"ancestor",
"conditional",
"nodes",
"are",
"registered",
"as",
"feature",
"-",
"testing",
"the",
"resource",
"."... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/GuardedCallback.java#L244-L267 |
23,820 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.prioritizeFromEntryNode | private void prioritizeFromEntryNode(DiGraphNode<Node, Branch> entry) {
PriorityQueue<DiGraphNode<Node, Branch>> worklist =
new PriorityQueue<>(10, priorityComparator);
worklist.add(entry);
while (!worklist.isEmpty()) {
DiGraphNode<Node, Branch> current = worklist.remove();
if (nodePrio... | java | private void prioritizeFromEntryNode(DiGraphNode<Node, Branch> entry) {
PriorityQueue<DiGraphNode<Node, Branch>> worklist =
new PriorityQueue<>(10, priorityComparator);
worklist.add(entry);
while (!worklist.isEmpty()) {
DiGraphNode<Node, Branch> current = worklist.remove();
if (nodePrio... | [
"private",
"void",
"prioritizeFromEntryNode",
"(",
"DiGraphNode",
"<",
"Node",
",",
"Branch",
">",
"entry",
")",
"{",
"PriorityQueue",
"<",
"DiGraphNode",
"<",
"Node",
",",
"Branch",
">",
">",
"worklist",
"=",
"new",
"PriorityQueue",
"<>",
"(",
"10",
",",
... | Given an entry node, find all the nodes reachable from that node
and prioritize them. | [
"Given",
"an",
"entry",
"node",
"find",
"all",
"the",
"nodes",
"reachable",
"from",
"that",
"node",
"and",
"prioritize",
"them",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L196-L212 |
23,821 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.computeFallThrough | static Node computeFallThrough(Node n) {
switch (n.getToken()) {
case DO:
case FOR:
return computeFallThrough(n.getFirstChild());
case FOR_IN:
case FOR_OF:
case FOR_AWAIT_OF:
return n.getSecondChild();
case LABEL:
return computeFallThrough(n.getLastChild()... | java | static Node computeFallThrough(Node n) {
switch (n.getToken()) {
case DO:
case FOR:
return computeFallThrough(n.getFirstChild());
case FOR_IN:
case FOR_OF:
case FOR_AWAIT_OF:
return n.getSecondChild();
case LABEL:
return computeFallThrough(n.getLastChild()... | [
"static",
"Node",
"computeFallThrough",
"(",
"Node",
"n",
")",
"{",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"DO",
":",
"case",
"FOR",
":",
"return",
"computeFallThrough",
"(",
"n",
".",
"getFirstChild",
"(",
")",
")",
";",
"c... | Computes the destination node of n when we want to fallthrough into the
subtree of n. We don't always create a CFG edge into n itself because of
DOs and FORs. | [
"Computes",
"the",
"destination",
"node",
"of",
"n",
"when",
"we",
"want",
"to",
"fallthrough",
"into",
"the",
"subtree",
"of",
"n",
".",
"We",
"don",
"t",
"always",
"create",
"a",
"CFG",
"edge",
"into",
"n",
"itself",
"because",
"of",
"DOs",
"and",
"F... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L836-L850 |
23,822 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.createEdge | private void createEdge(Node fromNode, ControlFlowGraph.Branch branch,
Node toNode) {
cfg.createNode(fromNode);
cfg.createNode(toNode);
cfg.connectIfNotFound(fromNode, branch, toNode);
} | java | private void createEdge(Node fromNode, ControlFlowGraph.Branch branch,
Node toNode) {
cfg.createNode(fromNode);
cfg.createNode(toNode);
cfg.connectIfNotFound(fromNode, branch, toNode);
} | [
"private",
"void",
"createEdge",
"(",
"Node",
"fromNode",
",",
"ControlFlowGraph",
".",
"Branch",
"branch",
",",
"Node",
"toNode",
")",
"{",
"cfg",
".",
"createNode",
"(",
"fromNode",
")",
";",
"cfg",
".",
"createNode",
"(",
"toNode",
")",
";",
"cfg",
".... | Connects the two nodes in the control flow graph.
@param fromNode Source.
@param toNode Destination. | [
"Connects",
"the",
"two",
"nodes",
"in",
"the",
"control",
"flow",
"graph",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L858-L863 |
23,823 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.connectToPossibleExceptionHandler | private void connectToPossibleExceptionHandler(Node cfgNode, Node target) {
if (mayThrowException(target) && !exceptionHandler.isEmpty()) {
Node lastJump = cfgNode;
for (Node handler : exceptionHandler) {
if (handler.isFunction()) {
return;
}
checkState(handler.isTry())... | java | private void connectToPossibleExceptionHandler(Node cfgNode, Node target) {
if (mayThrowException(target) && !exceptionHandler.isEmpty()) {
Node lastJump = cfgNode;
for (Node handler : exceptionHandler) {
if (handler.isFunction()) {
return;
}
checkState(handler.isTry())... | [
"private",
"void",
"connectToPossibleExceptionHandler",
"(",
"Node",
"cfgNode",
",",
"Node",
"target",
")",
"{",
"if",
"(",
"mayThrowException",
"(",
"target",
")",
"&&",
"!",
"exceptionHandler",
".",
"isEmpty",
"(",
")",
")",
"{",
"Node",
"lastJump",
"=",
"... | Connects cfgNode to the proper CATCH block if target subtree might throw
an exception. If there are FINALLY blocks reached before a CATCH, it will
make the corresponding entry in finallyMap. | [
"Connects",
"cfgNode",
"to",
"the",
"proper",
"CATCH",
"block",
"if",
"target",
"subtree",
"might",
"throw",
"an",
"exception",
".",
"If",
"there",
"are",
"FINALLY",
"blocks",
"reached",
"before",
"a",
"CATCH",
"it",
"will",
"make",
"the",
"corresponding",
"... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L870-L908 |
23,824 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.isBreakTarget | public static boolean isBreakTarget(Node target, String label) {
return isBreakStructure(target, label != null) &&
matchLabel(target.getParent(), label);
} | java | public static boolean isBreakTarget(Node target, String label) {
return isBreakStructure(target, label != null) &&
matchLabel(target.getParent(), label);
} | [
"public",
"static",
"boolean",
"isBreakTarget",
"(",
"Node",
"target",
",",
"String",
"label",
")",
"{",
"return",
"isBreakStructure",
"(",
"target",
",",
"label",
"!=",
"null",
")",
"&&",
"matchLabel",
"(",
"target",
".",
"getParent",
"(",
")",
",",
"labe... | Checks if target is actually the break target of labeled continue. The
label can be null if it is an unlabeled break. | [
"Checks",
"if",
"target",
"is",
"actually",
"the",
"break",
"target",
"of",
"labeled",
"continue",
".",
"The",
"label",
"can",
"be",
"null",
"if",
"it",
"is",
"an",
"unlabeled",
"break",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L928-L931 |
23,825 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.isContinueTarget | static boolean isContinueTarget(
Node target, String label) {
return NodeUtil.isLoopStructure(target) && matchLabel(target.getParent(), label);
} | java | static boolean isContinueTarget(
Node target, String label) {
return NodeUtil.isLoopStructure(target) && matchLabel(target.getParent(), label);
} | [
"static",
"boolean",
"isContinueTarget",
"(",
"Node",
"target",
",",
"String",
"label",
")",
"{",
"return",
"NodeUtil",
".",
"isLoopStructure",
"(",
"target",
")",
"&&",
"matchLabel",
"(",
"target",
".",
"getParent",
"(",
")",
",",
"label",
")",
";",
"}"
] | Checks if target is actually the continue target of labeled continue. The
label can be null if it is an unlabeled continue. | [
"Checks",
"if",
"target",
"is",
"actually",
"the",
"continue",
"target",
"of",
"labeled",
"continue",
".",
"The",
"label",
"can",
"be",
"null",
"if",
"it",
"is",
"an",
"unlabeled",
"continue",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L937-L940 |
23,826 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.matchLabel | private static boolean matchLabel(Node target, String label) {
if (label == null) {
return true;
}
while (target.isLabel()) {
if (target.getFirstChild().getString().equals(label)) {
return true;
}
target = target.getParent();
}
return false;
} | java | private static boolean matchLabel(Node target, String label) {
if (label == null) {
return true;
}
while (target.isLabel()) {
if (target.getFirstChild().getString().equals(label)) {
return true;
}
target = target.getParent();
}
return false;
} | [
"private",
"static",
"boolean",
"matchLabel",
"(",
"Node",
"target",
",",
"String",
"label",
")",
"{",
"if",
"(",
"label",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"while",
"(",
"target",
".",
"isLabel",
"(",
")",
")",
"{",
"if",
"(",
"t... | Check if label is actually referencing the target control structure. If
label is null, it always returns true. | [
"Check",
"if",
"label",
"is",
"actually",
"referencing",
"the",
"target",
"control",
"structure",
".",
"If",
"label",
"is",
"null",
"it",
"always",
"returns",
"true",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L946-L957 |
23,827 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.mayThrowException | public static boolean mayThrowException(Node n) {
switch (n.getToken()) {
case CALL:
case TAGGED_TEMPLATELIT:
case GETPROP:
case GETELEM:
case THROW:
case NEW:
case ASSIGN:
case INC:
case DEC:
case INSTANCEOF:
case IN:
case YIELD:
case AW... | java | public static boolean mayThrowException(Node n) {
switch (n.getToken()) {
case CALL:
case TAGGED_TEMPLATELIT:
case GETPROP:
case GETELEM:
case THROW:
case NEW:
case ASSIGN:
case INC:
case DEC:
case INSTANCEOF:
case IN:
case YIELD:
case AW... | [
"public",
"static",
"boolean",
"mayThrowException",
"(",
"Node",
"n",
")",
"{",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"CALL",
":",
"case",
"TAGGED_TEMPLATELIT",
":",
"case",
"GETPROP",
":",
"case",
"GETELEM",
":",
"case",
"THRO... | Determines if the subtree might throw an exception. | [
"Determines",
"if",
"the",
"subtree",
"might",
"throw",
"an",
"exception",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L962-L989 |
23,828 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.isBreakStructure | static boolean isBreakStructure(Node n, boolean labeled) {
switch (n.getToken()) {
case FOR:
case FOR_IN:
case FOR_OF:
case FOR_AWAIT_OF:
case DO:
case WHILE:
case SWITCH:
return true;
case BLOCK:
case ROOT:
case IF:
case TRY:
return ... | java | static boolean isBreakStructure(Node n, boolean labeled) {
switch (n.getToken()) {
case FOR:
case FOR_IN:
case FOR_OF:
case FOR_AWAIT_OF:
case DO:
case WHILE:
case SWITCH:
return true;
case BLOCK:
case ROOT:
case IF:
case TRY:
return ... | [
"static",
"boolean",
"isBreakStructure",
"(",
"Node",
"n",
",",
"boolean",
"labeled",
")",
"{",
"switch",
"(",
"n",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"FOR",
":",
"case",
"FOR_IN",
":",
"case",
"FOR_OF",
":",
"case",
"FOR_AWAIT_OF",
":",
"cas... | Determines whether the given node can be terminated with a BREAK node. | [
"Determines",
"whether",
"the",
"given",
"node",
"can",
"be",
"terminated",
"with",
"a",
"BREAK",
"node",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L994-L1012 |
23,829 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.getExceptionHandler | static Node getExceptionHandler(Node n) {
for (Node cur = n;
!cur.isScript() && !cur.isFunction();
cur = cur.getParent()) {
Node catchNode = getCatchHandlerForBlock(cur);
if (catchNode != null) {
return catchNode;
}
}
return null;
} | java | static Node getExceptionHandler(Node n) {
for (Node cur = n;
!cur.isScript() && !cur.isFunction();
cur = cur.getParent()) {
Node catchNode = getCatchHandlerForBlock(cur);
if (catchNode != null) {
return catchNode;
}
}
return null;
} | [
"static",
"Node",
"getExceptionHandler",
"(",
"Node",
"n",
")",
"{",
"for",
"(",
"Node",
"cur",
"=",
"n",
";",
"!",
"cur",
".",
"isScript",
"(",
")",
"&&",
"!",
"cur",
".",
"isFunction",
"(",
")",
";",
"cur",
"=",
"cur",
".",
"getParent",
"(",
")... | Get the TRY block with a CATCH that would be run if n throws an exception.
@return The CATCH node or null if it there isn't a CATCH before the
the function terminates. | [
"Get",
"the",
"TRY",
"block",
"with",
"a",
"CATCH",
"that",
"would",
"be",
"run",
"if",
"n",
"throws",
"an",
"exception",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L1019-L1029 |
23,830 | google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.getCatchHandlerForBlock | static Node getCatchHandlerForBlock(Node block) {
if (block.isBlock()
&& block.getParent().isTry()
&& block.getParent().getFirstChild() == block) {
for (Node s = block.getNext(); s != null; s = s.getNext()) {
if (NodeUtil.hasCatchHandler(s)) {
return s.getFirstChild();
... | java | static Node getCatchHandlerForBlock(Node block) {
if (block.isBlock()
&& block.getParent().isTry()
&& block.getParent().getFirstChild() == block) {
for (Node s = block.getNext(); s != null; s = s.getNext()) {
if (NodeUtil.hasCatchHandler(s)) {
return s.getFirstChild();
... | [
"static",
"Node",
"getCatchHandlerForBlock",
"(",
"Node",
"block",
")",
"{",
"if",
"(",
"block",
".",
"isBlock",
"(",
")",
"&&",
"block",
".",
"getParent",
"(",
")",
".",
"isTry",
"(",
")",
"&&",
"block",
".",
"getParent",
"(",
")",
".",
"getFirstChild... | Locate the catch BLOCK given the first block in a TRY.
@return The CATCH node or null there is no catch handler. | [
"Locate",
"the",
"catch",
"BLOCK",
"given",
"the",
"first",
"block",
"in",
"a",
"TRY",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L1035-L1046 |
23,831 | google/closure-compiler | src/com/google/javascript/jscomp/CoverageInstrumentationCallback.java | CoverageInstrumentationCallback.visit | @Override
public void visit(NodeTraversal traversal, Node node, Node parent) {
// SCRIPT node is special - it is the root of the AST for code from a file.
// Append code to declare and initialize structures used in instrumentation.
if (node.isScript()) {
String fileName = getFileName(traversal);
... | java | @Override
public void visit(NodeTraversal traversal, Node node, Node parent) {
// SCRIPT node is special - it is the root of the AST for code from a file.
// Append code to declare and initialize structures used in instrumentation.
if (node.isScript()) {
String fileName = getFileName(traversal);
... | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"NodeTraversal",
"traversal",
",",
"Node",
"node",
",",
"Node",
"parent",
")",
"{",
"// SCRIPT node is special - it is the root of the AST for code from a file.",
"// Append code to declare and initialize structures used in instrumen... | Instruments the JS code by inserting appropriate nodes into the AST. The
instrumentation logic is tuned to collect "line coverage" data only. | [
"Instruments",
"the",
"JS",
"code",
"by",
"inserting",
"appropriate",
"nodes",
"into",
"the",
"AST",
".",
"The",
"instrumentation",
"logic",
"is",
"tuned",
"to",
"collect",
"line",
"coverage",
"data",
"only",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CoverageInstrumentationCallback.java#L146-L208 |
23,832 | google/closure-compiler | src/com/google/javascript/jscomp/PrepareAst.java | PrepareAst.normalizeNodeTypes | private void normalizeNodeTypes(Node n) {
normalizeBlocks(n);
for (Node child = n.getFirstChild();
child != null; child = child.getNext()) {
// This pass is run during the CompilerTestCase validation, so this
// parent pointer check serves as a more general check.
checkState(child.ge... | java | private void normalizeNodeTypes(Node n) {
normalizeBlocks(n);
for (Node child = n.getFirstChild();
child != null; child = child.getNext()) {
// This pass is run during the CompilerTestCase validation, so this
// parent pointer check serves as a more general check.
checkState(child.ge... | [
"private",
"void",
"normalizeNodeTypes",
"(",
"Node",
"n",
")",
"{",
"normalizeBlocks",
"(",
"n",
")",
";",
"for",
"(",
"Node",
"child",
"=",
"n",
".",
"getFirstChild",
"(",
")",
";",
"child",
"!=",
"null",
";",
"child",
"=",
"child",
".",
"getNext",
... | Covert EXPR_VOID to EXPR_RESULT to simplify the rest of the code. | [
"Covert",
"EXPR_VOID",
"to",
"EXPR_RESULT",
"to",
"simplify",
"the",
"rest",
"of",
"the",
"code",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PrepareAst.java#L76-L87 |
23,833 | google/closure-compiler | src/com/google/javascript/jscomp/PrepareAst.java | PrepareAst.normalizeBlocks | private void normalizeBlocks(Node n) {
if (NodeUtil.isControlStructure(n)
&& !n.isLabel()
&& !n.isSwitch()) {
for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
if (NodeUtil.isControlStructureCodeBlock(n, c) && !c.isBlock()) {
Node newBlock = IR.block().srcref(n);... | java | private void normalizeBlocks(Node n) {
if (NodeUtil.isControlStructure(n)
&& !n.isLabel()
&& !n.isSwitch()) {
for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
if (NodeUtil.isControlStructureCodeBlock(n, c) && !c.isBlock()) {
Node newBlock = IR.block().srcref(n);... | [
"private",
"void",
"normalizeBlocks",
"(",
"Node",
"n",
")",
"{",
"if",
"(",
"NodeUtil",
".",
"isControlStructure",
"(",
"n",
")",
"&&",
"!",
"n",
".",
"isLabel",
"(",
")",
"&&",
"!",
"n",
".",
"isSwitch",
"(",
")",
")",
"{",
"for",
"(",
"Node",
... | Add blocks to IF, WHILE, DO, etc. | [
"Add",
"blocks",
"to",
"IF",
"WHILE",
"DO",
"etc",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PrepareAst.java#L92-L109 |
23,834 | google/closure-compiler | src/com/google/javascript/jscomp/lint/CheckInterfaces.java | CheckInterfaces.isInterface | private boolean isInterface(Node n) {
if (!n.isFunction()) {
return false;
}
JSDocInfo jsDoc = NodeUtil.getBestJSDocInfo(n);
return jsDoc != null && jsDoc.isInterface();
} | java | private boolean isInterface(Node n) {
if (!n.isFunction()) {
return false;
}
JSDocInfo jsDoc = NodeUtil.getBestJSDocInfo(n);
return jsDoc != null && jsDoc.isInterface();
} | [
"private",
"boolean",
"isInterface",
"(",
"Node",
"n",
")",
"{",
"if",
"(",
"!",
"n",
".",
"isFunction",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"JSDocInfo",
"jsDoc",
"=",
"NodeUtil",
".",
"getBestJSDocInfo",
"(",
"n",
")",
";",
"return",
"j... | Whether a function is an interface constructor, or a method on an interface. | [
"Whether",
"a",
"function",
"is",
"an",
"interface",
"constructor",
"or",
"a",
"method",
"on",
"an",
"interface",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/lint/CheckInterfaces.java#L65-L72 |
23,835 | google/closure-compiler | src/com/google/javascript/jscomp/Es6RewriteDestructuring.java | Es6RewriteDestructuring.pullDestructuringOutOfParams | private void pullDestructuringOutOfParams(Node paramList, Node function) {
Node insertSpot = null;
Node body = function.getLastChild();
int i = 0;
Node next = null;
for (Node param = paramList.getFirstChild(); param != null; param = next, i++) {
next = param.getNext();
if (param.isDefaul... | java | private void pullDestructuringOutOfParams(Node paramList, Node function) {
Node insertSpot = null;
Node body = function.getLastChild();
int i = 0;
Node next = null;
for (Node param = paramList.getFirstChild(); param != null; param = next, i++) {
next = param.getNext();
if (param.isDefaul... | [
"private",
"void",
"pullDestructuringOutOfParams",
"(",
"Node",
"paramList",
",",
"Node",
"function",
")",
"{",
"Node",
"insertSpot",
"=",
"null",
";",
"Node",
"body",
"=",
"function",
".",
"getLastChild",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"Node",
... | the parameter list contains a usage of OBJECT_REST. | [
"the",
"parameter",
"list",
"contains",
"a",
"usage",
"of",
"OBJECT_REST",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteDestructuring.java#L225-L289 |
23,836 | google/closure-compiler | src/com/google/javascript/jscomp/Es6RewriteDestructuring.java | Es6RewriteDestructuring.replacePatternParamWithTempVar | private Node replacePatternParamWithTempVar(
Node function, Node insertSpot, Node patternParam, String tempVarName) {
// Convert `function f([a, b]) {}` to `function f(tempVar) { var [a, b] = tempVar; }`
JSType paramType = patternParam.getJSType();
Node newParam = astFactory.createName(tempVarName, pa... | java | private Node replacePatternParamWithTempVar(
Node function, Node insertSpot, Node patternParam, String tempVarName) {
// Convert `function f([a, b]) {}` to `function f(tempVar) { var [a, b] = tempVar; }`
JSType paramType = patternParam.getJSType();
Node newParam = astFactory.createName(tempVarName, pa... | [
"private",
"Node",
"replacePatternParamWithTempVar",
"(",
"Node",
"function",
",",
"Node",
"insertSpot",
",",
"Node",
"patternParam",
",",
"String",
"tempVarName",
")",
"{",
"// Convert `function f([a, b]) {}` to `function f(tempVar) { var [a, b] = tempVar; }`",
"JSType",
"para... | Replace a destructuring pattern parameter with a a temporary parameter name and add a new
local variable declaration to the function assigning the temporary parameter to the pattern.
<p> Note: Rewrites of variable declaration destructuring will happen later to rewrite
this declaration as non-destructured code.
@param ... | [
"Replace",
"a",
"destructuring",
"pattern",
"parameter",
"with",
"a",
"a",
"temporary",
"parameter",
"name",
"and",
"add",
"a",
"new",
"local",
"variable",
"declaration",
"to",
"the",
"function",
"assigning",
"the",
"temporary",
"parameter",
"to",
"the",
"patter... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteDestructuring.java#L303-L313 |
23,837 | google/closure-compiler | src/com/google/javascript/jscomp/Es6RewriteDestructuring.java | Es6RewriteDestructuring.replacePattern | private void replacePattern(
NodeTraversal t, Node pattern, Node rhs, Node parent, Node nodeToDetach) {
checkArgument(NodeUtil.isStatement(nodeToDetach), nodeToDetach);
switch (pattern.getToken()) {
case ARRAY_PATTERN:
replaceArrayPattern(t, pattern, rhs, parent, nodeToDetach);
break... | java | private void replacePattern(
NodeTraversal t, Node pattern, Node rhs, Node parent, Node nodeToDetach) {
checkArgument(NodeUtil.isStatement(nodeToDetach), nodeToDetach);
switch (pattern.getToken()) {
case ARRAY_PATTERN:
replaceArrayPattern(t, pattern, rhs, parent, nodeToDetach);
break... | [
"private",
"void",
"replacePattern",
"(",
"NodeTraversal",
"t",
",",
"Node",
"pattern",
",",
"Node",
"rhs",
",",
"Node",
"parent",
",",
"Node",
"nodeToDetach",
")",
"{",
"checkArgument",
"(",
"NodeUtil",
".",
"isStatement",
"(",
"nodeToDetach",
")",
",",
"no... | Transpiles a destructuring pattern in a declaration or assignment to ES5
@param nodeToDetach a statement node containing the pattern. This method will replace the node
with one or more other statements. | [
"Transpiles",
"a",
"destructuring",
"pattern",
"in",
"a",
"declaration",
"or",
"assignment",
"to",
"ES5"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteDestructuring.java#L350-L363 |
23,838 | google/closure-compiler | src/com/google/javascript/jscomp/Es6RewriteDestructuring.java | Es6RewriteDestructuring.objectPatternRestRHS | private Node objectPatternRestRHS(
Node objectPattern, Node rest, String restTempVarName, ArrayList<Node> statedProperties) {
checkArgument(objectPattern.getLastChild() == rest);
Node restTempVarModel = astFactory.createName(restTempVarName, objectPattern.getJSType());
Node result = restTempVarModel.c... | java | private Node objectPatternRestRHS(
Node objectPattern, Node rest, String restTempVarName, ArrayList<Node> statedProperties) {
checkArgument(objectPattern.getLastChild() == rest);
Node restTempVarModel = astFactory.createName(restTempVarName, objectPattern.getJSType());
Node result = restTempVarModel.c... | [
"private",
"Node",
"objectPatternRestRHS",
"(",
"Node",
"objectPattern",
",",
"Node",
"rest",
",",
"String",
"restTempVarName",
",",
"ArrayList",
"<",
"Node",
">",
"statedProperties",
")",
"{",
"checkArgument",
"(",
"objectPattern",
".",
"getLastChild",
"(",
")",
... | Convert "rest" of object destructuring lhs by making a clone and deleting any properties that
were stated in the original object pattern.
<p>Nodes in statedProperties that are a stringKey will be used in a getprop when deleting. All
other types will be used in a getelem such as what is done for computed properties.
<... | [
"Convert",
"rest",
"of",
"object",
"destructuring",
"lhs",
"by",
"making",
"a",
"clone",
"and",
"deleting",
"any",
"properties",
"that",
"were",
"stated",
"in",
"the",
"original",
"object",
"pattern",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteDestructuring.java#L545-L562 |
23,839 | google/closure-compiler | src/com/google/javascript/jscomp/Es6RewriteDestructuring.java | Es6RewriteDestructuring.defaultValueHook | private Node defaultValueHook(Node getprop, Node defaultValue) {
Node undefined = astFactory.createName("undefined", JSTypeNative.VOID_TYPE);
undefined.makeNonIndexable();
Node getpropClone = getprop.cloneTree().setJSType(getprop.getJSType());
return astFactory.createHook(
astFactory.createSheq(... | java | private Node defaultValueHook(Node getprop, Node defaultValue) {
Node undefined = astFactory.createName("undefined", JSTypeNative.VOID_TYPE);
undefined.makeNonIndexable();
Node getpropClone = getprop.cloneTree().setJSType(getprop.getJSType());
return astFactory.createHook(
astFactory.createSheq(... | [
"private",
"Node",
"defaultValueHook",
"(",
"Node",
"getprop",
",",
"Node",
"defaultValue",
")",
"{",
"Node",
"undefined",
"=",
"astFactory",
".",
"createName",
"(",
"\"undefined\"",
",",
"JSTypeNative",
".",
"VOID_TYPE",
")",
";",
"undefined",
".",
"makeNonInde... | Helper for transpiling DEFAULT_VALUE trees. | [
"Helper",
"for",
"transpiling",
"DEFAULT_VALUE",
"trees",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteDestructuring.java#L770-L776 |
23,840 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.cloneClassDoc | public JSDocInfo cloneClassDoc() {
JSDocInfo other = new JSDocInfo();
other.info = this.info == null ? null : this.info.cloneClassDoc();
other.documentation = this.documentation;
other.visibility = this.visibility;
other.bitset = this.bitset;
other.type = cloneType(this.type, false);
other.t... | java | public JSDocInfo cloneClassDoc() {
JSDocInfo other = new JSDocInfo();
other.info = this.info == null ? null : this.info.cloneClassDoc();
other.documentation = this.documentation;
other.visibility = this.visibility;
other.bitset = this.bitset;
other.type = cloneType(this.type, false);
other.t... | [
"public",
"JSDocInfo",
"cloneClassDoc",
"(",
")",
"{",
"JSDocInfo",
"other",
"=",
"new",
"JSDocInfo",
"(",
")",
";",
"other",
".",
"info",
"=",
"this",
".",
"info",
"==",
"null",
"?",
"null",
":",
"this",
".",
"info",
".",
"cloneClassDoc",
"(",
")",
... | This is used to get all nodes + the description, excluding the param nodes. Used to help in an
ES5 to ES6 class converter only. | [
"This",
"is",
"used",
"to",
"get",
"all",
"nodes",
"+",
"the",
"description",
"excluding",
"the",
"param",
"nodes",
".",
"Used",
"to",
"help",
"in",
"an",
"ES5",
"to",
"ES6",
"class",
"converter",
"only",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L607-L623 |
23,841 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.cloneConstructorDoc | public JSDocInfo cloneConstructorDoc() {
JSDocInfo other = new JSDocInfo();
other.info = this.info == null ? null : this.info.cloneConstructorDoc();
other.documentation =
this.documentation == null ? null : this.documentation.cloneConstructorDoc();
return other;
} | java | public JSDocInfo cloneConstructorDoc() {
JSDocInfo other = new JSDocInfo();
other.info = this.info == null ? null : this.info.cloneConstructorDoc();
other.documentation =
this.documentation == null ? null : this.documentation.cloneConstructorDoc();
return other;
} | [
"public",
"JSDocInfo",
"cloneConstructorDoc",
"(",
")",
"{",
"JSDocInfo",
"other",
"=",
"new",
"JSDocInfo",
"(",
")",
";",
"other",
".",
"info",
"=",
"this",
".",
"info",
"==",
"null",
"?",
"null",
":",
"this",
".",
"info",
".",
"cloneConstructorDoc",
"(... | This is used to get only the parameter nodes. Used to help in an ES5 to ES6 converter class
only. | [
"This",
"is",
"used",
"to",
"get",
"only",
"the",
"parameter",
"nodes",
".",
"Used",
"to",
"help",
"in",
"an",
"ES5",
"to",
"ES6",
"converter",
"class",
"only",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L629-L635 |
23,842 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.setDeprecationReason | boolean setDeprecationReason(String reason) {
lazyInitInfo();
if (info.deprecated != null) {
return false;
}
info.deprecated = reason;
return true;
} | java | boolean setDeprecationReason(String reason) {
lazyInitInfo();
if (info.deprecated != null) {
return false;
}
info.deprecated = reason;
return true;
} | [
"boolean",
"setDeprecationReason",
"(",
"String",
"reason",
")",
"{",
"lazyInitInfo",
"(",
")",
";",
"if",
"(",
"info",
".",
"deprecated",
"!=",
"null",
")",
"{",
"return",
"false",
";",
"}",
"info",
".",
"deprecated",
"=",
"reason",
";",
"return",
"true... | Sets the deprecation reason.
@param reason The deprecation reason | [
"Sets",
"the",
"deprecation",
"reason",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1171-L1180 |
23,843 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.addSuppression | void addSuppression(String suppression) {
lazyInitInfo();
if (info.suppressions == null) {
info.suppressions = ImmutableSet.of(suppression);
} else {
info.suppressions = new ImmutableSet.Builder<String>()
.addAll(info.suppressions)
.add(suppression)
.build();
}... | java | void addSuppression(String suppression) {
lazyInitInfo();
if (info.suppressions == null) {
info.suppressions = ImmutableSet.of(suppression);
} else {
info.suppressions = new ImmutableSet.Builder<String>()
.addAll(info.suppressions)
.add(suppression)
.build();
}... | [
"void",
"addSuppression",
"(",
"String",
"suppression",
")",
"{",
"lazyInitInfo",
"(",
")",
";",
"if",
"(",
"info",
".",
"suppressions",
"==",
"null",
")",
"{",
"info",
".",
"suppressions",
"=",
"ImmutableSet",
".",
"of",
"(",
"suppression",
")",
";",
"}... | Add a suppressed warning. | [
"Add",
"a",
"suppressed",
"warning",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1185-L1196 |
23,844 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.setModifies | boolean setModifies(Set<String> modifies) {
lazyInitInfo();
if (info.modifies != null) {
return false;
}
info.modifies = ImmutableSet.copyOf(modifies);
return true;
} | java | boolean setModifies(Set<String> modifies) {
lazyInitInfo();
if (info.modifies != null) {
return false;
}
info.modifies = ImmutableSet.copyOf(modifies);
return true;
} | [
"boolean",
"setModifies",
"(",
"Set",
"<",
"String",
">",
"modifies",
")",
"{",
"lazyInitInfo",
"(",
")",
";",
"if",
"(",
"info",
".",
"modifies",
"!=",
"null",
")",
"{",
"return",
"false",
";",
"}",
"info",
".",
"modifies",
"=",
"ImmutableSet",
".",
... | Sets modifies values.
@param modifies A list of modifies types. | [
"Sets",
"modifies",
"values",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1215-L1224 |
23,845 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.documentVersion | boolean documentVersion(String version) {
if (!lazyInitDocumentation()) {
return true;
}
if (documentation.version != null) {
return false;
}
documentation.version = version;
return true;
} | java | boolean documentVersion(String version) {
if (!lazyInitDocumentation()) {
return true;
}
if (documentation.version != null) {
return false;
}
documentation.version = version;
return true;
} | [
"boolean",
"documentVersion",
"(",
"String",
"version",
")",
"{",
"if",
"(",
"!",
"lazyInitDocumentation",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"documentation",
".",
"version",
"!=",
"null",
")",
"{",
"return",
"false",
";",
"}",
... | Documents the version. | [
"Documents",
"the",
"version",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1229-L1240 |
23,846 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.declareThrows | boolean declareThrows(JSTypeExpression jsType) {
lazyInitInfo();
if (info.thrownTypes == null) {
info.thrownTypes = new ArrayList<>();
}
info.thrownTypes.add(jsType);
return true;
} | java | boolean declareThrows(JSTypeExpression jsType) {
lazyInitInfo();
if (info.thrownTypes == null) {
info.thrownTypes = new ArrayList<>();
}
info.thrownTypes.add(jsType);
return true;
} | [
"boolean",
"declareThrows",
"(",
"JSTypeExpression",
"jsType",
")",
"{",
"lazyInitInfo",
"(",
")",
";",
"if",
"(",
"info",
".",
"thrownTypes",
"==",
"null",
")",
"{",
"info",
".",
"thrownTypes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"info",
... | Declares that the method throws a given type.
@param jsType The type that can be thrown by the method. | [
"Declares",
"that",
"the",
"method",
"throws",
"a",
"given",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1462-L1471 |
23,847 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getParameterType | public JSTypeExpression getParameterType(String parameter) {
if (info == null || info.parameters == null) {
return null;
}
return info.parameters.get(parameter);
} | java | public JSTypeExpression getParameterType(String parameter) {
if (info == null || info.parameters == null) {
return null;
}
return info.parameters.get(parameter);
} | [
"public",
"JSTypeExpression",
"getParameterType",
"(",
"String",
"parameter",
")",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"info",
".",
"parameters",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"info",
".",
"parameters",
".",
"get",
... | Gets the type of a given named parameter.
@param parameter the parameter's name
@return the parameter's type or {@code null} if this parameter is not
defined or has a {@code null} type | [
"Gets",
"the",
"type",
"of",
"a",
"given",
"named",
"parameter",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1488-L1493 |
23,848 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.hasParameter | public boolean hasParameter(String parameter) {
if (info == null || info.parameters == null) {
return false;
}
return info.parameters.containsKey(parameter);
} | java | public boolean hasParameter(String parameter) {
if (info == null || info.parameters == null) {
return false;
}
return info.parameters.containsKey(parameter);
} | [
"public",
"boolean",
"hasParameter",
"(",
"String",
"parameter",
")",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"info",
".",
"parameters",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"info",
".",
"parameters",
".",
"containsKey",
"("... | Returns whether the parameter is defined. | [
"Returns",
"whether",
"the",
"parameter",
"is",
"defined",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1498-L1503 |
23,849 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getParameterNames | public Set<String> getParameterNames() {
if (info == null || info.parameters == null) {
return ImmutableSet.of();
}
return ImmutableSet.copyOf(info.parameters.keySet());
} | java | public Set<String> getParameterNames() {
if (info == null || info.parameters == null) {
return ImmutableSet.of();
}
return ImmutableSet.copyOf(info.parameters.keySet());
} | [
"public",
"Set",
"<",
"String",
">",
"getParameterNames",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"info",
".",
"parameters",
"==",
"null",
")",
"{",
"return",
"ImmutableSet",
".",
"of",
"(",
")",
";",
"}",
"return",
"ImmutableSet",
".",
... | Returns the set of names of the defined parameters. The iteration order
of the returned set is the order in which parameters are defined in the
JSDoc, rather than the order in which the function declares them.
@return the set of names of the defined parameters. The returned set is
immutable. | [
"Returns",
"the",
"set",
"of",
"names",
"of",
"the",
"defined",
"parameters",
".",
"The",
"iteration",
"order",
"of",
"the",
"returned",
"set",
"is",
"the",
"order",
"in",
"which",
"parameters",
"are",
"defined",
"in",
"the",
"JSDoc",
"rather",
"than",
"th... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1523-L1528 |
23,850 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getParameterNameAt | public String getParameterNameAt(int index) {
if (info == null || info.parameters == null) {
return null;
}
if (index >= info.parameters.size()) {
return null;
}
return Iterables.get(info.parameters.keySet(), index);
} | java | public String getParameterNameAt(int index) {
if (info == null || info.parameters == null) {
return null;
}
if (index >= info.parameters.size()) {
return null;
}
return Iterables.get(info.parameters.keySet(), index);
} | [
"public",
"String",
"getParameterNameAt",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"info",
".",
"parameters",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"index",
">=",
"info",
".",
"parameters",
".",
"... | Returns the nth name in the defined parameters. The iteration order
is the order in which parameters are defined in the JSDoc, rather
than the order in which the function declares them. | [
"Returns",
"the",
"nth",
"name",
"in",
"the",
"defined",
"parameters",
".",
"The",
"iteration",
"order",
"is",
"the",
"order",
"in",
"which",
"parameters",
"are",
"defined",
"in",
"the",
"JSDoc",
"rather",
"than",
"the",
"order",
"in",
"which",
"the",
"fun... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1535-L1543 |
23,851 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getThrownTypes | public List<JSTypeExpression> getThrownTypes() {
if (info == null || info.thrownTypes == null) {
return ImmutableList.of();
}
return Collections.unmodifiableList(info.thrownTypes);
} | java | public List<JSTypeExpression> getThrownTypes() {
if (info == null || info.thrownTypes == null) {
return ImmutableList.of();
}
return Collections.unmodifiableList(info.thrownTypes);
} | [
"public",
"List",
"<",
"JSTypeExpression",
">",
"getThrownTypes",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"info",
".",
"thrownTypes",
"==",
"null",
")",
"{",
"return",
"ImmutableList",
".",
"of",
"(",
")",
";",
"}",
"return",
"Collections",... | Returns the list of thrown types. | [
"Returns",
"the",
"list",
"of",
"thrown",
"types",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1592-L1597 |
23,852 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getThrowsDescriptionForType | public String getThrowsDescriptionForType(JSTypeExpression type) {
if (documentation == null || documentation.throwsDescriptions == null) {
return null;
}
return documentation.throwsDescriptions.get(type);
} | java | public String getThrowsDescriptionForType(JSTypeExpression type) {
if (documentation == null || documentation.throwsDescriptions == null) {
return null;
}
return documentation.throwsDescriptions.get(type);
} | [
"public",
"String",
"getThrowsDescriptionForType",
"(",
"JSTypeExpression",
"type",
")",
"{",
"if",
"(",
"documentation",
"==",
"null",
"||",
"documentation",
".",
"throwsDescriptions",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"documentation",... | Get the message for a given thrown type. | [
"Get",
"the",
"message",
"for",
"a",
"given",
"thrown",
"type",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1602-L1608 |
23,853 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.addImplementedInterface | boolean addImplementedInterface(JSTypeExpression interfaceName) {
lazyInitInfo();
if (info.implementedInterfaces == null) {
info.implementedInterfaces = new ArrayList<>(2);
}
if (info.implementedInterfaces.contains(interfaceName)) {
return false;
}
info.implementedInterfaces.add(inte... | java | boolean addImplementedInterface(JSTypeExpression interfaceName) {
lazyInitInfo();
if (info.implementedInterfaces == null) {
info.implementedInterfaces = new ArrayList<>(2);
}
if (info.implementedInterfaces.contains(interfaceName)) {
return false;
}
info.implementedInterfaces.add(inte... | [
"boolean",
"addImplementedInterface",
"(",
"JSTypeExpression",
"interfaceName",
")",
"{",
"lazyInitInfo",
"(",
")",
";",
"if",
"(",
"info",
".",
"implementedInterfaces",
"==",
"null",
")",
"{",
"info",
".",
"implementedInterfaces",
"=",
"new",
"ArrayList",
"<>",
... | Adds an implemented interface. Returns whether the interface was added. If
the interface was already present in the list, it won't get added again. | [
"Adds",
"an",
"implemented",
"interface",
".",
"Returns",
"whether",
"the",
"interface",
"was",
"added",
".",
"If",
"the",
"interface",
"was",
"already",
"present",
"in",
"the",
"list",
"it",
"won",
"t",
"get",
"added",
"again",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1943-L1953 |
23,854 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getExtendedInterfaces | public List<JSTypeExpression> getExtendedInterfaces() {
if (info == null || info.extendedInterfaces == null) {
return ImmutableList.of();
}
return Collections.unmodifiableList(info.extendedInterfaces);
} | java | public List<JSTypeExpression> getExtendedInterfaces() {
if (info == null || info.extendedInterfaces == null) {
return ImmutableList.of();
}
return Collections.unmodifiableList(info.extendedInterfaces);
} | [
"public",
"List",
"<",
"JSTypeExpression",
">",
"getExtendedInterfaces",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"info",
".",
"extendedInterfaces",
"==",
"null",
")",
"{",
"return",
"ImmutableList",
".",
"of",
"(",
")",
";",
"}",
"return",
... | Returns the interfaces extended by an interface
@return An immutable list of JSTypeExpression objects that can
be resolved to types. | [
"Returns",
"the",
"interfaces",
"extended",
"by",
"an",
"interface"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L2002-L2007 |
23,855 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getSuppressions | public Set<String> getSuppressions() {
Set<String> suppressions = info == null ? null : info.suppressions;
return suppressions == null ? Collections.<String>emptySet() : suppressions;
} | java | public Set<String> getSuppressions() {
Set<String> suppressions = info == null ? null : info.suppressions;
return suppressions == null ? Collections.<String>emptySet() : suppressions;
} | [
"public",
"Set",
"<",
"String",
">",
"getSuppressions",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"suppressions",
"=",
"info",
"==",
"null",
"?",
"null",
":",
"info",
".",
"suppressions",
";",
"return",
"suppressions",
"==",
"null",
"?",
"Collections",
"... | Returns the set of suppressed warnings. | [
"Returns",
"the",
"set",
"of",
"suppressed",
"warnings",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L2029-L2032 |
23,856 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getModifies | public Set<String> getModifies() {
Set<String> modifies = info == null ? null : info.modifies;
return modifies == null ? Collections.<String>emptySet() : modifies;
} | java | public Set<String> getModifies() {
Set<String> modifies = info == null ? null : info.modifies;
return modifies == null ? Collections.<String>emptySet() : modifies;
} | [
"public",
"Set",
"<",
"String",
">",
"getModifies",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"modifies",
"=",
"info",
"==",
"null",
"?",
"null",
":",
"info",
".",
"modifies",
";",
"return",
"modifies",
"==",
"null",
"?",
"Collections",
".",
"<",
"St... | Returns the set of sideeffect notations. | [
"Returns",
"the",
"set",
"of",
"sideeffect",
"notations",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L2037-L2040 |
23,857 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.hasDescriptionForParameter | public boolean hasDescriptionForParameter(String name) {
if (documentation == null || documentation.parameters == null) {
return false;
}
return documentation.parameters.containsKey(name);
} | java | public boolean hasDescriptionForParameter(String name) {
if (documentation == null || documentation.parameters == null) {
return false;
}
return documentation.parameters.containsKey(name);
} | [
"public",
"boolean",
"hasDescriptionForParameter",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"documentation",
"==",
"null",
"||",
"documentation",
".",
"parameters",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"documentation",
".",
"parame... | Returns whether a description exists for the parameter with the specified
name. | [
"Returns",
"whether",
"a",
"description",
"exists",
"for",
"the",
"parameter",
"with",
"the",
"specified",
"name",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L2057-L2063 |
23,858 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getDescriptionForParameter | public String getDescriptionForParameter(String name) {
if (documentation == null || documentation.parameters == null) {
return null;
}
return documentation.parameters.get(name);
} | java | public String getDescriptionForParameter(String name) {
if (documentation == null || documentation.parameters == null) {
return null;
}
return documentation.parameters.get(name);
} | [
"public",
"String",
"getDescriptionForParameter",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"documentation",
"==",
"null",
"||",
"documentation",
".",
"parameters",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"documentation",
".",
"paramete... | Returns the description for the parameter with the given name, if its
exists. | [
"Returns",
"the",
"description",
"for",
"the",
"parameter",
"with",
"the",
"given",
"name",
"if",
"its",
"exists",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L2069-L2075 |
23,859 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getMarkers | public Collection<Marker> getMarkers() {
return (documentation == null || documentation.markers == null)
? ImmutableList.<Marker>of() : documentation.markers;
} | java | public Collection<Marker> getMarkers() {
return (documentation == null || documentation.markers == null)
? ImmutableList.<Marker>of() : documentation.markers;
} | [
"public",
"Collection",
"<",
"Marker",
">",
"getMarkers",
"(",
")",
"{",
"return",
"(",
"documentation",
"==",
"null",
"||",
"documentation",
".",
"markers",
"==",
"null",
")",
"?",
"ImmutableList",
".",
"<",
"Marker",
">",
"of",
"(",
")",
":",
"document... | Gets the list of all markers for the documentation in this JSDoc. | [
"Gets",
"the",
"list",
"of",
"all",
"markers",
"for",
"the",
"documentation",
"in",
"this",
"JSDoc",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L2127-L2130 |
23,860 | google/closure-compiler | src/com/google/javascript/rhino/JSDocInfo.java | JSDocInfo.getTypeTransformations | public ImmutableMap<String, Node> getTypeTransformations() {
if (info == null || info.typeTransformations == null) {
return ImmutableMap.<String, Node>of();
}
return ImmutableMap.copyOf(info.typeTransformations);
} | java | public ImmutableMap<String, Node> getTypeTransformations() {
if (info == null || info.typeTransformations == null) {
return ImmutableMap.<String, Node>of();
}
return ImmutableMap.copyOf(info.typeTransformations);
} | [
"public",
"ImmutableMap",
"<",
"String",
",",
"Node",
">",
"getTypeTransformations",
"(",
")",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"info",
".",
"typeTransformations",
"==",
"null",
")",
"{",
"return",
"ImmutableMap",
".",
"<",
"String",
",",
"Node"... | Gets the type transformations. | [
"Gets",
"the",
"type",
"transformations",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L2145-L2150 |
23,861 | google/closure-compiler | src/com/google/javascript/jscomp/TypedScopeCreator.java | TypedScopeCreator.removeScopesForScript | void removeScopesForScript(String scriptName) {
memoized.keySet().removeIf(n -> scriptName.equals(NodeUtil.getSourceName(n)));
} | java | void removeScopesForScript(String scriptName) {
memoized.keySet().removeIf(n -> scriptName.equals(NodeUtil.getSourceName(n)));
} | [
"void",
"removeScopesForScript",
"(",
"String",
"scriptName",
")",
"{",
"memoized",
".",
"keySet",
"(",
")",
".",
"removeIf",
"(",
"n",
"->",
"scriptName",
".",
"equals",
"(",
"NodeUtil",
".",
"getSourceName",
"(",
"n",
")",
")",
")",
";",
"}"
] | Removes all scopes with root nodes from a given script file.
@param scriptName the name of the script file to remove nodes for. | [
"Removes",
"all",
"scopes",
"with",
"root",
"nodes",
"from",
"a",
"given",
"script",
"file",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L350-L352 |
23,862 | google/closure-compiler | src/com/google/javascript/jscomp/TypedScopeCreator.java | TypedScopeCreator.createScope | TypedScope createScope(Node n) {
TypedScope s = memoized.get(n);
return s != null
? s
: createScope(n, createScope(NodeUtil.getEnclosingScopeRoot(n.getParent())));
} | java | TypedScope createScope(Node n) {
TypedScope s = memoized.get(n);
return s != null
? s
: createScope(n, createScope(NodeUtil.getEnclosingScopeRoot(n.getParent())));
} | [
"TypedScope",
"createScope",
"(",
"Node",
"n",
")",
"{",
"TypedScope",
"s",
"=",
"memoized",
".",
"get",
"(",
"n",
")",
";",
"return",
"s",
"!=",
"null",
"?",
"s",
":",
"createScope",
"(",
"n",
",",
"createScope",
"(",
"NodeUtil",
".",
"getEnclosingSco... | Create a scope if it doesn't already exist, looking up in the map for the parent scope. | [
"Create",
"a",
"scope",
"if",
"it",
"doesn",
"t",
"already",
"exist",
"looking",
"up",
"in",
"the",
"map",
"for",
"the",
"parent",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L355-L360 |
23,863 | google/closure-compiler | src/com/google/javascript/jscomp/TypedScopeCreator.java | TypedScopeCreator.createScope | @Override
public TypedScope createScope(Node root, AbstractScope<?, ?> parent) {
checkArgument(parent == null || parent instanceof TypedScope);
TypedScope typedParent = (TypedScope) parent;
TypedScope scope = memoized.get(root);
if (scope != null) {
checkState(typedParent == scope.getParent());... | java | @Override
public TypedScope createScope(Node root, AbstractScope<?, ?> parent) {
checkArgument(parent == null || parent instanceof TypedScope);
TypedScope typedParent = (TypedScope) parent;
TypedScope scope = memoized.get(root);
if (scope != null) {
checkState(typedParent == scope.getParent());... | [
"@",
"Override",
"public",
"TypedScope",
"createScope",
"(",
"Node",
"root",
",",
"AbstractScope",
"<",
"?",
",",
"?",
">",
"parent",
")",
"{",
"checkArgument",
"(",
"parent",
"==",
"null",
"||",
"parent",
"instanceof",
"TypedScope",
")",
";",
"TypedScope",
... | Creates a scope with all types declared. Declares newly discovered types
and type properties in the type registry. | [
"Creates",
"a",
"scope",
"with",
"all",
"types",
"declared",
".",
"Declares",
"newly",
"discovered",
"types",
"and",
"type",
"properties",
"in",
"the",
"type",
"registry",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L366-L379 |
23,864 | google/closure-compiler | src/com/google/javascript/jscomp/TypedScopeCreator.java | TypedScopeCreator.initializeModuleScope | private void initializeModuleScope(Node moduleBody, Module module, TypedScope moduleScope) {
if (module.metadata().isGoogModule()) {
declareExportsInModuleScope(module, moduleBody, moduleScope);
markGoogModuleExportsAsConst(module);
}
} | java | private void initializeModuleScope(Node moduleBody, Module module, TypedScope moduleScope) {
if (module.metadata().isGoogModule()) {
declareExportsInModuleScope(module, moduleBody, moduleScope);
markGoogModuleExportsAsConst(module);
}
} | [
"private",
"void",
"initializeModuleScope",
"(",
"Node",
"moduleBody",
",",
"Module",
"module",
",",
"TypedScope",
"moduleScope",
")",
"{",
"if",
"(",
"module",
".",
"metadata",
"(",
")",
".",
"isGoogModule",
"(",
")",
")",
"{",
"declareExportsInModuleScope",
... | Builds the beginning of a module-scope. This can be an ES module or a goog.module. | [
"Builds",
"the",
"beginning",
"of",
"a",
"module",
"-",
"scope",
".",
"This",
"can",
"be",
"an",
"ES",
"module",
"or",
"a",
"goog",
".",
"module",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L465-L470 |
23,865 | google/closure-compiler | src/com/google/javascript/jscomp/TypedScopeCreator.java | TypedScopeCreator.declareExportsInModuleScope | private void declareExportsInModuleScope(
Module googModule, Node moduleBody, TypedScope moduleScope) {
if (!googModule.namespace().containsKey(Export.NAMESPACE)) {
// The goog.module never assigns `exports = ...`, so declare `exports` as an object literal.
moduleScope.declare(
"exports"... | java | private void declareExportsInModuleScope(
Module googModule, Node moduleBody, TypedScope moduleScope) {
if (!googModule.namespace().containsKey(Export.NAMESPACE)) {
// The goog.module never assigns `exports = ...`, so declare `exports` as an object literal.
moduleScope.declare(
"exports"... | [
"private",
"void",
"declareExportsInModuleScope",
"(",
"Module",
"googModule",
",",
"Node",
"moduleBody",
",",
"TypedScope",
"moduleScope",
")",
"{",
"if",
"(",
"!",
"googModule",
".",
"namespace",
"(",
")",
".",
"containsKey",
"(",
"Export",
".",
"NAMESPACE",
... | Ensures that the name `exports` is declared in goog.module scope.
<p>If a goog.module explicitly assigns to exports, we want to treat that assignment inside the
scope as if it were a declaration: `const exports = ...`. This method only handles cases where
we want to treat exports as implicitly declared. | [
"Ensures",
"that",
"the",
"name",
"exports",
"is",
"declared",
"in",
"goog",
".",
"module",
"scope",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L479-L490 |
23,866 | google/closure-compiler | src/com/google/javascript/jscomp/TypedScopeCreator.java | TypedScopeCreator.gatherAllProvides | private void gatherAllProvides(Node root) {
if (!processClosurePrimitives) {
return;
}
Node externs = root.getFirstChild();
Node js = root.getSecondChild();
Map<String, ProvidedName> providedNames =
new ProcessClosureProvidesAndRequires(
compiler,
/* pr... | java | private void gatherAllProvides(Node root) {
if (!processClosurePrimitives) {
return;
}
Node externs = root.getFirstChild();
Node js = root.getSecondChild();
Map<String, ProvidedName> providedNames =
new ProcessClosureProvidesAndRequires(
compiler,
/* pr... | [
"private",
"void",
"gatherAllProvides",
"(",
"Node",
"root",
")",
"{",
"if",
"(",
"!",
"processClosurePrimitives",
")",
"{",
"return",
";",
"}",
"Node",
"externs",
"=",
"root",
".",
"getFirstChild",
"(",
")",
";",
"Node",
"js",
"=",
"root",
".",
"getSeco... | Gathers all namespaces created by goog.provide and any definitions in code.
<p>This method does not actually declare anything in the scope. In order to accurately report
redefinition warnings, wait to declare implicit names until the actual goog.provide call.
@param root The global ROOT or a SCRIPT | [
"Gathers",
"all",
"namespaces",
"created",
"by",
"goog",
".",
"provide",
"and",
"any",
"definitions",
"in",
"code",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L518-L549 |
23,867 | google/closure-compiler | src/com/google/javascript/jscomp/TypedScopeCreator.java | TypedScopeCreator.patchGlobalScope | void patchGlobalScope(TypedScope globalScope, Node scriptRoot) {
// Preconditions: This is supposed to be called only on (named) SCRIPT nodes
// and a global typed scope should have been generated already.
checkState(scriptRoot.isScript());
checkNotNull(globalScope);
checkState(globalScope.isGlobal(... | java | void patchGlobalScope(TypedScope globalScope, Node scriptRoot) {
// Preconditions: This is supposed to be called only on (named) SCRIPT nodes
// and a global typed scope should have been generated already.
checkState(scriptRoot.isScript());
checkNotNull(globalScope);
checkState(globalScope.isGlobal(... | [
"void",
"patchGlobalScope",
"(",
"TypedScope",
"globalScope",
",",
"Node",
"scriptRoot",
")",
"{",
"// Preconditions: This is supposed to be called only on (named) SCRIPT nodes",
"// and a global typed scope should have been generated already.",
"checkState",
"(",
"scriptRoot",
".",
... | Patches a given global scope by removing variables previously declared in a script and
re-traversing a new version of that script.
@param globalScope The global scope generated by {@code createScope}.
@param scriptRoot The script that is modified. | [
"Patches",
"a",
"given",
"global",
"scope",
"by",
"removing",
"variables",
"previously",
"declared",
"in",
"a",
"script",
"and",
"re",
"-",
"traversing",
"a",
"new",
"version",
"of",
"that",
"script",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L558-L603 |
23,868 | google/closure-compiler | src/com/google/javascript/jscomp/TypedScopeCreator.java | TypedScopeCreator.setDeferredType | void setDeferredType(Node node, JSType type) {
// Other parts of this pass may read the not-yet-resolved type off the node.
// (like when we set the LHS of an assign with a typed RHS function.)
node.setJSType(type);
deferredSetTypes.add(new DeferredSetType(node, type));
} | java | void setDeferredType(Node node, JSType type) {
// Other parts of this pass may read the not-yet-resolved type off the node.
// (like when we set the LHS of an assign with a typed RHS function.)
node.setJSType(type);
deferredSetTypes.add(new DeferredSetType(node, type));
} | [
"void",
"setDeferredType",
"(",
"Node",
"node",
",",
"JSType",
"type",
")",
"{",
"// Other parts of this pass may read the not-yet-resolved type off the node.",
"// (like when we set the LHS of an assign with a typed RHS function.)",
"node",
".",
"setJSType",
"(",
"type",
")",
";... | Set the type for a node now, and enqueue it to be updated with a resolved type later. | [
"Set",
"the",
"type",
"for",
"a",
"node",
"now",
"and",
"enqueue",
"it",
"to",
"be",
"updated",
"with",
"a",
"resolved",
"type",
"later",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L656-L661 |
23,869 | google/closure-compiler | src/com/google/javascript/jscomp/DefaultNameGenerator.java | DefaultNameGenerator.reserveCharacters | CharPriority[] reserveCharacters(char[] chars, char[] reservedCharacters) {
if (reservedCharacters == null || reservedCharacters.length == 0) {
CharPriority[] result = new CharPriority[chars.length];
for (int i = 0; i < chars.length; i++) {
result[i] = priorityLookupMap.get(chars[i]);
}
... | java | CharPriority[] reserveCharacters(char[] chars, char[] reservedCharacters) {
if (reservedCharacters == null || reservedCharacters.length == 0) {
CharPriority[] result = new CharPriority[chars.length];
for (int i = 0; i < chars.length; i++) {
result[i] = priorityLookupMap.get(chars[i]);
}
... | [
"CharPriority",
"[",
"]",
"reserveCharacters",
"(",
"char",
"[",
"]",
"chars",
",",
"char",
"[",
"]",
"reservedCharacters",
")",
"{",
"if",
"(",
"reservedCharacters",
"==",
"null",
"||",
"reservedCharacters",
".",
"length",
"==",
"0",
")",
"{",
"CharPriority... | Provides the array of available characters based on the specified arrays.
@param chars The list of characters that are legal
@param reservedCharacters The characters that should not be used
@return An array of characters to use. Will return the chars array if
reservedCharacters is null or empty, otherwise creates a new... | [
"Provides",
"the",
"array",
"of",
"available",
"characters",
"based",
"on",
"the",
"specified",
"arrays",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultNameGenerator.java#L222-L241 |
23,870 | google/closure-compiler | src/com/google/javascript/jscomp/DefaultNameGenerator.java | DefaultNameGenerator.checkPrefix | private void checkPrefix(String prefix) {
if (prefix.length() > 0) {
// Make sure that prefix starts with a legal character.
if (!contains(firstChars, prefix.charAt(0))) {
char[] chars = new char[firstChars.length];
for (int i = 0; i < chars.length; i++) {
chars[i] = firstChars... | java | private void checkPrefix(String prefix) {
if (prefix.length() > 0) {
// Make sure that prefix starts with a legal character.
if (!contains(firstChars, prefix.charAt(0))) {
char[] chars = new char[firstChars.length];
for (int i = 0; i < chars.length; i++) {
chars[i] = firstChars... | [
"private",
"void",
"checkPrefix",
"(",
"String",
"prefix",
")",
"{",
"if",
"(",
"prefix",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"// Make sure that prefix starts with a legal character.",
"if",
"(",
"!",
"contains",
"(",
"firstChars",
",",
"prefix",
".",... | Validates a name prefix. | [
"Validates",
"a",
"name",
"prefix",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultNameGenerator.java#L244-L267 |
23,871 | google/closure-compiler | src/com/google/javascript/jscomp/DefaultNameGenerator.java | DefaultNameGenerator.generateNextName | @Override
public String generateNextName() {
String name;
do {
name = prefix;
int i = nameCount;
if (name.isEmpty()) {
int pos = i % firstChars.length;
name = String.valueOf(firstChars[pos].name);
i /= firstChars.length;
}
while (i > 0) {
i--;
... | java | @Override
public String generateNextName() {
String name;
do {
name = prefix;
int i = nameCount;
if (name.isEmpty()) {
int pos = i % firstChars.length;
name = String.valueOf(firstChars[pos].name);
i /= firstChars.length;
}
while (i > 0) {
i--;
... | [
"@",
"Override",
"public",
"String",
"generateNextName",
"(",
")",
"{",
"String",
"name",
";",
"do",
"{",
"name",
"=",
"prefix",
";",
"int",
"i",
"=",
"nameCount",
";",
"if",
"(",
"name",
".",
"isEmpty",
"(",
")",
")",
"{",
"int",
"pos",
"=",
"i",
... | Generates the next short name. | [
"Generates",
"the",
"next",
"short",
"name",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultNameGenerator.java#L281-L307 |
23,872 | google/closure-compiler | src/com/google/javascript/jscomp/CheckMissingReturn.java | CheckMissingReturn.fastAllPathsReturnCheck | private boolean fastAllPathsReturnCheck(ControlFlowGraph<Node> cfg) {
for (DiGraphEdge<Node, Branch> s : cfg.getImplicitReturn().getInEdges()) {
Node n = s.getSource().getValue();
// NOTE(dimvar): it is possible to change ControlFlowAnalysis.java, so
// that the calls that always throw are treated... | java | private boolean fastAllPathsReturnCheck(ControlFlowGraph<Node> cfg) {
for (DiGraphEdge<Node, Branch> s : cfg.getImplicitReturn().getInEdges()) {
Node n = s.getSource().getValue();
// NOTE(dimvar): it is possible to change ControlFlowAnalysis.java, so
// that the calls that always throw are treated... | [
"private",
"boolean",
"fastAllPathsReturnCheck",
"(",
"ControlFlowGraph",
"<",
"Node",
">",
"cfg",
")",
"{",
"for",
"(",
"DiGraphEdge",
"<",
"Node",
",",
"Branch",
">",
"s",
":",
"cfg",
".",
"getImplicitReturn",
"(",
")",
".",
"getInEdges",
"(",
")",
")",
... | Fast check to see if all execution paths contain a return statement.
May spuriously report that a return statement is missing.
@return true if all paths return, converse not necessarily true | [
"Fast",
"check",
"to",
"see",
"if",
"all",
"execution",
"paths",
"contain",
"a",
"return",
"statement",
".",
"May",
"spuriously",
"report",
"that",
"a",
"return",
"statement",
"is",
"missing",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckMissingReturn.java#L140-L151 |
23,873 | google/closure-compiler | src/com/google/javascript/jscomp/CheckMissingReturn.java | CheckMissingReturn.getExplicitReturnTypeIfExpected | @Nullable
private JSType getExplicitReturnTypeIfExpected(Node scopeRoot) {
if (!scopeRoot.isFunction()) {
// Nothing to do in a global/module/block scope.
return null;
}
FunctionType scopeType = JSType.toMaybeFunctionType(scopeRoot.getJSType());
if (scopeType == null) {
return null;... | java | @Nullable
private JSType getExplicitReturnTypeIfExpected(Node scopeRoot) {
if (!scopeRoot.isFunction()) {
// Nothing to do in a global/module/block scope.
return null;
}
FunctionType scopeType = JSType.toMaybeFunctionType(scopeRoot.getJSType());
if (scopeType == null) {
return null;... | [
"@",
"Nullable",
"private",
"JSType",
"getExplicitReturnTypeIfExpected",
"(",
"Node",
"scopeRoot",
")",
"{",
"if",
"(",
"!",
"scopeRoot",
".",
"isFunction",
"(",
")",
")",
"{",
"// Nothing to do in a global/module/block scope.",
"return",
"null",
";",
"}",
"Function... | Determines if the given scope should explicitly return. All functions
with non-void or non-unknown return types must have explicit returns.
Exception: Constructors which specifically specify a return type are
used to allow invocation without requiring the "new" keyword. They
have an implicit return type. See unit test... | [
"Determines",
"if",
"the",
"given",
"scope",
"should",
"explicitly",
"return",
".",
"All",
"functions",
"with",
"non",
"-",
"void",
"or",
"non",
"-",
"unknown",
"return",
"types",
"must",
"have",
"explicit",
"returns",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckMissingReturn.java#L177-L213 |
23,874 | google/closure-compiler | src/com/google/javascript/jscomp/RewriteAsyncIteration.java | RewriteAsyncIteration.convertAsyncGenerator | private void convertAsyncGenerator(NodeTraversal t, Node originalFunction) {
checkNotNull(originalFunction);
checkState(originalFunction.isAsyncGeneratorFunction());
Node asyncGeneratorWrapperRef =
astFactory.createAsyncGeneratorWrapperReference(originalFunction.getJSType(), t.getScope());
Node... | java | private void convertAsyncGenerator(NodeTraversal t, Node originalFunction) {
checkNotNull(originalFunction);
checkState(originalFunction.isAsyncGeneratorFunction());
Node asyncGeneratorWrapperRef =
astFactory.createAsyncGeneratorWrapperReference(originalFunction.getJSType(), t.getScope());
Node... | [
"private",
"void",
"convertAsyncGenerator",
"(",
"NodeTraversal",
"t",
",",
"Node",
"originalFunction",
")",
"{",
"checkNotNull",
"(",
"originalFunction",
")",
";",
"checkState",
"(",
"originalFunction",
".",
"isAsyncGeneratorFunction",
"(",
")",
")",
";",
"Node",
... | Moves the body of an async generator function into a nested generator function and removes the
async and generator props from the original function.
<pre>{@code
async function* foo() {
bar();
}
}</pre>
<p>becomes
<pre>{@code
function foo() {
return new $jscomp.AsyncGeneratorWrapper((function*(){
bar();
})())
}
}</pr... | [
"Moves",
"the",
"body",
"of",
"an",
"async",
"generator",
"function",
"into",
"a",
"nested",
"generator",
"function",
"and",
"removes",
"the",
"async",
"and",
"generator",
"props",
"from",
"the",
"original",
"function",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RewriteAsyncIteration.java#L370-L398 |
23,875 | google/closure-compiler | src/com/google/javascript/jscomp/RewriteAsyncIteration.java | RewriteAsyncIteration.convertAwaitOfAsyncGenerator | private void convertAwaitOfAsyncGenerator(NodeTraversal t, LexicalContext ctx, Node awaitNode) {
checkNotNull(awaitNode);
checkState(awaitNode.isAwait());
checkState(ctx != null && ctx.function != null);
checkState(ctx.function.isAsyncGeneratorFunction());
Node expression = awaitNode.removeFirstChi... | java | private void convertAwaitOfAsyncGenerator(NodeTraversal t, LexicalContext ctx, Node awaitNode) {
checkNotNull(awaitNode);
checkState(awaitNode.isAwait());
checkState(ctx != null && ctx.function != null);
checkState(ctx.function.isAsyncGeneratorFunction());
Node expression = awaitNode.removeFirstChi... | [
"private",
"void",
"convertAwaitOfAsyncGenerator",
"(",
"NodeTraversal",
"t",
",",
"LexicalContext",
"ctx",
",",
"Node",
"awaitNode",
")",
"{",
"checkNotNull",
"(",
"awaitNode",
")",
";",
"checkState",
"(",
"awaitNode",
".",
"isAwait",
"(",
")",
")",
";",
"che... | Converts an await into a yield of an ActionRecord to perform "AWAIT".
<pre>{@code await myPromise}</pre>
<p>becomes
<pre>{@code yield new ActionRecord(ActionEnum.AWAIT_VALUE, myPromise)}</pre>
@param awaitNode the original await Node to be converted | [
"Converts",
"an",
"await",
"into",
"a",
"yield",
"of",
"an",
"ActionRecord",
"to",
"perform",
"AWAIT",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RewriteAsyncIteration.java#L411-L427 |
23,876 | google/closure-compiler | src/com/google/javascript/jscomp/RewriteAsyncIteration.java | RewriteAsyncIteration.convertYieldOfAsyncGenerator | private void convertYieldOfAsyncGenerator(NodeTraversal t, LexicalContext ctx, Node yieldNode) {
checkNotNull(yieldNode);
checkState(yieldNode.isYield());
checkState(ctx != null && ctx.function != null);
checkState(ctx.function.isAsyncGeneratorFunction());
Node expression = yieldNode.removeFirstChi... | java | private void convertYieldOfAsyncGenerator(NodeTraversal t, LexicalContext ctx, Node yieldNode) {
checkNotNull(yieldNode);
checkState(yieldNode.isYield());
checkState(ctx != null && ctx.function != null);
checkState(ctx.function.isAsyncGeneratorFunction());
Node expression = yieldNode.removeFirstChi... | [
"private",
"void",
"convertYieldOfAsyncGenerator",
"(",
"NodeTraversal",
"t",
",",
"LexicalContext",
"ctx",
",",
"Node",
"yieldNode",
")",
"{",
"checkNotNull",
"(",
"yieldNode",
")",
";",
"checkState",
"(",
"yieldNode",
".",
"isYield",
"(",
")",
")",
";",
"che... | Converts a yield into a yield of an ActionRecord to perform "YIELD" or "YIELD_STAR".
<pre>{@code
yield;
yield first;
yield* second;
}</pre>
<p>becomes
<pre>{@code
yield new ActionRecord(ActionEnum.YIELD_VALUE, undefined);
yield new ActionRecord(ActionEnum.YIELD_VALUE, first);
yield new ActionRecord(ActionEnum.YIELD_... | [
"Converts",
"a",
"yield",
"into",
"a",
"yield",
"of",
"an",
"ActionRecord",
"to",
"perform",
"YIELD",
"or",
"YIELD_STAR",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RewriteAsyncIteration.java#L448-L475 |
23,877 | google/closure-compiler | src/com/google/javascript/jscomp/AmbiguateProperties.java | AmbiguateProperties.getIntForType | private int getIntForType(JSType type) {
// Templatized types don't exist at runtime, so collapse to raw type
if (type != null && type.isGenericObjectType()) {
type = type.toMaybeObjectType().getRawType();
}
if (intForType.containsKey(type)) {
return intForType.get(type).intValue();
}
... | java | private int getIntForType(JSType type) {
// Templatized types don't exist at runtime, so collapse to raw type
if (type != null && type.isGenericObjectType()) {
type = type.toMaybeObjectType().getRawType();
}
if (intForType.containsKey(type)) {
return intForType.get(type).intValue();
}
... | [
"private",
"int",
"getIntForType",
"(",
"JSType",
"type",
")",
"{",
"// Templatized types don't exist at runtime, so collapse to raw type",
"if",
"(",
"type",
"!=",
"null",
"&&",
"type",
".",
"isGenericObjectType",
"(",
")",
")",
"{",
"type",
"=",
"type",
".",
"to... | Returns an integer that uniquely identifies a JSType. | [
"Returns",
"an",
"integer",
"that",
"uniquely",
"identifies",
"a",
"JSType",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AmbiguateProperties.java#L165-L176 |
23,878 | google/closure-compiler | src/com/google/javascript/jscomp/AmbiguateProperties.java | AmbiguateProperties.computeRelatedTypesForNonUnionType | @SuppressWarnings("ReferenceEquality")
private void computeRelatedTypesForNonUnionType(JSType type) {
// This method could be expanded to handle union types if necessary, but currently no union
// types are ever passed as input so the method doesn't have logic for union types
checkState(!type.isUnionType(... | java | @SuppressWarnings("ReferenceEquality")
private void computeRelatedTypesForNonUnionType(JSType type) {
// This method could be expanded to handle union types if necessary, but currently no union
// types are ever passed as input so the method doesn't have logic for union types
checkState(!type.isUnionType(... | [
"@",
"SuppressWarnings",
"(",
"\"ReferenceEquality\"",
")",
"private",
"void",
"computeRelatedTypesForNonUnionType",
"(",
"JSType",
"type",
")",
"{",
"// This method could be expanded to handle union types if necessary, but currently no union",
"// types are ever passed as input so the m... | Adds subtypes - and implementors, in the case of interfaces - of the type to its JSTypeBitSet
of related types.
<p>The 'is related to' relationship is best understood graphically. Draw an arrow from each
instance type to the prototype of each of its subclass. Draw an arrow from each prototype to
its instance type. Dra... | [
"Adds",
"subtypes",
"-",
"and",
"implementors",
"in",
"the",
"case",
"of",
"interfaces",
"-",
"of",
"the",
"type",
"to",
"its",
"JSTypeBitSet",
"of",
"related",
"types",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AmbiguateProperties.java#L279-L328 |
23,879 | google/closure-compiler | src/com/google/javascript/jscomp/AmbiguateProperties.java | AmbiguateProperties.addRelatedInstance | private void addRelatedInstance(FunctionType constructor, JSTypeBitSet related) {
checkArgument(constructor.hasInstanceType(),
"Constructor %s without instance type.", constructor);
ObjectType instanceType = constructor.getInstanceType();
addRelatedType(instanceType, related);
} | java | private void addRelatedInstance(FunctionType constructor, JSTypeBitSet related) {
checkArgument(constructor.hasInstanceType(),
"Constructor %s without instance type.", constructor);
ObjectType instanceType = constructor.getInstanceType();
addRelatedType(instanceType, related);
} | [
"private",
"void",
"addRelatedInstance",
"(",
"FunctionType",
"constructor",
",",
"JSTypeBitSet",
"related",
")",
"{",
"checkArgument",
"(",
"constructor",
".",
"hasInstanceType",
"(",
")",
",",
"\"Constructor %s without instance type.\"",
",",
"constructor",
")",
";",
... | Adds the instance of the given constructor, its implicit prototype and all
its related types to the given bit set. | [
"Adds",
"the",
"instance",
"of",
"the",
"given",
"constructor",
"its",
"implicit",
"prototype",
"and",
"all",
"its",
"related",
"types",
"to",
"the",
"given",
"bit",
"set",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AmbiguateProperties.java#L334-L339 |
23,880 | google/closure-compiler | src/com/google/javascript/jscomp/AmbiguateProperties.java | AmbiguateProperties.addRelatedType | private void addRelatedType(JSType type, JSTypeBitSet related) {
computeRelatedTypesForNonUnionType(type);
related.or(relatedBitsets.get(type));
} | java | private void addRelatedType(JSType type, JSTypeBitSet related) {
computeRelatedTypesForNonUnionType(type);
related.or(relatedBitsets.get(type));
} | [
"private",
"void",
"addRelatedType",
"(",
"JSType",
"type",
",",
"JSTypeBitSet",
"related",
")",
"{",
"computeRelatedTypesForNonUnionType",
"(",
"type",
")",
";",
"related",
".",
"or",
"(",
"relatedBitsets",
".",
"get",
"(",
"type",
")",
")",
";",
"}"
] | Adds the given type and all its related types to the given bit set. | [
"Adds",
"the",
"given",
"type",
"and",
"all",
"its",
"related",
"types",
"to",
"the",
"given",
"bit",
"set",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AmbiguateProperties.java#L342-L345 |
23,881 | google/closure-compiler | src/com/google/javascript/jscomp/CheckGlobalNames.java | CheckGlobalNames.checkDescendantNames | private void checkDescendantNames(Name name, boolean nameIsDefined) {
if (name.props != null) {
for (Name prop : name.props) {
// if the ancestor of a property is not defined, then we should emit
// warnings for all references to the property.
boolean propIsDefined = false;
if ... | java | private void checkDescendantNames(Name name, boolean nameIsDefined) {
if (name.props != null) {
for (Name prop : name.props) {
// if the ancestor of a property is not defined, then we should emit
// warnings for all references to the property.
boolean propIsDefined = false;
if ... | [
"private",
"void",
"checkDescendantNames",
"(",
"Name",
"name",
",",
"boolean",
"nameIsDefined",
")",
"{",
"if",
"(",
"name",
".",
"props",
"!=",
"null",
")",
"{",
"for",
"(",
"Name",
"prop",
":",
"name",
".",
"props",
")",
"{",
"// if the ancestor of a pr... | Checks to make sure all the descendants of a name are defined if they
are referenced.
@param name A global name.
@param nameIsDefined If true, {@code name} is defined. Otherwise, it's
undefined, and any references to descendant names should emit warnings. | [
"Checks",
"to",
"make",
"sure",
"all",
"the",
"descendants",
"of",
"a",
"name",
"are",
"defined",
"if",
"they",
"are",
"referenced",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckGlobalNames.java#L132-L150 |
23,882 | google/closure-compiler | src/com/google/javascript/jscomp/CheckGlobalNames.java | CheckGlobalNames.checkForBadModuleReference | private boolean checkForBadModuleReference(Name name, Ref ref) {
JSModuleGraph moduleGraph = compiler.getModuleGraph();
if (name.getGlobalSets() == 0 || ref.type == Ref.Type.SET_FROM_GLOBAL) {
// Back off if either 1) this name was never set, or 2) this reference /is/ a set.
return false;
}
... | java | private boolean checkForBadModuleReference(Name name, Ref ref) {
JSModuleGraph moduleGraph = compiler.getModuleGraph();
if (name.getGlobalSets() == 0 || ref.type == Ref.Type.SET_FROM_GLOBAL) {
// Back off if either 1) this name was never set, or 2) this reference /is/ a set.
return false;
}
... | [
"private",
"boolean",
"checkForBadModuleReference",
"(",
"Name",
"name",
",",
"Ref",
"ref",
")",
"{",
"JSModuleGraph",
"moduleGraph",
"=",
"compiler",
".",
"getModuleGraph",
"(",
")",
";",
"if",
"(",
"name",
".",
"getGlobalSets",
"(",
")",
"==",
"0",
"||",
... | Returns true if this name is potentially referenced before being defined in a different module
<p>For example:
<ul>
<li>Module B depends on Module A. name is set in Module A and referenced in Module B. this is
fine, and this method returns false.
<li>Module A and Module B are unrelated. name is set in Module A and re... | [
"Returns",
"true",
"if",
"this",
"name",
"is",
"potentially",
"referenced",
"before",
"being",
"defined",
"in",
"a",
"different",
"module"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckGlobalNames.java#L229-L249 |
23,883 | google/closure-compiler | src/com/google/javascript/jscomp/CheckGlobalNames.java | CheckGlobalNames.isSetFromPrecedingModule | private static boolean isSetFromPrecedingModule(
Ref originalRef, Ref set, JSModuleGraph moduleGraph) {
return set.type == Ref.Type.SET_FROM_GLOBAL
&& (originalRef.getModule() == set.getModule()
|| moduleGraph.dependsOn(originalRef.getModule(), set.getModule()));
} | java | private static boolean isSetFromPrecedingModule(
Ref originalRef, Ref set, JSModuleGraph moduleGraph) {
return set.type == Ref.Type.SET_FROM_GLOBAL
&& (originalRef.getModule() == set.getModule()
|| moduleGraph.dependsOn(originalRef.getModule(), set.getModule()));
} | [
"private",
"static",
"boolean",
"isSetFromPrecedingModule",
"(",
"Ref",
"originalRef",
",",
"Ref",
"set",
",",
"JSModuleGraph",
"moduleGraph",
")",
"{",
"return",
"set",
".",
"type",
"==",
"Ref",
".",
"Type",
".",
"SET_FROM_GLOBAL",
"&&",
"(",
"originalRef",
"... | Whether the set is in the global scope and occurs in a module the original ref depends on | [
"Whether",
"the",
"set",
"is",
"in",
"the",
"global",
"scope",
"and",
"occurs",
"in",
"a",
"module",
"the",
"original",
"ref",
"depends",
"on"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckGlobalNames.java#L252-L257 |
23,884 | google/closure-compiler | src/com/google/javascript/jscomp/CheckGlobalNames.java | CheckGlobalNames.propertyMustBeInitializedByFullName | private boolean propertyMustBeInitializedByFullName(Name name) {
// If an object or function literal in the global namespace is never
// aliased, then its properties can only come from one of 2 places:
// 1) From its prototype chain, or
// 2) From an assignment to its fully qualified name.
// If we ... | java | private boolean propertyMustBeInitializedByFullName(Name name) {
// If an object or function literal in the global namespace is never
// aliased, then its properties can only come from one of 2 places:
// 1) From its prototype chain, or
// 2) From an assignment to its fully qualified name.
// If we ... | [
"private",
"boolean",
"propertyMustBeInitializedByFullName",
"(",
"Name",
"name",
")",
"{",
"// If an object or function literal in the global namespace is never",
"// aliased, then its properties can only come from one of 2 places:",
"// 1) From its prototype chain, or",
"// 2) From an assign... | The input name is a property. Check whether this property
must be initialized with its full qualified name. | [
"The",
"input",
"name",
"is",
"a",
"property",
".",
"Check",
"whether",
"this",
"property",
"must",
"be",
"initialized",
"with",
"its",
"full",
"qualified",
"name",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckGlobalNames.java#L283-L326 |
23,885 | google/closure-compiler | src/com/google/javascript/jscomp/CheckGlobalNames.java | CheckGlobalNames.hasSuperclass | private boolean hasSuperclass(Name es6Class) {
Node decl = es6Class.getDeclaration().getNode();
Node classNode = NodeUtil.getRValueOfLValue(decl);
checkState(classNode.isClass(), classNode);
Node superclass = classNode.getSecondChild();
return !superclass.isEmpty();
} | java | private boolean hasSuperclass(Name es6Class) {
Node decl = es6Class.getDeclaration().getNode();
Node classNode = NodeUtil.getRValueOfLValue(decl);
checkState(classNode.isClass(), classNode);
Node superclass = classNode.getSecondChild();
return !superclass.isEmpty();
} | [
"private",
"boolean",
"hasSuperclass",
"(",
"Name",
"es6Class",
")",
"{",
"Node",
"decl",
"=",
"es6Class",
".",
"getDeclaration",
"(",
")",
".",
"getNode",
"(",
")",
";",
"Node",
"classNode",
"=",
"NodeUtil",
".",
"getRValueOfLValue",
"(",
"decl",
")",
";"... | Returns whether the given ES6 class extends something. | [
"Returns",
"whether",
"the",
"given",
"ES6",
"class",
"extends",
"something",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckGlobalNames.java#L329-L336 |
23,886 | google/closure-compiler | src/com/google/javascript/jscomp/ModuleImportResolver.java | ModuleImportResolver.getClosureNamespaceTypeFromCall | ScopedName getClosureNamespaceTypeFromCall(Node googRequire) {
if (moduleMap == null) {
// TODO(b/124919359): make sure all tests have generated a ModuleMap
return null;
}
String moduleId = googRequire.getSecondChild().getString();
Module module = moduleMap.getClosureModule(moduleId);
if... | java | ScopedName getClosureNamespaceTypeFromCall(Node googRequire) {
if (moduleMap == null) {
// TODO(b/124919359): make sure all tests have generated a ModuleMap
return null;
}
String moduleId = googRequire.getSecondChild().getString();
Module module = moduleMap.getClosureModule(moduleId);
if... | [
"ScopedName",
"getClosureNamespaceTypeFromCall",
"(",
"Node",
"googRequire",
")",
"{",
"if",
"(",
"moduleMap",
"==",
"null",
")",
"{",
"// TODO(b/124919359): make sure all tests have generated a ModuleMap",
"return",
"null",
";",
"}",
"String",
"moduleId",
"=",
"googRequi... | Attempts to look up the type of a Closure namespace from a require call
<p>This returns null if the given {@link ModuleMap} is null, if the required module does not
exist, or if support is missing for the type of required {@link Module}. Currently only
requires of other goog.modules are supported.
@param googRequire ... | [
"Attempts",
"to",
"look",
"up",
"the",
"type",
"of",
"a",
"Closure",
"namespace",
"from",
"a",
"require",
"call"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ModuleImportResolver.java#L68-L102 |
23,887 | google/closure-compiler | src/com/google/javascript/jscomp/TemplateAstMatcher.java | TemplateAstMatcher.initTemplate | private Node initTemplate(Node templateFunctionNode) {
Node prepped = templateFunctionNode.cloneTree();
prepTemplatePlaceholders(prepped);
Node body = prepped.getLastChild();
Node startNode;
if (body.hasOneChild() && body.getFirstChild().isExprResult()) {
// When matching an expression, don't... | java | private Node initTemplate(Node templateFunctionNode) {
Node prepped = templateFunctionNode.cloneTree();
prepTemplatePlaceholders(prepped);
Node body = prepped.getLastChild();
Node startNode;
if (body.hasOneChild() && body.getFirstChild().isExprResult()) {
// When matching an expression, don't... | [
"private",
"Node",
"initTemplate",
"(",
"Node",
"templateFunctionNode",
")",
"{",
"Node",
"prepped",
"=",
"templateFunctionNode",
".",
"cloneTree",
"(",
")",
";",
"prepTemplatePlaceholders",
"(",
"prepped",
")",
";",
"Node",
"body",
"=",
"prepped",
".",
"getLast... | Prepare an template AST to use when performing matches.
@param templateFunctionNode The template declaration function to extract
the template AST from.
@return The first node of the template AST sequence to use when matching. | [
"Prepare",
"an",
"template",
"AST",
"to",
"use",
"when",
"performing",
"matches",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TemplateAstMatcher.java#L167-L191 |
23,888 | google/closure-compiler | src/com/google/javascript/jscomp/TemplateAstMatcher.java | TemplateAstMatcher.prepTemplatePlaceholders | private void prepTemplatePlaceholders(Node fn) {
final List<String> locals = templateLocals;
final List<String> params = templateParams;
final Map<String, JSType> paramTypes = new HashMap<>();
// drop the function name so it isn't include in the name maps
String fnName = fn.getFirstChild().getStrin... | java | private void prepTemplatePlaceholders(Node fn) {
final List<String> locals = templateLocals;
final List<String> params = templateParams;
final Map<String, JSType> paramTypes = new HashMap<>();
// drop the function name so it isn't include in the name maps
String fnName = fn.getFirstChild().getStrin... | [
"private",
"void",
"prepTemplatePlaceholders",
"(",
"Node",
"fn",
")",
"{",
"final",
"List",
"<",
"String",
">",
"locals",
"=",
"templateLocals",
";",
"final",
"List",
"<",
"String",
">",
"params",
"=",
"templateParams",
";",
"final",
"Map",
"<",
"String",
... | Build parameter and local information for the template and replace
the references in the template 'fn' with placeholder nodes use to
facility matching. | [
"Build",
"parameter",
"and",
"local",
"information",
"for",
"the",
"template",
"and",
"replace",
"the",
"references",
"in",
"the",
"template",
"fn",
"with",
"placeholder",
"nodes",
"use",
"to",
"facility",
"matching",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TemplateAstMatcher.java#L198-L251 |
23,889 | google/closure-compiler | src/com/google/javascript/jscomp/TemplateAstMatcher.java | TemplateAstMatcher.createTemplateParameterNode | private Node createTemplateParameterNode(int index, JSType type, boolean isStringLiteral) {
checkState(index >= 0);
checkNotNull(type);
Node n = Node.newNumber(index);
if (isStringLiteral) {
n.setToken(TEMPLATE_STRING_LITERAL);
} else {
n.setToken(TEMPLATE_TYPE_PARAM);
}
n.setJST... | java | private Node createTemplateParameterNode(int index, JSType type, boolean isStringLiteral) {
checkState(index >= 0);
checkNotNull(type);
Node n = Node.newNumber(index);
if (isStringLiteral) {
n.setToken(TEMPLATE_STRING_LITERAL);
} else {
n.setToken(TEMPLATE_TYPE_PARAM);
}
n.setJST... | [
"private",
"Node",
"createTemplateParameterNode",
"(",
"int",
"index",
",",
"JSType",
"type",
",",
"boolean",
"isStringLiteral",
")",
"{",
"checkState",
"(",
"index",
">=",
"0",
")",
";",
"checkNotNull",
"(",
"type",
")",
";",
"Node",
"n",
"=",
"Node",
"."... | Creates a template parameter or string literal template node. | [
"Creates",
"a",
"template",
"parameter",
"or",
"string",
"literal",
"template",
"node",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TemplateAstMatcher.java#L293-L304 |
23,890 | google/closure-compiler | src/com/google/javascript/jscomp/TemplateAstMatcher.java | TemplateAstMatcher.matchesTemplateShape | private boolean matchesTemplateShape(Node template, Node ast) {
while (template != null) {
if (ast == null || !matchesNodeShape(template, ast)) {
return false;
}
template = template.getNext();
ast = ast.getNext();
}
return true;
} | java | private boolean matchesTemplateShape(Node template, Node ast) {
while (template != null) {
if (ast == null || !matchesNodeShape(template, ast)) {
return false;
}
template = template.getNext();
ast = ast.getNext();
}
return true;
} | [
"private",
"boolean",
"matchesTemplateShape",
"(",
"Node",
"template",
",",
"Node",
"ast",
")",
"{",
"while",
"(",
"template",
"!=",
"null",
")",
"{",
"if",
"(",
"ast",
"==",
"null",
"||",
"!",
"matchesNodeShape",
"(",
"template",
",",
"ast",
")",
")",
... | Returns whether the template matches an AST structure node starting with
node, taking into account the template parameters that were provided to
this matcher.
Here only the template shape is checked, template local declarations and
parameters are checked later. | [
"Returns",
"whether",
"the",
"template",
"matches",
"an",
"AST",
"structure",
"node",
"starting",
"with",
"node",
"taking",
"into",
"account",
"the",
"template",
"parameters",
"that",
"were",
"provided",
"to",
"this",
"matcher",
".",
"Here",
"only",
"the",
"te... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TemplateAstMatcher.java#L324-L333 |
23,891 | google/closure-compiler | src/com/google/javascript/jscomp/TemplateAstMatcher.java | TemplateAstMatcher.matchesNode | private boolean matchesNode(Node template, Node ast) {
if (isTemplateParameterNode(template)) {
int paramIndex = (int) (template.getDouble());
Node previousMatch = paramNodeMatches.get(paramIndex);
if (previousMatch != null) {
// If this named node has already been matched against, make su... | java | private boolean matchesNode(Node template, Node ast) {
if (isTemplateParameterNode(template)) {
int paramIndex = (int) (template.getDouble());
Node previousMatch = paramNodeMatches.get(paramIndex);
if (previousMatch != null) {
// If this named node has already been matched against, make su... | [
"private",
"boolean",
"matchesNode",
"(",
"Node",
"template",
",",
"Node",
"ast",
")",
"{",
"if",
"(",
"isTemplateParameterNode",
"(",
"template",
")",
")",
"{",
"int",
"paramIndex",
"=",
"(",
"int",
")",
"(",
"template",
".",
"getDouble",
"(",
")",
")",... | Returns whether two nodes are equivalent, taking into account the template parameters that were
provided to this matcher. If the template comparison node is a parameter node, then only the
types of the node must match. If the template node is a string literal, only match string
literals. Otherwise, the node must be equ... | [
"Returns",
"whether",
"two",
"nodes",
"are",
"equivalent",
"taking",
"into",
"account",
"the",
"template",
"parameters",
"that",
"were",
"provided",
"to",
"this",
"matcher",
".",
"If",
"the",
"template",
"comparison",
"node",
"is",
"a",
"parameter",
"node",
"t... | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TemplateAstMatcher.java#L391-L476 |
23,892 | google/closure-compiler | src/com/google/javascript/rhino/jstype/PrototypeObjectType.java | PrototypeObjectType.hasOverriddenNativeProperty | private boolean hasOverriddenNativeProperty(String propertyName) {
if (isNativeObjectType()) {
return false;
}
JSType propertyType = getPropertyType(propertyName);
ObjectType nativeType =
isFunctionType()
? registry.getNativeObjectType(JSTypeNative.FUNCTION_PROTOTYPE)
... | java | private boolean hasOverriddenNativeProperty(String propertyName) {
if (isNativeObjectType()) {
return false;
}
JSType propertyType = getPropertyType(propertyName);
ObjectType nativeType =
isFunctionType()
? registry.getNativeObjectType(JSTypeNative.FUNCTION_PROTOTYPE)
... | [
"private",
"boolean",
"hasOverriddenNativeProperty",
"(",
"String",
"propertyName",
")",
"{",
"if",
"(",
"isNativeObjectType",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"JSType",
"propertyType",
"=",
"getPropertyType",
"(",
"propertyName",
")",
";",
"Obje... | Given the name of a native object property, checks whether the property is
present on the object and different from the native one. | [
"Given",
"the",
"name",
"of",
"a",
"native",
"object",
"property",
"checks",
"whether",
"the",
"property",
"is",
"present",
"on",
"the",
"object",
"and",
"different",
"from",
"the",
"native",
"one",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/PrototypeObjectType.java#L247-L259 |
23,893 | google/closure-compiler | src/com/google/javascript/rhino/jstype/PrototypeObjectType.java | PrototypeObjectType.isSubtype | private static boolean isSubtype(
ObjectType typeA,
RecordType typeB,
ImplCache implicitImplCache,
SubtypingMode subtypingMode) {
MatchStatus cached = implicitImplCache.checkCache(typeA, typeB);
if (cached != null) {
return cached.subtypeValue();
}
boolean result =
... | java | private static boolean isSubtype(
ObjectType typeA,
RecordType typeB,
ImplCache implicitImplCache,
SubtypingMode subtypingMode) {
MatchStatus cached = implicitImplCache.checkCache(typeA, typeB);
if (cached != null) {
return cached.subtypeValue();
}
boolean result =
... | [
"private",
"static",
"boolean",
"isSubtype",
"(",
"ObjectType",
"typeA",
",",
"RecordType",
"typeB",
",",
"ImplCache",
"implicitImplCache",
",",
"SubtypingMode",
"subtypingMode",
")",
"{",
"MatchStatus",
"cached",
"=",
"implicitImplCache",
".",
"checkCache",
"(",
"t... | Determines if typeA is a subtype of typeB | [
"Determines",
"if",
"typeA",
"is",
"a",
"subtype",
"of",
"typeB"
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/PrototypeObjectType.java#L433-L448 |
23,894 | google/closure-compiler | src/com/google/javascript/jscomp/SourceMapInput.java | SourceMapInput.getSourceMap | public synchronized @Nullable SourceMapConsumerV3 getSourceMap(ErrorManager errorManager) {
if (!cached) {
// Avoid re-reading or reparsing files.
cached = true;
String sourceMapPath = sourceFile.getOriginalPath();
try {
String sourceMapContents = sourceFile.getCode();
Source... | java | public synchronized @Nullable SourceMapConsumerV3 getSourceMap(ErrorManager errorManager) {
if (!cached) {
// Avoid re-reading or reparsing files.
cached = true;
String sourceMapPath = sourceFile.getOriginalPath();
try {
String sourceMapContents = sourceFile.getCode();
Source... | [
"public",
"synchronized",
"@",
"Nullable",
"SourceMapConsumerV3",
"getSourceMap",
"(",
"ErrorManager",
"errorManager",
")",
"{",
"if",
"(",
"!",
"cached",
")",
"{",
"// Avoid re-reading or reparsing files.",
"cached",
"=",
"true",
";",
"String",
"sourceMapPath",
"=",
... | Gets the source map, reading from disk and parsing if necessary. Returns null if the sourcemap
cannot be resolved or is malformed. | [
"Gets",
"the",
"source",
"map",
"reading",
"from",
"disk",
"and",
"parsing",
"if",
"necessary",
".",
"Returns",
"null",
"if",
"the",
"sourcemap",
"cannot",
"be",
"resolved",
"or",
"is",
"malformed",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SourceMapInput.java#L50-L71 |
23,895 | google/closure-compiler | src/com/google/javascript/jscomp/RemoveUnusedPolyfills.java | RemoveUnusedPolyfills.getLastPartOfQualifiedName | private static String getLastPartOfQualifiedName(Node n) {
if (n.isName()) {
return n.getString();
} else if (n.isGetProp()) {
return n.getLastChild().getString();
}
return null;
} | java | private static String getLastPartOfQualifiedName(Node n) {
if (n.isName()) {
return n.getString();
} else if (n.isGetProp()) {
return n.getLastChild().getString();
}
return null;
} | [
"private",
"static",
"String",
"getLastPartOfQualifiedName",
"(",
"Node",
"n",
")",
"{",
"if",
"(",
"n",
".",
"isName",
"(",
")",
")",
"{",
"return",
"n",
".",
"getString",
"(",
")",
";",
"}",
"else",
"if",
"(",
"n",
".",
"isGetProp",
"(",
")",
")"... | or null for 'this' and 'super'. | [
"or",
"null",
"for",
"this",
"and",
"super",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RemoveUnusedPolyfills.java#L222-L229 |
23,896 | google/closure-compiler | src/com/google/javascript/jscomp/CrossChunkCodeMotion.java | CrossChunkCodeMotion.moveGlobalSymbols | private void moveGlobalSymbols(Collection<GlobalSymbol> globalSymbols) {
for (GlobalSymbolCycle globalSymbolCycle :
new OrderAndCombineGlobalSymbols(globalSymbols).orderAndCombine()) {
// Symbols whose declarations refer to each other must be grouped together and their
// declaration statements ... | java | private void moveGlobalSymbols(Collection<GlobalSymbol> globalSymbols) {
for (GlobalSymbolCycle globalSymbolCycle :
new OrderAndCombineGlobalSymbols(globalSymbols).orderAndCombine()) {
// Symbols whose declarations refer to each other must be grouped together and their
// declaration statements ... | [
"private",
"void",
"moveGlobalSymbols",
"(",
"Collection",
"<",
"GlobalSymbol",
">",
"globalSymbols",
")",
"{",
"for",
"(",
"GlobalSymbolCycle",
"globalSymbolCycle",
":",
"new",
"OrderAndCombineGlobalSymbols",
"(",
"globalSymbols",
")",
".",
"orderAndCombine",
"(",
")... | Moves all of the declaration statements that can move to their best possible chunk location. | [
"Moves",
"all",
"of",
"the",
"declaration",
"statements",
"that",
"can",
"move",
"to",
"their",
"best",
"possible",
"chunk",
"location",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CrossChunkCodeMotion.java#L214-L221 |
23,897 | google/closure-compiler | src/com/google/javascript/refactoring/RefasterJsScanner.java | RefasterJsScanner.loadRefasterJsTemplate | public void loadRefasterJsTemplate(String refasterjsTemplate) throws IOException {
checkState(
templateJs == null, "Can't load RefasterJs template since a template is already loaded.");
this.templateJs =
Thread.currentThread().getContextClassLoader().getResource(refasterjsTemplate) != null
... | java | public void loadRefasterJsTemplate(String refasterjsTemplate) throws IOException {
checkState(
templateJs == null, "Can't load RefasterJs template since a template is already loaded.");
this.templateJs =
Thread.currentThread().getContextClassLoader().getResource(refasterjsTemplate) != null
... | [
"public",
"void",
"loadRefasterJsTemplate",
"(",
"String",
"refasterjsTemplate",
")",
"throws",
"IOException",
"{",
"checkState",
"(",
"templateJs",
"==",
"null",
",",
"\"Can't load RefasterJs template since a template is already loaded.\"",
")",
";",
"this",
".",
"template... | Loads the RefasterJs template. This must be called before the scanner is used. | [
"Loads",
"the",
"RefasterJs",
"template",
".",
"This",
"must",
"be",
"called",
"before",
"the",
"scanner",
"is",
"used",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/RefasterJsScanner.java#L85-L92 |
23,898 | google/closure-compiler | src/com/google/javascript/refactoring/RefasterJsScanner.java | RefasterJsScanner.transformNode | private Node transformNode(
Node templateNode,
Map<String, Node> templateNodeToMatchMap,
Map<String, String> shortNames) {
Node clone = templateNode.cloneNode();
if (templateNode.isName()) {
String name = templateNode.getString();
if (templateNodeToMatchMap.containsKey(name)) {
... | java | private Node transformNode(
Node templateNode,
Map<String, Node> templateNodeToMatchMap,
Map<String, String> shortNames) {
Node clone = templateNode.cloneNode();
if (templateNode.isName()) {
String name = templateNode.getString();
if (templateNodeToMatchMap.containsKey(name)) {
... | [
"private",
"Node",
"transformNode",
"(",
"Node",
"templateNode",
",",
"Map",
"<",
"String",
",",
"Node",
">",
"templateNodeToMatchMap",
",",
"Map",
"<",
"String",
",",
"String",
">",
"shortNames",
")",
"{",
"Node",
"clone",
"=",
"templateNode",
".",
"cloneNo... | Transforms the template node to a replacement node by mapping the template names to the ones
that were matched against in the JsSourceMatcher. | [
"Transforms",
"the",
"template",
"node",
"to",
"a",
"replacement",
"node",
"by",
"mapping",
"the",
"template",
"names",
"to",
"the",
"ones",
"that",
"were",
"matched",
"against",
"in",
"the",
"JsSourceMatcher",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/RefasterJsScanner.java#L209-L251 |
23,899 | google/closure-compiler | src/com/google/javascript/rhino/jstype/RecordTypeBuilder.java | RecordTypeBuilder.build | public JSType build() {
// If we have an empty record, simply return the object type.
if (isEmpty) {
return registry.getNativeObjectType(JSTypeNative.OBJECT_TYPE);
}
ImmutableSortedMap.Builder<String, RecordProperty> m = ImmutableSortedMap.naturalOrder();
m.putAll(this.properties);
retur... | java | public JSType build() {
// If we have an empty record, simply return the object type.
if (isEmpty) {
return registry.getNativeObjectType(JSTypeNative.OBJECT_TYPE);
}
ImmutableSortedMap.Builder<String, RecordProperty> m = ImmutableSortedMap.naturalOrder();
m.putAll(this.properties);
retur... | [
"public",
"JSType",
"build",
"(",
")",
"{",
"// If we have an empty record, simply return the object type.",
"if",
"(",
"isEmpty",
")",
"{",
"return",
"registry",
".",
"getNativeObjectType",
"(",
"JSTypeNative",
".",
"OBJECT_TYPE",
")",
";",
"}",
"ImmutableSortedMap",
... | Creates a record. Fails if any duplicate property names were added.
@return The record type. | [
"Creates",
"a",
"record",
".",
"Fails",
"if",
"any",
"duplicate",
"property",
"names",
"were",
"added",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/RecordTypeBuilder.java#L85-L93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.