id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
24,000
google/closure-compiler
src/com/google/javascript/jscomp/JSModule.java
JSModule.addAfter
public void addAfter(CompilerInput input, CompilerInput other) { checkState(inputs.contains(other)); inputs.add(inputs.indexOf(other), input); input.setModule(this); }
java
public void addAfter(CompilerInput input, CompilerInput other) { checkState(inputs.contains(other)); inputs.add(inputs.indexOf(other), input); input.setModule(this); }
[ "public", "void", "addAfter", "(", "CompilerInput", "input", ",", "CompilerInput", "other", ")", "{", "checkState", "(", "inputs", ".", "contains", "(", "other", ")", ")", ";", "inputs", ".", "add", "(", "inputs", ".", "indexOf", "(", "other", ")", ",", ...
Adds a source code input to this module directly after other.
[ "Adds", "a", "source", "code", "input", "to", "this", "module", "directly", "after", "other", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModule.java#L165-L169
24,001
google/closure-compiler
src/com/google/javascript/jscomp/JSModule.java
JSModule.addDependency
public void addDependency(JSModule dep) { checkNotNull(dep); Preconditions.checkState(dep != this, "Cannot add dependency on self", this); deps.add(dep); }
java
public void addDependency(JSModule dep) { checkNotNull(dep); Preconditions.checkState(dep != this, "Cannot add dependency on self", this); deps.add(dep); }
[ "public", "void", "addDependency", "(", "JSModule", "dep", ")", "{", "checkNotNull", "(", "dep", ")", ";", "Preconditions", ".", "checkState", "(", "dep", "!=", "this", ",", "\"Cannot add dependency on self\"", ",", "this", ")", ";", "deps", ".", "add", "(",...
Adds a dependency on another module.
[ "Adds", "a", "dependency", "on", "another", "module", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModule.java#L172-L176
24,002
google/closure-compiler
src/com/google/javascript/jscomp/JSModule.java
JSModule.getSortedDependencyNames
List<String> getSortedDependencyNames() { List<String> names = new ArrayList<>(); for (JSModule module : getDependencies()) { names.add(module.getName()); } Collections.sort(names); return names; }
java
List<String> getSortedDependencyNames() { List<String> names = new ArrayList<>(); for (JSModule module : getDependencies()) { names.add(module.getName()); } Collections.sort(names); return names; }
[ "List", "<", "String", ">", "getSortedDependencyNames", "(", ")", "{", "List", "<", "String", ">", "names", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "JSModule", "module", ":", "getDependencies", "(", ")", ")", "{", "names", ".", "add",...
Gets the names of the modules that this module depends on, sorted alphabetically.
[ "Gets", "the", "names", "of", "the", "modules", "that", "this", "module", "depends", "on", "sorted", "alphabetically", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModule.java#L205-L212
24,003
google/closure-compiler
src/com/google/javascript/jscomp/JSModule.java
JSModule.getAllDependencies
public Set<JSModule> getAllDependencies() { // JSModule uses identity semantics Set<JSModule> allDeps = Sets.newIdentityHashSet(); allDeps.addAll(deps); ArrayDeque<JSModule> stack = new ArrayDeque<>(deps); while (!stack.isEmpty()) { JSModule module = stack.pop(); List<JSModule> moduleDe...
java
public Set<JSModule> getAllDependencies() { // JSModule uses identity semantics Set<JSModule> allDeps = Sets.newIdentityHashSet(); allDeps.addAll(deps); ArrayDeque<JSModule> stack = new ArrayDeque<>(deps); while (!stack.isEmpty()) { JSModule module = stack.pop(); List<JSModule> moduleDe...
[ "public", "Set", "<", "JSModule", ">", "getAllDependencies", "(", ")", "{", "// JSModule uses identity semantics", "Set", "<", "JSModule", ">", "allDeps", "=", "Sets", ".", "newIdentityHashSet", "(", ")", ";", "allDeps", ".", "addAll", "(", "deps", ")", ";", ...
Returns the transitive closure of dependencies starting from the dependencies of this module.
[ "Returns", "the", "transitive", "closure", "of", "dependencies", "starting", "from", "the", "dependencies", "of", "this", "module", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModule.java#L218-L234
24,004
google/closure-compiler
src/com/google/javascript/jscomp/JSModule.java
JSModule.getThisAndAllDependencies
public Set<JSModule> getThisAndAllDependencies() { Set<JSModule> deps = getAllDependencies(); deps.add(this); return deps; }
java
public Set<JSModule> getThisAndAllDependencies() { Set<JSModule> deps = getAllDependencies(); deps.add(this); return deps; }
[ "public", "Set", "<", "JSModule", ">", "getThisAndAllDependencies", "(", ")", "{", "Set", "<", "JSModule", ">", "deps", "=", "getAllDependencies", "(", ")", ";", "deps", ".", "add", "(", "this", ")", ";", "return", "deps", ";", "}" ]
Returns this module and all of its dependencies in one list.
[ "Returns", "this", "module", "and", "all", "of", "its", "dependencies", "in", "one", "list", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModule.java#L237-L241
24,005
google/closure-compiler
src/com/google/javascript/jscomp/JSModule.java
JSModule.getByName
public CompilerInput getByName(String name) { for (CompilerInput input : inputs) { if (name.equals(input.getName())) { return input; } } return null; }
java
public CompilerInput getByName(String name) { for (CompilerInput input : inputs) { if (name.equals(input.getName())) { return input; } } return null; }
[ "public", "CompilerInput", "getByName", "(", "String", "name", ")", "{", "for", "(", "CompilerInput", "input", ":", "inputs", ")", "{", "if", "(", "name", ".", "equals", "(", "input", ".", "getName", "(", ")", ")", ")", "{", "return", "input", ";", "...
Returns the input with the given name or null if none.
[ "Returns", "the", "input", "with", "the", "given", "name", "or", "null", "if", "none", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModule.java#L263-L270
24,006
google/closure-compiler
src/com/google/javascript/jscomp/JSModule.java
JSModule.removeByName
public boolean removeByName(String name) { boolean found = false; Iterator<CompilerInput> iter = inputs.iterator(); while (iter.hasNext()) { CompilerInput file = iter.next(); if (name.equals(file.getName())) { iter.remove(); file.setModule(null); found = true; } ...
java
public boolean removeByName(String name) { boolean found = false; Iterator<CompilerInput> iter = inputs.iterator(); while (iter.hasNext()) { CompilerInput file = iter.next(); if (name.equals(file.getName())) { iter.remove(); file.setModule(null); found = true; } ...
[ "public", "boolean", "removeByName", "(", "String", "name", ")", "{", "boolean", "found", "=", "false", ";", "Iterator", "<", "CompilerInput", ">", "iter", "=", "inputs", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", "...
Removes any input with the given name. Returns whether any were removed.
[ "Removes", "any", "input", "with", "the", "given", "name", ".", "Returns", "whether", "any", "were", "removed", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModule.java#L275-L287
24,007
google/closure-compiler
src/com/google/javascript/jscomp/JSModule.java
JSModule.sortInputsByDeps
public void sortInputsByDeps(AbstractCompiler compiler) { // Set the compiler, so that we can parse requires/provides and report // errors properly. for (CompilerInput input : inputs) { input.setCompiler(compiler); } // Sort the JSModule in this order. List<CompilerInput> sortedList = new...
java
public void sortInputsByDeps(AbstractCompiler compiler) { // Set the compiler, so that we can parse requires/provides and report // errors properly. for (CompilerInput input : inputs) { input.setCompiler(compiler); } // Sort the JSModule in this order. List<CompilerInput> sortedList = new...
[ "public", "void", "sortInputsByDeps", "(", "AbstractCompiler", "compiler", ")", "{", "// Set the compiler, so that we can parse requires/provides and report", "// errors properly.", "for", "(", "CompilerInput", "input", ":", "inputs", ")", "{", "input", ".", "setCompiler", ...
Puts the JS files into a topologically sorted order by their dependencies.
[ "Puts", "the", "JS", "files", "into", "a", "topologically", "sorted", "order", "by", "their", "dependencies", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModule.java#L306-L317
24,008
google/closure-compiler
src/com/google/javascript/jscomp/OptimizeArgumentsArray.java
OptimizeArgumentsArray.tryReplaceArguments
private void tryReplaceArguments(Scope scope) { // Find the number of parameters that can be accessed without using `arguments`. Node parametersList = NodeUtil.getFunctionParameters(scope.getRootNode()); checkState(parametersList.isParamList(), parametersList); int numParameters = parametersList.getChil...
java
private void tryReplaceArguments(Scope scope) { // Find the number of parameters that can be accessed without using `arguments`. Node parametersList = NodeUtil.getFunctionParameters(scope.getRootNode()); checkState(parametersList.isParamList(), parametersList); int numParameters = parametersList.getChil...
[ "private", "void", "tryReplaceArguments", "(", "Scope", "scope", ")", "{", "// Find the number of parameters that can be accessed without using `arguments`.", "Node", "parametersList", "=", "NodeUtil", ".", "getFunctionParameters", "(", "scope", ".", "getRootNode", "(", ")", ...
Tries to optimize all the arguments array access in this scope by assigning a name to each element. @param scope scope of the function
[ "Tries", "to", "optimize", "all", "the", "arguments", "array", "access", "in", "this", "scope", "by", "assigning", "a", "name", "to", "each", "element", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/OptimizeArgumentsArray.java#L151-L168
24,009
google/closure-compiler
src/com/google/javascript/jscomp/OptimizeArgumentsArray.java
OptimizeArgumentsArray.getHighestIndex
private int getHighestIndex(int highestIndex) { for (Node ref : currentArgumentsAccesses) { Node getElem = ref.getParent(); // Bail on anything but argument[c] access where c is a constant. // TODO(user): We might not need to bail out all the time, there might // be more cases that we can ...
java
private int getHighestIndex(int highestIndex) { for (Node ref : currentArgumentsAccesses) { Node getElem = ref.getParent(); // Bail on anything but argument[c] access where c is a constant. // TODO(user): We might not need to bail out all the time, there might // be more cases that we can ...
[ "private", "int", "getHighestIndex", "(", "int", "highestIndex", ")", "{", "for", "(", "Node", "ref", ":", "currentArgumentsAccesses", ")", "{", "Node", "getElem", "=", "ref", ".", "getParent", "(", ")", ";", "// Bail on anything but argument[c] access where c is a ...
Iterate through all the references to arguments array in the function to determine the real highestIndex. Returns -1 when we should not be replacing any arguments for this scope - we should exit tryReplaceArguments @param highestIndex highest index that has been accessed from the arguments array
[ "Iterate", "through", "all", "the", "references", "to", "arguments", "array", "in", "the", "function", "to", "determine", "the", "real", "highestIndex", ".", "Returns", "-", "1", "when", "we", "should", "not", "be", "replacing", "any", "arguments", "for", "t...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/OptimizeArgumentsArray.java#L177-L223
24,010
google/closure-compiler
src/com/google/javascript/jscomp/OptimizeArgumentsArray.java
OptimizeArgumentsArray.changeMethodSignature
private void changeMethodSignature(ImmutableSortedMap<Integer, String> argNames, Node paramList) { ImmutableSortedMap<Integer, String> newParams = argNames.tailMap(paramList.getChildCount()); for (String name : newParams.values()) { paramList.addChildToBack(IR.name(name).useSourceInfoIfMissingFrom(paramLi...
java
private void changeMethodSignature(ImmutableSortedMap<Integer, String> argNames, Node paramList) { ImmutableSortedMap<Integer, String> newParams = argNames.tailMap(paramList.getChildCount()); for (String name : newParams.values()) { paramList.addChildToBack(IR.name(name).useSourceInfoIfMissingFrom(paramLi...
[ "private", "void", "changeMethodSignature", "(", "ImmutableSortedMap", "<", "Integer", ",", "String", ">", "argNames", ",", "Node", "paramList", ")", "{", "ImmutableSortedMap", "<", "Integer", ",", "String", ">", "newParams", "=", "argNames", ".", "tailMap", "("...
Inserts new formal parameters into the method's signature based on the given set of names. <p>Example: function() --> function(r0, r1, r2) @param argNames maps param index to param name, if the param with that index has a name. @param paramList node representing the function signature
[ "Inserts", "new", "formal", "parameters", "into", "the", "method", "s", "signature", "based", "on", "the", "given", "set", "of", "names", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/OptimizeArgumentsArray.java#L233-L241
24,011
google/closure-compiler
src/com/google/javascript/jscomp/parsing/parser/Scanner.java
Scanner.skipWhitespace
private boolean skipWhitespace() { boolean foundLineTerminator = false; while (!isAtEnd() && peekWhitespace()) { if (isLineTerminator(nextChar())) { foundLineTerminator = true; } } return foundLineTerminator; }
java
private boolean skipWhitespace() { boolean foundLineTerminator = false; while (!isAtEnd() && peekWhitespace()) { if (isLineTerminator(nextChar())) { foundLineTerminator = true; } } return foundLineTerminator; }
[ "private", "boolean", "skipWhitespace", "(", ")", "{", "boolean", "foundLineTerminator", "=", "false", ";", "while", "(", "!", "isAtEnd", "(", ")", "&&", "peekWhitespace", "(", ")", ")", "{", "if", "(", "isLineTerminator", "(", "nextChar", "(", ")", ")", ...
Returns true if the whitespace that was skipped included any line terminators.
[ "Returns", "true", "if", "the", "whitespace", "that", "was", "skipped", "included", "any", "line", "terminators", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/parser/Scanner.java#L270-L278
24,012
google/closure-compiler
src/com/google/javascript/jscomp/parsing/parser/Scanner.java
Scanner.processUnicodeEscapes
private static String processUnicodeEscapes(String value) { while (value.contains("\\")) { int escapeStart = value.indexOf('\\'); try { if (value.charAt(escapeStart + 1) != 'u') { return null; } String hexDigits; int escapeEnd; if (value.charAt(escapeSt...
java
private static String processUnicodeEscapes(String value) { while (value.contains("\\")) { int escapeStart = value.indexOf('\\'); try { if (value.charAt(escapeStart + 1) != 'u') { return null; } String hexDigits; int escapeEnd; if (value.charAt(escapeSt...
[ "private", "static", "String", "processUnicodeEscapes", "(", "String", "value", ")", "{", "while", "(", "value", ".", "contains", "(", "\"\\\\\"", ")", ")", "{", "int", "escapeStart", "=", "value", ".", "indexOf", "(", "'", "'", ")", ";", "try", "{", "...
Converts unicode escapes in the given string to the equivalent unicode character. If there are no escapes, returns the input unchanged. If there is an invalid escape sequence, returns null.
[ "Converts", "unicode", "escapes", "in", "the", "given", "string", "to", "the", "equivalent", "unicode", "character", ".", "If", "there", "are", "no", "escapes", "returns", "the", "input", "unchanged", ".", "If", "there", "is", "an", "invalid", "escape", "seq...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/parser/Scanner.java#L767-L804
24,013
google/closure-compiler
src/com/google/javascript/jscomp/regex/CaseCanonicalize.java
CaseCanonicalize.caseCanonicalize
public static String caseCanonicalize(String s) { for (int i = 0, n = s.length(); i < n; ++i) { char ch = s.charAt(i); char cu = caseCanonicalize(ch); if (cu != ch) { StringBuilder sb = new StringBuilder(s); sb.setCharAt(i, cu); while (++i < n) { sb.setCharAt(i, c...
java
public static String caseCanonicalize(String s) { for (int i = 0, n = s.length(); i < n; ++i) { char ch = s.charAt(i); char cu = caseCanonicalize(ch); if (cu != ch) { StringBuilder sb = new StringBuilder(s); sb.setCharAt(i, cu); while (++i < n) { sb.setCharAt(i, c...
[ "public", "static", "String", "caseCanonicalize", "(", "String", "s", ")", "{", "for", "(", "int", "i", "=", "0", ",", "n", "=", "s", ".", "length", "(", ")", ";", "i", "<", "n", ";", "++", "i", ")", "{", "char", "ch", "=", "s", ".", "charAt"...
Returns the case canonical version of the given string.
[ "Returns", "the", "case", "canonical", "version", "of", "the", "given", "string", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/regex/CaseCanonicalize.java#L191-L205
24,014
google/closure-compiler
src/com/google/javascript/jscomp/regex/CaseCanonicalize.java
CaseCanonicalize.caseCanonicalize
public static char caseCanonicalize(char ch) { if (ch < 0x80) { // Normal case. return ('A' <= ch && ch <= 'Z') ? (char) (ch | 32) : ch; } // Non-ASCII case. if (CASE_SENSITIVE.contains(ch)) { for (DeltaSet ds : CANON_DELTA_SETS) { if (ds.codeUnits.contains(ch)) { return (...
java
public static char caseCanonicalize(char ch) { if (ch < 0x80) { // Normal case. return ('A' <= ch && ch <= 'Z') ? (char) (ch | 32) : ch; } // Non-ASCII case. if (CASE_SENSITIVE.contains(ch)) { for (DeltaSet ds : CANON_DELTA_SETS) { if (ds.codeUnits.contains(ch)) { return (...
[ "public", "static", "char", "caseCanonicalize", "(", "char", "ch", ")", "{", "if", "(", "ch", "<", "0x80", ")", "{", "// Normal case.", "return", "(", "'", "'", "<=", "ch", "&&", "ch", "<=", "'", "'", ")", "?", "(", "char", ")", "(", "ch", "|", ...
Returns the case canonical version of the given code-unit. ECMAScript 5 explicitly says that code-units are to be treated as their code-point equivalent, even surrogates.
[ "Returns", "the", "case", "canonical", "version", "of", "the", "given", "code", "-", "unit", ".", "ECMAScript", "5", "explicitly", "says", "that", "code", "-", "units", "are", "to", "be", "treated", "as", "their", "code", "-", "point", "equivalent", "even"...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/regex/CaseCanonicalize.java#L212-L225
24,015
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.process
@Override public void process(Node externsRoot, Node jsRoot) { checkNotNull(scopeCreator); checkNotNull(topScope); Node externsAndJs = jsRoot.getParent(); checkState(externsAndJs != null); checkState(externsRoot == null || externsAndJs.hasChild(externsRoot)); if (externsRoot != null) { ...
java
@Override public void process(Node externsRoot, Node jsRoot) { checkNotNull(scopeCreator); checkNotNull(topScope); Node externsAndJs = jsRoot.getParent(); checkState(externsAndJs != null); checkState(externsRoot == null || externsAndJs.hasChild(externsRoot)); if (externsRoot != null) { ...
[ "@", "Override", "public", "void", "process", "(", "Node", "externsRoot", ",", "Node", "jsRoot", ")", "{", "checkNotNull", "(", "scopeCreator", ")", ";", "checkNotNull", "(", "topScope", ")", ";", "Node", "externsAndJs", "=", "jsRoot", ".", "getParent", "(",...
Main entry point for this phase of processing. This follows the pattern for JSCompiler phases. @param externsRoot The root of the externs parse tree. @param jsRoot The root of the input parse tree to be checked.
[ "Main", "entry", "point", "for", "this", "phase", "of", "processing", ".", "This", "follows", "the", "pattern", "for", "JSCompiler", "phases", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L437-L450
24,016
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.doPercentTypedAccounting
private void doPercentTypedAccounting(Node n) { JSType type = n.getJSType(); if (type == null) { nullCount++; } else if (type.isUnknownType()) { if (reportUnknownTypes) { compiler.report(JSError.make(n, UNKNOWN_EXPR_TYPE)); } unknownCount++; } else { typedCount++; ...
java
private void doPercentTypedAccounting(Node n) { JSType type = n.getJSType(); if (type == null) { nullCount++; } else if (type.isUnknownType()) { if (reportUnknownTypes) { compiler.report(JSError.make(n, UNKNOWN_EXPR_TYPE)); } unknownCount++; } else { typedCount++; ...
[ "private", "void", "doPercentTypedAccounting", "(", "Node", "n", ")", "{", "JSType", "type", "=", "n", ".", "getJSType", "(", ")", ";", "if", "(", "type", "==", "null", ")", "{", "nullCount", "++", ";", "}", "else", "if", "(", "type", ".", "isUnknown...
Counts the given node in the typed statistics. @param n a node that should be typed
[ "Counts", "the", "given", "node", "in", "the", "typed", "statistics", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1073-L1085
24,017
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkCanAssignToWithScope
private void checkCanAssignToWithScope( NodeTraversal t, Node nodeToWarn, Node lvalue, JSType rightType, JSDocInfo info, String msg) { if (lvalue.isDestructuringPattern()) { checkDestructuringAssignment(t, nodeToWarn, lvalue, rightType, msg); } else { checkCanAssignToNameGetpropOrGetelem(t, no...
java
private void checkCanAssignToWithScope( NodeTraversal t, Node nodeToWarn, Node lvalue, JSType rightType, JSDocInfo info, String msg) { if (lvalue.isDestructuringPattern()) { checkDestructuringAssignment(t, nodeToWarn, lvalue, rightType, msg); } else { checkCanAssignToNameGetpropOrGetelem(t, no...
[ "private", "void", "checkCanAssignToWithScope", "(", "NodeTraversal", "t", ",", "Node", "nodeToWarn", ",", "Node", "lvalue", ",", "JSType", "rightType", ",", "JSDocInfo", "info", ",", "String", "msg", ")", "{", "if", "(", "lvalue", ".", "isDestructuringPattern",...
Checks that we can assign the given right type to the given lvalue or destructuring pattern. <p>See {@link #checkCanAssignToNameGetpropOrGetelem(NodeTraversal, Node, Node, JSType, JSDocInfo, String)} for more details @param nodeToWarn A node to report type mismatch warnings on @param lvalue The lvalue to which we're ...
[ "Checks", "that", "we", "can", "assign", "the", "given", "right", "type", "to", "the", "given", "lvalue", "or", "destructuring", "pattern", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1116-L1123
24,018
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkCanAssignToNameGetpropOrGetelem
private void checkCanAssignToNameGetpropOrGetelem( NodeTraversal t, Node nodeToWarn, Node lvalue, JSType rightType, JSDocInfo info, String msg) { checkArgument( lvalue.isName() || lvalue.isGetProp() || lvalue.isGetElem() || lvalue.isCast(), lvalue); if (lvalue.isGetProp()) { Node object = l...
java
private void checkCanAssignToNameGetpropOrGetelem( NodeTraversal t, Node nodeToWarn, Node lvalue, JSType rightType, JSDocInfo info, String msg) { checkArgument( lvalue.isName() || lvalue.isGetProp() || lvalue.isGetElem() || lvalue.isCast(), lvalue); if (lvalue.isGetProp()) { Node object = l...
[ "private", "void", "checkCanAssignToNameGetpropOrGetelem", "(", "NodeTraversal", "t", ",", "Node", "nodeToWarn", ",", "Node", "lvalue", ",", "JSType", "rightType", ",", "JSDocInfo", "info", ",", "String", "msg", ")", "{", "checkArgument", "(", "lvalue", ".", "is...
Checks that we can assign the given right type to the given lvalue. <p>If the lvalue is a qualified name, and has a declared type in the given scope, uses the declared type of the qualified name instead of the type on the node. @param nodeToWarn A node to report type mismatch warnings on @param lvalue The lvalue to w...
[ "Checks", "that", "we", "can", "assign", "the", "given", "right", "type", "to", "the", "given", "lvalue", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1152-L1234
24,019
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitObjectPattern
private void visitObjectPattern(Node pattern) { JSType patternType = getJSType(pattern); validator.expectObject(pattern, patternType, "cannot destructure 'null' or 'undefined'"); for (Node child : pattern.children()) { DestructuredTarget target = DestructuredTarget.createTarget(typeRegistry, patternTy...
java
private void visitObjectPattern(Node pattern) { JSType patternType = getJSType(pattern); validator.expectObject(pattern, patternType, "cannot destructure 'null' or 'undefined'"); for (Node child : pattern.children()) { DestructuredTarget target = DestructuredTarget.createTarget(typeRegistry, patternTy...
[ "private", "void", "visitObjectPattern", "(", "Node", "pattern", ")", "{", "JSType", "patternType", "=", "getJSType", "(", "pattern", ")", ";", "validator", ".", "expectObject", "(", "pattern", ",", "patternType", ",", "\"cannot destructure 'null' or 'undefined'\"", ...
Validates all keys in an object pattern <p>Validating the types assigned to any lhs nodes in the pattern is done at the ASSIGN/VAR/ PARAM_LIST/etc. node
[ "Validates", "all", "keys", "in", "an", "object", "pattern" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1352-L1378
24,020
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.propertyIsImplicitCast
private static boolean propertyIsImplicitCast(ObjectType type, String prop) { for (; type != null; type = type.getImplicitPrototype()) { JSDocInfo docInfo = type.getOwnPropertyJSDocInfo(prop); if (docInfo != null && docInfo.isImplicitCast()) { return true; } } return false; }
java
private static boolean propertyIsImplicitCast(ObjectType type, String prop) { for (; type != null; type = type.getImplicitPrototype()) { JSDocInfo docInfo = type.getOwnPropertyJSDocInfo(prop); if (docInfo != null && docInfo.isImplicitCast()) { return true; } } return false; }
[ "private", "static", "boolean", "propertyIsImplicitCast", "(", "ObjectType", "type", ",", "String", "prop", ")", "{", "for", "(", ";", "type", "!=", "null", ";", "type", "=", "type", ".", "getImplicitPrototype", "(", ")", ")", "{", "JSDocInfo", "docInfo", ...
Returns true if any type in the chain has an implicitCast annotation for the given property.
[ "Returns", "true", "if", "any", "type", "in", "the", "chain", "has", "an", "implicitCast", "annotation", "for", "the", "given", "property", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1493-L1501
24,021
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.hasUnknownOrEmptySupertype
private static boolean hasUnknownOrEmptySupertype(FunctionType ctor) { checkArgument(ctor.isConstructor() || ctor.isInterface()); checkArgument(!ctor.isUnknownType()); // The type system should notice inheritance cycles on its own // and break the cycle. while (true) { ObjectType maybeSuperIn...
java
private static boolean hasUnknownOrEmptySupertype(FunctionType ctor) { checkArgument(ctor.isConstructor() || ctor.isInterface()); checkArgument(!ctor.isUnknownType()); // The type system should notice inheritance cycles on its own // and break the cycle. while (true) { ObjectType maybeSuperIn...
[ "private", "static", "boolean", "hasUnknownOrEmptySupertype", "(", "FunctionType", "ctor", ")", "{", "checkArgument", "(", "ctor", ".", "isConstructor", "(", ")", "||", "ctor", ".", "isInterface", "(", ")", ")", ";", "checkArgument", "(", "!", "ctor", ".", "...
Given a constructor or an interface type, find out whether the unknown type is a supertype of the current type.
[ "Given", "a", "constructor", "or", "an", "interface", "type", "find", "out", "whether", "the", "unknown", "type", "is", "a", "supertype", "of", "the", "current", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1736-L1758
24,022
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitInterfacePropertyAssignment
private void visitInterfacePropertyAssignment(Node object, Node lvalue) { if (!lvalue.getParent().isAssign()) { // assignments to interface properties cannot be in destructuring patterns or for-of loops reportInvalidInterfaceMemberDeclaration(object); return; } Node assign = lvalue.getPare...
java
private void visitInterfacePropertyAssignment(Node object, Node lvalue) { if (!lvalue.getParent().isAssign()) { // assignments to interface properties cannot be in destructuring patterns or for-of loops reportInvalidInterfaceMemberDeclaration(object); return; } Node assign = lvalue.getPare...
[ "private", "void", "visitInterfacePropertyAssignment", "(", "Node", "object", ",", "Node", "lvalue", ")", "{", "if", "(", "!", "lvalue", ".", "getParent", "(", ")", ".", "isAssign", "(", ")", ")", "{", "// assignments to interface properties cannot be in destructuri...
Visits an lvalue node for cases such as <pre> interface.prototype.property = ...; </pre>
[ "Visits", "an", "lvalue", "node", "for", "cases", "such", "as" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1801-L1825
24,023
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitName
boolean visitName(NodeTraversal t, Node n, Node parent) { // At this stage, we need to determine whether this is a leaf // node in an expression (which therefore needs to have a type // assigned for it) versus some other decorative node that we // can safely ignore. Function names, arguments (children ...
java
boolean visitName(NodeTraversal t, Node n, Node parent) { // At this stage, we need to determine whether this is a leaf // node in an expression (which therefore needs to have a type // assigned for it) versus some other decorative node that we // can safely ignore. Function names, arguments (children ...
[ "boolean", "visitName", "(", "NodeTraversal", "t", ",", "Node", "n", ",", "Node", "parent", ")", "{", "// At this stage, we need to determine whether this is a leaf", "// node in an expression (which therefore needs to have a type", "// assigned for it) versus some other decorative nod...
Visits a NAME node. @param t The node traversal object that supplies context, such as the scope chain to use in name lookups as well as error reporting. @param n The node being visited. @param parent The parent of the node n. @return whether the node is typeable or not
[ "Visits", "a", "NAME", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1844-L1879
24,024
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkForOfTypes
private void checkForOfTypes(NodeTraversal t, Node forOf) { Node lhs = forOf.getFirstChild(); Node iterable = forOf.getSecondChild(); JSType iterableType = getJSType(iterable); JSType actualType; if (forOf.isForAwaitOf()) { Optional<JSType> maybeType = validator.expectAutoboxesToIte...
java
private void checkForOfTypes(NodeTraversal t, Node forOf) { Node lhs = forOf.getFirstChild(); Node iterable = forOf.getSecondChild(); JSType iterableType = getJSType(iterable); JSType actualType; if (forOf.isForAwaitOf()) { Optional<JSType> maybeType = validator.expectAutoboxesToIte...
[ "private", "void", "checkForOfTypes", "(", "NodeTraversal", "t", ",", "Node", "forOf", ")", "{", "Node", "lhs", "=", "forOf", ".", "getFirstChild", "(", ")", ";", "Node", "iterable", "=", "forOf", ".", "getSecondChild", "(", ")", ";", "JSType", "iterableTy...
Visits the loop variable of a FOR_OF and FOR_AWAIT_OF and verifies the type being assigned to it.
[ "Visits", "the", "loop", "variable", "of", "a", "FOR_OF", "and", "FOR_AWAIT_OF", "and", "verifies", "the", "type", "being", "assigned", "to", "it", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1885-L1934
24,025
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitGetProp
private void visitGetProp(NodeTraversal t, Node n) { // obj.prop or obj.method() // Lots of types can appear on the left, a call to a void function can // never be on the left. getPropertyType will decide what is acceptable // and what isn't. Node property = n.getLastChild(); Node objNode = n.ge...
java
private void visitGetProp(NodeTraversal t, Node n) { // obj.prop or obj.method() // Lots of types can appear on the left, a call to a void function can // never be on the left. getPropertyType will decide what is acceptable // and what isn't. Node property = n.getLastChild(); Node objNode = n.ge...
[ "private", "void", "visitGetProp", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "// obj.prop or obj.method()", "// Lots of types can appear on the left, a call to a void function can", "// never be on the left. getPropertyType will decide what is acceptable", "// and what isn't...
Visits a GETPROP node. @param t The node traversal object that supplies context, such as the scope chain to use in name lookups as well as error reporting. @param n The node being visited.
[ "Visits", "a", "GETPROP", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1943-L1959
24,026
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitGetElem
private void visitGetElem(Node n) { validator.expectIndexMatch(n, getJSType(n.getFirstChild()), getJSType(n.getLastChild())); ensureTyped(n); }
java
private void visitGetElem(Node n) { validator.expectIndexMatch(n, getJSType(n.getFirstChild()), getJSType(n.getLastChild())); ensureTyped(n); }
[ "private", "void", "visitGetElem", "(", "Node", "n", ")", "{", "validator", ".", "expectIndexMatch", "(", "n", ",", "getJSType", "(", "n", ".", "getFirstChild", "(", ")", ")", ",", "getJSType", "(", "n", ".", "getLastChild", "(", ")", ")", ")", ";", ...
Visits a GETELEM node. @param n The node being visited.
[ "Visits", "a", "GETELEM", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2217-L2220
24,027
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitVar
private void visitVar(NodeTraversal t, Node n) { // Handle var declarations in for-of loops separately from regular var declarations. if (n.getParent().isForOf() || n.getParent().isForIn()) { return; } // TODO(nicksantos): Fix this so that the doc info always shows up // on the NAME node. We ...
java
private void visitVar(NodeTraversal t, Node n) { // Handle var declarations in for-of loops separately from regular var declarations. if (n.getParent().isForOf() || n.getParent().isForIn()) { return; } // TODO(nicksantos): Fix this so that the doc info always shows up // on the NAME node. We ...
[ "private", "void", "visitVar", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "// Handle var declarations in for-of loops separately from regular var declarations.", "if", "(", "n", ".", "getParent", "(", ")", ".", "isForOf", "(", ")", "||", "n", ".", "get...
Visits a VAR node. @param t The node traversal object that supplies context, such as the scope chain to use in name lookups as well as error reporting. @param n The node being visited.
[ "Visits", "a", "VAR", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2229-L2262
24,028
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitNew
private void visitNew(Node n) { Node constructor = n.getFirstChild(); JSType type = getJSType(constructor).restrictByNotNullOrUndefined(); if (!couldBeAConstructor(type) || type.isEquivalentTo(typeRegistry.getNativeType(SYMBOL_OBJECT_FUNCTION_TYPE))) { report(n, NOT_A_CONSTRUCTOR); ensur...
java
private void visitNew(Node n) { Node constructor = n.getFirstChild(); JSType type = getJSType(constructor).restrictByNotNullOrUndefined(); if (!couldBeAConstructor(type) || type.isEquivalentTo(typeRegistry.getNativeType(SYMBOL_OBJECT_FUNCTION_TYPE))) { report(n, NOT_A_CONSTRUCTOR); ensur...
[ "private", "void", "visitNew", "(", "Node", "n", ")", "{", "Node", "constructor", "=", "n", ".", "getFirstChild", "(", ")", ";", "JSType", "type", "=", "getJSType", "(", "constructor", ")", ".", "restrictByNotNullOrUndefined", "(", ")", ";", "if", "(", "...
Visits a NEW node.
[ "Visits", "a", "NEW", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2265-L2286
24,029
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkInterfaceConflictProperties
private void checkInterfaceConflictProperties( Node n, String functionName, Map<String, ObjectType> properties, Map<String, ObjectType> currentProperties, ObjectType interfaceType) { ObjectType implicitProto = interfaceType.getImplicitPrototype(); Set<String> currentPropertyNames; ...
java
private void checkInterfaceConflictProperties( Node n, String functionName, Map<String, ObjectType> properties, Map<String, ObjectType> currentProperties, ObjectType interfaceType) { ObjectType implicitProto = interfaceType.getImplicitPrototype(); Set<String> currentPropertyNames; ...
[ "private", "void", "checkInterfaceConflictProperties", "(", "Node", "n", ",", "String", "functionName", ",", "Map", "<", "String", ",", "ObjectType", ">", "properties", ",", "Map", "<", "String", ",", "ObjectType", ">", "currentProperties", ",", "ObjectType", "i...
Check whether there's any property conflict for for a particular super interface @param n The node being visited @param functionName The function name being checked @param properties The property names in the super interfaces that have been visited @param currentProperties The property names in the super interface tha...
[ "Check", "whether", "there", "s", "any", "property", "conflict", "for", "for", "a", "particular", "super", "interface" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2301-L2344
24,030
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitClass
private void visitClass(Node n) { FunctionType functionType = JSType.toMaybeFunctionType(n.getJSType()); Node extendsClause = n.getSecondChild(); if (!extendsClause.isEmpty()) { // Ensure that the `extends` clause is actually a constructor or interface. If it is, but // it's the wrong one then ...
java
private void visitClass(Node n) { FunctionType functionType = JSType.toMaybeFunctionType(n.getJSType()); Node extendsClause = n.getSecondChild(); if (!extendsClause.isEmpty()) { // Ensure that the `extends` clause is actually a constructor or interface. If it is, but // it's the wrong one then ...
[ "private", "void", "visitClass", "(", "Node", "n", ")", "{", "FunctionType", "functionType", "=", "JSType", ".", "toMaybeFunctionType", "(", "n", ".", "getJSType", "(", ")", ")", ";", "Node", "extendsClause", "=", "n", ".", "getSecondChild", "(", ")", ";",...
Visits a CLASS node.
[ "Visits", "a", "CLASS", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2382-L2409
24,031
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkConstructor
private void checkConstructor(Node n, FunctionType functionType) { FunctionType baseConstructor = functionType.getSuperClassConstructor(); if (!Objects.equals(baseConstructor, getNativeType(OBJECT_FUNCTION_TYPE)) && baseConstructor != null && baseConstructor.isInterface()) { // Warn if a c...
java
private void checkConstructor(Node n, FunctionType functionType) { FunctionType baseConstructor = functionType.getSuperClassConstructor(); if (!Objects.equals(baseConstructor, getNativeType(OBJECT_FUNCTION_TYPE)) && baseConstructor != null && baseConstructor.isInterface()) { // Warn if a c...
[ "private", "void", "checkConstructor", "(", "Node", "n", ",", "FunctionType", "functionType", ")", "{", "FunctionType", "baseConstructor", "=", "functionType", ".", "getSuperClassConstructor", "(", ")", ";", "if", "(", "!", "Objects", ".", "equals", "(", "baseCo...
Checks a constructor, which may be either an ES5-style FUNCTION node, or a CLASS node.
[ "Checks", "a", "constructor", "which", "may", "be", "either", "an", "ES5", "-", "style", "FUNCTION", "node", "or", "a", "CLASS", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2412-L2458
24,032
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkInterface
private void checkInterface(Node n, FunctionType functionType) { // Interface must extend only interfaces for (ObjectType extInterface : functionType.getExtendedInterfaces()) { if (extInterface.getConstructor() != null && !extInterface.getConstructor().isInterface()) { compiler.report( ...
java
private void checkInterface(Node n, FunctionType functionType) { // Interface must extend only interfaces for (ObjectType extInterface : functionType.getExtendedInterfaces()) { if (extInterface.getConstructor() != null && !extInterface.getConstructor().isInterface()) { compiler.report( ...
[ "private", "void", "checkInterface", "(", "Node", "n", ",", "FunctionType", "functionType", ")", "{", "// Interface must extend only interfaces", "for", "(", "ObjectType", "extInterface", ":", "functionType", ".", "getExtendedInterfaces", "(", ")", ")", "{", "if", "...
Checks an interface, which may be either an ES5-style FUNCTION node, or a CLASS node.
[ "Checks", "an", "interface", "which", "may", "be", "either", "an", "ES5", "-", "style", "FUNCTION", "node", "or", "a", "CLASS", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2461-L2493
24,033
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkCallConventions
private void checkCallConventions(NodeTraversal t, Node n) { SubclassRelationship relationship = compiler.getCodingConvention().getClassesDefinedByCall(n); TypedScope scope = t.getTypedScope(); if (relationship != null) { ObjectType superClass = TypeValidator.getInstanceOfCtor( ...
java
private void checkCallConventions(NodeTraversal t, Node n) { SubclassRelationship relationship = compiler.getCodingConvention().getClassesDefinedByCall(n); TypedScope scope = t.getTypedScope(); if (relationship != null) { ObjectType superClass = TypeValidator.getInstanceOfCtor( ...
[ "private", "void", "checkCallConventions", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "SubclassRelationship", "relationship", "=", "compiler", ".", "getCodingConvention", "(", ")", ".", "getClassesDefinedByCall", "(", "n", ")", ";", "TypedScope", "scop...
Validate class-defining calls. Because JS has no 'native' syntax for defining classes, we need to do this manually.
[ "Validate", "class", "-", "defining", "calls", ".", "Because", "JS", "has", "no", "native", "syntax", "for", "defining", "classes", "we", "need", "to", "do", "this", "manually", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2506-L2525
24,034
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitCall
private void visitCall(NodeTraversal t, Node n) { checkCallConventions(t, n); Node child = n.getFirstChild(); JSType childType = getJSType(child).restrictByNotNullOrUndefined(); if (!childType.canBeCalled()) { report(n, NOT_CALLABLE, childType.toString()); ensureTyped(n); return; ...
java
private void visitCall(NodeTraversal t, Node n) { checkCallConventions(t, n); Node child = n.getFirstChild(); JSType childType = getJSType(child).restrictByNotNullOrUndefined(); if (!childType.canBeCalled()) { report(n, NOT_CALLABLE, childType.toString()); ensureTyped(n); return; ...
[ "private", "void", "visitCall", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "checkCallConventions", "(", "t", ",", "n", ")", ";", "Node", "child", "=", "n", ".", "getFirstChild", "(", ")", ";", "JSType", "childType", "=", "getJSType", "(", "...
Visits a CALL node. @param t The node traversal object that supplies context, such as the scope chain to use in name lookups as well as error reporting. @param n The node being visited.
[ "Visits", "a", "CALL", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2534-L2583
24,035
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitArgumentList
private void visitArgumentList(Node call, FunctionType functionType) { Iterator<Node> parameters = functionType.getParameters().iterator(); Iterator<Node> arguments = NodeUtil.getInvocationArgsAsIterable(call).iterator(); checkArgumentsMatchParameters(call, functionType, arguments, parameters, 0); }
java
private void visitArgumentList(Node call, FunctionType functionType) { Iterator<Node> parameters = functionType.getParameters().iterator(); Iterator<Node> arguments = NodeUtil.getInvocationArgsAsIterable(call).iterator(); checkArgumentsMatchParameters(call, functionType, arguments, parameters, 0); }
[ "private", "void", "visitArgumentList", "(", "Node", "call", ",", "FunctionType", "functionType", ")", "{", "Iterator", "<", "Node", ">", "parameters", "=", "functionType", ".", "getParameters", "(", ")", ".", "iterator", "(", ")", ";", "Iterator", "<", "Nod...
Visits the parameters of a CALL or a NEW node.
[ "Visits", "the", "parameters", "of", "a", "CALL", "or", "a", "NEW", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2586-L2590
24,036
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkArgumentsMatchParameters
private void checkArgumentsMatchParameters( Node call, FunctionType functionType, Iterator<Node> arguments, Iterator<Node> parameters, int firstParameterIndex) { int spreadArgumentCount = 0; int normalArgumentCount = firstParameterIndex; boolean checkArgumentTypeAgainstParamet...
java
private void checkArgumentsMatchParameters( Node call, FunctionType functionType, Iterator<Node> arguments, Iterator<Node> parameters, int firstParameterIndex) { int spreadArgumentCount = 0; int normalArgumentCount = firstParameterIndex; boolean checkArgumentTypeAgainstParamet...
[ "private", "void", "checkArgumentsMatchParameters", "(", "Node", "call", ",", "FunctionType", "functionType", ",", "Iterator", "<", "Node", ">", "arguments", ",", "Iterator", "<", "Node", ">", "parameters", ",", "int", "firstParameterIndex", ")", "{", "int", "sp...
Checks that a list of arguments match a list of formal parameters <p>If given a TAGGED_TEMPLATE_LIT, the given Iterator should only contain the parameters corresponding to the actual template lit sub arguments, skipping over the first parameter. @param firstParameterIndex The index of the first parameter in the given...
[ "Checks", "that", "a", "list", "of", "arguments", "match", "a", "list", "of", "formal", "parameters" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2601-L2674
24,037
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitImplicitReturnExpression
private void visitImplicitReturnExpression(NodeTraversal t, Node exprNode) { Node enclosingFunction = t.getEnclosingFunction(); JSType jsType = getJSType(enclosingFunction); if (jsType.isFunctionType()) { FunctionType functionType = jsType.toMaybeFunctionType(); JSType expectedReturnType = func...
java
private void visitImplicitReturnExpression(NodeTraversal t, Node exprNode) { Node enclosingFunction = t.getEnclosingFunction(); JSType jsType = getJSType(enclosingFunction); if (jsType.isFunctionType()) { FunctionType functionType = jsType.toMaybeFunctionType(); JSType expectedReturnType = func...
[ "private", "void", "visitImplicitReturnExpression", "(", "NodeTraversal", "t", ",", "Node", "exprNode", ")", "{", "Node", "enclosingFunction", "=", "t", ".", "getEnclosingFunction", "(", ")", ";", "JSType", "jsType", "=", "getJSType", "(", "enclosingFunction", ")"...
Visits an arrow function expression body.
[ "Visits", "an", "arrow", "function", "expression", "body", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2677-L2699
24,038
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitReturn
private void visitReturn(NodeTraversal t, Node n) { Node enclosingFunction = t.getEnclosingFunction(); if (enclosingFunction.isGeneratorFunction() && !n.hasChildren()) { // Allow "return;" in a generator function, even if it's not the declared return type. // e.g. Don't warn for a generator function...
java
private void visitReturn(NodeTraversal t, Node n) { Node enclosingFunction = t.getEnclosingFunction(); if (enclosingFunction.isGeneratorFunction() && !n.hasChildren()) { // Allow "return;" in a generator function, even if it's not the declared return type. // e.g. Don't warn for a generator function...
[ "private", "void", "visitReturn", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "Node", "enclosingFunction", "=", "t", ".", "getEnclosingFunction", "(", ")", ";", "if", "(", "enclosingFunction", ".", "isGeneratorFunction", "(", ")", "&&", "!", "n", ...
Visits a RETURN node. @param t The node traversal object that supplies context, such as the scope chain to use in name lookups as well as error reporting. @param n The node being visited.
[ "Visits", "a", "RETURN", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2708-L2769
24,039
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitYield
private void visitYield(NodeTraversal t, Node n) { JSType jsType = getJSType(t.getEnclosingFunction()); JSType declaredYieldType = getNativeType(UNKNOWN_TYPE); if (jsType.isFunctionType()) { FunctionType functionType = jsType.toMaybeFunctionType(); JSType returnType = functionType.getReturnType...
java
private void visitYield(NodeTraversal t, Node n) { JSType jsType = getJSType(t.getEnclosingFunction()); JSType declaredYieldType = getNativeType(UNKNOWN_TYPE); if (jsType.isFunctionType()) { FunctionType functionType = jsType.toMaybeFunctionType(); JSType returnType = functionType.getReturnType...
[ "private", "void", "visitYield", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "JSType", "jsType", "=", "getJSType", "(", "t", ".", "getEnclosingFunction", "(", ")", ")", ";", "JSType", "declaredYieldType", "=", "getNativeType", "(", "UNKNOWN_TYPE", ...
Visits a YIELD node.
[ "Visits", "a", "YIELD", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2772-L2828
24,040
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitBinaryOperator
private void visitBinaryOperator(Token op, Node n) { Node left = n.getFirstChild(); JSType leftType = getJSType(left); Node right = n.getLastChild(); JSType rightType = getJSType(right); switch (op) { case ASSIGN_LSH: case ASSIGN_RSH: case LSH: case RSH: case ASSIGN_URS...
java
private void visitBinaryOperator(Token op, Node n) { Node left = n.getFirstChild(); JSType leftType = getJSType(left); Node right = n.getLastChild(); JSType rightType = getJSType(right); switch (op) { case ASSIGN_LSH: case ASSIGN_RSH: case LSH: case RSH: case ASSIGN_URS...
[ "private", "void", "visitBinaryOperator", "(", "Token", "op", ",", "Node", "n", ")", "{", "Node", "left", "=", "n", ".", "getFirstChild", "(", ")", ";", "JSType", "leftType", "=", "getJSType", "(", "left", ")", ";", "Node", "right", "=", "n", ".", "g...
This function unifies the type checking involved in the core binary operators and the corresponding assignment operators. The representation used internally is such that common code can handle both kinds of operators easily. @param op The operator. @param t The traversal object, needed to report errors. @param n The n...
[ "This", "function", "unifies", "the", "type", "checking", "involved", "in", "the", "core", "binary", "operators", "and", "the", "corresponding", "assignment", "operators", ".", "The", "representation", "used", "internally", "is", "such", "that", "common", "code", ...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2884-L2941
24,041
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkEnumAlias
private void checkEnumAlias( NodeTraversal t, JSDocInfo declInfo, JSType valueType, Node nodeToWarn) { if (declInfo == null || !declInfo.hasEnumParameterType()) { return; } if (!valueType.isEnumType()) { return; } EnumType valueEnumType = valueType.toMaybeEnumType(); JSType v...
java
private void checkEnumAlias( NodeTraversal t, JSDocInfo declInfo, JSType valueType, Node nodeToWarn) { if (declInfo == null || !declInfo.hasEnumParameterType()) { return; } if (!valueType.isEnumType()) { return; } EnumType valueEnumType = valueType.toMaybeEnumType(); JSType v...
[ "private", "void", "checkEnumAlias", "(", "NodeTraversal", "t", ",", "JSDocInfo", "declInfo", ",", "JSType", "valueType", ",", "Node", "nodeToWarn", ")", "{", "if", "(", "declInfo", "==", "null", "||", "!", "declInfo", ".", "hasEnumParameterType", "(", ")", ...
Checks enum aliases. <p>We verify that the enum element type of the enum used for initialization is a subtype of the enum element type of the enum the value is being copied in. <p>Example: <pre>var myEnum = myOtherEnum;</pre> <p>Enum aliases are irregular, so we need special code for this :( @param valueType the t...
[ "Checks", "enum", "aliases", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2958-L2976
24,042
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.ensureTyped
private void ensureTyped(Node n, JSType type) { // Make sure FUNCTION nodes always get function type. checkState(!n.isFunction() || type.isFunctionType() || type.isUnknownType()); if (n.getJSType() == null) { n.setJSType(type); } }
java
private void ensureTyped(Node n, JSType type) { // Make sure FUNCTION nodes always get function type. checkState(!n.isFunction() || type.isFunctionType() || type.isUnknownType()); if (n.getJSType() == null) { n.setJSType(type); } }
[ "private", "void", "ensureTyped", "(", "Node", "n", ",", "JSType", "type", ")", "{", "// Make sure FUNCTION nodes always get function type.", "checkState", "(", "!", "n", ".", "isFunction", "(", ")", "||", "type", ".", "isFunctionType", "(", ")", "||", "type", ...
Ensures the node is typed. @param n The node getting a type assigned to it. @param type The type to be assigned.
[ "Ensures", "the", "node", "is", "typed", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L3028-L3034
24,043
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.isObjectTypeWithNonStringifiableKey
private boolean isObjectTypeWithNonStringifiableKey(JSType type) { if (!type.isTemplatizedType()) { return false; } TemplatizedType templatizedType = type.toMaybeTemplatizedType(); if (templatizedType.getReferencedType().isNativeObjectType() && templatizedType.getTemplateTypes().size() > 1...
java
private boolean isObjectTypeWithNonStringifiableKey(JSType type) { if (!type.isTemplatizedType()) { return false; } TemplatizedType templatizedType = type.toMaybeTemplatizedType(); if (templatizedType.getReferencedType().isNativeObjectType() && templatizedType.getTemplateTypes().size() > 1...
[ "private", "boolean", "isObjectTypeWithNonStringifiableKey", "(", "JSType", "type", ")", "{", "if", "(", "!", "type", ".", "isTemplatizedType", "(", ")", ")", "{", "return", "false", ";", "}", "TemplatizedType", "templatizedType", "=", "type", ".", "toMaybeTempl...
Checks whether current type is Object type with non-stringifable key.
[ "Checks", "whether", "current", "type", "is", "Object", "type", "with", "non", "-", "stringifable", "key", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L3156-L3167
24,044
google/closure-compiler
src/com/google/javascript/jscomp/graph/Graph.java
Graph.connectIfNotFound
public final void connectIfNotFound(N n1, E edge, N n2) { if (!isConnected(n1, edge, n2)) { connect(n1, edge, n2); } }
java
public final void connectIfNotFound(N n1, E edge, N n2) { if (!isConnected(n1, edge, n2)) { connect(n1, edge, n2); } }
[ "public", "final", "void", "connectIfNotFound", "(", "N", "n1", ",", "E", "edge", ",", "N", "n2", ")", "{", "if", "(", "!", "isConnected", "(", "n1", ",", "edge", ",", "n2", ")", ")", "{", "connect", "(", "n1", ",", "edge", ",", "n2", ")", ";",...
Connects two nodes in the graph with an edge if such edge does not already exists between the nodes. @param n1 First node. @param edge The edge. @param n2 Second node.
[ "Connects", "two", "nodes", "in", "the", "graph", "with", "an", "edge", "if", "such", "edge", "does", "not", "already", "exists", "between", "the", "nodes", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/Graph.java#L118-L122
24,045
google/closure-compiler
src/com/google/javascript/jscomp/graph/Graph.java
Graph.getNodeOrFail
@SuppressWarnings("unchecked") <T extends GraphNode<N, E>> T getNodeOrFail(N val) { T node = (T) getNode(val); if (node == null) { throw new IllegalArgumentException(val + " does not exist in graph"); } return node; }
java
@SuppressWarnings("unchecked") <T extends GraphNode<N, E>> T getNodeOrFail(N val) { T node = (T) getNode(val); if (node == null) { throw new IllegalArgumentException(val + " does not exist in graph"); } return node; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "<", "T", "extends", "GraphNode", "<", "N", ",", "E", ">", ">", "T", "getNodeOrFail", "(", "N", "val", ")", "{", "T", "node", "=", "(", "T", ")", "getNode", "(", "val", ")", ";", "if", "(", "nod...
Gets the node of the specified type, or throws an IllegalArgumentException.
[ "Gets", "the", "node", "of", "the", "specified", "type", "or", "throws", "an", "IllegalArgumentException", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/Graph.java#L218-L225
24,046
google/closure-compiler
src/com/google/javascript/jscomp/graph/Graph.java
Graph.pushAnnotations
private static void pushAnnotations( Deque<GraphAnnotationState> stack, Collection<? extends Annotatable> haveAnnotations) { stack.push(new GraphAnnotationState(haveAnnotations.size())); for (Annotatable h : haveAnnotations) { stack.peek().add(new AnnotationState(h, h.getAnnotation())); ...
java
private static void pushAnnotations( Deque<GraphAnnotationState> stack, Collection<? extends Annotatable> haveAnnotations) { stack.push(new GraphAnnotationState(haveAnnotations.size())); for (Annotatable h : haveAnnotations) { stack.peek().add(new AnnotationState(h, h.getAnnotation())); ...
[ "private", "static", "void", "pushAnnotations", "(", "Deque", "<", "GraphAnnotationState", ">", "stack", ",", "Collection", "<", "?", "extends", "Annotatable", ">", "haveAnnotations", ")", "{", "stack", ".", "push", "(", "new", "GraphAnnotationState", "(", "have...
Pushes a new list on stack and stores nodes annotations in the new list. Clears objects' annotations as well.
[ "Pushes", "a", "new", "list", "on", "stack", "and", "stores", "nodes", "annotations", "in", "the", "new", "list", ".", "Clears", "objects", "annotations", "as", "well", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/Graph.java#L333-L341
24,047
google/closure-compiler
src/com/google/javascript/jscomp/graph/Graph.java
Graph.popAnnotations
private static void popAnnotations(Deque<GraphAnnotationState> stack) { for (AnnotationState as : stack.pop()) { as.first.setAnnotation(as.second); } }
java
private static void popAnnotations(Deque<GraphAnnotationState> stack) { for (AnnotationState as : stack.pop()) { as.first.setAnnotation(as.second); } }
[ "private", "static", "void", "popAnnotations", "(", "Deque", "<", "GraphAnnotationState", ">", "stack", ")", "{", "for", "(", "AnnotationState", "as", ":", "stack", ".", "pop", "(", ")", ")", "{", "as", ".", "first", ".", "setAnnotation", "(", "as", ".",...
Restores the node annotations on the top of stack and pops stack.
[ "Restores", "the", "node", "annotations", "on", "the", "top", "of", "stack", "and", "pops", "stack", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/Graph.java#L346-L350
24,048
google/closure-compiler
src/com/google/javascript/jscomp/PassConfig.java
PassConfig.regenerateGlobalTypedScope
void regenerateGlobalTypedScope(AbstractCompiler compiler, Node root) { typedScopeCreator = new TypedScopeCreator(compiler); topScope = typedScopeCreator.createScope(root, null); }
java
void regenerateGlobalTypedScope(AbstractCompiler compiler, Node root) { typedScopeCreator = new TypedScopeCreator(compiler); topScope = typedScopeCreator.createScope(root, null); }
[ "void", "regenerateGlobalTypedScope", "(", "AbstractCompiler", "compiler", ",", "Node", "root", ")", "{", "typedScopeCreator", "=", "new", "TypedScopeCreator", "(", "compiler", ")", ";", "topScope", "=", "typedScopeCreator", ".", "createScope", "(", "root", ",", "...
Regenerates the top scope from scratch. @param compiler The compiler for which the global scope is regenerated. @param root The root of the AST.
[ "Regenerates", "the", "top", "scope", "from", "scratch", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L53-L56
24,049
google/closure-compiler
src/com/google/javascript/jscomp/PassConfig.java
PassConfig.patchGlobalTypedScope
void patchGlobalTypedScope(AbstractCompiler compiler, Node scriptRoot) { checkNotNull(typedScopeCreator); typedScopeCreator.patchGlobalScope(topScope, scriptRoot); }
java
void patchGlobalTypedScope(AbstractCompiler compiler, Node scriptRoot) { checkNotNull(typedScopeCreator); typedScopeCreator.patchGlobalScope(topScope, scriptRoot); }
[ "void", "patchGlobalTypedScope", "(", "AbstractCompiler", "compiler", ",", "Node", "scriptRoot", ")", "{", "checkNotNull", "(", "typedScopeCreator", ")", ";", "typedScopeCreator", ".", "patchGlobalScope", "(", "topScope", ",", "scriptRoot", ")", ";", "}" ]
Regenerates the top scope potentially only for a sub-tree of AST and then copies information for the old global scope. @param compiler The compiler for which the global scope is generated. @param scriptRoot The root of the AST used to generate global scope.
[ "Regenerates", "the", "top", "scope", "potentially", "only", "for", "a", "sub", "-", "tree", "of", "AST", "and", "then", "copies", "information", "for", "the", "old", "global", "scope", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L70-L73
24,050
google/closure-compiler
src/com/google/javascript/jscomp/PassConfig.java
PassConfig.getPassGraph
GraphvizGraph getPassGraph() { LinkedDirectedGraph<String, String> graph = LinkedDirectedGraph.createWithoutAnnotations(); Iterable<PassFactory> allPasses = Iterables.concat(getChecks(), getOptimizations()); String lastPass = null; String loopStart = null; for (PassFactory pass : all...
java
GraphvizGraph getPassGraph() { LinkedDirectedGraph<String, String> graph = LinkedDirectedGraph.createWithoutAnnotations(); Iterable<PassFactory> allPasses = Iterables.concat(getChecks(), getOptimizations()); String lastPass = null; String loopStart = null; for (PassFactory pass : all...
[ "GraphvizGraph", "getPassGraph", "(", ")", "{", "LinkedDirectedGraph", "<", "String", ",", "String", ">", "graph", "=", "LinkedDirectedGraph", ".", "createWithoutAnnotations", "(", ")", ";", "Iterable", "<", "PassFactory", ">", "allPasses", "=", "Iterables", ".", ...
Gets a graph of the passes run. For debugging.
[ "Gets", "a", "graph", "of", "the", "passes", "run", ".", "For", "debugging", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L126-L154
24,051
google/closure-compiler
src/com/google/javascript/jscomp/PassConfig.java
PassConfig.makeTypeInference
final TypeInferencePass makeTypeInference(AbstractCompiler compiler) { return new TypeInferencePass( compiler, compiler.getReverseAbstractInterpreter(), topScope, typedScopeCreator); }
java
final TypeInferencePass makeTypeInference(AbstractCompiler compiler) { return new TypeInferencePass( compiler, compiler.getReverseAbstractInterpreter(), topScope, typedScopeCreator); }
[ "final", "TypeInferencePass", "makeTypeInference", "(", "AbstractCompiler", "compiler", ")", "{", "return", "new", "TypeInferencePass", "(", "compiler", ",", "compiler", ".", "getReverseAbstractInterpreter", "(", ")", ",", "topScope", ",", "typedScopeCreator", ")", ";...
Create a type inference pass.
[ "Create", "a", "type", "inference", "pass", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L159-L163
24,052
google/closure-compiler
src/com/google/javascript/jscomp/PassConfig.java
PassConfig.makeTypeCheck
final TypeCheck makeTypeCheck(AbstractCompiler compiler) { return new TypeCheck( compiler, compiler.getReverseAbstractInterpreter(), compiler.getTypeRegistry(), topScope, typedScopeCreator) .reportUnknownTypes(options.enables(DiagnosticGroup.forTyp...
java
final TypeCheck makeTypeCheck(AbstractCompiler compiler) { return new TypeCheck( compiler, compiler.getReverseAbstractInterpreter(), compiler.getTypeRegistry(), topScope, typedScopeCreator) .reportUnknownTypes(options.enables(DiagnosticGroup.forTyp...
[ "final", "TypeCheck", "makeTypeCheck", "(", "AbstractCompiler", "compiler", ")", "{", "return", "new", "TypeCheck", "(", "compiler", ",", "compiler", ".", "getReverseAbstractInterpreter", "(", ")", ",", "compiler", ".", "getTypeRegistry", "(", ")", ",", "topScope"...
Create a type-checking pass.
[ "Create", "a", "type", "-", "checking", "pass", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L172-L182
24,053
google/closure-compiler
src/com/google/javascript/jscomp/PassConfig.java
PassConfig.addPassFactoryBefore
static final void addPassFactoryBefore( List<PassFactory> factoryList, PassFactory factory, String passName) { factoryList.add( findPassIndexByName(factoryList, passName), factory); }
java
static final void addPassFactoryBefore( List<PassFactory> factoryList, PassFactory factory, String passName) { factoryList.add( findPassIndexByName(factoryList, passName), factory); }
[ "static", "final", "void", "addPassFactoryBefore", "(", "List", "<", "PassFactory", ">", "factoryList", ",", "PassFactory", "factory", ",", "String", "passName", ")", "{", "factoryList", ".", "add", "(", "findPassIndexByName", "(", "factoryList", ",", "passName", ...
Insert the given pass factory before the factory of the given name.
[ "Insert", "the", "given", "pass", "factory", "before", "the", "factory", "of", "the", "given", "name", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L187-L191
24,054
google/closure-compiler
src/com/google/javascript/jscomp/PassConfig.java
PassConfig.replacePassFactory
static final void replacePassFactory( List<PassFactory> factoryList, PassFactory factory) { factoryList.set( findPassIndexByName(factoryList, factory.getName()), factory); }
java
static final void replacePassFactory( List<PassFactory> factoryList, PassFactory factory) { factoryList.set( findPassIndexByName(factoryList, factory.getName()), factory); }
[ "static", "final", "void", "replacePassFactory", "(", "List", "<", "PassFactory", ">", "factoryList", ",", "PassFactory", "factory", ")", "{", "factoryList", ".", "set", "(", "findPassIndexByName", "(", "factoryList", ",", "factory", ".", "getName", "(", ")", ...
Find a pass factory with the same name as the given one, and replace it.
[ "Find", "a", "pass", "factory", "with", "the", "same", "name", "as", "the", "given", "one", "and", "replace", "it", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L196-L200
24,055
google/closure-compiler
src/com/google/javascript/jscomp/PassConfig.java
PassConfig.findPassIndexByName
private static int findPassIndexByName( List<PassFactory> factoryList, String name) { for (int i = 0; i < factoryList.size(); i++) { if (factoryList.get(i).getName().equals(name)) { return i; } } throw new IllegalArgumentException( "No factory named '" + name + "' in the f...
java
private static int findPassIndexByName( List<PassFactory> factoryList, String name) { for (int i = 0; i < factoryList.size(); i++) { if (factoryList.get(i).getName().equals(name)) { return i; } } throw new IllegalArgumentException( "No factory named '" + name + "' in the f...
[ "private", "static", "int", "findPassIndexByName", "(", "List", "<", "PassFactory", ">", "factoryList", ",", "String", "name", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "factoryList", ".", "size", "(", ")", ";", "i", "++", ")", "{", ...
Throws an exception if no pass with the given name exists.
[ "Throws", "an", "exception", "if", "no", "pass", "with", "the", "given", "name", "exists", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L205-L215
24,056
google/closure-compiler
src/com/google/javascript/jscomp/PassConfig.java
PassConfig.getBasePassConfig
final PassConfig getBasePassConfig() { PassConfig current = this; while (current instanceof PassConfigDelegate) { current = ((PassConfigDelegate) current).delegate; } return current; }
java
final PassConfig getBasePassConfig() { PassConfig current = this; while (current instanceof PassConfigDelegate) { current = ((PassConfigDelegate) current).delegate; } return current; }
[ "final", "PassConfig", "getBasePassConfig", "(", ")", "{", "PassConfig", "current", "=", "this", ";", "while", "(", "current", "instanceof", "PassConfigDelegate", ")", "{", "current", "=", "(", "(", "PassConfigDelegate", ")", "current", ")", ".", "delegate", "...
Find the first pass provider that does not have a delegate.
[ "Find", "the", "first", "pass", "provider", "that", "does", "not", "have", "a", "delegate", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L220-L226
24,057
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.empty
@SuppressWarnings("unchecked") // Empty immutable collection is safe to cast. public static <K, V> HamtPMap<K, V> empty() { return (HamtPMap<K, V>) EMPTY; }
java
@SuppressWarnings("unchecked") // Empty immutable collection is safe to cast. public static <K, V> HamtPMap<K, V> empty() { return (HamtPMap<K, V>) EMPTY; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// Empty immutable collection is safe to cast.", "public", "static", "<", "K", ",", "V", ">", "HamtPMap", "<", "K", ",", "V", ">", "empty", "(", ")", "{", "return", "(", "HamtPMap", "<", "K", ",", "V", "...
Returns an empty map.
[ "Returns", "an", "empty", "map", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L115-L118
24,058
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.emptyChildren
@SuppressWarnings("unchecked") // Empty array is safe to cast. private static <K, V> HamtPMap<K, V>[] emptyChildren() { return (HamtPMap<K, V>[]) EMPTY_CHILDREN; }
java
@SuppressWarnings("unchecked") // Empty array is safe to cast. private static <K, V> HamtPMap<K, V>[] emptyChildren() { return (HamtPMap<K, V>[]) EMPTY_CHILDREN; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// Empty array is safe to cast.", "private", "static", "<", "K", ",", "V", ">", "HamtPMap", "<", "K", ",", "V", ">", "[", "]", "emptyChildren", "(", ")", "{", "return", "(", "HamtPMap", "<", "K", ",", ...
Returns an empty array of child maps.
[ "Returns", "an", "empty", "array", "of", "child", "maps", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L121-L124
24,059
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.appendTo
private void appendTo(StringBuilder sb) { if (sb.length() > 1) { sb.append(", "); } sb.append(key).append(": ").append(value); for (HamtPMap<K, V> child : children) { child.appendTo(sb); } }
java
private void appendTo(StringBuilder sb) { if (sb.length() > 1) { sb.append(", "); } sb.append(key).append(": ").append(value); for (HamtPMap<K, V> child : children) { child.appendTo(sb); } }
[ "private", "void", "appendTo", "(", "StringBuilder", "sb", ")", "{", "if", "(", "sb", ".", "length", "(", ")", ">", "1", ")", "{", "sb", ".", "append", "(", "\", \"", ")", ";", "}", "sb", ".", "append", "(", "key", ")", ".", "append", "(", "\":...
Appends this map's contents to a string builder.
[ "Appends", "this", "map", "s", "contents", "to", "a", "string", "builder", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L136-L144
24,060
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.get
@Override public V get(K key) { return !isEmpty() ? get(key, hash(key)) : null; }
java
@Override public V get(K key) { return !isEmpty() ? get(key, hash(key)) : null; }
[ "@", "Override", "public", "V", "get", "(", "K", "key", ")", "{", "return", "!", "isEmpty", "(", ")", "?", "get", "(", "key", ",", "hash", "(", "key", ")", ")", ":", "null", ";", "}" ]
Retrieves the value associated with the given key from the map, or returns null if it is not present.
[ "Retrieves", "the", "value", "associated", "with", "the", "given", "key", "from", "the", "map", "or", "returns", "null", "if", "it", "is", "not", "present", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L165-L168
24,061
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.plus
@Override public HamtPMap<K, V> plus(K key, V value) { return !isEmpty() ? plus(key, hash(key), checkNotNull(value)) : new HamtPMap<>(key, hash(key), value, 0, emptyChildren()); }
java
@Override public HamtPMap<K, V> plus(K key, V value) { return !isEmpty() ? plus(key, hash(key), checkNotNull(value)) : new HamtPMap<>(key, hash(key), value, 0, emptyChildren()); }
[ "@", "Override", "public", "HamtPMap", "<", "K", ",", "V", ">", "plus", "(", "K", "key", ",", "V", "value", ")", "{", "return", "!", "isEmpty", "(", ")", "?", "plus", "(", "key", ",", "hash", "(", "key", ")", ",", "checkNotNull", "(", "value", ...
Returns a new map with the given key-value pair added. If the value is already present, then this same map will be returned.
[ "Returns", "a", "new", "map", "with", "the", "given", "key", "-", "value", "pair", "added", ".", "If", "the", "value", "is", "already", "present", "then", "this", "same", "map", "will", "be", "returned", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L184-L189
24,062
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.minus
@Override public HamtPMap<K, V> minus(K key) { return !isEmpty() ? minus(key, hash(key), null) : this; }
java
@Override public HamtPMap<K, V> minus(K key) { return !isEmpty() ? minus(key, hash(key), null) : this; }
[ "@", "Override", "public", "HamtPMap", "<", "K", ",", "V", ">", "minus", "(", "K", "key", ")", "{", "return", "!", "isEmpty", "(", ")", "?", "minus", "(", "key", ",", "hash", "(", "key", ")", ",", "null", ")", ":", "this", ";", "}" ]
Returns a new map with the given key removed. If the key was not present in the first place, then this same map will be returned.
[ "Returns", "a", "new", "map", "with", "the", "given", "key", "removed", ".", "If", "the", "key", "was", "not", "present", "in", "the", "first", "place", "then", "this", "same", "map", "will", "be", "returned", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L237-L240
24,063
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.equivalent
@Override public boolean equivalent(PMap<K, V> that, BiPredicate<V, V> equivalence) { return equivalent( !this.isEmpty() ? this : null, !that.isEmpty() ? (HamtPMap<K, V>) that : null, equivalence); }
java
@Override public boolean equivalent(PMap<K, V> that, BiPredicate<V, V> equivalence) { return equivalent( !this.isEmpty() ? this : null, !that.isEmpty() ? (HamtPMap<K, V>) that : null, equivalence); }
[ "@", "Override", "public", "boolean", "equivalent", "(", "PMap", "<", "K", ",", "V", ">", "that", ",", "BiPredicate", "<", "V", ",", "V", ">", "equivalence", ")", "{", "return", "equivalent", "(", "!", "this", ".", "isEmpty", "(", ")", "?", "this", ...
Checks equality recursively based on the given equivalence. Short-circuits as soon as a 'false' result is found.
[ "Checks", "equality", "recursively", "based", "on", "the", "given", "equivalence", ".", "Short", "-", "circuits", "as", "soon", "as", "a", "false", "result", "is", "found", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L375-L379
24,064
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.getChild
private HamtPMap<K, V> getChild(int bit) { return (mask & bit) != 0 ? children[index(bit)] : null; }
java
private HamtPMap<K, V> getChild(int bit) { return (mask & bit) != 0 ? children[index(bit)] : null; }
[ "private", "HamtPMap", "<", "K", ",", "V", ">", "getChild", "(", "int", "bit", ")", "{", "return", "(", "mask", "&", "bit", ")", "!=", "0", "?", "children", "[", "index", "(", "bit", ")", "]", ":", "null", ";", "}" ]
Returns the child for the given bit, which must have exactly one bit set. Returns null if there is no child for that bit.
[ "Returns", "the", "child", "for", "the", "given", "bit", "which", "must", "have", "exactly", "one", "bit", "set", ".", "Returns", "null", "if", "there", "is", "no", "child", "for", "that", "bit", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L431-L433
24,065
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.compareUnsigned
private static int compareUnsigned(int left, int right) { // NOTE: JDK 7 does not have a built-in operation for this, other than casting to longs. // In JDK 8 it's just Integer.compareUnsigned(left, right). For now we emulate it // by shifting the sign bit away, with a fallback second compare o...
java
private static int compareUnsigned(int left, int right) { // NOTE: JDK 7 does not have a built-in operation for this, other than casting to longs. // In JDK 8 it's just Integer.compareUnsigned(left, right). For now we emulate it // by shifting the sign bit away, with a fallback second compare o...
[ "private", "static", "int", "compareUnsigned", "(", "int", "left", ",", "int", "right", ")", "{", "// NOTE: JDK 7 does not have a built-in operation for this, other than casting to longs.", "// In JDK 8 it's just Integer.compareUnsigned(left, right). For now we emulate it", "// ...
Compare two unsigned integers.
[ "Compare", "two", "unsigned", "integers", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L463-L469
24,066
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.pivot
@SuppressWarnings("unchecked") private HamtPMap<K, V> pivot(K key, int hash) { return pivot(key, hash, null, (V[]) new Object[1]); }
java
@SuppressWarnings("unchecked") private HamtPMap<K, V> pivot(K key, int hash) { return pivot(key, hash, null, (V[]) new Object[1]); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "HamtPMap", "<", "K", ",", "V", ">", "pivot", "(", "K", "key", ",", "int", "hash", ")", "{", "return", "pivot", "(", "key", ",", "hash", ",", "null", ",", "(", "V", "[", "]", ")", "ne...
Returns a new version of this map with the given key at the root, and the root element moved to some deeper node. If the key is not found, then value will be null.
[ "Returns", "a", "new", "version", "of", "this", "map", "with", "the", "given", "key", "at", "the", "root", "and", "the", "root", "element", "moved", "to", "some", "deeper", "node", ".", "If", "the", "key", "is", "not", "found", "then", "value", "will",...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L475-L478
24,067
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.pivot
private HamtPMap<K, V> pivot(K key, int hash, HamtPMap<K, V> parent, V[] result) { int newMask = mask; HamtPMap<K, V>[] newChildren = this.children; if (hash == this.hash && key.equals(this.key)) { // Found the key: swap out this key/value with the parent and return the result in the holder. res...
java
private HamtPMap<K, V> pivot(K key, int hash, HamtPMap<K, V> parent, V[] result) { int newMask = mask; HamtPMap<K, V>[] newChildren = this.children; if (hash == this.hash && key.equals(this.key)) { // Found the key: swap out this key/value with the parent and return the result in the holder. res...
[ "private", "HamtPMap", "<", "K", ",", "V", ">", "pivot", "(", "K", "key", ",", "int", "hash", ",", "HamtPMap", "<", "K", ",", "V", ">", "parent", ",", "V", "[", "]", "result", ")", "{", "int", "newMask", "=", "mask", ";", "HamtPMap", "<", "K", ...
Internal recursive version of pivot. If parent is null then the result is used for the value in the returned map. The value, if found, is stored in the 'result' array as a secondary return.
[ "Internal", "recursive", "version", "of", "pivot", ".", "If", "parent", "is", "null", "then", "the", "result", "is", "used", "for", "the", "value", "in", "the", "returned", "map", ".", "The", "value", "if", "found", "is", "stored", "in", "the", "result",...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L484-L536
24,068
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.vacateRoot
private HamtPMap<K, V> vacateRoot() { int bucket = bucket(this.hash); int bucketMask = 1 << bucket; int index = index(bucketMask); if ((mask & bucketMask) != 0) { HamtPMap<K, V> newChild = children[index].plus(this.key, shift(this.hash), this.value); return new HamtPMap<>(null, 0, null, mask...
java
private HamtPMap<K, V> vacateRoot() { int bucket = bucket(this.hash); int bucketMask = 1 << bucket; int index = index(bucketMask); if ((mask & bucketMask) != 0) { HamtPMap<K, V> newChild = children[index].plus(this.key, shift(this.hash), this.value); return new HamtPMap<>(null, 0, null, mask...
[ "private", "HamtPMap", "<", "K", ",", "V", ">", "vacateRoot", "(", ")", "{", "int", "bucket", "=", "bucket", "(", "this", ".", "hash", ")", ";", "int", "bucketMask", "=", "1", "<<", "bucket", ";", "int", "index", "=", "index", "(", "bucketMask", ")...
Moves the root into the appropriate child.
[ "Moves", "the", "root", "into", "the", "appropriate", "child", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L539-L550
24,069
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.withChildren
private HamtPMap<K, V> withChildren(int mask, HamtPMap<K, V>[] children) { return mask == this.mask && children == this.children ? this : new HamtPMap<>(key, hash, value, mask, children); }
java
private HamtPMap<K, V> withChildren(int mask, HamtPMap<K, V>[] children) { return mask == this.mask && children == this.children ? this : new HamtPMap<>(key, hash, value, mask, children); }
[ "private", "HamtPMap", "<", "K", ",", "V", ">", "withChildren", "(", "int", "mask", ",", "HamtPMap", "<", "K", ",", "V", ">", "[", "]", "children", ")", "{", "return", "mask", "==", "this", ".", "mask", "&&", "children", "==", "this", ".", "childre...
Returns a copy of this node with a different array of children.
[ "Returns", "a", "copy", "of", "this", "node", "with", "a", "different", "array", "of", "children", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L553-L557
24,070
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.deleteRoot
private static <K, V> HamtPMap<K, V> deleteRoot(int mask, HamtPMap<K, V>[] children) { if (mask == 0) { return null; } HamtPMap<K, V> child = children[0]; int hashBits = Integer.numberOfTrailingZeros(mask); int newHash = unshift(child.hash, hashBits); HamtPMap<K, V> newChild = deleteRoot(c...
java
private static <K, V> HamtPMap<K, V> deleteRoot(int mask, HamtPMap<K, V>[] children) { if (mask == 0) { return null; } HamtPMap<K, V> child = children[0]; int hashBits = Integer.numberOfTrailingZeros(mask); int newHash = unshift(child.hash, hashBits); HamtPMap<K, V> newChild = deleteRoot(c...
[ "private", "static", "<", "K", ",", "V", ">", "HamtPMap", "<", "K", ",", "V", ">", "deleteRoot", "(", "int", "mask", ",", "HamtPMap", "<", "K", ",", "V", ">", "[", "]", "children", ")", "{", "if", "(", "mask", "==", "0", ")", "{", "return", "...
Returns a new map with the elements from children. One element is removed from one of the children and promoted to a root node. If there are no children, returns null.
[ "Returns", "a", "new", "map", "with", "the", "elements", "from", "children", ".", "One", "element", "is", "removed", "from", "one", "of", "the", "children", "and", "promoted", "to", "a", "root", "node", ".", "If", "there", "are", "no", "children", "retur...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L563-L578
24,071
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.insertChild
private static <K, V> HamtPMap<K, V>[] insertChild( HamtPMap<K, V>[] children, int index, HamtPMap<K, V> child) { @SuppressWarnings("unchecked") // only used internally. HamtPMap<K, V>[] newChildren = (HamtPMap<K, V>[]) new HamtPMap<?, ?>[children.length + 1]; newChildren[index] = child; System.ar...
java
private static <K, V> HamtPMap<K, V>[] insertChild( HamtPMap<K, V>[] children, int index, HamtPMap<K, V> child) { @SuppressWarnings("unchecked") // only used internally. HamtPMap<K, V>[] newChildren = (HamtPMap<K, V>[]) new HamtPMap<?, ?>[children.length + 1]; newChildren[index] = child; System.ar...
[ "private", "static", "<", "K", ",", "V", ">", "HamtPMap", "<", "K", ",", "V", ">", "[", "]", "insertChild", "(", "HamtPMap", "<", "K", ",", "V", ">", "[", "]", "children", ",", "int", "index", ",", "HamtPMap", "<", "K", ",", "V", ">", "child", ...
Returns a new array of children with an additional child inserted at the given index.
[ "Returns", "a", "new", "array", "of", "children", "with", "an", "additional", "child", "inserted", "at", "the", "given", "index", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L581-L589
24,072
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.replaceChild
private static <K, V> HamtPMap<K, V>[] replaceChild( HamtPMap<K, V>[] children, int index, HamtPMap<K, V> child) { HamtPMap<K, V>[] newChildren = Arrays.copyOf(children, children.length); newChildren[index] = child; return newChildren; }
java
private static <K, V> HamtPMap<K, V>[] replaceChild( HamtPMap<K, V>[] children, int index, HamtPMap<K, V> child) { HamtPMap<K, V>[] newChildren = Arrays.copyOf(children, children.length); newChildren[index] = child; return newChildren; }
[ "private", "static", "<", "K", ",", "V", ">", "HamtPMap", "<", "K", ",", "V", ">", "[", "]", "replaceChild", "(", "HamtPMap", "<", "K", ",", "V", ">", "[", "]", "children", ",", "int", "index", ",", "HamtPMap", "<", "K", ",", "V", ">", "child",...
Returns a new array of children with the child at the given index replaced.
[ "Returns", "a", "new", "array", "of", "children", "with", "the", "child", "at", "the", "given", "index", "replaced", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L592-L597
24,073
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.deleteChild
private static <K, V> HamtPMap<K, V>[] deleteChild( HamtPMap<K, V>[] children, int index) { if (children.length == 1) { // Note: index should always be zero. return emptyChildren(); } @SuppressWarnings("unchecked") // only used internally. HamtPMap<K, V>[] newChildren = (HamtPMap<K, V>...
java
private static <K, V> HamtPMap<K, V>[] deleteChild( HamtPMap<K, V>[] children, int index) { if (children.length == 1) { // Note: index should always be zero. return emptyChildren(); } @SuppressWarnings("unchecked") // only used internally. HamtPMap<K, V>[] newChildren = (HamtPMap<K, V>...
[ "private", "static", "<", "K", ",", "V", ">", "HamtPMap", "<", "K", ",", "V", ">", "[", "]", "deleteChild", "(", "HamtPMap", "<", "K", ",", "V", ">", "[", "]", "children", ",", "int", "index", ")", "{", "if", "(", "children", ".", "length", "==...
Returns a new array of children with the child at the given index deleted.
[ "Returns", "a", "new", "array", "of", "children", "with", "the", "child", "at", "the", "given", "index", "deleted", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L600-L611
24,074
google/closure-compiler
src/com/google/javascript/jscomp/IncrementalScopeCreator.java
IncrementalScopeCreator.getInstance
public static IncrementalScopeCreator getInstance(AbstractCompiler compiler) { IncrementalScopeCreator creator = compiler.getScopeCreator(); if (creator == null) { creator = new IncrementalScopeCreator(compiler); compiler.putScopeCreator(creator); } return creator; }
java
public static IncrementalScopeCreator getInstance(AbstractCompiler compiler) { IncrementalScopeCreator creator = compiler.getScopeCreator(); if (creator == null) { creator = new IncrementalScopeCreator(compiler); compiler.putScopeCreator(creator); } return creator; }
[ "public", "static", "IncrementalScopeCreator", "getInstance", "(", "AbstractCompiler", "compiler", ")", "{", "IncrementalScopeCreator", "creator", "=", "compiler", ".", "getScopeCreator", "(", ")", ";", "if", "(", "creator", "==", "null", ")", "{", "creator", "=",...
Get an instance of the ScopeCreator
[ "Get", "an", "instance", "of", "the", "ScopeCreator" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/IncrementalScopeCreator.java#L65-L72
24,075
google/closure-compiler
src/com/google/javascript/jscomp/bundle/Source.java
Source.builder
public static Builder builder() { return new AutoValue_Source.Builder() .setPath(DEV_NULL) .setCode("") .setOriginalCodeSupplier(null) .setSourceMap("") .setSourceUrl("") .setSourceMappingUrl("") .setRuntimes(ImmutableSet.of()) .setLoadFlags(ImmutableM...
java
public static Builder builder() { return new AutoValue_Source.Builder() .setPath(DEV_NULL) .setCode("") .setOriginalCodeSupplier(null) .setSourceMap("") .setSourceUrl("") .setSourceMappingUrl("") .setRuntimes(ImmutableSet.of()) .setLoadFlags(ImmutableM...
[ "public", "static", "Builder", "builder", "(", ")", "{", "return", "new", "AutoValue_Source", ".", "Builder", "(", ")", ".", "setPath", "(", "DEV_NULL", ")", ".", "setCode", "(", "\"\"", ")", ".", "setOriginalCodeSupplier", "(", "null", ")", ".", "setSourc...
Makes a new empty builder.
[ "Makes", "a", "new", "empty", "builder", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/bundle/Source.java#L75-L86
24,076
google/closure-compiler
src/com/google/javascript/jscomp/ChangeVerifier.java
ChangeVerifier.associateClones
private void associateClones(Node n, Node snapshot) { // TODO(johnlenz): determine if MODULE_BODY is useful here. if (n.isRoot() || NodeUtil.isChangeScopeRoot(n)) { clonesByCurrent.put(n, snapshot); } Node child = n.getFirstChild(); Node snapshotChild = snapshot.getFirstChild(); while (ch...
java
private void associateClones(Node n, Node snapshot) { // TODO(johnlenz): determine if MODULE_BODY is useful here. if (n.isRoot() || NodeUtil.isChangeScopeRoot(n)) { clonesByCurrent.put(n, snapshot); } Node child = n.getFirstChild(); Node snapshotChild = snapshot.getFirstChild(); while (ch...
[ "private", "void", "associateClones", "(", "Node", "n", ",", "Node", "snapshot", ")", "{", "// TODO(johnlenz): determine if MODULE_BODY is useful here.", "if", "(", "n", ".", "isRoot", "(", ")", "||", "NodeUtil", ".", "isChangeScopeRoot", "(", "n", ")", ")", "{"...
Given an AST and its copy, map the root node of each scope of main to the corresponding root node of clone
[ "Given", "an", "AST", "and", "its", "copy", "map", "the", "root", "node", "of", "each", "scope", "of", "main", "to", "the", "corresponding", "root", "node", "of", "clone" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ChangeVerifier.java#L62-L75
24,077
google/closure-compiler
src/com/google/javascript/jscomp/ChangeVerifier.java
ChangeVerifier.verifyScopeChangesHaveBeenRecorded
private void verifyScopeChangesHaveBeenRecorded(String passName, Node root) { final String passNameMsg = passName.isEmpty() ? "" : passName + ": "; // Gather all the scope nodes that existed when the snapshot was taken. final Set<Node> snapshotScopeNodes = new HashSet<>(); NodeUtil.visitPreOrder( ...
java
private void verifyScopeChangesHaveBeenRecorded(String passName, Node root) { final String passNameMsg = passName.isEmpty() ? "" : passName + ": "; // Gather all the scope nodes that existed when the snapshot was taken. final Set<Node> snapshotScopeNodes = new HashSet<>(); NodeUtil.visitPreOrder( ...
[ "private", "void", "verifyScopeChangesHaveBeenRecorded", "(", "String", "passName", ",", "Node", "root", ")", "{", "final", "String", "passNameMsg", "=", "passName", ".", "isEmpty", "(", ")", "?", "\"\"", ":", "passName", "+", "\": \"", ";", "// Gather all the s...
Checks that the scope roots marked as changed have indeed changed
[ "Checks", "that", "the", "scope", "roots", "marked", "as", "changed", "have", "indeed", "changed" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ChangeVerifier.java#L78-L117
24,078
google/closure-compiler
src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java
FunctionParamBuilder.addRequiredParams
public boolean addRequiredParams(JSType ...types) { if (hasOptionalOrVarArgs()) { return false; } for (JSType type : types) { newParameter(type); } return true; }
java
public boolean addRequiredParams(JSType ...types) { if (hasOptionalOrVarArgs()) { return false; } for (JSType type : types) { newParameter(type); } return true; }
[ "public", "boolean", "addRequiredParams", "(", "JSType", "...", "types", ")", "{", "if", "(", "hasOptionalOrVarArgs", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "JSType", "type", ":", "types", ")", "{", "newParameter", "(", "type", ")",...
Add parameters of the given type to the end of the param list. @return False if this is called after optional params are added.
[ "Add", "parameters", "of", "the", "given", "type", "to", "the", "end", "of", "the", "param", "list", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java#L62-L71
24,079
google/closure-compiler
src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java
FunctionParamBuilder.addOptionalParams
public boolean addOptionalParams(JSType ...types) { if (hasVarArgs()) { return false; } for (JSType type : types) { newParameter(registry.createOptionalType(type)).setOptionalArg(true); } return true; }
java
public boolean addOptionalParams(JSType ...types) { if (hasVarArgs()) { return false; } for (JSType type : types) { newParameter(registry.createOptionalType(type)).setOptionalArg(true); } return true; }
[ "public", "boolean", "addOptionalParams", "(", "JSType", "...", "types", ")", "{", "if", "(", "hasVarArgs", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "JSType", "type", ":", "types", ")", "{", "newParameter", "(", "registry", ".", "cr...
Add optional parameters of the given type to the end of the param list. @param types Types for each optional parameter. The builder will make them undefine-able. @return False if this is called after var args are added.
[ "Add", "optional", "parameters", "of", "the", "given", "type", "to", "the", "end", "of", "the", "param", "list", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java#L79-L88
24,080
google/closure-compiler
src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java
FunctionParamBuilder.addVarArgs
public boolean addVarArgs(JSType type) { if (hasVarArgs()) { return false; } newParameter(type).setVarArgs(true); return true; }
java
public boolean addVarArgs(JSType type) { if (hasVarArgs()) { return false; } newParameter(type).setVarArgs(true); return true; }
[ "public", "boolean", "addVarArgs", "(", "JSType", "type", ")", "{", "if", "(", "hasVarArgs", "(", ")", ")", "{", "return", "false", ";", "}", "newParameter", "(", "type", ")", ".", "setVarArgs", "(", "true", ")", ";", "return", "true", ";", "}" ]
Add variable arguments to the end of the parameter list. @return False if this is called after var args are added.
[ "Add", "variable", "arguments", "to", "the", "end", "of", "the", "parameter", "list", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java#L94-L101
24,081
google/closure-compiler
src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java
FunctionParamBuilder.newParameterFromNode
public Node newParameterFromNode(Node n) { Node newParam = newParameter(n.getJSType()); newParam.setVarArgs(n.isVarArgs()); newParam.setOptionalArg(n.isOptionalArg()); return newParam; }
java
public Node newParameterFromNode(Node n) { Node newParam = newParameter(n.getJSType()); newParam.setVarArgs(n.isVarArgs()); newParam.setOptionalArg(n.isOptionalArg()); return newParam; }
[ "public", "Node", "newParameterFromNode", "(", "Node", "n", ")", "{", "Node", "newParam", "=", "newParameter", "(", "n", ".", "getJSType", "(", ")", ")", ";", "newParam", ".", "setVarArgs", "(", "n", ".", "isVarArgs", "(", ")", ")", ";", "newParam", "....
Copies the parameter specification from the given node.
[ "Copies", "the", "parameter", "specification", "from", "the", "given", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java#L106-L111
24,082
google/closure-compiler
src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java
FunctionParamBuilder.newOptionalParameterFromNode
public Node newOptionalParameterFromNode(Node n) { Node newParam = newParameterFromNode(n); if (!newParam.isVarArgs() && !newParam.isOptionalArg()) { newParam.setOptionalArg(true); } return newParam; }
java
public Node newOptionalParameterFromNode(Node n) { Node newParam = newParameterFromNode(n); if (!newParam.isVarArgs() && !newParam.isOptionalArg()) { newParam.setOptionalArg(true); } return newParam; }
[ "public", "Node", "newOptionalParameterFromNode", "(", "Node", "n", ")", "{", "Node", "newParam", "=", "newParameterFromNode", "(", "n", ")", ";", "if", "(", "!", "newParam", ".", "isVarArgs", "(", ")", "&&", "!", "newParam", ".", "isOptionalArg", "(", ")"...
Copies the parameter specification from the given node, but makes sure it's optional.
[ "Copies", "the", "parameter", "specification", "from", "the", "given", "node", "but", "makes", "sure", "it", "s", "optional", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java#L117-L123
24,083
google/closure-compiler
src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java
FunctionParamBuilder.newParameter
private Node newParameter(JSType type) { Node paramNode = Node.newString(Token.NAME, ""); paramNode.setJSType(type); root.addChildToBack(paramNode); return paramNode; }
java
private Node newParameter(JSType type) { Node paramNode = Node.newString(Token.NAME, ""); paramNode.setJSType(type); root.addChildToBack(paramNode); return paramNode; }
[ "private", "Node", "newParameter", "(", "JSType", "type", ")", "{", "Node", "paramNode", "=", "Node", ".", "newString", "(", "Token", ".", "NAME", ",", "\"\"", ")", ";", "paramNode", ".", "setJSType", "(", "type", ")", ";", "root", ".", "addChildToBack",...
Add a parameter to the list with the given type.
[ "Add", "a", "parameter", "to", "the", "list", "with", "the", "given", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/FunctionParamBuilder.java#L126-L131
24,084
google/closure-compiler
src/com/google/javascript/jscomp/GatherGettersAndSetterProperties.java
GatherGettersAndSetterProperties.update
static void update(AbstractCompiler compiler, Node externs, Node root) { compiler.setExternGetterAndSetterProperties(gather(compiler, externs)); compiler.setSourceGetterAndSetterProperties(gather(compiler, root)); }
java
static void update(AbstractCompiler compiler, Node externs, Node root) { compiler.setExternGetterAndSetterProperties(gather(compiler, externs)); compiler.setSourceGetterAndSetterProperties(gather(compiler, root)); }
[ "static", "void", "update", "(", "AbstractCompiler", "compiler", ",", "Node", "externs", ",", "Node", "root", ")", "{", "compiler", ".", "setExternGetterAndSetterProperties", "(", "gather", "(", "compiler", ",", "externs", ")", ")", ";", "compiler", ".", "setS...
Gathers all getters and setters in the AST.
[ "Gathers", "all", "getters", "and", "setters", "in", "the", "AST", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/GatherGettersAndSetterProperties.java#L45-L48
24,085
google/closure-compiler
src/com/google/javascript/jscomp/lint/CheckProvidesSorted.java
CheckProvidesSorted.formatProvide
private static String formatProvide(String namespace) { StringBuilder sb = new StringBuilder(); sb.append("goog.provide('"); sb.append(namespace); sb.append("');"); return sb.toString(); }
java
private static String formatProvide(String namespace) { StringBuilder sb = new StringBuilder(); sb.append("goog.provide('"); sb.append(namespace); sb.append("');"); return sb.toString(); }
[ "private", "static", "String", "formatProvide", "(", "String", "namespace", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"goog.provide('\"", ")", ";", "sb", ".", "append", "(", "namespace", ")", "...
Returns the code for a correctly formatted provide call.
[ "Returns", "the", "code", "for", "a", "correctly", "formatted", "provide", "call", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/lint/CheckProvidesSorted.java#L127-L135
24,086
google/closure-compiler
src/com/google/javascript/jscomp/ExtractPrototypeMemberDeclarations.java
ExtractPrototypeMemberDeclarations.doExtraction
private void doExtraction(GatherExtractionInfo info) { // Insert a global temp if we are using the USE_GLOBAL_TEMP pattern. if (pattern == Pattern.USE_GLOBAL_TEMP) { Node injectionPoint = compiler.getNodeForCodeInsertion(null); Node var = NodeUtil.newVarNode(PROTOTYPE_ALIAS, null) .useSou...
java
private void doExtraction(GatherExtractionInfo info) { // Insert a global temp if we are using the USE_GLOBAL_TEMP pattern. if (pattern == Pattern.USE_GLOBAL_TEMP) { Node injectionPoint = compiler.getNodeForCodeInsertion(null); Node var = NodeUtil.newVarNode(PROTOTYPE_ALIAS, null) .useSou...
[ "private", "void", "doExtraction", "(", "GatherExtractionInfo", "info", ")", "{", "// Insert a global temp if we are using the USE_GLOBAL_TEMP pattern.", "if", "(", "pattern", "==", "Pattern", ".", "USE_GLOBAL_TEMP", ")", "{", "Node", "injectionPoint", "=", "compiler", "....
Declares the temp variable to point to prototype objects and iterates through all ExtractInstance and performs extraction there.
[ "Declares", "the", "temp", "variable", "to", "point", "to", "prototype", "objects", "and", "iterates", "through", "all", "ExtractInstance", "and", "performs", "extraction", "there", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExtractPrototypeMemberDeclarations.java#L150-L165
24,087
google/closure-compiler
src/com/google/javascript/jscomp/ExtractPrototypeMemberDeclarations.java
ExtractPrototypeMemberDeclarations.extractInstance
private void extractInstance(ExtractionInstance instance) { PrototypeMemberDeclaration first = instance.declarations.get(0); String className = first.qualifiedClassName; if (pattern == Pattern.USE_GLOBAL_TEMP) { // Use the temp variable to hold the prototype. Node classNameNode = NodeUtil.newQNa...
java
private void extractInstance(ExtractionInstance instance) { PrototypeMemberDeclaration first = instance.declarations.get(0); String className = first.qualifiedClassName; if (pattern == Pattern.USE_GLOBAL_TEMP) { // Use the temp variable to hold the prototype. Node classNameNode = NodeUtil.newQNa...
[ "private", "void", "extractInstance", "(", "ExtractionInstance", "instance", ")", "{", "PrototypeMemberDeclaration", "first", "=", "instance", ".", "declarations", ".", "get", "(", "0", ")", ";", "String", "className", "=", "first", ".", "qualifiedClassName", ";",...
At a given ExtractionInstance, stores and prototype object in the temp variable and rewrite each member declaration to assign to the temp variable instead.
[ "At", "a", "given", "ExtractionInstance", "stores", "and", "prototype", "object", "in", "the", "temp", "variable", "and", "rewrite", "each", "member", "declaration", "to", "assign", "to", "the", "temp", "variable", "instead", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExtractPrototypeMemberDeclarations.java#L172-L216
24,088
google/closure-compiler
src/com/google/javascript/jscomp/ExtractPrototypeMemberDeclarations.java
ExtractPrototypeMemberDeclarations.replacePrototypeMemberDeclaration
private void replacePrototypeMemberDeclaration(PrototypeMemberDeclaration declar) { // x.prototype.y = ... -> t.y = ... Node assignment = declar.node.getFirstChild(); Node lhs = assignment.getFirstChild(); Node name = NodeUtil.newQName( compiler, PROTOTYPE_ALIAS + "." + declar.memberNa...
java
private void replacePrototypeMemberDeclaration(PrototypeMemberDeclaration declar) { // x.prototype.y = ... -> t.y = ... Node assignment = declar.node.getFirstChild(); Node lhs = assignment.getFirstChild(); Node name = NodeUtil.newQName( compiler, PROTOTYPE_ALIAS + "." + declar.memberNa...
[ "private", "void", "replacePrototypeMemberDeclaration", "(", "PrototypeMemberDeclaration", "declar", ")", "{", "// x.prototype.y = ... -> t.y = ...", "Node", "assignment", "=", "declar", ".", "node", ".", "getFirstChild", "(", ")", ";", "Node", "lhs", "=", "assignment...
Replaces a member declaration to an assignment to the temp prototype object.
[ "Replaces", "a", "member", "declaration", "to", "an", "assignment", "to", "the", "temp", "prototype", "object", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExtractPrototypeMemberDeclarations.java#L222-L242
24,089
google/closure-compiler
src/com/google/javascript/jscomp/VariableVisibilityAnalysis.java
VariableVisibilityAnalysis.getVariableVisibility
public VariableVisibility getVariableVisibility(Node declaringNameNode) { Node parent = declaringNameNode.getParent(); checkArgument(parent.isVar() || parent.isFunction() || parent.isParamList()); return visibilityByDeclaringNameNode.get(declaringNameNode); }
java
public VariableVisibility getVariableVisibility(Node declaringNameNode) { Node parent = declaringNameNode.getParent(); checkArgument(parent.isVar() || parent.isFunction() || parent.isParamList()); return visibilityByDeclaringNameNode.get(declaringNameNode); }
[ "public", "VariableVisibility", "getVariableVisibility", "(", "Node", "declaringNameNode", ")", "{", "Node", "parent", "=", "declaringNameNode", ".", "getParent", "(", ")", ";", "checkArgument", "(", "parent", ".", "isVar", "(", ")", "||", "parent", ".", "isFunc...
Returns the visibility of of a variable, given that variable's declaring name node. The name node's parent must be one of: <pre> Token.VAR (for a variable declaration) Token.FUNCTION (for a function declaration) Token.PARAM_LIST (for a function formal parameter) </pre> The returned visibility will be one of: <pre> LO...
[ "Returns", "the", "visibility", "of", "of", "a", "variable", "given", "that", "variable", "s", "declaring", "name", "node", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/VariableVisibilityAnalysis.java#L92-L98
24,090
google/closure-compiler
src/com/google/javascript/jscomp/VariableVisibilityAnalysis.java
VariableVisibilityAnalysis.process
@Override public void process(Node externs, Node root) { ReferenceCollectingCallback callback = new ReferenceCollectingCallback(compiler, ReferenceCollectingCallback.DO_NOTHING_BEHAVIOR, new Es6SyntacticScopeCreator(compiler)); callback.process(root); for (Var variable : callback.getAllS...
java
@Override public void process(Node externs, Node root) { ReferenceCollectingCallback callback = new ReferenceCollectingCallback(compiler, ReferenceCollectingCallback.DO_NOTHING_BEHAVIOR, new Es6SyntacticScopeCreator(compiler)); callback.process(root); for (Var variable : callback.getAllS...
[ "@", "Override", "public", "void", "process", "(", "Node", "externs", ",", "Node", "root", ")", "{", "ReferenceCollectingCallback", "callback", "=", "new", "ReferenceCollectingCallback", "(", "compiler", ",", "ReferenceCollectingCallback", ".", "DO_NOTHING_BEHAVIOR", ...
Determines the visibility class for each variable in root.
[ "Determines", "the", "visibility", "class", "for", "each", "variable", "in", "root", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/VariableVisibilityAnalysis.java#L103-L133
24,091
google/closure-compiler
src/com/google/javascript/jscomp/VariableVisibilityAnalysis.java
VariableVisibilityAnalysis.variableIsParameter
private static boolean variableIsParameter(Var variable) { Node variableParent = variable.getParentNode(); return variableParent != null && variableParent.isParamList(); }
java
private static boolean variableIsParameter(Var variable) { Node variableParent = variable.getParentNode(); return variableParent != null && variableParent.isParamList(); }
[ "private", "static", "boolean", "variableIsParameter", "(", "Var", "variable", ")", "{", "Node", "variableParent", "=", "variable", ".", "getParentNode", "(", ")", ";", "return", "variableParent", "!=", "null", "&&", "variableParent", ".", "isParamList", "(", ")...
Returns true if the variable is a formal parameter.
[ "Returns", "true", "if", "the", "variable", "is", "a", "formal", "parameter", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/VariableVisibilityAnalysis.java#L138-L142
24,092
google/closure-compiler
src/com/google/javascript/jscomp/JSError.java
JSError.make
public static JSError make(DiagnosticType type, String... arguments) { return new JSError(null, null, -1, -1, type, null, arguments); }
java
public static JSError make(DiagnosticType type, String... arguments) { return new JSError(null, null, -1, -1, type, null, arguments); }
[ "public", "static", "JSError", "make", "(", "DiagnosticType", "type", ",", "String", "...", "arguments", ")", "{", "return", "new", "JSError", "(", "null", ",", "null", ",", "-", "1", ",", "-", "1", ",", "type", ",", "null", ",", "arguments", ")", ";...
Creates a JSError with no source information @param type The DiagnosticType @param arguments Arguments to be incorporated into the message
[ "Creates", "a", "JSError", "with", "no", "source", "information" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSError.java#L68-L70
24,093
google/closure-compiler
src/com/google/javascript/jscomp/JSError.java
JSError.make
public static JSError make(CheckLevel level, DiagnosticType type, String... arguments) { return new JSError(null, null, -1, -1, type, level, arguments); }
java
public static JSError make(CheckLevel level, DiagnosticType type, String... arguments) { return new JSError(null, null, -1, -1, type, level, arguments); }
[ "public", "static", "JSError", "make", "(", "CheckLevel", "level", ",", "DiagnosticType", "type", ",", "String", "...", "arguments", ")", "{", "return", "new", "JSError", "(", "null", ",", "null", ",", "-", "1", ",", "-", "1", ",", "type", ",", "level"...
Creates a JSError with no source information and a non-default level. @param level @param type The DiagnosticType @param arguments Arguments to be incorporated into the message
[ "Creates", "a", "JSError", "with", "no", "source", "information", "and", "a", "non", "-", "default", "level", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSError.java#L79-L81
24,094
google/closure-compiler
src/com/google/javascript/jscomp/JSError.java
JSError.make
public static JSError make(String sourceName, int lineno, int charno, DiagnosticType type, String... arguments) { return new JSError(sourceName, null, lineno, charno, type, null, arguments); }
java
public static JSError make(String sourceName, int lineno, int charno, DiagnosticType type, String... arguments) { return new JSError(sourceName, null, lineno, charno, type, null, arguments); }
[ "public", "static", "JSError", "make", "(", "String", "sourceName", ",", "int", "lineno", ",", "int", "charno", ",", "DiagnosticType", "type", ",", "String", "...", "arguments", ")", "{", "return", "new", "JSError", "(", "sourceName", ",", "null", ",", "li...
Creates a JSError at a given source location @param sourceName The source file name @param lineno Line number with source file, or -1 if unknown @param charno Column number within line, or -1 for whole line. @param type The DiagnosticType @param arguments Arguments to be incorporated into the message
[ "Creates", "a", "JSError", "at", "a", "given", "source", "location" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSError.java#L92-L95
24,095
google/closure-compiler
src/com/google/javascript/jscomp/JSError.java
JSError.make
public static JSError make(Node n, DiagnosticType type, String... arguments) { return new JSError(n.getSourceFileName(), n, type, arguments); }
java
public static JSError make(Node n, DiagnosticType type, String... arguments) { return new JSError(n.getSourceFileName(), n, type, arguments); }
[ "public", "static", "JSError", "make", "(", "Node", "n", ",", "DiagnosticType", "type", ",", "String", "...", "arguments", ")", "{", "return", "new", "JSError", "(", "n", ".", "getSourceFileName", "(", ")", ",", "n", ",", "type", ",", "arguments", ")", ...
Creates a JSError from a file and Node position. @param n Determines the line and char position and source file name @param type The DiagnosticType @param arguments Arguments to be incorporated into the message
[ "Creates", "a", "JSError", "from", "a", "file", "and", "Node", "position", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSError.java#L119-L121
24,096
google/closure-compiler
src/com/google/javascript/jscomp/JSError.java
JSError.format
public String format(CheckLevel level, MessageFormatter formatter) { switch (level) { case ERROR: return formatter.formatError(this); case WARNING: return formatter.formatWarning(this); default: return null; } }
java
public String format(CheckLevel level, MessageFormatter formatter) { switch (level) { case ERROR: return formatter.formatError(this); case WARNING: return formatter.formatWarning(this); default: return null; } }
[ "public", "String", "format", "(", "CheckLevel", "level", ",", "MessageFormatter", "formatter", ")", "{", "switch", "(", "level", ")", "{", "case", "ERROR", ":", "return", "formatter", ".", "formatError", "(", "this", ")", ";", "case", "WARNING", ":", "ret...
Format a message at the given level. @return the formatted message or {@code null}
[ "Format", "a", "message", "at", "the", "given", "level", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSError.java#L170-L181
24,097
google/closure-compiler
src/com/google/javascript/jscomp/deps/ModuleNames.java
ModuleNames.escapePath
static String escapePath(String input) { // Handle special characters String encodedInput = input.replace(':', '-') .replace('\\', '/') .replace(" ", "%20") .replace("[", "%5B") .replace("]", "%5D") .replace("<", "%3C") .replace(">", "%3E"); return canonicali...
java
static String escapePath(String input) { // Handle special characters String encodedInput = input.replace(':', '-') .replace('\\', '/') .replace(" ", "%20") .replace("[", "%5B") .replace("]", "%5D") .replace("<", "%3C") .replace(">", "%3E"); return canonicali...
[ "static", "String", "escapePath", "(", "String", "input", ")", "{", "// Handle special characters", "String", "encodedInput", "=", "input", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "repl...
Escapes the given input path.
[ "Escapes", "the", "given", "input", "path", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/ModuleNames.java#L45-L56
24,098
google/closure-compiler
src/com/google/javascript/jscomp/deps/ModuleNames.java
ModuleNames.canonicalizePath
static String canonicalizePath(String path) { String[] parts = path.split(MODULE_SLASH); String[] buffer = new String[parts.length]; int position = 0; int available = 0; boolean absolutePath = (parts.length > 1 && parts[0].isEmpty()); if (absolutePath) { // If the path starts with "/" (so...
java
static String canonicalizePath(String path) { String[] parts = path.split(MODULE_SLASH); String[] buffer = new String[parts.length]; int position = 0; int available = 0; boolean absolutePath = (parts.length > 1 && parts[0].isEmpty()); if (absolutePath) { // If the path starts with "/" (so...
[ "static", "String", "canonicalizePath", "(", "String", "path", ")", "{", "String", "[", "]", "parts", "=", "path", ".", "split", "(", "MODULE_SLASH", ")", ";", "String", "[", "]", "buffer", "=", "new", "String", "[", "parts", ".", "length", "]", ";", ...
Canonicalize a given path, removing segments containing "." and consuming segments for "..". If no segment could be consumed for "..", retains the segment.
[ "Canonicalize", "a", "given", "path", "removing", "segments", "containing", ".", "and", "consuming", "segments", "for", "..", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/ModuleNames.java#L95-L136
24,099
google/closure-compiler
src/com/google/javascript/rhino/jstype/FunctionType.java
FunctionType.makesStructs
public final boolean makesStructs() { if (!hasInstanceType()) { return false; } if (propAccess == PropAccess.STRUCT) { return true; } FunctionType superc = getSuperClassConstructor(); if (superc != null && superc.makesStructs()) { setStruct(); return true; } retur...
java
public final boolean makesStructs() { if (!hasInstanceType()) { return false; } if (propAccess == PropAccess.STRUCT) { return true; } FunctionType superc = getSuperClassConstructor(); if (superc != null && superc.makesStructs()) { setStruct(); return true; } retur...
[ "public", "final", "boolean", "makesStructs", "(", ")", "{", "if", "(", "!", "hasInstanceType", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "propAccess", "==", "PropAccess", ".", "STRUCT", ")", "{", "return", "true", ";", "}", "Function...
When a class B inherits from A and A is annotated as a struct, then B automatically gets the annotation, even if B's constructor is not explicitly annotated.
[ "When", "a", "class", "B", "inherits", "from", "A", "and", "A", "is", "annotated", "as", "a", "struct", "then", "B", "automatically", "gets", "the", "annotation", "even", "if", "B", "s", "constructor", "is", "not", "explicitly", "annotated", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/FunctionType.java#L239-L252