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,500
google/closure-compiler
src/com/google/javascript/jscomp/modules/Binding.java
Binding.from
static Binding from(Export boundExport, Node sourceNode) { return new AutoValue_Binding( boundExport.moduleMetadata(), sourceNode, boundExport, /* isModuleNamespace= */ false, /* closureNamespace= */ null, CreatedBy.EXPORT); }
java
static Binding from(Export boundExport, Node sourceNode) { return new AutoValue_Binding( boundExport.moduleMetadata(), sourceNode, boundExport, /* isModuleNamespace= */ false, /* closureNamespace= */ null, CreatedBy.EXPORT); }
[ "static", "Binding", "from", "(", "Export", "boundExport", ",", "Node", "sourceNode", ")", "{", "return", "new", "AutoValue_Binding", "(", "boundExport", ".", "moduleMetadata", "(", ")", ",", "sourceNode", ",", "boundExport", ",", "/* isModuleNamespace= */", "fals...
Binding for an exported value that is not a module namespace object.
[ "Binding", "for", "an", "exported", "value", "that", "is", "not", "a", "module", "namespace", "object", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/modules/Binding.java#L93-L101
24,501
google/closure-compiler
src/com/google/javascript/jscomp/modules/Binding.java
Binding.copy
Binding copy(Node sourceNode, CreatedBy createdBy) { checkNotNull(sourceNode); return new AutoValue_Binding( metadata(), sourceNode, originatingExport(), isModuleNamespace(), closureNamespace(), createdBy); }
java
Binding copy(Node sourceNode, CreatedBy createdBy) { checkNotNull(sourceNode); return new AutoValue_Binding( metadata(), sourceNode, originatingExport(), isModuleNamespace(), closureNamespace(), createdBy); }
[ "Binding", "copy", "(", "Node", "sourceNode", ",", "CreatedBy", "createdBy", ")", "{", "checkNotNull", "(", "sourceNode", ")", ";", "return", "new", "AutoValue_Binding", "(", "metadata", "(", ")", ",", "sourceNode", ",", "originatingExport", "(", ")", ",", "...
Copies the binding with a new source node and CreatedBy binding.
[ "Copies", "the", "binding", "with", "a", "new", "source", "node", "and", "CreatedBy", "binding", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/modules/Binding.java#L131-L141
24,502
google/closure-compiler
src/com/google/javascript/jscomp/ConstCheck.java
ConstCheck.reportError
void reportError(Node n, Var var, String name) { JSDocInfo info = NodeUtil.getBestJSDocInfo(n); if (info == null || !info.getSuppressions().contains("const")) { Node declNode = var.getNode(); String declaredPosition = declNode.getSourceFileName() + ":" + declNode.getLineno(); compiler.report(J...
java
void reportError(Node n, Var var, String name) { JSDocInfo info = NodeUtil.getBestJSDocInfo(n); if (info == null || !info.getSuppressions().contains("const")) { Node declNode = var.getNode(); String declaredPosition = declNode.getSourceFileName() + ":" + declNode.getLineno(); compiler.report(J...
[ "void", "reportError", "(", "Node", "n", ",", "Var", "var", ",", "String", "name", ")", "{", "JSDocInfo", "info", "=", "NodeUtil", ".", "getBestJSDocInfo", "(", "n", ")", ";", "if", "(", "info", "==", "null", "||", "!", "info", ".", "getSuppressions", ...
Reports a reassigned constant error.
[ "Reports", "a", "reassigned", "constant", "error", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ConstCheck.java#L132-L139
24,503
google/closure-compiler
src/com/google/javascript/jscomp/JsIterables.java
JsIterables.getElementType
static final JSType getElementType(JSType iterableOrIterator, JSTypeRegistry typeRegistry) { TemplateTypeMap templateTypeMap = iterableOrIterator // Remember that `string` will box to a `Iterable`. .autobox() .getTemplateTypeMap(); if (templateTypeMap.hasTemplateKey(...
java
static final JSType getElementType(JSType iterableOrIterator, JSTypeRegistry typeRegistry) { TemplateTypeMap templateTypeMap = iterableOrIterator // Remember that `string` will box to a `Iterable`. .autobox() .getTemplateTypeMap(); if (templateTypeMap.hasTemplateKey(...
[ "static", "final", "JSType", "getElementType", "(", "JSType", "iterableOrIterator", ",", "JSTypeRegistry", "typeRegistry", ")", "{", "TemplateTypeMap", "templateTypeMap", "=", "iterableOrIterator", "// Remember that `string` will box to a `Iterable`.", ".", "autobox", "(", ")...
Returns the given `Iterable`s element type. <p>If the given type is not an `Iterator`, `Iterable`, `AsyncIterator`, or `AsyncIterable`, returns the unknown type.
[ "Returns", "the", "given", "Iterable", "s", "element", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsIterables.java#L43-L64
24,504
google/closure-compiler
src/com/google/javascript/jscomp/FileInstrumentationData.java
FileInstrumentationData.putBranchNode
void putBranchNode(int lineNumber, int branchNumber, Node block) { Preconditions.checkArgument( lineNumber > 0, "Expected non-zero positive integer as line number: %s", lineNumber); Preconditions.checkArgument( branchNumber > 0, "Expected non-zero positive integer as branch number: %s", branchNu...
java
void putBranchNode(int lineNumber, int branchNumber, Node block) { Preconditions.checkArgument( lineNumber > 0, "Expected non-zero positive integer as line number: %s", lineNumber); Preconditions.checkArgument( branchNumber > 0, "Expected non-zero positive integer as branch number: %s", branchNu...
[ "void", "putBranchNode", "(", "int", "lineNumber", ",", "int", "branchNumber", ",", "Node", "block", ")", "{", "Preconditions", ".", "checkArgument", "(", "lineNumber", ">", "0", ",", "\"Expected non-zero positive integer as line number: %s\"", ",", "lineNumber", ")",...
Store a node to be instrumented later for branch coverage. @param lineNumber 1-based line number @param branchNumber 1-based branch number @param block the node of the conditional block.
[ "Store", "a", "node", "to", "be", "instrumented", "later", "for", "branch", "coverage", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FileInstrumentationData.java#L124-L131
24,505
google/closure-compiler
src/com/google/javascript/jscomp/FileInstrumentationData.java
FileInstrumentationData.getBranchNode
Node getBranchNode(int lineNumber, int branchNumber) { Preconditions.checkArgument( lineNumber > 0, "Expected non-zero positive integer as line number: %s", lineNumber); Preconditions.checkArgument( branchNumber > 0, "Expected non-zero positive integer as branch number: %s", branchNumber); ...
java
Node getBranchNode(int lineNumber, int branchNumber) { Preconditions.checkArgument( lineNumber > 0, "Expected non-zero positive integer as line number: %s", lineNumber); Preconditions.checkArgument( branchNumber > 0, "Expected non-zero positive integer as branch number: %s", branchNumber); ...
[ "Node", "getBranchNode", "(", "int", "lineNumber", ",", "int", "branchNumber", ")", "{", "Preconditions", ".", "checkArgument", "(", "lineNumber", ">", "0", ",", "\"Expected non-zero positive integer as line number: %s\"", ",", "lineNumber", ")", ";", "Preconditions", ...
Get the block node to be instrumented for branch coverage. @param lineNumber 1-based line number @param branchNumber 1-based branch number @return the node of the conditional block.
[ "Get", "the", "block", "node", "to", "be", "instrumented", "for", "branch", "coverage", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FileInstrumentationData.java#L139-L146
24,506
google/closure-compiler
src/com/google/javascript/jscomp/FileInstrumentationData.java
FileInstrumentationData.addBranches
void addBranches(int lineNumber, int numberOfBranches) { int lineIdx = lineNumber - 1; Integer currentValue = branchesInLine.get(Integer.valueOf(lineIdx)); if (currentValue == null) { branchesInLine.put(lineIdx, numberOfBranches); } else { branchesInLine.put(lineIdx, currentValue + numberOfB...
java
void addBranches(int lineNumber, int numberOfBranches) { int lineIdx = lineNumber - 1; Integer currentValue = branchesInLine.get(Integer.valueOf(lineIdx)); if (currentValue == null) { branchesInLine.put(lineIdx, numberOfBranches); } else { branchesInLine.put(lineIdx, currentValue + numberOfB...
[ "void", "addBranches", "(", "int", "lineNumber", ",", "int", "numberOfBranches", ")", "{", "int", "lineIdx", "=", "lineNumber", "-", "1", ";", "Integer", "currentValue", "=", "branchesInLine", ".", "get", "(", "Integer", ".", "valueOf", "(", "lineIdx", ")", ...
Add a number of branches to a line. @param lineNumber the line number that contains the branch statement. @param numberOfBranches the number of branches to add to the record.
[ "Add", "a", "number", "of", "branches", "to", "a", "line", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FileInstrumentationData.java#L214-L222
24,507
google/closure-compiler
src/com/google/javascript/jscomp/FileInstrumentationData.java
FileInstrumentationData.getNumBranches
int getNumBranches(int lineNumber) { Integer numBranches = branchesInLine.get(lineNumber - 1); if (numBranches == null) { return 0; } else { return numBranches; } }
java
int getNumBranches(int lineNumber) { Integer numBranches = branchesInLine.get(lineNumber - 1); if (numBranches == null) { return 0; } else { return numBranches; } }
[ "int", "getNumBranches", "(", "int", "lineNumber", ")", "{", "Integer", "numBranches", "=", "branchesInLine", ".", "get", "(", "lineNumber", "-", "1", ")", ";", "if", "(", "numBranches", "==", "null", ")", "{", "return", "0", ";", "}", "else", "{", "re...
Get the number of branches on a line @param lineNumber - the 1-based line number @return the number of branches on the line.
[ "Get", "the", "number", "of", "branches", "on", "a", "line" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FileInstrumentationData.java#L229-L236
24,508
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.populateDefaults
private static void populateDefaults(JSDocInfo info) { if (info.getVisibility() == null) { info.setVisibility(Visibility.INHERITED); } }
java
private static void populateDefaults(JSDocInfo info) { if (info.getVisibility() == null) { info.setVisibility(Visibility.INHERITED); } }
[ "private", "static", "void", "populateDefaults", "(", "JSDocInfo", "info", ")", "{", "if", "(", "info", ".", "getVisibility", "(", ")", "==", "null", ")", "{", "info", ".", "setVisibility", "(", "Visibility", ".", "INHERITED", ")", ";", "}", "}" ]
Generate defaults when certain parameters are not specified.
[ "Generate", "defaults", "when", "certain", "parameters", "are", "not", "specified", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L201-L205
24,509
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.markAnnotation
public void markAnnotation(String annotation, int lineno, int charno) { JSDocInfo.Marker marker = currentInfo.addMarker(); if (marker != null) { JSDocInfo.TrimmedStringPosition position = new JSDocInfo.TrimmedStringPosition(); position.setItem(annotation); position.setPositionInform...
java
public void markAnnotation(String annotation, int lineno, int charno) { JSDocInfo.Marker marker = currentInfo.addMarker(); if (marker != null) { JSDocInfo.TrimmedStringPosition position = new JSDocInfo.TrimmedStringPosition(); position.setItem(annotation); position.setPositionInform...
[ "public", "void", "markAnnotation", "(", "String", "annotation", ",", "int", "lineno", ",", "int", "charno", ")", "{", "JSDocInfo", ".", "Marker", "marker", "=", "currentInfo", ".", "addMarker", "(", ")", ";", "if", "(", "marker", "!=", "null", ")", "{",...
Adds a marker to the current JSDocInfo and populates the marker with the annotation information.
[ "Adds", "a", "marker", "to", "the", "current", "JSDocInfo", "and", "populates", "the", "marker", "with", "the", "annotation", "information", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L211-L225
24,510
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.markText
public void markText(String text, int startLineno, int startCharno, int endLineno, int endCharno) { if (currentMarker != null) { JSDocInfo.StringPosition position = new JSDocInfo.StringPosition(); position.setItem(text); position.setPositionInformation(startLineno, startCharno, end...
java
public void markText(String text, int startLineno, int startCharno, int endLineno, int endCharno) { if (currentMarker != null) { JSDocInfo.StringPosition position = new JSDocInfo.StringPosition(); position.setItem(text); position.setPositionInformation(startLineno, startCharno, end...
[ "public", "void", "markText", "(", "String", "text", ",", "int", "startLineno", ",", "int", "startCharno", ",", "int", "endLineno", ",", "int", "endCharno", ")", "{", "if", "(", "currentMarker", "!=", "null", ")", "{", "JSDocInfo", ".", "StringPosition", "...
Adds a textual block to the current marker.
[ "Adds", "a", "textual", "block", "to", "the", "current", "marker", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L230-L239
24,511
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.markTypeNode
public void markTypeNode(Node typeNode, int lineno, int startCharno, int endLineno, int endCharno, boolean hasLC) { if (currentMarker != null) { JSDocInfo.TypePosition position = new JSDocInfo.TypePosition(); position.setItem(typeNode); position.setHasBrackets(hasLC); position.setPosit...
java
public void markTypeNode(Node typeNode, int lineno, int startCharno, int endLineno, int endCharno, boolean hasLC) { if (currentMarker != null) { JSDocInfo.TypePosition position = new JSDocInfo.TypePosition(); position.setItem(typeNode); position.setHasBrackets(hasLC); position.setPosit...
[ "public", "void", "markTypeNode", "(", "Node", "typeNode", ",", "int", "lineno", ",", "int", "startCharno", ",", "int", "endLineno", ",", "int", "endCharno", ",", "boolean", "hasLC", ")", "{", "if", "(", "currentMarker", "!=", "null", ")", "{", "JSDocInfo"...
Adds a type declaration to the current marker.
[ "Adds", "a", "type", "declaration", "to", "the", "current", "marker", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L244-L254
24,512
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.markName
public void markName(String name, Node templateNode, int lineno, int charno) { if (currentMarker != null) { // Record the name as both a SourcePosition<String> and a // SourcePosition<Node>. The <String> form is deprecated, // because <Node> is more consistent with how other name // re...
java
public void markName(String name, Node templateNode, int lineno, int charno) { if (currentMarker != null) { // Record the name as both a SourcePosition<String> and a // SourcePosition<Node>. The <String> form is deprecated, // because <Node> is more consistent with how other name // re...
[ "public", "void", "markName", "(", "String", "name", ",", "Node", "templateNode", ",", "int", "lineno", ",", "int", "charno", ")", "{", "if", "(", "currentMarker", "!=", "null", ")", "{", "// Record the name as both a SourcePosition<String> and a", "// SourcePositio...
Adds a name declaration to the current marker.
[ "Adds", "a", "name", "declaration", "to", "the", "current", "marker", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L259-L286
24,513
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordVisibility
public boolean recordVisibility(Visibility visibility) { if (currentInfo.getVisibility() == null) { populated = true; currentInfo.setVisibility(visibility); return true; } else { return false; } }
java
public boolean recordVisibility(Visibility visibility) { if (currentInfo.getVisibility() == null) { populated = true; currentInfo.setVisibility(visibility); return true; } else { return false; } }
[ "public", "boolean", "recordVisibility", "(", "Visibility", "visibility", ")", "{", "if", "(", "currentInfo", ".", "getVisibility", "(", ")", "==", "null", ")", "{", "populated", "=", "true", ";", "currentInfo", ".", "setVisibility", "(", "visibility", ")", ...
Records a visibility. @return {@code true} if the visibility was recorded and {@code false} if it was already defined
[ "Records", "a", "visibility", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L304-L312
24,514
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordParameter
public boolean recordParameter(String parameterName, JSTypeExpression type) { if (!hasAnySingletonTypeTags() && currentInfo.declareParam(type, parameterName)) { populated = true; return true; } else { return false; } }
java
public boolean recordParameter(String parameterName, JSTypeExpression type) { if (!hasAnySingletonTypeTags() && currentInfo.declareParam(type, parameterName)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordParameter", "(", "String", "parameterName", ",", "JSTypeExpression", "type", ")", "{", "if", "(", "!", "hasAnySingletonTypeTags", "(", ")", "&&", "currentInfo", ".", "declareParam", "(", "type", ",", "parameterName", ")", ")", "{", ...
Records a typed parameter. @return {@code true} if the typed parameter was recorded and {@code false} if a parameter with the same name was already defined
[ "Records", "a", "typed", "parameter", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L325-L333
24,515
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordParameterDescription
public boolean recordParameterDescription( String parameterName, String description) { if (currentInfo.documentParam(parameterName, description)) { populated = true; return true; } else { return false; } }
java
public boolean recordParameterDescription( String parameterName, String description) { if (currentInfo.documentParam(parameterName, description)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordParameterDescription", "(", "String", "parameterName", ",", "String", "description", ")", "{", "if", "(", "currentInfo", ".", "documentParam", "(", "parameterName", ",", "description", ")", ")", "{", "populated", "=", "true", ";", "re...
Records a parameter's description. @return {@code true} if the parameter's description was recorded and {@code false} if a parameter with the same name was already defined
[ "Records", "a", "parameter", "s", "description", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L341-L349
24,516
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordTemplateTypeName
public boolean recordTemplateTypeName(String name) { if (currentInfo.declareTemplateTypeName(name)) { populated = true; return true; } else { return false; } }
java
public boolean recordTemplateTypeName(String name) { if (currentInfo.declareTemplateTypeName(name)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordTemplateTypeName", "(", "String", "name", ")", "{", "if", "(", "currentInfo", ".", "declareTemplateTypeName", "(", "name", ")", ")", "{", "populated", "=", "true", ";", "return", "true", ";", "}", "else", "{", "return", "false", ...
Records a template type name. @return {@code true} if the template type name was recorded and {@code false} if the input template type name was already defined.
[ "Records", "a", "template", "type", "name", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L357-L364
24,517
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordTypeTransformation
public boolean recordTypeTransformation(String name, Node expr) { if (currentInfo.declareTypeTransformation(name, expr)) { populated = true; return true; } else { return false; } }
java
public boolean recordTypeTransformation(String name, Node expr) { if (currentInfo.declareTypeTransformation(name, expr)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordTypeTransformation", "(", "String", "name", ",", "Node", "expr", ")", "{", "if", "(", "currentInfo", ".", "declareTypeTransformation", "(", "name", ",", "expr", ")", ")", "{", "populated", "=", "true", ";", "return", "true", ";", ...
Records a type transformation expression together with its template type name.
[ "Records", "a", "type", "transformation", "expression", "together", "with", "its", "template", "type", "name", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L370-L377
24,518
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordThrowType
public boolean recordThrowType(JSTypeExpression type) { if (type != null && !hasAnySingletonTypeTags()) { currentInfo.declareThrows(type); populated = true; return true; } return false; }
java
public boolean recordThrowType(JSTypeExpression type) { if (type != null && !hasAnySingletonTypeTags()) { currentInfo.declareThrows(type); populated = true; return true; } return false; }
[ "public", "boolean", "recordThrowType", "(", "JSTypeExpression", "type", ")", "{", "if", "(", "type", "!=", "null", "&&", "!", "hasAnySingletonTypeTags", "(", ")", ")", "{", "currentInfo", ".", "declareThrows", "(", "type", ")", ";", "populated", "=", "true"...
Records a thrown type.
[ "Records", "a", "thrown", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L382-L389
24,519
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordThrowDescription
public boolean recordThrowDescription( JSTypeExpression type, String description) { if (currentInfo.documentThrows(type, description)) { populated = true; return true; } else { return false; } }
java
public boolean recordThrowDescription( JSTypeExpression type, String description) { if (currentInfo.documentThrows(type, description)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordThrowDescription", "(", "JSTypeExpression", "type", ",", "String", "description", ")", "{", "if", "(", "currentInfo", ".", "documentThrows", "(", "type", ",", "description", ")", ")", "{", "populated", "=", "true", ";", "return", "t...
Records a throw type's description. @return {@code true} if the type's description was recorded and {@code false} if a description with the same type was already defined
[ "Records", "a", "throw", "type", "s", "description", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L397-L405
24,520
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.addAuthor
public boolean addAuthor(String author) { if (currentInfo.documentAuthor(author)) { populated = true; return true; } else { return false; } }
java
public boolean addAuthor(String author) { if (currentInfo.documentAuthor(author)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "addAuthor", "(", "String", "author", ")", "{", "if", "(", "currentInfo", ".", "documentAuthor", "(", "author", ")", ")", "{", "populated", "=", "true", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}"...
Adds an author to the current information.
[ "Adds", "an", "author", "to", "the", "current", "information", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L411-L418
24,521
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.addReference
public boolean addReference(String reference) { if (currentInfo.documentReference(reference)) { populated = true; return true; } else { return false; } }
java
public boolean addReference(String reference) { if (currentInfo.documentReference(reference)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "addReference", "(", "String", "reference", ")", "{", "if", "(", "currentInfo", ".", "documentReference", "(", "reference", ")", ")", "{", "populated", "=", "true", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", ...
Adds a reference ("@see") to the current information.
[ "Adds", "a", "reference", "(" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L424-L431
24,522
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordVersion
public boolean recordVersion(String version) { if (currentInfo.documentVersion(version)) { populated = true; return true; } else { return false; } }
java
public boolean recordVersion(String version) { if (currentInfo.documentVersion(version)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordVersion", "(", "String", "version", ")", "{", "if", "(", "currentInfo", ".", "documentVersion", "(", "version", ")", ")", "{", "populated", "=", "true", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}"...
Records the version.
[ "Records", "the", "version", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L505-L512
24,523
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordDeprecationReason
public boolean recordDeprecationReason(String reason) { if (currentInfo.setDeprecationReason(reason)) { populated = true; return true; } else { return false; } }
java
public boolean recordDeprecationReason(String reason) { if (currentInfo.setDeprecationReason(reason)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordDeprecationReason", "(", "String", "reason", ")", "{", "if", "(", "currentInfo", ".", "setDeprecationReason", "(", "reason", ")", ")", "{", "populated", "=", "true", ";", "return", "true", ";", "}", "else", "{", "return", "false",...
Records the deprecation reason.
[ "Records", "the", "deprecation", "reason", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L517-L524
24,524
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordModifies
public boolean recordModifies(Set<String> modifies) { if (!hasAnySingletonSideEffectTags() && currentInfo.setModifies(modifies)) { populated = true; return true; } else { return false; } }
java
public boolean recordModifies(Set<String> modifies) { if (!hasAnySingletonSideEffectTags() && currentInfo.setModifies(modifies)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordModifies", "(", "Set", "<", "String", ">", "modifies", ")", "{", "if", "(", "!", "hasAnySingletonSideEffectTags", "(", ")", "&&", "currentInfo", ".", "setModifies", "(", "modifies", ")", ")", "{", "populated", "=", "true", ";", ...
Records the list of modifies warnings.
[ "Records", "the", "list", "of", "modifies", "warnings", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L550-L558
24,525
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordType
public boolean recordType(JSTypeExpression type) { if (type != null && !hasAnyTypeRelatedTags()) { currentInfo.setType(type); populated = true; return true; } else { return false; } }
java
public boolean recordType(JSTypeExpression type) { if (type != null && !hasAnyTypeRelatedTags()) { currentInfo.setType(type); populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordType", "(", "JSTypeExpression", "type", ")", "{", "if", "(", "type", "!=", "null", "&&", "!", "hasAnyTypeRelatedTags", "(", ")", ")", "{", "currentInfo", ".", "setType", "(", "type", ")", ";", "populated", "=", "true", ";", "r...
Records a type. @return {@code true} if the type was recorded and {@code false} if it is invalid or was already defined
[ "Records", "a", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L566-L574
24,526
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordReturnType
public boolean recordReturnType(JSTypeExpression jsType) { if (jsType != null && currentInfo.getReturnType() == null && !hasAnySingletonTypeTags()) { currentInfo.setReturnType(jsType); populated = true; return true; } else { return false; } }
java
public boolean recordReturnType(JSTypeExpression jsType) { if (jsType != null && currentInfo.getReturnType() == null && !hasAnySingletonTypeTags()) { currentInfo.setReturnType(jsType); populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordReturnType", "(", "JSTypeExpression", "jsType", ")", "{", "if", "(", "jsType", "!=", "null", "&&", "currentInfo", ".", "getReturnType", "(", ")", "==", "null", "&&", "!", "hasAnySingletonTypeTags", "(", ")", ")", "{", "currentInfo",...
Records a return type. @return {@code true} if the return type was recorded and {@code false} if it is invalid or was already defined
[ "Records", "a", "return", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L616-L625
24,527
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordReturnDescription
public boolean recordReturnDescription(String description) { if (currentInfo.documentReturn(description)) { populated = true; return true; } else { return false; } }
java
public boolean recordReturnDescription(String description) { if (currentInfo.documentReturn(description)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordReturnDescription", "(", "String", "description", ")", "{", "if", "(", "currentInfo", ".", "documentReturn", "(", "description", ")", ")", "{", "populated", "=", "true", ";", "return", "true", ";", "}", "else", "{", "return", "fal...
Records a return description @return {@code true} if the return description was recorded and {@code false} if it is invalid or was already defined
[ "Records", "a", "return", "description" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L633-L640
24,528
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordDefineType
public boolean recordDefineType(JSTypeExpression type) { if (type != null && !currentInfo.isConstant() && !currentInfo.isDefine() && recordType(type)) { currentInfo.setDefine(true); populated = true; return true; } else { return false; } }
java
public boolean recordDefineType(JSTypeExpression type) { if (type != null && !currentInfo.isConstant() && !currentInfo.isDefine() && recordType(type)) { currentInfo.setDefine(true); populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordDefineType", "(", "JSTypeExpression", "type", ")", "{", "if", "(", "type", "!=", "null", "&&", "!", "currentInfo", ".", "isConstant", "(", ")", "&&", "!", "currentInfo", ".", "isDefine", "(", ")", "&&", "recordType", "(", "type"...
Records the type of a define. 'Define' values are special constants that may be manipulated by the compiler. They are designed to mimic the #define command in the C preprocessor.
[ "Records", "the", "type", "of", "a", "define", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L649-L660
24,529
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordEnumParameterType
public boolean recordEnumParameterType(JSTypeExpression type) { if (type != null && !hasAnyTypeRelatedTags()) { currentInfo.setEnumParameterType(type); populated = true; return true; } else { return false; } }
java
public boolean recordEnumParameterType(JSTypeExpression type) { if (type != null && !hasAnyTypeRelatedTags()) { currentInfo.setEnumParameterType(type); populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordEnumParameterType", "(", "JSTypeExpression", "type", ")", "{", "if", "(", "type", "!=", "null", "&&", "!", "hasAnyTypeRelatedTags", "(", ")", ")", "{", "currentInfo", ".", "setEnumParameterType", "(", "type", ")", ";", "populated", ...
Records a parameter type to an enum. @return {@code true} if the enum's parameter type was recorded and {@code false} if it was invalid or already defined
[ "Records", "a", "parameter", "type", "to", "an", "enum", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L668-L676
24,530
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordBaseType
public boolean recordBaseType(JSTypeExpression jsType) { if (jsType != null && !hasAnySingletonTypeTags() && !currentInfo.hasBaseType()) { currentInfo.setBaseType(jsType); populated = true; return true; } else { return false; } }
java
public boolean recordBaseType(JSTypeExpression jsType) { if (jsType != null && !hasAnySingletonTypeTags() && !currentInfo.hasBaseType()) { currentInfo.setBaseType(jsType); populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordBaseType", "(", "JSTypeExpression", "jsType", ")", "{", "if", "(", "jsType", "!=", "null", "&&", "!", "hasAnySingletonTypeTags", "(", ")", "&&", "!", "currentInfo", ".", "hasBaseType", "(", ")", ")", "{", "currentInfo", ".", "setB...
Records a base type. @return {@code true} if the base type was recorded and {@code false} if it was already defined
[ "Records", "a", "base", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L706-L715
24,531
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.changeBaseType
public boolean changeBaseType(JSTypeExpression jsType) { if (jsType != null && !hasAnySingletonTypeTags()) { currentInfo.setBaseType(jsType); populated = true; return true; } else { return false; } }
java
public boolean changeBaseType(JSTypeExpression jsType) { if (jsType != null && !hasAnySingletonTypeTags()) { currentInfo.setBaseType(jsType); populated = true; return true; } else { return false; } }
[ "public", "boolean", "changeBaseType", "(", "JSTypeExpression", "jsType", ")", "{", "if", "(", "jsType", "!=", "null", "&&", "!", "hasAnySingletonTypeTags", "(", ")", ")", "{", "currentInfo", ".", "setBaseType", "(", "jsType", ")", ";", "populated", "=", "tr...
Changes a base type, even if one has already been set on currentInfo. @return {@code true} if the base type was changed successfully.
[ "Changes", "a", "base", "type", "even", "if", "one", "has", "already", "been", "set", "on", "currentInfo", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L722-L730
24,532
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordClosurePrimitiveId
public boolean recordClosurePrimitiveId(String closurePrimitiveId) { if (closurePrimitiveId != null && currentInfo.getClosurePrimitiveId() == null) { currentInfo.setClosurePrimitiveId(closurePrimitiveId); populated = true; return true; } else { return false; } }
java
public boolean recordClosurePrimitiveId(String closurePrimitiveId) { if (closurePrimitiveId != null && currentInfo.getClosurePrimitiveId() == null) { currentInfo.setClosurePrimitiveId(closurePrimitiveId); populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordClosurePrimitiveId", "(", "String", "closurePrimitiveId", ")", "{", "if", "(", "closurePrimitiveId", "!=", "null", "&&", "currentInfo", ".", "getClosurePrimitiveId", "(", ")", "==", "null", ")", "{", "currentInfo", ".", "setClosurePrimiti...
Records an identifier for a Closure Primitive. function. @return {@code true} If the id was successfully updated.
[ "Records", "an", "identifier", "for", "a", "Closure", "Primitive", ".", "function", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L802-L810
24,533
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordFileOverview
public boolean recordFileOverview(String description) { if (currentInfo.documentFileOverview(description)) { populated = true; return true; } else { return false; } }
java
public boolean recordFileOverview(String description) { if (currentInfo.documentFileOverview(description)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordFileOverview", "(", "String", "description", ")", "{", "if", "(", "currentInfo", ".", "documentFileOverview", "(", "description", ")", ")", "{", "populated", "=", "true", ";", "return", "true", ";", "}", "else", "{", "return", "fa...
Records a fileoverview description. @return {@code true} if the description was recorded and {@code false} if the description was invalid or was already defined.
[ "Records", "a", "fileoverview", "description", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L818-L825
24,534
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordImplementedInterface
public boolean recordImplementedInterface(JSTypeExpression interfaceName) { if (interfaceName != null && currentInfo.addImplementedInterface(interfaceName)) { populated = true; return true; } else { return false; } }
java
public boolean recordImplementedInterface(JSTypeExpression interfaceName) { if (interfaceName != null && currentInfo.addImplementedInterface(interfaceName)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordImplementedInterface", "(", "JSTypeExpression", "interfaceName", ")", "{", "if", "(", "interfaceName", "!=", "null", "&&", "currentInfo", ".", "addImplementedInterface", "(", "interfaceName", ")", ")", "{", "populated", "=", "true", ";", ...
Records an implemented interface.
[ "Records", "an", "implemented", "interface", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L1202-L1209
24,535
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordExtendedInterface
public boolean recordExtendedInterface(JSTypeExpression interfaceType) { if (interfaceType != null && currentInfo.addExtendedInterface(interfaceType)) { populated = true; return true; } else { return false; } }
java
public boolean recordExtendedInterface(JSTypeExpression interfaceType) { if (interfaceType != null && currentInfo.addExtendedInterface(interfaceType)) { populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordExtendedInterface", "(", "JSTypeExpression", "interfaceType", ")", "{", "if", "(", "interfaceType", "!=", "null", "&&", "currentInfo", ".", "addExtendedInterface", "(", "interfaceType", ")", ")", "{", "populated", "=", "true", ";", "ret...
Records an extended interface type.
[ "Records", "an", "extended", "interface", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L1214-L1221
24,536
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordLends
public boolean recordLends(JSTypeExpression name) { if (!hasAnyTypeRelatedTags()) { currentInfo.setLendsName(name); populated = true; return true; } else { return false; } }
java
public boolean recordLends(JSTypeExpression name) { if (!hasAnyTypeRelatedTags()) { currentInfo.setLendsName(name); populated = true; return true; } else { return false; } }
[ "public", "boolean", "recordLends", "(", "JSTypeExpression", "name", ")", "{", "if", "(", "!", "hasAnyTypeRelatedTags", "(", ")", ")", "{", "currentInfo", ".", "setLendsName", "(", "name", ")", ";", "populated", "=", "true", ";", "return", "true", ";", "}"...
Records that we're lending to another name.
[ "Records", "that", "we", "re", "lending", "to", "another", "name", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L1224-L1232
24,537
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.recordDisposesParameter
public boolean recordDisposesParameter(List<String> parameterNames) { for (String parameterName : parameterNames) { if ((currentInfo.hasParameter(parameterName) || parameterName.equals("*")) && currentInfo.setDisposedParameter(parameterName)) { populated = true; } else { ...
java
public boolean recordDisposesParameter(List<String> parameterNames) { for (String parameterName : parameterNames) { if ((currentInfo.hasParameter(parameterName) || parameterName.equals("*")) && currentInfo.setDisposedParameter(parameterName)) { populated = true; } else { ...
[ "public", "boolean", "recordDisposesParameter", "(", "List", "<", "String", ">", "parameterNames", ")", "{", "for", "(", "String", "parameterName", ":", "parameterNames", ")", "{", "if", "(", "(", "currentInfo", ".", "hasParameter", "(", "parameterName", ")", ...
Records a parameter that gets disposed. @return {@code true} if all the parameters was recorded and {@code false} if a parameter with the same name was already defined
[ "Records", "a", "parameter", "that", "gets", "disposed", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L1367-L1378
24,538
google/closure-compiler
src/com/google/javascript/jscomp/RenameVars.java
RenameVars.reusePreviouslyUsedVariableMap
private void reusePreviouslyUsedVariableMap(SortedSet<Assignment> varsToRename) { // If prevUsedRenameMap had duplicate values then this pass would be // non-deterministic. // In such a case, the following will throw an IllegalArgumentException. checkNotNull(prevUsedRenameMap.getNewNameToOriginalNameMap...
java
private void reusePreviouslyUsedVariableMap(SortedSet<Assignment> varsToRename) { // If prevUsedRenameMap had duplicate values then this pass would be // non-deterministic. // In such a case, the following will throw an IllegalArgumentException. checkNotNull(prevUsedRenameMap.getNewNameToOriginalNameMap...
[ "private", "void", "reusePreviouslyUsedVariableMap", "(", "SortedSet", "<", "Assignment", ">", "varsToRename", ")", "{", "// If prevUsedRenameMap had duplicate values then this pass would be", "// non-deterministic.", "// In such a case, the following will throw an IllegalArgumentException...
Runs through the assignments and reuses as many names as possible from the previously used variable map. Updates reservedNames with the set of names that were reused.
[ "Runs", "through", "the", "assignments", "and", "reuses", "as", "many", "names", "as", "possible", "from", "the", "previously", "used", "variable", "map", ".", "Updates", "reservedNames", "with", "the", "set", "of", "names", "that", "were", "reused", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RenameVars.java#L440-L458
24,539
google/closure-compiler
src/com/google/javascript/jscomp/RenameVars.java
RenameVars.assignNames
private void assignNames(SortedSet<Assignment> varsToRename) { NameGenerator globalNameGenerator = null; NameGenerator localNameGenerator = null; globalNameGenerator = nameGenerator; nameGenerator.reset(reservedNames, prefix, reservedCharacters); // Local variables never need a prefix. // Also...
java
private void assignNames(SortedSet<Assignment> varsToRename) { NameGenerator globalNameGenerator = null; NameGenerator localNameGenerator = null; globalNameGenerator = nameGenerator; nameGenerator.reset(reservedNames, prefix, reservedCharacters); // Local variables never need a prefix. // Also...
[ "private", "void", "assignNames", "(", "SortedSet", "<", "Assignment", ">", "varsToRename", ")", "{", "NameGenerator", "globalNameGenerator", "=", "null", ";", "NameGenerator", "localNameGenerator", "=", "null", ";", "globalNameGenerator", "=", "nameGenerator", ";", ...
Determines which new names to substitute for the original names.
[ "Determines", "which", "new", "names", "to", "substitute", "for", "the", "original", "names", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RenameVars.java#L463-L542
24,540
google/closure-compiler
src/com/google/javascript/jscomp/RenameVars.java
RenameVars.finalizeNameAssignment
private void finalizeNameAssignment(Assignment a, String newName) { a.setNewName(newName); // Keep track of the mapping renameMap.put(a.oldName, newName); }
java
private void finalizeNameAssignment(Assignment a, String newName) { a.setNewName(newName); // Keep track of the mapping renameMap.put(a.oldName, newName); }
[ "private", "void", "finalizeNameAssignment", "(", "Assignment", "a", ",", "String", "newName", ")", "{", "a", ".", "setNewName", "(", "newName", ")", ";", "// Keep track of the mapping", "renameMap", ".", "put", "(", "a", ".", "oldName", ",", "newName", ")", ...
Makes a final name assignment.
[ "Makes", "a", "final", "name", "assignment", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RenameVars.java#L547-L552
24,541
google/closure-compiler
src/com/google/javascript/jscomp/parsing/parser/FeatureSet.java
FeatureSet.version
public String version() { if (ES3.contains(this)) { return "es3"; } if (ES5.contains(this)) { return "es5"; } if (ES6_MODULES.contains(this)) { return "es6"; } if (ES7_MODULES.contains(this)) { return "es7"; } if (ES8_MODULES.contains(this)) { return "es...
java
public String version() { if (ES3.contains(this)) { return "es3"; } if (ES5.contains(this)) { return "es5"; } if (ES6_MODULES.contains(this)) { return "es6"; } if (ES7_MODULES.contains(this)) { return "es7"; } if (ES8_MODULES.contains(this)) { return "es...
[ "public", "String", "version", "(", ")", "{", "if", "(", "ES3", ".", "contains", "(", "this", ")", ")", "{", "return", "\"es3\"", ";", "}", "if", "(", "ES5", ".", "contains", "(", "this", ")", ")", "{", "return", "\"es5\"", ";", "}", "if", "(", ...
Returns a string representation suitable for encoding in depgraph and deps.js files.
[ "Returns", "a", "string", "representation", "suitable", "for", "encoding", "in", "depgraph", "and", "deps", ".", "js", "files", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/parser/FeatureSet.java#L222-L254
24,542
google/closure-compiler
src/com/google/javascript/jscomp/parsing/parser/FeatureSet.java
FeatureSet.valueOf
public static FeatureSet valueOf(String name) { switch (name) { case "es3": return ES3; case "es5": return ES5; case "es6-impl": case "es6": return ES6; case "typeCheckSupported": return TYPE_CHECK_SUPPORTED; case "es7": return ES7; c...
java
public static FeatureSet valueOf(String name) { switch (name) { case "es3": return ES3; case "es5": return ES5; case "es6-impl": case "es6": return ES6; case "typeCheckSupported": return TYPE_CHECK_SUPPORTED; case "es7": return ES7; c...
[ "public", "static", "FeatureSet", "valueOf", "(", "String", "name", ")", "{", "switch", "(", "name", ")", "{", "case", "\"es3\"", ":", "return", "ES3", ";", "case", "\"es5\"", ":", "return", "ES5", ";", "case", "\"es6-impl\"", ":", "case", "\"es6\"", ":"...
Parses known strings into feature sets.
[ "Parses", "known", "strings", "into", "feature", "sets", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/parser/FeatureSet.java#L411-L438
24,543
google/closure-compiler
src/com/google/javascript/jscomp/deps/DepsGenerator.java
DepsGenerator.computeDependencyCalls
public String computeDependencyCalls() throws IOException { // Build a map of closure-relative path -> DepInfo. Map<String, DependencyInfo> depsFiles = parseDepsFiles(); if (logger.isLoggable(Level.FINE)) { logger.fine("preparsedFiles: " + depsFiles); } // Find all goog.provides & goog.require...
java
public String computeDependencyCalls() throws IOException { // Build a map of closure-relative path -> DepInfo. Map<String, DependencyInfo> depsFiles = parseDepsFiles(); if (logger.isLoggable(Level.FINE)) { logger.fine("preparsedFiles: " + depsFiles); } // Find all goog.provides & goog.require...
[ "public", "String", "computeDependencyCalls", "(", ")", "throws", "IOException", "{", "// Build a map of closure-relative path -> DepInfo.", "Map", "<", "String", ",", "DependencyInfo", ">", "depsFiles", "=", "parseDepsFiles", "(", ")", ";", "if", "(", "logger", ".", ...
Performs the parsing inputs and writing of outputs. @throws IOException Occurs upon an IO error. @return Returns a String of goog.addDependency calls that will build the dependency graph. Returns null if there was an error.
[ "Performs", "the", "parsing", "inputs", "and", "writing", "of", "outputs", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsGenerator.java#L134-L162
24,544
google/closure-compiler
src/com/google/javascript/jscomp/deps/DepsGenerator.java
DepsGenerator.cleanUpDuplicatedFiles
protected void cleanUpDuplicatedFiles(Map<String, DependencyInfo> depsFiles, Map<String, DependencyInfo> jsFiles) { Set<String> depsPathsCopy = new HashSet<>(depsFiles.keySet()); for (String path : depsPathsCopy) { if (mergeStrategy != InclusionStrategy.WHEN_IN_SRCS) { jsFiles.remove(path); ...
java
protected void cleanUpDuplicatedFiles(Map<String, DependencyInfo> depsFiles, Map<String, DependencyInfo> jsFiles) { Set<String> depsPathsCopy = new HashSet<>(depsFiles.keySet()); for (String path : depsPathsCopy) { if (mergeStrategy != InclusionStrategy.WHEN_IN_SRCS) { jsFiles.remove(path); ...
[ "protected", "void", "cleanUpDuplicatedFiles", "(", "Map", "<", "String", ",", "DependencyInfo", ">", "depsFiles", ",", "Map", "<", "String", ",", "DependencyInfo", ">", "jsFiles", ")", "{", "Set", "<", "String", ">", "depsPathsCopy", "=", "new", "HashSet", ...
Removes duplicated depsInfo from jsFiles if this info already present in some of the parsed deps.js @param depsFiles DepsInfo from deps.js dependencies @param jsFiles DepsInfo from some of jsSources
[ "Removes", "duplicated", "depsInfo", "from", "jsFiles", "if", "this", "info", "already", "present", "in", "some", "of", "the", "parsed", "deps", ".", "js" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsGenerator.java#L171-L186
24,545
google/closure-compiler
src/com/google/javascript/jscomp/deps/DepsGenerator.java
DepsGenerator.addToProvideMap
private void addToProvideMap( Iterable<DependencyInfo> depInfos, Map<String, DependencyInfo> providesMap, boolean isFromDepsFile) { for (DependencyInfo depInfo : depInfos) { List<String> provides = new ArrayList<>(depInfo.getProvides()); // Add a munged symbol to the provides map so t...
java
private void addToProvideMap( Iterable<DependencyInfo> depInfos, Map<String, DependencyInfo> providesMap, boolean isFromDepsFile) { for (DependencyInfo depInfo : depInfos) { List<String> provides = new ArrayList<>(depInfo.getProvides()); // Add a munged symbol to the provides map so t...
[ "private", "void", "addToProvideMap", "(", "Iterable", "<", "DependencyInfo", ">", "depInfos", ",", "Map", "<", "String", ",", "DependencyInfo", ">", "providesMap", ",", "boolean", "isFromDepsFile", ")", "{", "for", "(", "DependencyInfo", "depInfo", ":", "depInf...
Adds the given DependencyInfos to the given providesMap. Also checks for and reports duplicate provides.
[ "Adds", "the", "given", "DependencyInfos", "to", "the", "given", "providesMap", ".", "Also", "checks", "for", "and", "reports", "duplicate", "provides", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsGenerator.java#L370-L404
24,546
google/closure-compiler
src/com/google/javascript/jscomp/deps/DepsGenerator.java
DepsGenerator.parseDepsFiles
private Map<String, DependencyInfo> parseDepsFiles() throws IOException { DepsFileParser depsParser = createDepsFileParser(); Map<String, DependencyInfo> depsFiles = new LinkedHashMap<>(); for (SourceFile file : deps) { if (!shouldSkipDepsFile(file)) { List<DependencyInfo> depInfos...
java
private Map<String, DependencyInfo> parseDepsFiles() throws IOException { DepsFileParser depsParser = createDepsFileParser(); Map<String, DependencyInfo> depsFiles = new LinkedHashMap<>(); for (SourceFile file : deps) { if (!shouldSkipDepsFile(file)) { List<DependencyInfo> depInfos...
[ "private", "Map", "<", "String", ",", "DependencyInfo", ">", "parseDepsFiles", "(", ")", "throws", "IOException", "{", "DepsFileParser", "depsParser", "=", "createDepsFileParser", "(", ")", ";", "Map", "<", "String", ",", "DependencyInfo", ">", "depsFiles", "=",...
Parses all deps.js files in the deps list and creates a map of closure-relative path -> DependencyInfo.
[ "Parses", "all", "deps", ".", "js", "files", "in", "the", "deps", "list", "and", "creates", "a", "map", "of", "closure", "-", "relative", "path", "-", ">", "DependencyInfo", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsGenerator.java#L423-L455
24,547
google/closure-compiler
src/com/google/javascript/jscomp/deps/DepsGenerator.java
DepsGenerator.parseSources
private Map<String, DependencyInfo> parseSources( Set<String> preparsedFiles) throws IOException { Map<String, DependencyInfo> parsedFiles = new LinkedHashMap<>(); JsFileParser jsParser = new JsFileParser(errorManager).setModuleLoader(loader); Compiler compiler = new Compiler(); compiler.init(Immu...
java
private Map<String, DependencyInfo> parseSources( Set<String> preparsedFiles) throws IOException { Map<String, DependencyInfo> parsedFiles = new LinkedHashMap<>(); JsFileParser jsParser = new JsFileParser(errorManager).setModuleLoader(loader); Compiler compiler = new Compiler(); compiler.init(Immu...
[ "private", "Map", "<", "String", ",", "DependencyInfo", ">", "parseSources", "(", "Set", "<", "String", ">", "preparsedFiles", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "DependencyInfo", ">", "parsedFiles", "=", "new", "LinkedHashMap", "<>"...
Parses all source files for dependency information. @param preparsedFiles A set of closure-relative paths. Files in this set are not parsed if they are encountered in srcs. @return Returns a map of closure-relative paths -> DependencyInfo for the newly parsed files. @throws IOException Occurs upon an IO error.
[ "Parses", "all", "source", "files", "for", "dependency", "information", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsGenerator.java#L477-L506
24,548
google/closure-compiler
src/com/google/javascript/jscomp/deps/DepsGenerator.java
DepsGenerator.writeDepsContent
private void writeDepsContent(Map<String, DependencyInfo> depsFiles, Map<String, DependencyInfo> jsFiles, PrintStream out) throws IOException { // Print all dependencies extracted from srcs. writeDepInfos(out, jsFiles.values()); // Print all dependencies extracted from deps. if (mergeStrate...
java
private void writeDepsContent(Map<String, DependencyInfo> depsFiles, Map<String, DependencyInfo> jsFiles, PrintStream out) throws IOException { // Print all dependencies extracted from srcs. writeDepInfos(out, jsFiles.values()); // Print all dependencies extracted from deps. if (mergeStrate...
[ "private", "void", "writeDepsContent", "(", "Map", "<", "String", ",", "DependencyInfo", ">", "depsFiles", ",", "Map", "<", "String", ",", "DependencyInfo", ">", "jsFiles", ",", "PrintStream", "out", ")", "throws", "IOException", "{", "// Print all dependencies ex...
Creates the content to put into the output deps.js file. If mergeDeps is true, then all of the dependency information in the providedDeps will be included in the output. @throws IOException Occurs upon an IO error.
[ "Creates", "the", "content", "to", "put", "into", "the", "output", "deps", ".", "js", "file", ".", "If", "mergeDeps", "is", "true", "then", "all", "of", "the", "dependency", "information", "in", "the", "providedDeps", "will", "be", "included", "in", "the",...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsGenerator.java#L514-L533
24,549
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.addReturnTypeIfMissing
private void addReturnTypeIfMissing( PolymerClassDefinition cls, String getterPropName, JSTypeExpression jsType) { Node classMembers = NodeUtil.getClassMembers(cls.definition); Node getter = NodeUtil.getFirstGetterMatchingKey(classMembers, getterPropName); if (getter != null) { JSDocInfo info = ...
java
private void addReturnTypeIfMissing( PolymerClassDefinition cls, String getterPropName, JSTypeExpression jsType) { Node classMembers = NodeUtil.getClassMembers(cls.definition); Node getter = NodeUtil.getFirstGetterMatchingKey(classMembers, getterPropName); if (getter != null) { JSDocInfo info = ...
[ "private", "void", "addReturnTypeIfMissing", "(", "PolymerClassDefinition", "cls", ",", "String", "getterPropName", ",", "JSTypeExpression", "jsType", ")", "{", "Node", "classMembers", "=", "NodeUtil", ".", "getClassMembers", "(", "cls", ".", "definition", ")", ";",...
Adds return type information to class getters
[ "Adds", "return", "type", "information", "to", "class", "getters" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L300-L312
24,550
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.addPropertiesConfigObjectReflection
private void addPropertiesConfigObjectReflection( PolymerClassDefinition cls, Node propertiesLiteral) { checkNotNull(propertiesLiteral); checkState(propertiesLiteral.isObjectLit()); Node parent = propertiesLiteral.getParent(); Node objReflectCall = IR.call( NodeUtil.newQN...
java
private void addPropertiesConfigObjectReflection( PolymerClassDefinition cls, Node propertiesLiteral) { checkNotNull(propertiesLiteral); checkState(propertiesLiteral.isObjectLit()); Node parent = propertiesLiteral.getParent(); Node objReflectCall = IR.call( NodeUtil.newQN...
[ "private", "void", "addPropertiesConfigObjectReflection", "(", "PolymerClassDefinition", "cls", ",", "Node", "propertiesLiteral", ")", "{", "checkNotNull", "(", "propertiesLiteral", ")", ";", "checkState", "(", "propertiesLiteral", ".", "isObjectLit", "(", ")", ")", "...
Wrap the properties config object in an objectReflect call
[ "Wrap", "the", "properties", "config", "object", "in", "an", "objectReflect", "call" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L315-L330
24,551
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.appendPropertiesToBlock
private void appendPropertiesToBlock(List<MemberDefinition> props, Node block, String basePath) { for (MemberDefinition prop : props) { Node propertyNode = IR.exprResult(NodeUtil.newQName(compiler, basePath + prop.name.getString())); // If a property string is quoted, make sure the added prot...
java
private void appendPropertiesToBlock(List<MemberDefinition> props, Node block, String basePath) { for (MemberDefinition prop : props) { Node propertyNode = IR.exprResult(NodeUtil.newQName(compiler, basePath + prop.name.getString())); // If a property string is quoted, make sure the added prot...
[ "private", "void", "appendPropertiesToBlock", "(", "List", "<", "MemberDefinition", ">", "props", ",", "Node", "block", ",", "String", "basePath", ")", "{", "for", "(", "MemberDefinition", "prop", ":", "props", ")", "{", "Node", "propertyNode", "=", "IR", "....
Appends all of the given properties to the given block.
[ "Appends", "all", "of", "the", "given", "properties", "to", "the", "given", "block", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L439-L461
24,552
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.removePropertyDocs
private void removePropertyDocs( final Node objLit, PolymerClassDefinition.DefinitionType defType) { for (MemberDefinition prop : PolymerPassStaticUtils.extractProperties( objLit, defType, compiler, /** constructor= */ null)) { prop.nam...
java
private void removePropertyDocs( final Node objLit, PolymerClassDefinition.DefinitionType defType) { for (MemberDefinition prop : PolymerPassStaticUtils.extractProperties( objLit, defType, compiler, /** constructor= */ null)) { prop.nam...
[ "private", "void", "removePropertyDocs", "(", "final", "Node", "objLit", ",", "PolymerClassDefinition", ".", "DefinitionType", "defType", ")", "{", "for", "(", "MemberDefinition", "prop", ":", "PolymerPassStaticUtils", ".", "extractProperties", "(", "objLit", ",", "...
Remove all JSDocs from properties of a class definition
[ "Remove", "all", "JSDocs", "from", "properties", "of", "a", "class", "definition" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L464-L475
24,553
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.appendBehaviorMembersToBlock
private void appendBehaviorMembersToBlock(final PolymerClassDefinition cls, Node block) { String qualifiedPath = cls.target.getQualifiedName() + ".prototype."; Map<String, Node> nameToExprResult = new HashMap<>(); for (BehaviorDefinition behavior : cls.behaviors) { for (MemberDefinition behaviorFuncti...
java
private void appendBehaviorMembersToBlock(final PolymerClassDefinition cls, Node block) { String qualifiedPath = cls.target.getQualifiedName() + ".prototype."; Map<String, Node> nameToExprResult = new HashMap<>(); for (BehaviorDefinition behavior : cls.behaviors) { for (MemberDefinition behaviorFuncti...
[ "private", "void", "appendBehaviorMembersToBlock", "(", "final", "PolymerClassDefinition", "cls", ",", "Node", "block", ")", "{", "String", "qualifiedPath", "=", "cls", ".", "target", ".", "getQualifiedName", "(", ")", "+", "\".prototype.\"", ";", "Map", "<", "S...
Appends all required behavior functions and non-property members to the given block.
[ "Appends", "all", "required", "behavior", "functions", "and", "non", "-", "property", "members", "to", "the", "given", "block", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L478-L546
24,554
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.makeReadOnlySetter
private Node makeReadOnlySetter(String propName, String qualifiedPath) { String setterName = "_set" + propName.substring(0, 1).toUpperCase() + propName.substring(1); Node fnNode = IR.function(IR.name(""), IR.paramList(IR.name(propName)), IR.block()); compiler.reportChangeToChangeScope(fnNode); Node expr...
java
private Node makeReadOnlySetter(String propName, String qualifiedPath) { String setterName = "_set" + propName.substring(0, 1).toUpperCase() + propName.substring(1); Node fnNode = IR.function(IR.name(""), IR.paramList(IR.name(propName)), IR.block()); compiler.reportChangeToChangeScope(fnNode); Node expr...
[ "private", "Node", "makeReadOnlySetter", "(", "String", "propName", ",", "String", "qualifiedPath", ")", "{", "String", "setterName", "=", "\"_set\"", "+", "propName", ".", "substring", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")", "+", "propName", ...
Adds the generated setter for a readonly property. @see https://www.polymer-project.org/0.8/docs/devguide/properties.html#read-only
[ "Adds", "the", "generated", "setter", "for", "a", "readonly", "property", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L553-L567
24,555
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.createExportsAndExterns
private void createExportsAndExterns( final PolymerClassDefinition cls, List<MemberDefinition> readOnlyProps, List<MemberDefinition> attributeReflectedProps) { Node block = IR.block(); String interfaceName = getInterfaceName(cls); Node fnNode = NodeUtil.emptyFunction(); compiler.repor...
java
private void createExportsAndExterns( final PolymerClassDefinition cls, List<MemberDefinition> readOnlyProps, List<MemberDefinition> attributeReflectedProps) { Node block = IR.block(); String interfaceName = getInterfaceName(cls); Node fnNode = NodeUtil.emptyFunction(); compiler.repor...
[ "private", "void", "createExportsAndExterns", "(", "final", "PolymerClassDefinition", "cls", ",", "List", "<", "MemberDefinition", ">", "readOnlyProps", ",", "List", "<", "MemberDefinition", ">", "attributeReflectedProps", ")", "{", "Node", "block", "=", "IR", ".", ...
Create exports and externs to protect element properties and methods from renaming and dead code removal. <p>Since Polymer templates, observers, and computed properties rely on string references to element properties and methods, and because we don't yet have a way to update those references reliably, we instead expor...
[ "Create", "exports", "and", "externs", "to", "protect", "element", "properties", "and", "methods", "from", "renaming", "and", "dead", "code", "removal", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L606-L688
24,556
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.varToAssign
private static Node varToAssign(Node var) { Node assign = IR.assign(var.getFirstChild().cloneNode(), var.getFirstChild().removeFirstChild()); return IR.exprResult(assign).useSourceInfoIfMissingFromForTree(var); }
java
private static Node varToAssign(Node var) { Node assign = IR.assign(var.getFirstChild().cloneNode(), var.getFirstChild().removeFirstChild()); return IR.exprResult(assign).useSourceInfoIfMissingFromForTree(var); }
[ "private", "static", "Node", "varToAssign", "(", "Node", "var", ")", "{", "Node", "assign", "=", "IR", ".", "assign", "(", "var", ".", "getFirstChild", "(", ")", ".", "cloneNode", "(", ")", ",", "var", ".", "getFirstChild", "(", ")", ".", "removeFirstC...
Returns an assign replacing the equivalent var or let declaration.
[ "Returns", "an", "assign", "replacing", "the", "equivalent", "var", "or", "let", "declaration", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L732-L736
24,557
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.convertSimpleObserverStringsToReferences
private void convertSimpleObserverStringsToReferences(final PolymerClassDefinition cls) { for (MemberDefinition prop : cls.props) { if (prop.value.isObjectLit()) { Node observer = NodeUtil.getFirstPropMatchingKey(prop.value, "observer"); if (observer != null && observer.isString()) { ...
java
private void convertSimpleObserverStringsToReferences(final PolymerClassDefinition cls) { for (MemberDefinition prop : cls.props) { if (prop.value.isObjectLit()) { Node observer = NodeUtil.getFirstPropMatchingKey(prop.value, "observer"); if (observer != null && observer.isString()) { ...
[ "private", "void", "convertSimpleObserverStringsToReferences", "(", "final", "PolymerClassDefinition", "cls", ")", "{", "for", "(", "MemberDefinition", "prop", ":", "cls", ".", "props", ")", "{", "if", "(", "prop", ".", "value", ".", "isObjectLit", "(", ")", "...
Converts property observer strings to direct function references. <p>From: <code>observer: '_observerName'</code> To: <code> observer: ClassName.prototype._observerName</code>
[ "Converts", "property", "observer", "strings", "to", "direct", "function", "references", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L744-L758
24,558
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.addComputedPropertiesReflectionCalls
private List<Node> addComputedPropertiesReflectionCalls(final PolymerClassDefinition cls) { List<Node> propertySinkStatements = new ArrayList<>(); for (MemberDefinition prop : cls.props) { if (prop.value.isObjectLit()) { Node computed = NodeUtil.getFirstPropMatchingKey(prop.value, "computed"); ...
java
private List<Node> addComputedPropertiesReflectionCalls(final PolymerClassDefinition cls) { List<Node> propertySinkStatements = new ArrayList<>(); for (MemberDefinition prop : cls.props) { if (prop.value.isObjectLit()) { Node computed = NodeUtil.getFirstPropMatchingKey(prop.value, "computed"); ...
[ "private", "List", "<", "Node", ">", "addComputedPropertiesReflectionCalls", "(", "final", "PolymerClassDefinition", "cls", ")", "{", "List", "<", "Node", ">", "propertySinkStatements", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "MemberDefinition", ...
For any property in the Polymer property configuration object with a `computed` key, parse the method call and path arguments and replace them with property reflection calls. <p>Returns a list of property sink statements to guard against dead code elimination since the compiler may not see these methods as being used.
[ "For", "any", "property", "in", "the", "Polymer", "property", "configuration", "object", "with", "a", "computed", "key", "parse", "the", "method", "call", "and", "path", "arguments", "and", "replace", "them", "with", "property", "reflection", "calls", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L767-L779
24,559
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.addComplexObserverReflectionCalls
private List<Node> addComplexObserverReflectionCalls(final PolymerClassDefinition cls) { List<Node> propertySinkStatements = new ArrayList<>(); Node classMembers = NodeUtil.getClassMembers(cls.definition); Node getter = NodeUtil.getFirstGetterMatchingKey(classMembers, "observers"); if (getter != null) {...
java
private List<Node> addComplexObserverReflectionCalls(final PolymerClassDefinition cls) { List<Node> propertySinkStatements = new ArrayList<>(); Node classMembers = NodeUtil.getClassMembers(cls.definition); Node getter = NodeUtil.getFirstGetterMatchingKey(classMembers, "observers"); if (getter != null) {...
[ "private", "List", "<", "Node", ">", "addComplexObserverReflectionCalls", "(", "final", "PolymerClassDefinition", "cls", ")", "{", "List", "<", "Node", ">", "propertySinkStatements", "=", "new", "ArrayList", "<>", "(", ")", ";", "Node", "classMembers", "=", "Nod...
For any strings returned in the array from the Polymer static observers property, parse the method call and path arguments and replace them with property reflection calls. <p>Returns a list of property sink statements to guard against dead code elimination since the compiler may not see these methods as being used.
[ "For", "any", "strings", "returned", "in", "the", "array", "from", "the", "Polymer", "static", "observers", "property", "parse", "the", "method", "call", "and", "path", "arguments", "and", "replace", "them", "with", "property", "reflection", "calls", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L788-L812
24,560
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.parseMethodParams
private List<String> parseMethodParams(String methodParameters, Node methodSignature) { List<String> parsedParameters = new ArrayList<>(); char nextDelimeter = ','; String currentTerm = ""; for (int i = 0; i < methodParameters.length(); i++) { if (methodParameters.charAt(i) == nextDelimeter) { ...
java
private List<String> parseMethodParams(String methodParameters, Node methodSignature) { List<String> parsedParameters = new ArrayList<>(); char nextDelimeter = ','; String currentTerm = ""; for (int i = 0; i < methodParameters.length(); i++) { if (methodParameters.charAt(i) == nextDelimeter) { ...
[ "private", "List", "<", "String", ">", "parseMethodParams", "(", "String", "methodParameters", ",", "Node", "methodSignature", ")", "{", "List", "<", "String", ">", "parsedParameters", "=", "new", "ArrayList", "<>", "(", ")", ";", "char", "nextDelimeter", "=",...
Parses the parameters string from a complex observer or computed property into distinct parameters. Since a parameter can be a quoted string literal, we can't just split on commas.
[ "Parses", "the", "parameters", "string", "from", "a", "complex", "observer", "or", "computed", "property", "into", "distinct", "parameters", ".", "Since", "a", "parameter", "can", "be", "a", "quoted", "string", "literal", "we", "can", "t", "just", "split", "...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L944-L973
24,561
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.isParamLiteral
private static boolean isParamLiteral(String param) { try { Double.parseDouble(param); return true; } catch (NumberFormatException e) { // Check to see if the parameter is a literal - either a quoted string or // numeric literal if (param.length() > 1 && (param.charAt(0) ...
java
private static boolean isParamLiteral(String param) { try { Double.parseDouble(param); return true; } catch (NumberFormatException e) { // Check to see if the parameter is a literal - either a quoted string or // numeric literal if (param.length() > 1 && (param.charAt(0) ...
[ "private", "static", "boolean", "isParamLiteral", "(", "String", "param", ")", "{", "try", "{", "Double", ".", "parseDouble", "(", "param", ")", ";", "return", "true", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "// Check to see if the para...
Determine if the method parameter a quoted string or numeric literal recognized by Polymer.
[ "Determine", "if", "the", "method", "parameter", "a", "quoted", "string", "or", "numeric", "literal", "recognized", "by", "Polymer", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L976-L990
24,562
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.inferParameters
@SuppressWarnings("ReferenceEquality") // unknownType is a singleton private FlowScope inferParameters(FlowScope entryFlowScope) { Node functionNode = containerScope.getRootNode(); if (!functionNode.isFunction()) { return entryFlowScope; // we're in the global scope } else if (NodeUtil.isBundledGoog...
java
@SuppressWarnings("ReferenceEquality") // unknownType is a singleton private FlowScope inferParameters(FlowScope entryFlowScope) { Node functionNode = containerScope.getRootNode(); if (!functionNode.isFunction()) { return entryFlowScope; // we're in the global scope } else if (NodeUtil.isBundledGoog...
[ "@", "SuppressWarnings", "(", "\"ReferenceEquality\"", ")", "// unknownType is a singleton", "private", "FlowScope", "inferParameters", "(", "FlowScope", "entryFlowScope", ")", "{", "Node", "functionNode", "=", "containerScope", ".", "getRootNode", "(", ")", ";", "if", ...
Infers all of a function's parameters if their types aren't declared.
[ "Infers", "all", "of", "a", "function", "s", "parameters", "if", "their", "types", "aren", "t", "declared", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L151-L236
24,563
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.traverseReturn
@CheckReturnValue private FlowScope traverseReturn(Node n, FlowScope scope) { scope = traverseChildren(n, scope); Node retValue = n.getFirstChild(); if (retValue != null) { JSType type = functionScope.getRootNode().getJSType(); if (type != null) { FunctionType fnType = type.toMaybeFun...
java
@CheckReturnValue private FlowScope traverseReturn(Node n, FlowScope scope) { scope = traverseChildren(n, scope); Node retValue = n.getFirstChild(); if (retValue != null) { JSType type = functionScope.getRootNode().getJSType(); if (type != null) { FunctionType fnType = type.toMaybeFun...
[ "@", "CheckReturnValue", "private", "FlowScope", "traverseReturn", "(", "Node", "n", ",", "FlowScope", "scope", ")", "{", "scope", "=", "traverseChildren", "(", "n", ",", "scope", ")", ";", "Node", "retValue", "=", "n", ".", "getFirstChild", "(", ")", ";",...
Traverse a return value.
[ "Traverse", "a", "return", "value", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L830-L846
24,564
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.traverseCatch
@CheckReturnValue private FlowScope traverseCatch(Node catchNode, FlowScope scope) { Node catchTarget = catchNode.getFirstChild(); if (catchTarget.isName()) { // TODO(lharker): is this case even necessary? seems like TypedScopeCreator handles it Node name = catchNode.getFirstChild(); JSType ...
java
@CheckReturnValue private FlowScope traverseCatch(Node catchNode, FlowScope scope) { Node catchTarget = catchNode.getFirstChild(); if (catchTarget.isName()) { // TODO(lharker): is this case even necessary? seems like TypedScopeCreator handles it Node name = catchNode.getFirstChild(); JSType ...
[ "@", "CheckReturnValue", "private", "FlowScope", "traverseCatch", "(", "Node", "catchNode", ",", "FlowScope", "scope", ")", "{", "Node", "catchTarget", "=", "catchNode", ".", "getFirstChild", "(", ")", ";", "if", "(", "catchTarget", ".", "isName", "(", ")", ...
Any value can be thrown, so it's really impossible to determine the type of a CATCH param. Treat it as the UNKNOWN type.
[ "Any", "value", "can", "be", "thrown", "so", "it", "s", "really", "impossible", "to", "determine", "the", "type", "of", "a", "CATCH", "param", ".", "Treat", "it", "as", "the", "UNKNOWN", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L852-L877
24,565
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.updateScopeForAssignment
@CheckReturnValue private FlowScope updateScopeForAssignment( FlowScope scope, Node target, JSType resultType, Node updateNode, AssignmentType type) { checkNotNull(resultType); checkState(updateNode == null || updateNode == target); JSType targetType = target.getJSType(); // may be null Node r...
java
@CheckReturnValue private FlowScope updateScopeForAssignment( FlowScope scope, Node target, JSType resultType, Node updateNode, AssignmentType type) { checkNotNull(resultType); checkState(updateNode == null || updateNode == target); JSType targetType = target.getJSType(); // may be null Node r...
[ "@", "CheckReturnValue", "private", "FlowScope", "updateScopeForAssignment", "(", "FlowScope", "scope", ",", "Node", "target", ",", "JSType", "resultType", ",", "Node", "updateNode", ",", "AssignmentType", "type", ")", "{", "checkNotNull", "(", "resultType", ")", ...
Updates the scope according to the result of an assignment.
[ "Updates", "the", "scope", "according", "to", "the", "result", "of", "an", "assignment", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L959-L1088
24,566
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.ensurePropertyDefined
private void ensurePropertyDefined(Node getprop, JSType rightType, FlowScope scope) { String propName = getprop.getLastChild().getString(); Node obj = getprop.getFirstChild(); JSType nodeType = getJSType(obj); ObjectType objectType = ObjectType.cast( nodeType.restrictByNotNullOrUndefined()); ...
java
private void ensurePropertyDefined(Node getprop, JSType rightType, FlowScope scope) { String propName = getprop.getLastChild().getString(); Node obj = getprop.getFirstChild(); JSType nodeType = getJSType(obj); ObjectType objectType = ObjectType.cast( nodeType.restrictByNotNullOrUndefined()); ...
[ "private", "void", "ensurePropertyDefined", "(", "Node", "getprop", ",", "JSType", "rightType", ",", "FlowScope", "scope", ")", "{", "String", "propName", "=", "getprop", ".", "getLastChild", "(", ")", ".", "getString", "(", ")", ";", "Node", "obj", "=", "...
Defines a property if the property has not been defined yet.
[ "Defines", "a", "property", "if", "the", "property", "has", "not", "been", "defined", "yet", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1091-L1157
24,567
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.ensurePropertyDeclaredHelper
private boolean ensurePropertyDeclaredHelper( Node getprop, ObjectType objectType, FlowScope scope) { if (getprop.isQualifiedName()) { String propName = getprop.getLastChild().getString(); String qName = getprop.getQualifiedName(); TypedVar var = getDeclaredVar(scope, qName); if (var !...
java
private boolean ensurePropertyDeclaredHelper( Node getprop, ObjectType objectType, FlowScope scope) { if (getprop.isQualifiedName()) { String propName = getprop.getLastChild().getString(); String qName = getprop.getQualifiedName(); TypedVar var = getDeclaredVar(scope, qName); if (var !...
[ "private", "boolean", "ensurePropertyDeclaredHelper", "(", "Node", "getprop", ",", "ObjectType", "objectType", ",", "FlowScope", "scope", ")", "{", "if", "(", "getprop", ".", "isQualifiedName", "(", ")", ")", "{", "String", "propName", "=", "getprop", ".", "ge...
Declares a property on its owner, if necessary. @return True if a property was declared.
[ "Declares", "a", "property", "on", "its", "owner", "if", "necessary", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1164-L1184
24,568
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.traverseDestructuringPattern
private FlowScope traverseDestructuringPattern( Node pattern, FlowScope scope, JSType patternType, AssignmentType assignmentType) { return traverseDestructuringPatternHelper( pattern, scope, patternType, (FlowScope flowScope, Node targetNode, JSType targetType) -> { t...
java
private FlowScope traverseDestructuringPattern( Node pattern, FlowScope scope, JSType patternType, AssignmentType assignmentType) { return traverseDestructuringPatternHelper( pattern, scope, patternType, (FlowScope flowScope, Node targetNode, JSType targetType) -> { t...
[ "private", "FlowScope", "traverseDestructuringPattern", "(", "Node", "pattern", ",", "FlowScope", "scope", ",", "JSType", "patternType", ",", "AssignmentType", "assignmentType", ")", "{", "return", "traverseDestructuringPatternHelper", "(", "pattern", ",", "scope", ",",...
Traverses a destructuring pattern in an assignment or declaration
[ "Traverses", "a", "destructuring", "pattern", "in", "an", "assignment", "or", "declaration" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1206-L1216
24,569
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.traverseArrayLiteral
private FlowScope traverseArrayLiteral(Node n, FlowScope scope) { scope = traverseChildren(n, scope); n.setJSType(getNativeType(ARRAY_TYPE)); return scope; }
java
private FlowScope traverseArrayLiteral(Node n, FlowScope scope) { scope = traverseChildren(n, scope); n.setJSType(getNativeType(ARRAY_TYPE)); return scope; }
[ "private", "FlowScope", "traverseArrayLiteral", "(", "Node", "n", ",", "FlowScope", "scope", ")", "{", "scope", "=", "traverseChildren", "(", "n", ",", "scope", ")", ";", "n", ".", "setJSType", "(", "getNativeType", "(", "ARRAY_TYPE", ")", ")", ";", "retur...
Traverse each element of the array.
[ "Traverse", "each", "element", "of", "the", "array", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1343-L1347
24,570
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.backwardsInferenceFromCallSite
private void backwardsInferenceFromCallSite(Node n, FunctionType fnType, FlowScope scope) { boolean updatedFnType = inferTemplatedTypesForCall(n, fnType, scope); if (updatedFnType) { fnType = n.getFirstChild().getJSType().toMaybeFunctionType(); } updateTypeOfArguments(n, fnType); updateBind(n)...
java
private void backwardsInferenceFromCallSite(Node n, FunctionType fnType, FlowScope scope) { boolean updatedFnType = inferTemplatedTypesForCall(n, fnType, scope); if (updatedFnType) { fnType = n.getFirstChild().getJSType().toMaybeFunctionType(); } updateTypeOfArguments(n, fnType); updateBind(n)...
[ "private", "void", "backwardsInferenceFromCallSite", "(", "Node", "n", ",", "FunctionType", "fnType", ",", "FlowScope", "scope", ")", "{", "boolean", "updatedFnType", "=", "inferTemplatedTypesForCall", "(", "n", ",", "fnType", ",", "scope", ")", ";", "if", "(", ...
We only do forward type inference. We do not do full backwards type inference. In other words, if we have, <code> var x = f(); g(x); </code> a forward type-inference engine would try to figure out the type of "x" from the return type of "f". A backwards type-inference engine would try to figure out the type of "x" fro...
[ "We", "only", "do", "forward", "type", "inference", ".", "We", "do", "not", "do", "full", "backwards", "type", "inference", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1617-L1624
24,571
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.updateBind
private void updateBind(Node n) { CodingConvention.Bind bind = compiler.getCodingConvention().describeFunctionBind(n, false, true); if (bind == null) { return; } Node target = bind.target; FunctionType callTargetFn = getJSType(target) .restrictByNotNullOrUndefined().toMaybeFun...
java
private void updateBind(Node n) { CodingConvention.Bind bind = compiler.getCodingConvention().describeFunctionBind(n, false, true); if (bind == null) { return; } Node target = bind.target; FunctionType callTargetFn = getJSType(target) .restrictByNotNullOrUndefined().toMaybeFun...
[ "private", "void", "updateBind", "(", "Node", "n", ")", "{", "CodingConvention", ".", "Bind", "bind", "=", "compiler", ".", "getCodingConvention", "(", ")", ".", "describeFunctionBind", "(", "n", ",", "false", ",", "true", ")", ";", "if", "(", "bind", "=...
When "bind" is called on a function, we infer the type of the returned "bound" function by looking at the number of parameters in the call site. We also infer the "this" type of the target, if it's a function expression.
[ "When", "bind", "is", "called", "on", "a", "function", "we", "infer", "the", "type", "of", "the", "returned", "bound", "function", "by", "looking", "at", "the", "number", "of", "parameters", "in", "the", "call", "site", ".", "We", "also", "infer", "the",...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1631-L1662
24,572
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.updateTypeOfArguments
private void updateTypeOfArguments(Node n, FunctionType fnType) { checkState(NodeUtil.isInvocation(n), n); Iterator<Node> parameters = fnType.getParameters().iterator(); if (n.isTaggedTemplateLit()) { // Skip the first parameter because it corresponds to a constructed array of the template lit /...
java
private void updateTypeOfArguments(Node n, FunctionType fnType) { checkState(NodeUtil.isInvocation(n), n); Iterator<Node> parameters = fnType.getParameters().iterator(); if (n.isTaggedTemplateLit()) { // Skip the first parameter because it corresponds to a constructed array of the template lit /...
[ "private", "void", "updateTypeOfArguments", "(", "Node", "n", ",", "FunctionType", "fnType", ")", "{", "checkState", "(", "NodeUtil", ".", "isInvocation", "(", "n", ")", ",", "n", ")", ";", "Iterator", "<", "Node", ">", "parameters", "=", "fnType", ".", ...
Performs a limited back-inference on function arguments based on the expected parameter types. <p>Currently this only does back-inference in two cases: it infers the type of function literal arguments and adds inferred properties to inferred object-typed arguments. <p>For example: if someone calls `Promise<string>.pr...
[ "Performs", "a", "limited", "back", "-", "inference", "on", "function", "arguments", "based", "on", "the", "expected", "parameter", "types", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1674-L1735
24,573
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.matchFunction
private FunctionType matchFunction( FunctionType expectedType, FunctionType currentType, boolean declared) { if (declared) { // If the function was declared but it doesn't have a known "this" // but the expected type does, back fill it. if (currentType.getTypeOfThis().isUnknownType() ...
java
private FunctionType matchFunction( FunctionType expectedType, FunctionType currentType, boolean declared) { if (declared) { // If the function was declared but it doesn't have a known "this" // but the expected type does, back fill it. if (currentType.getTypeOfThis().isUnknownType() ...
[ "private", "FunctionType", "matchFunction", "(", "FunctionType", "expectedType", ",", "FunctionType", "currentType", ",", "boolean", "declared", ")", "{", "if", "(", "declared", ")", "{", "// If the function was declared but it doesn't have a known \"this\"", "// but the expe...
Take the current function type, and try to match the expected function type. This is a form of backwards-inference, like record-type constraint matching. @param declared Whether the given function type is user-provided as opposed to inferred
[ "Take", "the", "current", "function", "type", "and", "try", "to", "match", "the", "expected", "function", "type", ".", "This", "is", "a", "form", "of", "backwards", "-", "inference", "like", "record", "-", "type", "constraint", "matching", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1743-L1766
24,574
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.buildTypeVariables
private Map<String, JSType> buildTypeVariables( Map<TemplateType, JSType> inferredTypes) { Map<String, JSType> typeVars = new LinkedHashMap<>(); for (Entry<TemplateType, JSType> e : inferredTypes.entrySet()) { // Only add the template type that do not have a type transformation if (!e.getKey()...
java
private Map<String, JSType> buildTypeVariables( Map<TemplateType, JSType> inferredTypes) { Map<String, JSType> typeVars = new LinkedHashMap<>(); for (Entry<TemplateType, JSType> e : inferredTypes.entrySet()) { // Only add the template type that do not have a type transformation if (!e.getKey()...
[ "private", "Map", "<", "String", ",", "JSType", ">", "buildTypeVariables", "(", "Map", "<", "TemplateType", ",", "JSType", ">", "inferredTypes", ")", "{", "Map", "<", "String", ",", "JSType", ">", "typeVars", "=", "new", "LinkedHashMap", "<>", "(", ")", ...
Build the type environment where type transformations will be evaluated. It only considers the template type variables that do not have a type transformation.
[ "Build", "the", "type", "environment", "where", "type", "transformations", "will", "be", "evaluated", ".", "It", "only", "considers", "the", "template", "type", "variables", "that", "do", "not", "have", "a", "type", "transformation", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1992-L2002
24,575
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.evaluateTypeTransformations
private Map<TemplateType, JSType> evaluateTypeTransformations( ImmutableList<TemplateType> templateTypes, Map<TemplateType, JSType> inferredTypes, FlowScope scope) { Map<String, JSType> typeVars = null; Map<TemplateType, JSType> result = null; TypeTransformation ttlObj = null; for (T...
java
private Map<TemplateType, JSType> evaluateTypeTransformations( ImmutableList<TemplateType> templateTypes, Map<TemplateType, JSType> inferredTypes, FlowScope scope) { Map<String, JSType> typeVars = null; Map<TemplateType, JSType> result = null; TypeTransformation ttlObj = null; for (T...
[ "private", "Map", "<", "TemplateType", ",", "JSType", ">", "evaluateTypeTransformations", "(", "ImmutableList", "<", "TemplateType", ">", "templateTypes", ",", "Map", "<", "TemplateType", ",", "JSType", ">", "inferredTypes", ",", "FlowScope", "scope", ")", "{", ...
This function will evaluate the type transformations associated to the template types
[ "This", "function", "will", "evaluate", "the", "type", "transformations", "associated", "to", "the", "template", "types" ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L2005-L2033
24,576
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.inferTemplatedTypesForCall
private boolean inferTemplatedTypesForCall(Node n, FunctionType fnType, FlowScope scope) { ImmutableList<TemplateType> keys = fnType.getTemplateTypeMap().getTemplateKeys(); if (keys.isEmpty()) { return false; } // Try to infer the template types Map<TemplateType, JSType> rawInferrence = infer...
java
private boolean inferTemplatedTypesForCall(Node n, FunctionType fnType, FlowScope scope) { ImmutableList<TemplateType> keys = fnType.getTemplateTypeMap().getTemplateKeys(); if (keys.isEmpty()) { return false; } // Try to infer the template types Map<TemplateType, JSType> rawInferrence = infer...
[ "private", "boolean", "inferTemplatedTypesForCall", "(", "Node", "n", ",", "FunctionType", "fnType", ",", "FlowScope", "scope", ")", "{", "ImmutableList", "<", "TemplateType", ">", "keys", "=", "fnType", ".", "getTemplateTypeMap", "(", ")", ".", "getTemplateKeys",...
For functions that use template types, specialize the function type for the call target based on the call-site specific arguments. Specifically, this enables inference to set the type of any function literal parameters based on these inferred types.
[ "For", "functions", "that", "use", "template", "types", "specialize", "the", "function", "type", "for", "the", "call", "target", "based", "on", "the", "call", "-", "site", "specific", "arguments", ".", "Specifically", "this", "enables", "inference", "to", "set...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L2040-L2075
24,577
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.inferPropertyTypesToMatchConstraint
private static void inferPropertyTypesToMatchConstraint( JSType type, JSType constraint) { if (type == null || constraint == null) { return; } type.matchConstraint(constraint); }
java
private static void inferPropertyTypesToMatchConstraint( JSType type, JSType constraint) { if (type == null || constraint == null) { return; } type.matchConstraint(constraint); }
[ "private", "static", "void", "inferPropertyTypesToMatchConstraint", "(", "JSType", "type", ",", "JSType", "constraint", ")", "{", "if", "(", "type", "==", "null", "||", "constraint", "==", "null", ")", "{", "return", ";", "}", "type", ".", "matchConstraint", ...
Suppose X is an object with inferred properties. Suppose also that X is used in a way where it would only type-check correctly if some of those properties are widened. Then we should be polite and automatically widen X's properties. For a concrete example, consider: param x {{prop: (number|undefined)}} function f(x) {...
[ "Suppose", "X", "is", "an", "object", "with", "inferred", "properties", ".", "Suppose", "also", "that", "X", "is", "used", "in", "a", "way", "where", "it", "would", "only", "type", "-", "check", "correctly", "if", "some", "of", "those", "properties", "ar...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L2173-L2180
24,578
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.tightenTypeAfterDereference
private FlowScope tightenTypeAfterDereference(Node n, FlowScope scope) { if (n.isQualifiedName()) { JSType type = getJSType(n); JSType narrowed = type.restrictByNotNullOrUndefined(); if (!type.equals(narrowed)) { scope = narrowScope(scope, n, narrowed); } } return scope; }
java
private FlowScope tightenTypeAfterDereference(Node n, FlowScope scope) { if (n.isQualifiedName()) { JSType type = getJSType(n); JSType narrowed = type.restrictByNotNullOrUndefined(); if (!type.equals(narrowed)) { scope = narrowScope(scope, n, narrowed); } } return scope; }
[ "private", "FlowScope", "tightenTypeAfterDereference", "(", "Node", "n", ",", "FlowScope", "scope", ")", "{", "if", "(", "n", ".", "isQualifiedName", "(", ")", ")", "{", "JSType", "type", "=", "getJSType", "(", "n", ")", ";", "JSType", "narrowed", "=", "...
If we access a property of a symbol, then that symbol is not null or undefined.
[ "If", "we", "access", "a", "property", "of", "a", "symbol", "then", "that", "symbol", "is", "not", "null", "or", "undefined", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L2186-L2195
24,579
google/closure-compiler
src/com/google/javascript/jscomp/Es6RewriteModulesToCommonJsModules.java
Es6RewriteModulesToCommonJsModules.normalizePath
private static String normalizePath(String path) { int indexOfProtocol = path.indexOf("://"); if (indexOfProtocol > -1) { path = path.substring(indexOfProtocol + 3); int indexOfSlash = path.indexOf('/'); if (indexOfSlash > -1) { path = path.substring(indexOfSlash + 1); } } el...
java
private static String normalizePath(String path) { int indexOfProtocol = path.indexOf("://"); if (indexOfProtocol > -1) { path = path.substring(indexOfProtocol + 3); int indexOfSlash = path.indexOf('/'); if (indexOfSlash > -1) { path = path.substring(indexOfSlash + 1); } } el...
[ "private", "static", "String", "normalizePath", "(", "String", "path", ")", "{", "int", "indexOfProtocol", "=", "path", ".", "indexOf", "(", "\"://\"", ")", ";", "if", "(", "indexOfProtocol", ">", "-", "1", ")", "{", "path", "=", "path", ".", "substring"...
Normalizes a registered or import path. <p>Absolute import paths need to match the registered path exactly. Some {@link ModuleLoader.ModulePath}s will have a leading slash and some won't. So in order to have everything line up AND preserve schemes (if they exist) then just strip leading /. <p>Additionally if any path...
[ "Normalizes", "a", "registered", "or", "import", "path", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteModulesToCommonJsModules.java#L102-L114
24,580
google/closure-compiler
src/com/google/javascript/refactoring/ApplySuggestedFixes.java
ApplySuggestedFixes.applySuggestedFixesToFiles
public static void applySuggestedFixesToFiles(Iterable<SuggestedFix> fixes) throws IOException { Set<String> filenames = new HashSet<>(); for (SuggestedFix fix : fixes) { filenames.addAll(fix.getReplacements().keySet()); } Map<String, String> filenameToCodeMap = new HashMap<>(); for (St...
java
public static void applySuggestedFixesToFiles(Iterable<SuggestedFix> fixes) throws IOException { Set<String> filenames = new HashSet<>(); for (SuggestedFix fix : fixes) { filenames.addAll(fix.getReplacements().keySet()); } Map<String, String> filenameToCodeMap = new HashMap<>(); for (St...
[ "public", "static", "void", "applySuggestedFixesToFiles", "(", "Iterable", "<", "SuggestedFix", ">", "fixes", ")", "throws", "IOException", "{", "Set", "<", "String", ">", "filenames", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "SuggestedFix", "...
Applies the provided set of suggested fixes to the files listed in the suggested fixes. The fixes can be provided in any order, but they may not have any overlapping modifications for the same file.
[ "Applies", "the", "provided", "set", "of", "suggested", "fixes", "to", "the", "files", "listed", "in", "the", "suggested", "fixes", ".", "The", "fixes", "can", "be", "provided", "in", "any", "order", "but", "they", "may", "not", "have", "any", "overlapping...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/ApplySuggestedFixes.java#L61-L77
24,581
google/closure-compiler
src/com/google/javascript/refactoring/ApplySuggestedFixes.java
ApplySuggestedFixes.applyCodeReplacements
public static String applyCodeReplacements(Iterable<CodeReplacement> replacements, String code) { List<CodeReplacement> sortedReplacements = ORDER_CODE_REPLACEMENTS.sortedCopy(replacements); validateNoOverlaps(sortedReplacements); StringBuilder sb = new StringBuilder(); int lastIndex = 0; for (Code...
java
public static String applyCodeReplacements(Iterable<CodeReplacement> replacements, String code) { List<CodeReplacement> sortedReplacements = ORDER_CODE_REPLACEMENTS.sortedCopy(replacements); validateNoOverlaps(sortedReplacements); StringBuilder sb = new StringBuilder(); int lastIndex = 0; for (Code...
[ "public", "static", "String", "applyCodeReplacements", "(", "Iterable", "<", "CodeReplacement", ">", "replacements", ",", "String", "code", ")", "{", "List", "<", "CodeReplacement", ">", "sortedReplacements", "=", "ORDER_CODE_REPLACEMENTS", ".", "sortedCopy", "(", "...
Applies the provided set of code replacements to the code and returns the transformed code. The code replacements may not have any overlap.
[ "Applies", "the", "provided", "set", "of", "code", "replacements", "to", "the", "code", "and", "returns", "the", "transformed", "code", ".", "The", "code", "replacements", "may", "not", "have", "any", "overlap", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/ApplySuggestedFixes.java#L146-L161
24,582
google/closure-compiler
src/com/google/javascript/refactoring/ApplySuggestedFixes.java
ApplySuggestedFixes.validateNoOverlaps
private static void validateNoOverlaps(List<CodeReplacement> replacements) { checkState(ORDER_CODE_REPLACEMENTS.isOrdered(replacements)); if (containsOverlaps(replacements)) { throw new IllegalArgumentException( "Found overlap between code replacements!\n" + Joiner.on("\n\n").join(replacements))...
java
private static void validateNoOverlaps(List<CodeReplacement> replacements) { checkState(ORDER_CODE_REPLACEMENTS.isOrdered(replacements)); if (containsOverlaps(replacements)) { throw new IllegalArgumentException( "Found overlap between code replacements!\n" + Joiner.on("\n\n").join(replacements))...
[ "private", "static", "void", "validateNoOverlaps", "(", "List", "<", "CodeReplacement", ">", "replacements", ")", "{", "checkState", "(", "ORDER_CODE_REPLACEMENTS", ".", "isOrdered", "(", "replacements", ")", ")", ";", "if", "(", "containsOverlaps", "(", "replacem...
Validates that none of the CodeReplacements have any overlap, since applying changes that have overlap will produce malformed results. The replacements must be provided in order sorted by start position, as sorted by ORDER_CODE_REPLACEMENTS.
[ "Validates", "that", "none", "of", "the", "CodeReplacements", "have", "any", "overlap", "since", "applying", "changes", "that", "have", "overlap", "will", "produce", "malformed", "results", ".", "The", "replacements", "must", "be", "provided", "in", "order", "so...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/ApplySuggestedFixes.java#L169-L175
24,583
google/closure-compiler
src/com/google/javascript/refactoring/ApplySuggestedFixes.java
ApplySuggestedFixes.containsOverlaps
private static boolean containsOverlaps(List<CodeReplacement> replacements) { checkState(ORDER_CODE_REPLACEMENTS.isOrdered(replacements)); int start = -1; for (CodeReplacement replacement : replacements) { if (replacement.getStartPosition() < start) { return true; } start = Math.ma...
java
private static boolean containsOverlaps(List<CodeReplacement> replacements) { checkState(ORDER_CODE_REPLACEMENTS.isOrdered(replacements)); int start = -1; for (CodeReplacement replacement : replacements) { if (replacement.getStartPosition() < start) { return true; } start = Math.ma...
[ "private", "static", "boolean", "containsOverlaps", "(", "List", "<", "CodeReplacement", ">", "replacements", ")", "{", "checkState", "(", "ORDER_CODE_REPLACEMENTS", ".", "isOrdered", "(", "replacements", ")", ")", ";", "int", "start", "=", "-", "1", ";", "for...
Checks whether the CodeReplacements have any overlap. The replacements must be provided in order sorted by start position, as sorted by ORDER_CODE_REPLACEMENTS.
[ "Checks", "whether", "the", "CodeReplacements", "have", "any", "overlap", ".", "The", "replacements", "must", "be", "provided", "in", "order", "sorted", "by", "start", "position", "as", "sorted", "by", "ORDER_CODE_REPLACEMENTS", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/ApplySuggestedFixes.java#L181-L191
24,584
google/closure-compiler
src/com/google/javascript/jscomp/ClosureRewriteModule.java
ClosureRewriteModule.rewriteJsdoc
private void rewriteJsdoc(JSDocInfo info) { for (Node typeNode : info.getTypeNodes()) { NodeUtil.visitPreOrder(typeNode, replaceJsDocRefs); } }
java
private void rewriteJsdoc(JSDocInfo info) { for (Node typeNode : info.getTypeNodes()) { NodeUtil.visitPreOrder(typeNode, replaceJsDocRefs); } }
[ "private", "void", "rewriteJsdoc", "(", "JSDocInfo", "info", ")", "{", "for", "(", "Node", "typeNode", ":", "info", ".", "getTypeNodes", "(", ")", ")", "{", "NodeUtil", ".", "visitPreOrder", "(", "typeNode", ",", "replaceJsDocRefs", ")", ";", "}", "}" ]
Rewrites JsDoc type references to match AST changes resulting from imported alias inlining, module content renaming of top level constructor functions and classes, and module renaming from fully qualified legacy namespace to its binary name.
[ "Rewrites", "JsDoc", "type", "references", "to", "match", "AST", "changes", "resulting", "from", "imported", "alias", "inlining", "module", "content", "renaming", "of", "top", "level", "constructor", "functions", "and", "classes", "and", "module", "renaming", "fro...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureRewriteModule.java#L514-L518
24,585
google/closure-compiler
src/com/google/javascript/jscomp/ClosureRewriteModule.java
ClosureRewriteModule.pushScript
private void pushScript(ScriptDescription newCurrentScript) { currentScript = newCurrentScript; if (!scriptStack.isEmpty()) { ScriptDescription parentScript = scriptStack.peek(); parentScript.addChildScript(currentScript); } scriptStack.addFirst(currentScript); }
java
private void pushScript(ScriptDescription newCurrentScript) { currentScript = newCurrentScript; if (!scriptStack.isEmpty()) { ScriptDescription parentScript = scriptStack.peek(); parentScript.addChildScript(currentScript); } scriptStack.addFirst(currentScript); }
[ "private", "void", "pushScript", "(", "ScriptDescription", "newCurrentScript", ")", "{", "currentScript", "=", "newCurrentScript", ";", "if", "(", "!", "scriptStack", ".", "isEmpty", "(", ")", ")", "{", "ScriptDescription", "parentScript", "=", "scriptStack", ".",...
Record the provided script as the current script at top of the script stack and add it as a child of the previous current script if there was one. <p>Keeping track of the current script facilitates aggregation of accurate script state so that rewriting can run properly. Handles scripts and nested goog.modules.
[ "Record", "the", "provided", "script", "as", "the", "current", "script", "at", "top", "of", "the", "script", "stack", "and", "add", "it", "as", "a", "child", "of", "the", "previous", "current", "script", "if", "there", "was", "one", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureRewriteModule.java#L1480-L1487
24,586
google/closure-compiler
src/com/google/javascript/jscomp/ClosureRewriteModule.java
ClosureRewriteModule.reportUnrecognizedRequires
private void reportUnrecognizedRequires() { for (UnrecognizedRequire unrecognizedRequire : unrecognizedRequires) { String legacyNamespace = unrecognizedRequire.legacyNamespace; Node requireNode = unrecognizedRequire.requireNode; boolean targetGoogModuleExists = rewriteState.containsModule(legacyN...
java
private void reportUnrecognizedRequires() { for (UnrecognizedRequire unrecognizedRequire : unrecognizedRequires) { String legacyNamespace = unrecognizedRequire.legacyNamespace; Node requireNode = unrecognizedRequire.requireNode; boolean targetGoogModuleExists = rewriteState.containsModule(legacyN...
[ "private", "void", "reportUnrecognizedRequires", "(", ")", "{", "for", "(", "UnrecognizedRequire", "unrecognizedRequire", ":", "unrecognizedRequires", ")", "{", "String", "legacyNamespace", "=", "unrecognizedRequire", ".", "legacyNamespace", ";", "Node", "requireNode", ...
Examines queue'ed unrecognizedRequires to categorize and report them as either missing module, missing namespace or late provide.
[ "Examines", "queue", "ed", "unrecognizedRequires", "to", "categorize", "and", "report", "them", "as", "either", "missing", "module", "missing", "namespace", "or", "late", "provide", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureRewriteModule.java#L1586-L1626
24,587
google/closure-compiler
src/com/google/javascript/jscomp/ClosureRewriteModule.java
ClosureRewriteModule.replaceStringNodeLocationForExportedTopLevelVariable
private void replaceStringNodeLocationForExportedTopLevelVariable( Node n, int sourcePosition, int length) { if (n.hasOneChild()) { Node assign = n.getFirstChild(); if (assign != null && assign.isAssign()) { // ASSIGN always has two children. Node getProp = assign.getFirstChild(); ...
java
private void replaceStringNodeLocationForExportedTopLevelVariable( Node n, int sourcePosition, int length) { if (n.hasOneChild()) { Node assign = n.getFirstChild(); if (assign != null && assign.isAssign()) { // ASSIGN always has two children. Node getProp = assign.getFirstChild(); ...
[ "private", "void", "replaceStringNodeLocationForExportedTopLevelVariable", "(", "Node", "n", ",", "int", "sourcePosition", ",", "int", "length", ")", "{", "if", "(", "n", ".", "hasOneChild", "(", ")", ")", "{", "Node", "assign", "=", "n", ".", "getFirstChild",...
If we had something like const FOO = "text" and we export FOO, change the source location information for the rewritten FOO. The replacement should be something like MOD.FOO = "text", so we look for MOD.FOO and replace the source location for FOO to the original location of FOO. @param n node tree to modify @param sou...
[ "If", "we", "had", "something", "like", "const", "FOO", "=", "text", "and", "we", "export", "FOO", "change", "the", "source", "location", "information", "for", "the", "rewritten", "FOO", ".", "The", "replacement", "should", "be", "something", "like", "MOD", ...
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ClosureRewriteModule.java#L1732-L1749
24,588
google/closure-compiler
src/com/google/javascript/rhino/NominalTypeBuilder.java
NominalTypeBuilder.declarePrototypeProperty
public void declarePrototypeProperty(String name, JSType type, Node defSite) { prototype.defineDeclaredProperty(name, type, defSite); }
java
public void declarePrototypeProperty(String name, JSType type, Node defSite) { prototype.defineDeclaredProperty(name, type, defSite); }
[ "public", "void", "declarePrototypeProperty", "(", "String", "name", ",", "JSType", "type", ",", "Node", "defSite", ")", "{", "prototype", ".", "defineDeclaredProperty", "(", "name", ",", "type", ",", "defSite", ")", ";", "}" ]
Declares a property on the nominal type's prototype.
[ "Declares", "a", "property", "on", "the", "nominal", "type", "s", "prototype", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/NominalTypeBuilder.java#L70-L72
24,589
google/closure-compiler
src/com/google/javascript/rhino/NominalTypeBuilder.java
NominalTypeBuilder.declareInstanceProperty
public void declareInstanceProperty(String name, JSType type, Node defSite) { instance.defineDeclaredProperty(name, type, defSite); }
java
public void declareInstanceProperty(String name, JSType type, Node defSite) { instance.defineDeclaredProperty(name, type, defSite); }
[ "public", "void", "declareInstanceProperty", "(", "String", "name", ",", "JSType", "type", ",", "Node", "defSite", ")", "{", "instance", ".", "defineDeclaredProperty", "(", "name", ",", "type", ",", "defSite", ")", ";", "}" ]
Declares an instance property on the nominal type.
[ "Declares", "an", "instance", "property", "on", "the", "nominal", "type", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/NominalTypeBuilder.java#L75-L77
24,590
google/closure-compiler
src/com/google/javascript/rhino/NominalTypeBuilder.java
NominalTypeBuilder.declareConstructorProperty
public void declareConstructorProperty(String name, JSType type, Node defSite) { constructor.defineDeclaredProperty(name, type, defSite); }
java
public void declareConstructorProperty(String name, JSType type, Node defSite) { constructor.defineDeclaredProperty(name, type, defSite); }
[ "public", "void", "declareConstructorProperty", "(", "String", "name", ",", "JSType", "type", ",", "Node", "defSite", ")", "{", "constructor", ".", "defineDeclaredProperty", "(", "name", ",", "type", ",", "defSite", ")", ";", "}" ]
Declares a static property on the nominal type's constructor.
[ "Declares", "a", "static", "property", "on", "the", "nominal", "type", "s", "constructor", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/NominalTypeBuilder.java#L80-L82
24,591
google/closure-compiler
src/com/google/javascript/rhino/NominalTypeBuilder.java
NominalTypeBuilder.superClass
public NominalTypeBuilder superClass() { FunctionType ctor = instance.getSuperClassConstructor(); if (ctor == null) { return null; } return new NominalTypeBuilder(ctor, ctor.getInstanceType()); }
java
public NominalTypeBuilder superClass() { FunctionType ctor = instance.getSuperClassConstructor(); if (ctor == null) { return null; } return new NominalTypeBuilder(ctor, ctor.getInstanceType()); }
[ "public", "NominalTypeBuilder", "superClass", "(", ")", "{", "FunctionType", "ctor", "=", "instance", ".", "getSuperClassConstructor", "(", ")", ";", "if", "(", "ctor", "==", "null", ")", "{", "return", "null", ";", "}", "return", "new", "NominalTypeBuilder", ...
Returns a NominalTypeBuilder for this type's superclass.
[ "Returns", "a", "NominalTypeBuilder", "for", "this", "type", "s", "superclass", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/NominalTypeBuilder.java#L85-L91
24,592
google/closure-compiler
src/com/google/javascript/rhino/jstype/TemplateTypeMap.java
TemplateTypeMap.hasTemplateKey
@SuppressWarnings("ReferenceEquality") public boolean hasTemplateKey(TemplateType templateKey) { // Note: match by identity, not equality for (TemplateType entry : templateKeys) { if (entry == templateKey) { return true; } } return false; }
java
@SuppressWarnings("ReferenceEquality") public boolean hasTemplateKey(TemplateType templateKey) { // Note: match by identity, not equality for (TemplateType entry : templateKeys) { if (entry == templateKey) { return true; } } return false; }
[ "@", "SuppressWarnings", "(", "\"ReferenceEquality\"", ")", "public", "boolean", "hasTemplateKey", "(", "TemplateType", "templateKey", ")", "{", "// Note: match by identity, not equality", "for", "(", "TemplateType", "entry", ":", "templateKeys", ")", "{", "if", "(", ...
Returns true if this map contains the specified template key, false otherwise.
[ "Returns", "true", "if", "this", "map", "contains", "the", "specified", "template", "key", "false", "otherwise", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMap.java#L124-L133
24,593
google/closure-compiler
src/com/google/javascript/rhino/jstype/TemplateTypeMap.java
TemplateTypeMap.getTemplateTypeIndex
private int getTemplateTypeIndex(TemplateType key) { int maxIndex = Math.min(templateKeys.size(), templateValues.size()); for (int i = maxIndex - 1; i >= 0; i--) { if (isSameKey(templateKeys.get(i), key)) { return i; } } return -1; }
java
private int getTemplateTypeIndex(TemplateType key) { int maxIndex = Math.min(templateKeys.size(), templateValues.size()); for (int i = maxIndex - 1; i >= 0; i--) { if (isSameKey(templateKeys.get(i), key)) { return i; } } return -1; }
[ "private", "int", "getTemplateTypeIndex", "(", "TemplateType", "key", ")", "{", "int", "maxIndex", "=", "Math", ".", "min", "(", "templateKeys", ".", "size", "(", ")", ",", "templateValues", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=",...
Returns the index of the JSType value associated with the specified template key. If no JSType value is associated, returns -1.
[ "Returns", "the", "index", "of", "the", "JSType", "value", "associated", "with", "the", "specified", "template", "key", ".", "If", "no", "JSType", "value", "is", "associated", "returns", "-", "1", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMap.java#L187-L195
24,594
google/closure-compiler
src/com/google/javascript/rhino/jstype/TemplateTypeMap.java
TemplateTypeMap.getResolvedTemplateType
public JSType getResolvedTemplateType(TemplateType key) { int index = getTemplateTypeIndex(key); return (index == -1) ? registry.getNativeType(JSTypeNative.UNKNOWN_TYPE) : resolvedTemplateValues[index]; }
java
public JSType getResolvedTemplateType(TemplateType key) { int index = getTemplateTypeIndex(key); return (index == -1) ? registry.getNativeType(JSTypeNative.UNKNOWN_TYPE) : resolvedTemplateValues[index]; }
[ "public", "JSType", "getResolvedTemplateType", "(", "TemplateType", "key", ")", "{", "int", "index", "=", "getTemplateTypeIndex", "(", "key", ")", ";", "return", "(", "index", "==", "-", "1", ")", "?", "registry", ".", "getNativeType", "(", "JSTypeNative", "...
Returns the JSType value associated with the specified template key. If no JSType value is associated, returns UNKNOWN_TYPE.
[ "Returns", "the", "JSType", "value", "associated", "with", "the", "specified", "template", "key", ".", "If", "no", "JSType", "value", "is", "associated", "returns", "UNKNOWN_TYPE", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMap.java#L201-L206
24,595
google/closure-compiler
src/com/google/javascript/rhino/jstype/TemplateTypeMap.java
TemplateTypeMap.checkEquivalenceHelper
public boolean checkEquivalenceHelper( TemplateTypeMap that, EquivalenceMethod eqMethod, SubtypingMode subtypingMode) { return checkEquivalenceHelper(that, eqMethod, EqCache.create(), subtypingMode); }
java
public boolean checkEquivalenceHelper( TemplateTypeMap that, EquivalenceMethod eqMethod, SubtypingMode subtypingMode) { return checkEquivalenceHelper(that, eqMethod, EqCache.create(), subtypingMode); }
[ "public", "boolean", "checkEquivalenceHelper", "(", "TemplateTypeMap", "that", ",", "EquivalenceMethod", "eqMethod", ",", "SubtypingMode", "subtypingMode", ")", "{", "return", "checkEquivalenceHelper", "(", "that", ",", "eqMethod", ",", "EqCache", ".", "create", "(", ...
Determines if this map and the specified map have equivalent template types.
[ "Determines", "if", "this", "map", "and", "the", "specified", "map", "have", "equivalent", "template", "types", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMap.java#L220-L223
24,596
google/closure-compiler
src/com/google/javascript/rhino/jstype/TemplateTypeMap.java
TemplateTypeMap.failedEquivalenceCheck
private static boolean failedEquivalenceCheck( EquivalenceMatch eqMatch, EquivalenceMethod eqMethod) { return eqMatch == EquivalenceMatch.VALUE_MISMATCH || (eqMatch == EquivalenceMatch.NO_KEY_MATCH && eqMethod != EquivalenceMethod.INVARIANT); }
java
private static boolean failedEquivalenceCheck( EquivalenceMatch eqMatch, EquivalenceMethod eqMethod) { return eqMatch == EquivalenceMatch.VALUE_MISMATCH || (eqMatch == EquivalenceMatch.NO_KEY_MATCH && eqMethod != EquivalenceMethod.INVARIANT); }
[ "private", "static", "boolean", "failedEquivalenceCheck", "(", "EquivalenceMatch", "eqMatch", ",", "EquivalenceMethod", "eqMethod", ")", "{", "return", "eqMatch", "==", "EquivalenceMatch", ".", "VALUE_MISMATCH", "||", "(", "eqMatch", "==", "EquivalenceMatch", ".", "NO...
Determines if the specified EquivalenceMatch is considered a failing condition for an equivalence check, given the EquivalenceMethod used for the check.
[ "Determines", "if", "the", "specified", "EquivalenceMatch", "is", "considered", "a", "failing", "condition", "for", "an", "equivalence", "check", "given", "the", "EquivalenceMethod", "used", "for", "the", "check", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMap.java#L289-L293
24,597
google/closure-compiler
src/com/google/javascript/rhino/jstype/TemplateTypeMap.java
TemplateTypeMap.extend
TemplateTypeMap extend(TemplateTypeMap other) { ImmutableList<JSType> resizedOtherValues = other.resizedToMatchKeys(other.templateValues); return registry.createTemplateTypeMap( concatImmutableLists(other.templateKeys, templateKeys), concatImmutableLists(resizedOtherValues, templateValues)); }
java
TemplateTypeMap extend(TemplateTypeMap other) { ImmutableList<JSType> resizedOtherValues = other.resizedToMatchKeys(other.templateValues); return registry.createTemplateTypeMap( concatImmutableLists(other.templateKeys, templateKeys), concatImmutableLists(resizedOtherValues, templateValues)); }
[ "TemplateTypeMap", "extend", "(", "TemplateTypeMap", "other", ")", "{", "ImmutableList", "<", "JSType", ">", "resizedOtherValues", "=", "other", ".", "resizedToMatchKeys", "(", "other", ".", "templateValues", ")", ";", "return", "registry", ".", "createTemplateTypeM...
Extends this TemplateTypeMap with the contents of the specified map. UNKNOWN_TYPE will be used as the value for any missing values in the specified map.
[ "Extends", "this", "TemplateTypeMap", "with", "the", "contents", "of", "the", "specified", "map", ".", "UNKNOWN_TYPE", "will", "be", "used", "as", "the", "value", "for", "any", "missing", "values", "in", "the", "specified", "map", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMap.java#L299-L304
24,598
google/closure-compiler
src/com/google/javascript/rhino/jstype/TemplateTypeMap.java
TemplateTypeMap.copyFilledWithValues
TemplateTypeMap copyFilledWithValues(ImmutableList<JSType> additionalValues) { ImmutableList<JSType> finalValues = resizedToMatchKeys(concatImmutableLists(templateValues, additionalValues)); return registry.createTemplateTypeMap(templateKeys, finalValues); }
java
TemplateTypeMap copyFilledWithValues(ImmutableList<JSType> additionalValues) { ImmutableList<JSType> finalValues = resizedToMatchKeys(concatImmutableLists(templateValues, additionalValues)); return registry.createTemplateTypeMap(templateKeys, finalValues); }
[ "TemplateTypeMap", "copyFilledWithValues", "(", "ImmutableList", "<", "JSType", ">", "additionalValues", ")", "{", "ImmutableList", "<", "JSType", ">", "finalValues", "=", "resizedToMatchKeys", "(", "concatImmutableLists", "(", "templateValues", ",", "additionalValues", ...
Returns a new TemplateTypeMap whose values have been extended with the specified list.
[ "Returns", "a", "new", "TemplateTypeMap", "whose", "values", "have", "been", "extended", "with", "the", "specified", "list", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMap.java#L307-L311
24,599
google/closure-compiler
src/com/google/javascript/rhino/jstype/TemplateTypeMap.java
TemplateTypeMap.remove
TemplateTypeMap remove(Set<TemplateType> toRemove) { ImmutableList.Builder<TemplateType> keys = ImmutableList.builder(); keys.addAll(templateKeys.subList(0, templateValues.size())); for (int i = templateValues.size(); i < templateKeys.size(); i++) { TemplateType key = templateKeys.get(i); if (!t...
java
TemplateTypeMap remove(Set<TemplateType> toRemove) { ImmutableList.Builder<TemplateType> keys = ImmutableList.builder(); keys.addAll(templateKeys.subList(0, templateValues.size())); for (int i = templateValues.size(); i < templateKeys.size(); i++) { TemplateType key = templateKeys.get(i); if (!t...
[ "TemplateTypeMap", "remove", "(", "Set", "<", "TemplateType", ">", "toRemove", ")", "{", "ImmutableList", ".", "Builder", "<", "TemplateType", ">", "keys", "=", "ImmutableList", ".", "builder", "(", ")", ";", "keys", ".", "addAll", "(", "templateKeys", ".", ...
Returns a new TemplateTypeMap with the given template types removed. Keys will only be removed if they are unmapped.
[ "Returns", "a", "new", "TemplateTypeMap", "with", "the", "given", "template", "types", "removed", ".", "Keys", "will", "only", "be", "removed", "if", "they", "are", "unmapped", "." ]
d81e36740f6a9e8ac31a825ee8758182e1dc5aae
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMap.java#L317-L327