id
int64
1
889
project_id
stringclasses
17 values
bug_id
stringclasses
163 values
class
dict
method
dict
tests
listlengths
1
84
101
Closure
31
{ "fields": [ { "modifier": "", "original_string": "static final String SINGLETON_MODULE_NAME = \"[singleton]\";", "type": "String", "var_name": "SINGLETON_MODULE_NAME" }, { "modifier": "", "original_string": "static final DiagnosticType MODULE_DEPENDENCY_ERROR =\n ...
{ "body": "Node parseInputs() {\n boolean devMode = options.devMode != DevMode.OFF;\n\n // If old roots exist (we are parsing a second time), detach each of the\n // individual file parse trees.\n if (externsRoot != null) {\n externsRoot.detachChildren();\n }\n if (jsRoot != null) {\n jsRo...
[ { "covered_lines": 35, "line_coverage": 0.4217, "name": "com.google.javascript.jscomp.CommandLineRunnerTest::testDependencySortingWhitespaceMode", "total_lines": 83 } ]
102
Closure
32
{ "fields": [ { "modifier": "", "original_string": "private final JsDocTokenStream stream;", "type": "JsDocTokenStream", "var_name": "stream" }, { "modifier": "", "original_string": "private final JSDocInfoBuilder jsdocBuilder;", "type": "JSDocInfoBuilder", ...
{ "body": "@SuppressWarnings(\"fallthrough\")\n private ExtractionInfo extractMultilineTextualBlock(JsDocToken token,\n WhitespaceOption option) {\n\n if (token == JsDocToken.EOC || token == JsDocToken.EOL ||\n token == JsDocToken.EOF) {\n return ne...
[ { "covered_lines": 35, "line_coverage": 0.7778, "name": "com.google.javascript.jscomp.IntegrationTest::testIssue701", "total_lines": 45 }, { "covered_lines": 35, "line_coverage": 0.7778, "name": "com.google.javascript.jscomp.parsing.JsDocInfoParserTest::testParseLicense", "total_...
103
Closure
33
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final String className;", "type": "String", "var_name": "cl...
{ "body": "@Override\n public void matchConstraint(ObjectType constraintObj) {\n // We only want to match contraints on anonymous types.\n if (hasReferenceName()) {\n return;\n }\n\n // Handle the case where the constraint object is a record type.\n //\n // param constraintObj {{prop: (number|...
[ { "covered_lines": 11, "line_coverage": 1, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue700", "total_lines": 11 } ]
104
Closure
35
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType TEMPLATE_TYPE_NOT_OBJECT_TYPE =\n DiagnosticType.warning(\n \"JSC_TEMPLATE_TYPE_NOT_OBJECT_TYPE\",\n \"The template type must be an object type.\\nActual: {0}\");", "type": "DiagnosticType", "var...
{ "body": "private void inferPropertyTypesToMatchConstraint(\n JSType type, JSType constraint) {\n if (type == null || constraint == null) {\n return;\n }\n\n ObjectType constraintObj =\n ObjectType.cast(constraint.restrictByNotNullOrUndefined());\n if (constraintObj != null) {\n typ...
[ { "covered_lines": 7, "line_coverage": 0.4118, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue669", "total_lines": 17 } ]
105
Closure
37
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private final Callback callback;", "type": "Callback", "var_name": "cal...
{ "body": "private void traverseFunction(Node n, Node parent) {\n Preconditions.checkState(n.getChildCount() == 3);\n Preconditions.checkState(n.isFunction());\n\n final Node fnName = n.getFirstChild();\n\n boolean isFunctionExpression = (parent != null)\n && NodeUtil.isFunctionExpression(n);\n\n ...
[ { "covered_lines": 19, "line_coverage": 1, "name": "com.google.javascript.jscomp.IntegrationTest::testIncompleteFunction", "total_lines": 19 } ]
106
Closure
38
{ "fields": [ { "modifier": "", "original_string": "boolean statementNeedsEnded = false;", "type": "boolean", "var_name": "statementNeedsEnded" }, { "modifier": "", "original_string": "boolean statementStarted = false;", "type": "boolean", "var_name": "state...
{ "body": "void addNumber(double x) {\n // This is not pretty printing. This is to prevent misparsing of x- -4 as\n // x--4 (which is a syntax error).\n char prev = getLastChar();\n boolean negativeZero = isNegativeZero(x);\n if ((x < 0 || negativeZero) && prev == '-') {\n add(\" \");\n }\n\n ...
[ { "covered_lines": 6, "line_coverage": 0.3333, "name": "com.google.javascript.jscomp.CodePrinterTest::testMinusNegativeZero", "total_lines": 18 } ]
107
Closure
39
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final String className;", "type": "String", "var_name": "cl...
{ "body": "@Override\n String toStringHelper(boolean forAnnotations) {\n if (hasReferenceName()) {\n return getReferenceName();\n } else if (prettyPrint) {\n // Don't pretty print recursively.\n prettyPrint = false;\n\n // Use a tree set so that the properties are sorted.\n Set<String>...
[ { "covered_lines": 25, "line_coverage": 0.8929, "name": "com.google.javascript.rhino.jstype.RecordTypeTest::testRecursiveRecord", "total_lines": 28 }, { "covered_lines": 26, "line_coverage": 0.9286, "name": "com.google.javascript.rhino.jstype.RecordTypeTest::testLongToString", "t...
108
Closure
41
{ "fields": [ { "modifier": "", "original_string": "private final String fnName;", "type": "String", "var_name": "fnName" }, { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" ...
{ "body": "FunctionTypeBuilder inferFromOverriddenFunction(\n @Nullable FunctionType oldType, @Nullable Node paramsParent) {\n if (oldType == null) {\n return this;\n }\n\n returnType = oldType.getReturnType();\n returnTypeInferred = oldType.isReturnTypeInferred();\n if (paramsParent == null)...
[ { "covered_lines": 20, "line_coverage": 0.6667, "name": "com.google.javascript.jscomp.LooseTypeCheckTest::testMethodInference6", "total_lines": 30 }, { "covered_lines": 21, "line_coverage": 0.7, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue368", "total_lines": 30...
109
Closure
41
{ "fields": [ { "modifier": "", "original_string": "private final String fnName;", "type": "String", "var_name": "fnName" }, { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" ...
{ "body": "FunctionTypeBuilder inferParameterTypes(@Nullable Node argsParent,\n @Nullable JSDocInfo info) {\n if (argsParent == null) {\n if (info == null) {\n return this;\n } else {\n return inferParameterTypes(info);\n }\n }\n\n // arguments\n Node oldParameterType = n...
[ { "covered_lines": 28, "line_coverage": 0.6222, "name": "com.google.javascript.jscomp.LooseTypeCheckTest::testMethodInference6", "total_lines": 45 }, { "covered_lines": 33, "line_coverage": 0.7333, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue368", "total_lines":...
110
Closure
44
{ "fields": [ { "modifier": "", "original_string": "boolean statementNeedsEnded = false;", "type": "boolean", "var_name": "statementNeedsEnded" }, { "modifier": "", "original_string": "boolean statementStarted = false;", "type": "boolean", "var_name": "state...
{ "body": "void add(String newcode) {\n maybeEndStatement();\n\n if (newcode.length() == 0) {\n return;\n }\n\n char c = newcode.charAt(0);\n if ((isWordChar(c) || c == '\\\\') &&\n isWordChar(getLastChar())) {\n // need space to separate. This is not pretty printing.\n // For exa...
[ { "covered_lines": 7, "line_coverage": 0.7778, "name": "com.google.javascript.jscomp.CodePrinterTest::testIssue620", "total_lines": 9 } ]
111
Closure
45
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private final CodingConvention codingConvention;", "type": "CodingConvention"...
{ "body": "private void interpretAssigns() {\n boolean changes = false;\n do {\n changes = false;\n\n // We can't use traditional iterators and iterables for this list,\n // because our lazily-evaluated continuations will modify it while\n // we traverse it.\n for (int current = 0; curr...
[ { "covered_lines": 21, "line_coverage": 0.7241, "name": "com.google.javascript.jscomp.RemoveUnusedVarsTest::testIssue618_1", "total_lines": 29 } ]
112
Closure
46
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final SortedMap<String, JSType> properties = Maps.newTreeMap();", ...
{ "body": "JSType getGreatestSubtypeHelper(JSType that) {\n if (that.isRecordType()) {\n RecordType thatRecord = that.toMaybeRecordType();\n RecordTypeBuilder builder = new RecordTypeBuilder(registry);\n\n // The greatest subtype consists of those *unique* properties of both\n // record types. ...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.rhino.jstype.JSTypeTest::testRecordTypeLeastSuperType2", "total_lines": 37 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.rhino.jstype.JSTypeTest::testRecordTypeLeastSuperType3", ...
113
Closure
47
{ "fields": [ { "modifier": "", "original_string": "private final SourceMapGenerator generator;", "type": "SourceMapGenerator", "var_name": "generator" }, { "modifier": "", "original_string": "private List<LocationMapping> prefixMappings = Collections.emptyList();", ...
{ "body": "public void addMapping(\n Node node,\n FilePosition outputStartPosition,\n FilePosition outputEndPosition) {\n String sourceFile = node.getSourceFileName();\n\n // If the node does not have an associated source file or\n // its line number is -1, then the node does not have sufficie...
[ { "covered_lines": 7, "line_coverage": 0.875, "name": "com.google.debugging.sourcemap.SourceMapGeneratorV3Test::testParseSourceMetaMap", "total_lines": 8 }, { "covered_lines": 7, "line_coverage": 0.875, "name": "com.google.debugging.sourcemap.SourceMapGeneratorV3Test::testGoldenOutpu...
114
Closure
47
{ "fields": [ { "modifier": "", "original_string": "static final int UNMAPPED = -1;", "type": "int", "var_name": "UNMAPPED" }, { "modifier": "", "original_string": "private String[] sources;", "type": "String[]", "var_name": "sources" }, { "mod...
{ "body": "private OriginalMapping getOriginalMappingForEntry(Entry entry) {\n if (entry.getSourceFileId() == UNMAPPED) {\n return null;\n } else {\n // Adjust the line/column here to be start at 1.\n Builder x = OriginalMapping.newBuilder()\n .setOriginalFile(sources[entry.getSourceFileId...
[ { "covered_lines": 8, "line_coverage": 0.8889, "name": "com.google.debugging.sourcemap.SourceMapGeneratorV3Test::testParseSourceMetaMap", "total_lines": 9 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.debugging.sourcemap.SourceMapGeneratorV3Test::testGoldenOutput0a...
115
Closure
49
{ "fields": [ { "modifier": "", "original_string": "public static final String ARGUMENTS = \"arguments\";", "type": "String", "var_name": "ARGUMENTS" }, { "modifier": "", "original_string": "private Deque<Renamer> nameStack = new ArrayDeque<Renamer>();", "type": "...
{ "body": "@Override\n public void enterScope(NodeTraversal t) {\n Node declarationRoot = t.getScopeRoot();\n Renamer renamer;\n if (nameStack.isEmpty()) {\n // If the contextual renamer is being used the starting context can not\n // be a function.\n Preconditions.checkState(\n decl...
[ { "covered_lines": 18, "line_coverage": 1, "name": "com.google.javascript.jscomp.FunctionInjectorTest::testInline19b", "total_lines": 18 }, { "covered_lines": 18, "line_coverage": 1, "name": "com.google.javascript.jscomp.FunctionInjectorTest::testInlineIntoLoop", "total_lines": 1...
116
Closure
49
{ "fields": [ { "modifier": "", "original_string": "public static final String ARGUMENTS = \"arguments\";", "type": "String", "var_name": "ARGUMENTS" }, { "modifier": "", "original_string": "private Deque<Renamer> nameStack = new ArrayDeque<Renamer>();", "type": "...
{ "body": "@Override\n public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {\n\n switch (n.getType()) {\n case Token.FUNCTION:\n {\n // Add recursive function name, if needed.\n // NOTE: \"enterScope\" is called after we need to pick up this name.\n Renamer r...
[ { "covered_lines": 8, "line_coverage": 0.6154, "name": "com.google.javascript.jscomp.FunctionInjectorTest::testInline19b", "total_lines": 13 }, { "covered_lines": 8, "line_coverage": 0.6154, "name": "com.google.javascript.jscomp.FunctionInjectorTest::testInlineIntoLoop", "total_l...
117
Closure
49
{ "fields": [ { "modifier": "", "original_string": "public static final String ARGUMENTS = \"arguments\";", "type": "String", "var_name": "ARGUMENTS" }, { "modifier": "", "original_string": "private Deque<Renamer> nameStack = new ArrayDeque<Renamer>();", "type": "...
{ "body": "@Override\n public void visit(NodeTraversal t, Node n, Node parent) {\n switch (n.getType()) {\n case Token.NAME:\n String newName = getReplacementName(n.getString());\n if (newName != null) {\n Renamer renamer = nameStack.peek();\n if (renamer.stripConstIfReplaced(...
[ { "covered_lines": 11, "line_coverage": 0.8462, "name": "com.google.javascript.jscomp.FunctionInjectorTest::testInline19b", "total_lines": 13 }, { "covered_lines": 12, "line_coverage": 0.9231, "name": "com.google.javascript.jscomp.FunctionInjectorTest::testInlineIntoLoop", "total...
118
Closure
50
{ "fields": [ { "modifier": "", "original_string": "private static final Locale ROOT_LOCALE = new Locale(\"\");", "type": "Locale", "var_name": "ROOT_LOCALE" } ], "file": "src/com/google/javascript/jscomp/PeepholeReplaceKnownMethods.java", "identifier": "PeepholeReplaceKnownMetho...
{ "body": "private Node tryFoldArrayJoin(Node n) {\n Node callTarget = n.getFirstChild();\n\n if (callTarget == null || !NodeUtil.isGetProp(callTarget)) {\n return n;\n }\n\n Node right = callTarget.getNext();\n if (right != null) {\n if (right.getNext() != null || !NodeUtil.isImmutableValue(...
[ { "covered_lines": 62, "line_coverage": 0.8857, "name": "com.google.javascript.jscomp.PeepholeReplaceKnownMethodsTest::testStringJoinAdd", "total_lines": 70 }, { "covered_lines": 24, "line_coverage": 0.3429, "name": "com.google.javascript.jscomp.PeepholeReplaceKnownMethodsTest::testN...
119
Closure
51
{ "fields": [ { "modifier": "", "original_string": "boolean statementNeedsEnded = false;", "type": "boolean", "var_name": "statementNeedsEnded" }, { "modifier": "", "original_string": "boolean statementStarted = false;", "type": "boolean", "var_name": "state...
{ "body": "void addNumber(double x) {\n // This is not pretty printing. This is to prevent misparsing of x- -4 as\n // x--4 (which is a syntax error).\n char prev = getLastChar();\n if (x < 0 && prev == '-') {\n add(\" \");\n }\n\n if ((long) x == x && !isNegativeZero(x)) {\n long value = ...
[ { "covered_lines": 11, "line_coverage": 0.6471, "name": "com.google.javascript.jscomp.CodePrinterTest::testIssue582", "total_lines": 17 } ]
120
Closure
52
{ "fields": [ { "modifier": "", "original_string": "private final Map<String, String> ESCAPED_JS_STRINGS = Maps.newHashMap();", "type": "Map<String, String>", "var_name": "ESCAPED_JS_STRINGS" }, { "modifier": "", "original_string": "private static final char[] HEX_CHARS...
{ "body": "static boolean isSimpleNumber(String s) {\n int len = s.length();\n for (int index = 0; index < len; index++) {\n char c = s.charAt(index);\n if (c < '0' || c > '9') {\n return false;\n }\n }\n return len > 0 && s.charAt(0) != '0';\n }", "class_method_signature": "CodeG...
[ { "covered_lines": 5, "line_coverage": 0.8333, "name": "com.google.javascript.jscomp.CodePrinterTest::testNumericKeys", "total_lines": 6 } ]
121
Closure
54
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private ArrowType call;", "type": "ArrowType", "var_name": "call" ...
{ "body": "public boolean setPrototype(PrototypeObjectType prototype) {\n if (prototype == null) {\n return false;\n }\n // getInstanceType fails if the function is not a constructor\n if (isConstructor() && prototype == getInstanceType()) {\n return false;\n }\n\n PrototypeObjectType oldP...
[ { "covered_lines": 14, "line_coverage": 0.7, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue537a", "total_lines": 20 }, { "covered_lines": 14, "line_coverage": 0.7, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue537b", "total_lines": 20 }, { ...
122
Closure
54
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private ArrowType call;", "type": "ArrowType", "var_name": "call" ...
{ "body": "public void setPrototypeBasedOn(ObjectType baseType) {\n // This is a bit weird. We need to successfully handle these\n // two cases:\n // Foo.prototype = new Bar();\n // and\n // Foo.prototype = {baz: 3};\n // In the first case, we do not want new properties to get\n // added to Bar. ...
[ { "covered_lines": 8, "line_coverage": 1, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue537a", "total_lines": 8 }, { "covered_lines": 8, "line_coverage": 1, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue537b", "total_lines": 8 }, { "covered...
123
Closure
55
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private static final int SAVINGS_THRESHOLD = 16;", "type": "int", "var_...
{ "body": "private static boolean isReduceableFunctionExpression(Node n) {\n return NodeUtil.isFunctionExpression(n)\n && !NodeUtil.isGetOrSetKey(n.getParent());\n }", "class_method_signature": "FunctionRewriter.isReduceableFunctionExpression(Node n)", "constructor": false, "full_signature": "private...
[ { "covered_lines": 1, "line_coverage": 1, "name": "com.google.javascript.jscomp.FunctionRewriterTest::testIssue538", "total_lines": 1 } ]
124
Closure
56
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static final int SOURCE_EXCERPT_REGION_LENGTH = 5;", "type": "int...
{ "body": "public String getLine(int lineNumber) {\n String js = \"\";\n try {\n // NOTE(nicksantos): Right now, this is optimized for few warnings.\n // This is probably the right trade-off, but will be slow if there\n // are lots of warnings in one file.\n js = getCode();\n } catch (IOE...
[ { "covered_lines": 17, "line_coverage": 0.85, "name": "com.google.javascript.jscomp.JSCompilerSourceExcerptProviderTest::testExceptNoNewLine", "total_lines": 20 }, { "covered_lines": 13, "line_coverage": 0.65, "name": "com.google.javascript.jscomp.JsMessageExtractorTest::testSyntaxEr...
125
Closure
57
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "static final DiagnosticType OBJECTLIT_EXPECTED = DiagnosticType.warning(\n ...
{ "body": "private static String extractClassNameIfGoog(Node node, Node parent,\n String functionName){\n String className = null;\n if (NodeUtil.isExprCall(parent)) {\n Node callee = node.getFirstChild();\n if (callee != null && callee.getType() == Token.GETPROP) {\n String qualifiedName ...
[ { "covered_lines": 10, "line_coverage": 1, "name": "com.google.javascript.jscomp.ClosureCodingConventionTest::testRequire", "total_lines": 10 } ]
126
Closure
58
{ "fields": [ { "modifier": "", "original_string": "public static final String ARGUMENT_ARRAY_ALIAS = \"arguments\";", "type": "String", "var_name": "ARGUMENT_ARRAY_ALIAS" }, { "modifier": "", "original_string": "private final Scope jsScope;", "type": "Scope", ...
{ "body": "private void computeGenKill(Node n, BitSet gen, BitSet kill,\n boolean conditional) {\n\n switch (n.getType()) {\n case Token.SCRIPT:\n case Token.BLOCK:\n case Token.FUNCTION:\n return;\n\n case Token.WHILE:\n case Token.DO:\n case Token.IF:\n computeGen...
[ { "covered_lines": 7, "line_coverage": 0.1667, "name": "com.google.javascript.jscomp.LiveVariableAnalysisTest::testExpressionInForIn", "total_lines": 42 } ]
127
Closure
59
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType MODULE_DEPENDENCY_ERROR =\n DiagnosticType.error(\"JSC_MODULE_DEPENDENCY_ERROR\",\n \"Bad dependency: {0} -> {1}. \"\n + \"Modules must be listed in dependency order.\");", "type": "Diagnos...
{ "body": "public void initOptions(CompilerOptions options) {\n this.options = options;\n if (errorManager == null) {\n if (outStream == null) {\n setErrorManager(\n new LoggerErrorManager(createMessageFormatter(), logger));\n } else {\n PrintStreamErrorManager printer =\n ...
[ { "covered_lines": 20, "line_coverage": 0.6667, "name": "com.google.javascript.jscomp.CommandLineRunnerTest::testCheckGlobalThisOff", "total_lines": 30 } ]
128
Closure
60
{ "fields": [ { "modifier": "", "original_string": "static final long MAX_POSITIVE_INTEGER_NUMBER = (long)Math.pow(2, 53);", "type": "long", "var_name": "MAX_POSITIVE_INTEGER_NUMBER" }, { "modifier": "", "original_string": "final static String JSC_PROPERTY_NAME_FN = \"J...
{ "body": "static TernaryValue getPureBooleanValue(Node n) {\n switch (n.getType()) {\n case Token.STRING:\n return TernaryValue.forBoolean(n.getString().length() > 0);\n\n case Token.NUMBER:\n return TernaryValue.forBoolean(n.getDouble() != 0);\n\n case Token.NOT:\n return getP...
[ { "covered_lines": 3, "line_coverage": 0.1875, "name": "com.google.javascript.jscomp.CommandLineRunnerTest::testIssue504", "total_lines": 16 }, { "covered_lines": 11, "line_coverage": 0.6875, "name": "com.google.javascript.jscomp.NodeUtilTest::testGetBooleanValue", "total_lines":...
129
Closure
61
{ "fields": [ { "modifier": "", "original_string": "static final long MAX_POSITIVE_INTEGER_NUMBER = (long)Math.pow(2, 53);", "type": "long", "var_name": "MAX_POSITIVE_INTEGER_NUMBER" }, { "modifier": "", "original_string": "final static String JSC_PROPERTY_NAME_FN = \"J...
{ "body": "static boolean functionCallHasSideEffects(\n Node callNode, @Nullable AbstractCompiler compiler) {\n if (callNode.getType() != Token.CALL) {\n throw new IllegalStateException(\n \"Expected CALL node, got \" + Token.name(callNode.getType()));\n }\n\n if (callNode.isNoSideEffectsC...
[ { "covered_lines": 8, "line_coverage": 0.2581, "name": "com.google.javascript.jscomp.PeepholeRemoveDeadCodeTest::testCall1", "total_lines": 31 }, { "covered_lines": 8, "line_coverage": 0.2581, "name": "com.google.javascript.jscomp.PeepholeRemoveDeadCodeTest::testCall2", "total_li...
130
Closure
62
{ "fields": [ { "modifier": "", "original_string": "private SourceExcerpt excerpt;", "type": "SourceExcerpt", "var_name": "excerpt" }, { "modifier": "", "original_string": "private static final ExcerptFormatter excerptFormatter =\n new LineNumberingFormatter();", ...
{ "body": "private String format(JSError error, boolean warning) {\n // extract source excerpt\n SourceExcerptProvider source = getSource();\n String sourceExcerpt = source == null ? null :\n excerpt.get(\n source, error.sourceName, error.lineNumber, excerptFormatter);\n\n // formatting ...
[ { "covered_lines": 21, "line_coverage": 0.7778, "name": "com.google.javascript.jscomp.LightweightMessageFormatterTest::testFormatErrorSpaceEndOfLine1", "total_lines": 27 }, { "covered_lines": 21, "line_coverage": 0.7778, "name": "com.google.javascript.jscomp.LightweightMessageFormatt...
131
Closure
65
{ "fields": [ { "modifier": "", "original_string": "private final Map<String, String> ESCAPED_JS_STRINGS = Maps.newHashMap();", "type": "Map<String, String>", "var_name": "ESCAPED_JS_STRINGS" }, { "modifier": "", "original_string": "private static final char[] HEX_CHARS...
{ "body": "static String strEscape(String s, char quote,\n String doublequoteEscape,\n String singlequoteEscape,\n String backslashEscape,\n CharsetEncoder outputCharsetEncoder) {\n StringBuilder sb = new StringBuil...
[ { "covered_lines": 8, "line_coverage": 0.2162, "name": "com.google.javascript.jscomp.CodePrinterTest::testZero", "total_lines": 37 } ]
132
Closure
66
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType UNEXPECTED_TOKEN = DiagnosticType.error(\n \"JSC_INTERNAL_ERROR_UNEXPECTED_TOKEN\",\n \"Internal Error: Don't know how to handle {0}\");", "type": "DiagnosticType", "var_name": "UNEXPECTED_TOKEN" ...
{ "body": "public void visit(NodeTraversal t, Node n, Node parent) {\n JSType childType;\n JSType leftType, rightType;\n Node left, right;\n // To be explicitly set to false if the node is not typeable.\n boolean typeable = true;\n\n switch (n.getType()) {\n case Token.NAME:\n typeable =...
[ { "covered_lines": 23, "line_coverage": 0.1377, "name": "com.google.javascript.jscomp.TypeCheckTest::testGetTypedPercent5", "total_lines": 167 }, { "covered_lines": 23, "line_coverage": 0.1377, "name": "com.google.javascript.jscomp.TypeCheckTest::testGetTypedPercent6", "total_lin...
133
Closure
68
{ "fields": [ { "modifier": "", "original_string": "private final JsDocTokenStream stream;", "type": "JsDocTokenStream", "var_name": "stream" }, { "modifier": "", "original_string": "private final JSDocInfoBuilder jsdocBuilder;", "type": "JSDocInfoBuilder", ...
{ "body": "boolean parse() {\n int lineno;\n int charno;\n\n // JSTypes are represented as Rhino AST nodes, and then resolved later.\n JSTypeExpression type;\n\n state = State.SEARCHING_ANNOTATION;\n skipEOLs();\n\n JsDocToken token = next();\n\n List<ExtendedTypeInfo> extendedTypes = Lists.ne...
[ { "covered_lines": 33, "line_coverage": 0.0797, "name": "com.google.javascript.jscomp.parsing.JsDocInfoParserTest::testIssue477", "total_lines": 414 } ]
134
Closure
68
{ "fields": [ { "modifier": "", "original_string": "private final JsDocTokenStream stream;", "type": "JsDocTokenStream", "var_name": "stream" }, { "modifier": "", "original_string": "private final JSDocInfoBuilder jsdocBuilder;", "type": "JSDocInfoBuilder", ...
{ "body": "private Node parseBasicTypeExpression(JsDocToken token) {\n if (token == JsDocToken.STAR) {\n return newNode(Token.STAR);\n } else if (token == JsDocToken.LB) {\n skipEOLs();\n return parseArrayType(next());\n } else if (token == JsDocToken.LC) {\n skipEOLs();\n return par...
[ { "covered_lines": 9, "line_coverage": 0.45, "name": "com.google.javascript.jscomp.parsing.JsDocInfoParserTest::testIssue477", "total_lines": 20 } ]
135
Closure
68
{ "fields": [ { "modifier": "", "original_string": "private final JsDocTokenStream stream;", "type": "JsDocTokenStream", "var_name": "stream" }, { "modifier": "", "original_string": "private final JSDocInfoBuilder jsdocBuilder;", "type": "JSDocInfoBuilder", ...
{ "body": "private Node parseFunctionType(JsDocToken token) {\n // NOTE(nicksantos): We're not implementing generics at the moment, so\n // just throw out TypeParameters.\n if (token != JsDocToken.LP) {\n restoreLookAhead(token);\n return reportTypeSyntaxWarning(\"msg.jsdoc.missing.lp\");\n }\n\...
[ { "covered_lines": 2, "line_coverage": 0.0455, "name": "com.google.javascript.jscomp.parsing.JsDocInfoParserTest::testIssue477", "total_lines": 44 } ]
136
Closure
69
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType UNEXPECTED_TOKEN = DiagnosticType.error(\n \"JSC_INTERNAL_ERROR_UNEXPECTED_TOKEN\",\n \"Internal Error: Don't know how to handle {0}\");", "type": "DiagnosticType", "var_name": "UNEXPECTED_TOKEN" ...
{ "body": "private void visitCall(NodeTraversal t, Node n) {\n Node child = n.getFirstChild();\n JSType childType = getJSType(child).restrictByNotNullOrUndefined();\n\n if (!childType.canBeCalled()) {\n report(t, n, NOT_CALLABLE, childType.toString());\n ensureTyped(t, n);\n return;\n }\n\n...
[ { "covered_lines": 16, "line_coverage": 0.6667, "name": "com.google.javascript.jscomp.TypeCheckTest::testThisTypeOfFunction2", "total_lines": 24 }, { "covered_lines": 16, "line_coverage": 0.6667, "name": "com.google.javascript.jscomp.TypeCheckTest::testThisTypeOfFunction3", "tota...
137
Closure
71
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType DEPRECATED_NAME = DiagnosticType.disabled(\n \"JSC_DEPRECATED_VAR\",\n \"Variable {0} has been deprecated.\");", "type": "DiagnosticType", "var_name": "DEPRECATED_NAME" }, { "modifier": ...
{ "body": "private void checkPropertyVisibility(NodeTraversal t,\n Node getprop, Node parent) {\n ObjectType objectType =\n ObjectType.cast(dereference(getprop.getFirstChild().getJSType()));\n String propertyName = getprop.getLastChild().getString();\n\n if (objectType != null) {\n // Is thi...
[ { "covered_lines": 32, "line_coverage": 0.5926, "name": "com.google.javascript.jscomp.CheckAccessControlsTest::testNoPrivateAccessForProperties6", "total_lines": 54 }, { "covered_lines": 20, "line_coverage": 0.3704, "name": "com.google.javascript.jscomp.CheckAccessControlsTest::testN...
138
Closure
72
{ "fields": [ { "modifier": "", "original_string": "private AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private Supplier<String> safeNameIdSupplier;", "type": "Supplier<String>", "v...
{ "body": "private void makeLocalNamesUnique(Node fnNode, boolean isCallInLoop) {\n Supplier<String> idSupplier = compiler.getUniqueNameIdSupplier();\n // Make variable names unique to this instance.\n NodeTraversal.traverse(\n compiler, fnNode, new MakeDeclaredNamesUnique(\n new InlineRena...
[ { "covered_lines": 3, "line_coverage": 1, "name": "com.google.javascript.jscomp.InlineFunctionsTest::testInlineFunctions31", "total_lines": 3 } ]
139
Closure
73
{ "fields": [ { "modifier": "", "original_string": "private static final char[] HEX_CHARS\n = { '0', '1', '2', '3', '4', '5', '6', '7',\n '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };", "type": "char[]", "var_name": "HEX_CHARS" }, { "modifier": "", "original_s...
{ "body": "static String strEscape(String s, char quote,\n String doublequoteEscape,\n String singlequoteEscape,\n String backslashEscape,\n CharsetEncoder outputCharsetEncoder) {\n StringBuilder sb = new StringBuil...
[ { "covered_lines": 11, "line_coverage": 0.2973, "name": "com.google.javascript.jscomp.CodePrinterTest::testUnicode", "total_lines": 37 } ]
140
Closure
74
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType INVALID_GETELEM_INDEX_ERROR =\n DiagnosticType.error(\n \"JSC_INVALID_GETELEM_INDEX_ERROR\",\n \"Array index not integer: {0}\");", "type": "DiagnosticType", "var_name": "INVALID_GETELEM_...
{ "body": "@SuppressWarnings(\"fallthrough\")\n private Node tryFoldComparison(Node n, Node left, Node right) {\n if (!NodeUtil.isLiteralValue(left, false) ||\n !NodeUtil.isLiteralValue(right, false)) {\n // We only handle non-literal operands for LT and GT.\n if (n.getType() != Token.GT && n.get...
[ { "covered_lines": 10, "line_coverage": 0.1176, "name": "com.google.javascript.jscomp.PeepholeFoldConstantsTest::testFoldComparison3", "total_lines": 85 }, { "covered_lines": 41, "line_coverage": 0.4824, "name": "com.google.javascript.jscomp.PeepholeFoldConstantsTest::testInvertibleO...
141
Closure
75
{ "fields": [ { "modifier": "", "original_string": "final static String JSC_PROPERTY_NAME_FN = \"JSCompiler_renameProperty\";", "type": "String", "var_name": "JSC_PROPERTY_NAME_FN" }, { "modifier": "", "original_string": "private static final Set<String> CONSTRUCTORS_WI...
{ "body": "static Double getStringNumberValue(String rawJsString) {\n if (rawJsString.contains(\"\\u000b\")) {\n // vertical tab is not always whitespace\n return null;\n }\n\n String s = trimJsWhiteSpace(rawJsString);\n // return ScriptRuntime.toNumber(s);\n if (s.length() == 0) {\n ret...
[ { "covered_lines": 8, "line_coverage": 0.381, "name": "com.google.javascript.jscomp.PeepholeFoldConstantsTest::testIEString", "total_lines": 21 } ]
142
Closure
75
{ "fields": [ { "modifier": "", "original_string": "final static String JSC_PROPERTY_NAME_FN = \"JSCompiler_renameProperty\";", "type": "String", "var_name": "JSC_PROPERTY_NAME_FN" }, { "modifier": "", "original_string": "private static final Set<String> CONSTRUCTORS_WI...
{ "body": "static TernaryValue isStrWhiteSpaceChar(int c) {\n switch (c) {\n case '\\u000B': // <VT>\n return TernaryValue.UNKNOWN; // IE says \"no\", EcmaScript says \"yes\"\n case ' ': // <SP>\n case '\\n': // <LF>\n case '\\r': // <CR>\n case '\\t': // <TAB>\n case '\\u00A0...
[ { "covered_lines": 3, "line_coverage": 0.6, "name": "com.google.javascript.jscomp.PeepholeFoldConstantsTest::testIEString", "total_lines": 5 } ]
143
Closure
76
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private LiveVariablesAnalysis liveness;", "type": "LiveVariablesAnalysis", ...
{ "body": "private VariableLiveness isVariableReadBeforeKill(\n Node n, String variable) {\n if (ControlFlowGraph.isEnteringNewCfgNode(n)) { // Not a FUNCTION\n return VariableLiveness.MAYBE_LIVE;\n }\n\n if (NodeUtil.isName(n) && variable.equals(n.getString())) {\n if (NodeUtil.isLhs(n, n.get...
[ { "covered_lines": 6, "line_coverage": 0.3158, "name": "com.google.javascript.jscomp.DeadAssignmentsEliminationTest::testInExpression2", "total_lines": 19 }, { "covered_lines": 16, "line_coverage": 0.8421, "name": "com.google.javascript.jscomp.DeadAssignmentsEliminationTest::testIssu...
144
Closure
76
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private LiveVariablesAnalysis liveness;", "type": "LiveVariablesAnalysis", ...
{ "body": "private boolean isVariableStillLiveWithinExpression(\n Node n, Node exprRoot, String variable) {\n while (n != exprRoot) {\n VariableLiveness state = VariableLiveness.MAYBE_LIVE;\n switch (n.getParent().getType()) {\n case Token.OR:\n case Token.AND:\n // If the cur...
[ { "covered_lines": 8, "line_coverage": 0.5714, "name": "com.google.javascript.jscomp.DeadAssignmentsEliminationTest::testInExpression2", "total_lines": 14 }, { "covered_lines": 12, "line_coverage": 0.8571, "name": "com.google.javascript.jscomp.DeadAssignmentsEliminationTest::testIssu...
145
Closure
77
{ "fields": [ { "modifier": "", "original_string": "private static final char[] HEX_CHARS\n = { '0', '1', '2', '3', '4', '5', '6', '7',\n '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };", "type": "char[]", "var_name": "HEX_CHARS" }, { "modifier": "", "original_s...
{ "body": "static String strEscape(String s, char quote,\n String doublequoteEscape,\n String singlequoteEscape,\n String backslashEscape,\n CharsetEncoder outputCharsetEncoder) {\n StringBuilder sb = new StringBuil...
[ { "covered_lines": 10, "line_coverage": 0.2778, "name": "com.google.javascript.jscomp.CodePrinterTest::testZero", "total_lines": 36 } ]
146
Closure
78
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType INVALID_GETELEM_INDEX_ERROR =\n DiagnosticType.error(\n \"JSC_INVALID_GETELEM_INDEX_ERROR\",\n \"Array index not integer: {0}\");", "type": "DiagnosticType", "var_name": "INVALID_GETELEM_...
{ "body": "private Node performArithmeticOp(int opType, Node left, Node right) {\n // Unlike other operations, ADD operands are not always converted\n // to Number.\n if (opType == Token.ADD\n && (NodeUtil.mayBeString(left, false)\n || NodeUtil.mayBeString(right, false))) {\n return nu...
[ { "covered_lines": 25, "line_coverage": 0.5208, "name": "com.google.javascript.jscomp.PeepholeFoldConstantsTest::testFoldArithmetic", "total_lines": 48 } ]
147
Closure
79
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private final boolean assertOnChange;", "type": "boolean", "var_name": ...
{ "body": "@Override\n public void process(Node externs, Node root) {\n new NodeTraversal(\n compiler, new NormalizeStatements(compiler, assertOnChange))\n .traverseRoots(externs, root);\n if (MAKE_LOCAL_NAMES_UNIQUE) {\n MakeDeclaredNamesUnique renamer = new MakeDeclaredNamesUnique();\n ...
[ { "covered_lines": 6, "line_coverage": 0.5455, "name": "com.google.javascript.jscomp.NormalizeTest::testIssue", "total_lines": 11 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.VarCheckTest::testPropReferenceInExterns1", "total_lines": 11 }, ...
148
Closure
79
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType UNDEFINED_VAR_ERROR = DiagnosticType.error(\n \"JSC_UNDEFINED_VARIABLE\",\n \"variable {0} is undefined\");", "type": "DiagnosticType", "var_name": "UNDEFINED_VAR_ERROR" }, { "modifier":...
{ "body": "private void createSynthesizedExternVar(String varName) {\n Node nameNode = Node.newString(Token.NAME, varName);\n\n // Mark the variable as constant if it matches the coding convention\n // for constant vars.\n // NOTE(nicksantos): honestly, i'm not sure how much this matters.\n // AFAIK, a...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.NormalizeTest::testIssue", "total_lines": 6 }, { "covered_lines": 5, "line_coverage": 0.8333, "name": "com.google.javascript.jscomp.VarCheckTest::testPropReferenceInExterns1", "total_lines": 6 }, ...
149
Closure
80
{ "fields": [ { "modifier": "", "original_string": "final static String JSC_PROPERTY_NAME_FN = \"JSCompiler_renameProperty\";", "type": "String", "var_name": "JSC_PROPERTY_NAME_FN" }, { "modifier": "", "original_string": "private static final Set<String> CONSTRUCTORS_WI...
{ "body": "static boolean evaluatesToLocalValue(Node value, Predicate<Node> locals) {\n switch (value.getType()) {\n case Token.ASSIGN:\n // A result that is aliased by a non-local name, is the effectively the\n // same as returning a non-local name, but this doesn't matter if the\n // va...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.NodeUtilTest::testIsBooleanResult", "total_lines": 28 }, { "covered_lines": 27, "line_coverage": 0.9643, "name": "com.google.javascript.jscomp.NodeUtilTest::testLocalValue1", "total_lines": 28 } ]
150
Closure
80
{ "fields": [ { "modifier": "", "original_string": "final static String JSC_PROPERTY_NAME_FN = \"JSCompiler_renameProperty\";", "type": "String", "var_name": "JSC_PROPERTY_NAME_FN" }, { "modifier": "", "original_string": "private static final Set<String> CONSTRUCTORS_WI...
{ "body": "static boolean isBooleanResultHelper(Node n) {\n switch (n.getType()) {\n // Primitives\n case Token.TRUE:\n case Token.FALSE:\n // Comparisons\n case Token.EQ:\n case Token.NE:\n case Token.SHEQ:\n case Token.SHNE:\n case Token.LT:\n case Token.GT:\n ...
[ { "covered_lines": 3, "line_coverage": 1, "name": "com.google.javascript.jscomp.NodeUtilTest::testIsBooleanResult", "total_lines": 3 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.NodeUtilTest::testLocalValue1", "total_lines": 3 } ]
151
Closure
82
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private boolean resolved = false;", "type": "boolean", "var_name": ...
{ "body": "public final boolean isEmptyType() {\n return isNoType() || isNoObjectType() || isNoResolvedType() ||\n (registry.getNativeFunctionType(\n JSTypeNative.LEAST_FUNCTION_TYPE) == this);\n }", "class_method_signature": "JSType.isEmptyType()", "constructor": false, "full_signature":...
[ { "covered_lines": 1, "line_coverage": 1, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue301", "total_lines": 1 }, { "covered_lines": 1, "line_coverage": 1, "name": "com.google.javascript.rhino.jstype.FunctionTypeTest::testEmptyFunctionTypes", "total_lines": 1 } ...
152
Closure
85
{ "fields": [ { "modifier": "", "original_string": "private static final Logger logger =\n Logger.getLogger(UnreachableCodeElimination.class.getName());", "type": "Logger", "var_name": "logger" }, { "modifier": "", "original_string": "private final AbstractCompiler c...
{ "body": "private Node computeFollowing(Node n) {\n Node next = ControlFlowAnalysis.computeFollowNode(n);\n while (next != null && next.getType() == Token.BLOCK) {\n if (next.hasChildren()) {\n next = next.getFirstChild();\n } else {\n next = computeFollowing(next);\n }\n }\n ...
[ { "covered_lines": 2, "line_coverage": 1, "name": "com.google.javascript.jscomp.UnreachableCodeEliminationTest::testCascadedRemovalOfUnlessUnconditonalJumps", "total_lines": 2 }, { "covered_lines": 2, "line_coverage": 1, "name": "com.google.javascript.jscomp.UnreachableCodeEliminatio...
153
Closure
85
{ "fields": [ { "modifier": "", "original_string": "private static final Logger logger =\n Logger.getLogger(UnreachableCodeElimination.class.getName());", "type": "Logger", "var_name": "logger" }, { "modifier": "", "original_string": "private final AbstractCompiler c...
{ "body": "@SuppressWarnings(\"fallthrough\")\n private Node tryRemoveUnconditionalBranching(Node n) {\n /*\n * For each of the unconditional branching control flow node, check to see\n * if the ControlFlowAnalysis.computeFollowNode of that node is same as\n * the branching target. If it is, the branc...
[ { "covered_lines": 19, "line_coverage": 0.7308, "name": "com.google.javascript.jscomp.UnreachableCodeEliminationTest::testCascadedRemovalOfUnlessUnconditonalJumps", "total_lines": 26 }, { "covered_lines": 21, "line_coverage": 0.8077, "name": "com.google.javascript.jscomp.UnreachableC...
154
Closure
86
{ "fields": [ { "modifier": "", "original_string": "final static String JSC_PROPERTY_NAME_FN = \"JSCompiler_renameProperty\";", "type": "String", "var_name": "JSC_PROPERTY_NAME_FN" }, { "modifier": "", "original_string": "private static final Set<String> CONSTRUCTORS_WI...
{ "body": "static boolean evaluatesToLocalValue(Node value, Predicate<Node> locals) {\n switch (value.getType()) {\n case Token.ASSIGN:\n // A result that is aliased by a non-local name, is the effectively the\n // same as returning a non-local name, but this doesn't matter if the\n // va...
[ { "covered_lines": 7, "line_coverage": 0.2593, "name": "com.google.javascript.jscomp.NodeUtilTest::testLocalValue1", "total_lines": 27 }, { "covered_lines": 3, "line_coverage": 0.1111, "name": "com.google.javascript.jscomp.PureFunctionIdentifierTest::testLocalizedSideEffects8", "...
155
Closure
87
{ "fields": [ { "modifier": "", "original_string": "private static final int AND_PRECEDENCE = NodeUtil.precedence(Token.AND);", "type": "int", "var_name": "AND_PRECEDENCE" }, { "modifier": "", "original_string": "private static final int OR_PRECEDENCE = NodeUtil.precede...
{ "body": "private boolean isFoldableExpressBlock(Node n) {\n if (n.getType() == Token.BLOCK) {\n if (n.hasOneChild()) {\n Node maybeExpr = n.getFirstChild();\n if (maybeExpr.getType() == Token.EXPR_RESULT) {\n // IE has a bug where event handlers behave differently when\n // t...
[ { "covered_lines": 4, "line_coverage": 0.8, "name": "com.google.javascript.jscomp.PeepholeSubstituteAlternateSyntaxTest::testIssue291", "total_lines": 5 } ]
156
Closure
88
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private LiveVariablesAnalysis liveness;", "type": "LiveVariablesAnalysis", ...
{ "body": "private VariableLiveness isVariableReadBeforeKill(\n Node n, String variable) {\n if (NodeUtil.isName(n) && variable.equals(n.getString())) {\n if (NodeUtil.isLhs(n, n.getParent())) {\n Preconditions.checkState(n.getParent().getType() == Token.ASSIGN);\n // The expression to whic...
[ { "covered_lines": 10, "line_coverage": 0.9091, "name": "com.google.javascript.jscomp.CommandLineRunnerTest::testIssue297", "total_lines": 11 }, { "covered_lines": 10, "line_coverage": 0.9091, "name": "com.google.javascript.jscomp.DeadAssignmentsEliminationTest::testIssue297a", "...
157
Closure
89
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType UNSAFE_NAMESPACE_WARNING =\n DiagnosticType.warning(\n \"JSC_UNSAFE_NAMESPACE\",\n \"incomplete alias created for namespace {0}\");", "type": "DiagnosticType", "var_name": "UNSAFE_NAMESPA...
{ "body": "private void updateSimpleDeclaration(String alias, Name refName, Ref ref) {\n Node rvalue = ref.node.getNext();\n Node parent = ref.node.getParent();\n Node gramps = parent.getParent();\n Node greatGramps = gramps.getParent();\n Node greatGreatGramps = greatGramps.getParent();\n\n if (rva...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.CollapsePropertiesTest::testAddPropertyToChildOfUncollapsibleFunctionInLocalScope", "total_lines": 28 }, { "covered_lines": 17, "line_coverage": 0.6071, "name": "com.google.javascript.jscomp.CollapsePrope...
158
Closure
90
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private ArrowType call;", "type": "ArrowType", "var_name": "call" ...
{ "body": "@Override\n JSType resolveInternal(ErrorReporter t, StaticScope<JSType> scope) {\n setResolvedTypeInternal(this);\n\n call = (ArrowType) safeResolve(call, t, scope);\n prototype = (FunctionPrototypeType) safeResolve(prototype, t, scope);\n\n // Warning about typeOfThis if it doesn't resolve to...
[ { "covered_lines": 14, "line_coverage": 0.7368, "name": "com.google.javascript.jscomp.TypeCheckTest::testBackwardsTypedefUse8", "total_lines": 19 }, { "covered_lines": 14, "line_coverage": 0.7368, "name": "com.google.javascript.jscomp.TypeCheckTest::testBackwardsTypedefUse9", "to...
159
Closure
91
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType GLOBAL_THIS = DiagnosticType.warning(\n \"JSC_USED_GLOBAL_THIS\",\n \"dangerous use of the global 'this' object\");", "type": "DiagnosticType", "var_name": "GLOBAL_THIS" }, { "modifier":...
{ "body": "public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {\n\n if (n.getType() == Token.FUNCTION) {\n // Don't traverse functions that are constructors or have the @this\n // or @override annotation.\n JSDocInfo jsDoc = getFunctionJsDocInfo(n);\n if (jsDoc != null &&\n ...
[ { "covered_lines": 9, "line_coverage": 0.3462, "name": "com.google.javascript.jscomp.CheckGlobalThisTest::testLendsAnnotation3", "total_lines": 26 } ]
160
Closure
94
{ "fields": [ { "modifier": "", "original_string": "private static final Set<String> CONSTRUCTORS_WITHOUT_SIDE_EFFECTS =\n new HashSet<String>(Arrays.asList(\n \"Array\",\n \"Date\",\n \"Error\",\n \"Object\",\n \"RegExp\",\n \"XMLHttpRequest\"));", ...
{ "body": "static boolean isValidDefineValue(Node val, Set<String> defines) {\n switch (val.getType()) {\n case Token.STRING:\n case Token.NUMBER:\n case Token.TRUE:\n case Token.FALSE:\n return true;\n\n // Binary operators are only valid if both children are valid.\n case Tok...
[ { "covered_lines": 6, "line_coverage": 1, "name": "com.google.javascript.jscomp.NodeUtilTest::testValidDefine", "total_lines": 6 }, { "covered_lines": 2, "line_coverage": 0.3333, "name": "com.google.javascript.jscomp.ProcessDefinesTest::testOverridingString1", "total_lines": 6 ...
161
Closure
96
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType UNEXPECTED_TOKEN = DiagnosticType.error(\n \"JSC_INTERNAL_ERROR_UNEXPECTED_TOKEN\",\n \"Internal Error: Don't know how to handle {0}\");", "type": "DiagnosticType", "var_name": "UNEXPECTED_TOKEN" ...
{ "body": "private void visitParameterList(NodeTraversal t, Node call,\n FunctionType functionType) {\n Iterator<Node> arguments = call.children().iterator();\n arguments.next(); // skip the function name\n\n Iterator<Node> parameters = functionType.getParameters().iterator();\n int ordinal = 0;\n ...
[ { "covered_lines": 18, "line_coverage": 0.7826, "name": "com.google.javascript.jscomp.TypeCheckTest::testFunctionArguments16", "total_lines": 23 } ]
162
Closure
97
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType DIVIDE_BY_0_ERROR = DiagnosticType.error(\n \"JSC_DIVIDE_BY_0_ERROR\",\n \"Divide by 0\");", "type": "DiagnosticType", "var_name": "DIVIDE_BY_0_ERROR" }, { "modifier": "", "origina...
{ "body": "private Node tryFoldShift(Node n, Node left, Node right) {\n if (left.getType() == Token.NUMBER &&\n right.getType() == Token.NUMBER) {\n\n double result;\n double lval = left.getDouble();\n double rval = right.getDouble();\n\n // check ranges. We do not do anything that woul...
[ { "covered_lines": 21, "line_coverage": 0.6562, "name": "com.google.javascript.jscomp.PeepholeFoldConstantsTest::testFoldBitShifts", "total_lines": 32 } ]
163
Closure
99
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType GLOBAL_THIS = DiagnosticType.warning(\n \"JSC_USED_GLOBAL_THIS\",\n \"dangerous use of the global 'this' object\");", "type": "DiagnosticType", "var_name": "GLOBAL_THIS" }, { "modifier":...
{ "body": "public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {\n\n if (n.getType() == Token.FUNCTION) {\n // Don't traverse functions that are constructors or have the @this\n // or @override annotation.\n JSDocInfo jsDoc = getFunctionJsDocInfo(n);\n if (jsDoc != null &&\n ...
[ { "covered_lines": 16, "line_coverage": 0.7273, "name": "com.google.javascript.jscomp.CheckGlobalThisTest::testPropertyOfMethod", "total_lines": 22 }, { "covered_lines": 15, "line_coverage": 0.6818, "name": "com.google.javascript.jscomp.CheckGlobalThisTest::testMethod4", "total_l...
164
Closure
100
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType GLOBAL_THIS = DiagnosticType.warning(\n \"JSC_USED_GLOBAL_THIS\",\n \"dangerous use of the global 'this' object\");", "type": "DiagnosticType", "var_name": "GLOBAL_THIS" }, { "modifier":...
{ "body": "private boolean shouldReportThis(Node n, Node parent) {\n if (assignLhsChild != null) {\n // Always report a THIS on the left side of an assign.\n return true;\n }\n\n // Also report a THIS with a property access.\n return parent != null && NodeUtil.isGet(parent);\n }", "class_meth...
[ { "covered_lines": 2, "line_coverage": 0.6667, "name": "com.google.javascript.jscomp.CheckGlobalThisTest::testStaticFunction6", "total_lines": 3 }, { "covered_lines": 2, "line_coverage": 0.6667, "name": "com.google.javascript.jscomp.CheckGlobalThisTest::testStaticFunction7", "tot...
165
Closure
100
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType GLOBAL_THIS = DiagnosticType.warning(\n \"JSC_USED_GLOBAL_THIS\",\n \"dangerous use of the global 'this' object\");", "type": "DiagnosticType", "var_name": "GLOBAL_THIS" }, { "modifier":...
{ "body": "public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {\n\n if (n.getType() == Token.FUNCTION) {\n // Don't traverse functions that are constructors or have the @this\n // annotation.\n JSDocInfo jsDoc = getFunctionJsDocInfo(n);\n if (jsDoc != null && (jsDoc.isConstruct...
[ { "covered_lines": 11, "line_coverage": 0.6471, "name": "com.google.javascript.jscomp.CheckGlobalThisTest::testStaticFunction6", "total_lines": 17 }, { "covered_lines": 11, "line_coverage": 0.6471, "name": "com.google.javascript.jscomp.CheckGlobalThisTest::testStaticFunction7", "...
166
Closure
101
{ "fields": [ { "modifier": "", "original_string": "private final Flags flags = new Flags();", "type": "Flags", "var_name": "flags" } ], "file": "src/com/google/javascript/jscomp/CommandLineRunner.java", "identifier": "CommandLineRunner", "interfaces": "", "superclass": "Abst...
{ "body": "@Override\n protected CompilerOptions createOptions() {\n CompilerOptions options = new CompilerOptions();\n options.setCodingConvention(new ClosureCodingConvention());\n CompilationLevel level = flags.compilation_level;\n level.setOptionsForCompilationLevel(options);\n if (flags.debug) {\n...
[ { "covered_lines": 12, "line_coverage": 0.8, "name": "com.google.javascript.jscomp.CommandLineRunnerTest::testProcessClosurePrimitives", "total_lines": 15 } ]
167
Closure
102
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private final boolean assertOnChange;", "type": "boolean", "var_name": ...
{ "body": "@Override\n public void process(Node externs, Node root) {\n NodeTraversal.traverse(compiler, root, this);\n removeDuplicateDeclarations(root);\n if (MAKE_LOCAL_NAMES_UNIQUE) {\n MakeDeclaredNamesUnique renamer = new MakeDeclaredNamesUnique();\n NodeTraversal t = new NodeTraversal(compi...
[ { "covered_lines": 8, "line_coverage": 1, "name": "com.google.javascript.jscomp.CompilerRunnerTest::testIssue115", "total_lines": 8 } ]
168
Closure
103
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private ControlFlowGraph<Node> cfg;", "type": "ControlFlowGraph<Node>", ...
{ "body": "private static boolean mayThrowException(Node n) {\n switch (n.getType()) {\n case Token.CALL:\n case Token.GETPROP:\n case Token.GETELEM:\n case Token.THROW:\n case Token.NEW:\n case Token.ASSIGN:\n case Token.INC:\n case Token.DEC:\n case Token.INSTANCEOF:\...
[ { "covered_lines": 4, "line_coverage": 0.5714, "name": "com.google.javascript.jscomp.CheckUnreachableCodeTest::testInstanceOfThrowsException", "total_lines": 7 }, { "covered_lines": 4, "line_coverage": 0.5714, "name": "com.google.javascript.jscomp.ControlFlowAnalysisTest::testInstanc...
169
Closure
104
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "Set<JSType> alternates;", "type": "Set<JSType>", "var_name": "alter...
{ "body": "JSType meet(JSType that) {\n UnionTypeBuilder builder = new UnionTypeBuilder(registry);\n for (JSType alternate : alternates) {\n if (alternate.isSubtype(that)) {\n builder.addAlternate(alternate);\n }\n }\n\n if (that instanceof UnionType) {\n for (JSType otherAlternate :...
[ { "covered_lines": 9, "line_coverage": 0.5, "name": "com.google.javascript.rhino.jstype.UnionTypeTest::testGreatestSubtypeUnionTypes5", "total_lines": 18 } ]
170
Closure
106
{ "fields": [ { "modifier": "", "original_string": "private JSDocInfo currentInfo;", "type": "JSDocInfo", "var_name": "currentInfo" }, { "modifier": "", "original_string": "private boolean populated = false;", "type": "boolean", "var_name": "populated" }...
{ "body": "public boolean recordBlockDescription(String description) {\n populated = true;\n return currentInfo.documentBlock(description);\n }", "class_method_signature": "JSDocInfoBuilder.recordBlockDescription(String description)", "constructor": false, "full_signature": "public boolean recordBlockDes...
[ { "covered_lines": 2, "line_coverage": 0.6667, "name": "com.google.javascript.jscomp.CheckSideEffectsTest::testJSDocComments", "total_lines": 3 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.CollapsePropertiesTest::testTwinReferenceCancelsChildColl...
171
Closure
107
{ "fields": [ { "modifier": "", "original_string": "private final Flags flags = new Flags();", "type": "Flags", "var_name": "flags" }, { "modifier": "", "original_string": "private boolean isConfigValid = false;", "type": "boolean", "var_name": "isConfigVali...
{ "body": "@Override\n protected CompilerOptions createOptions() {\n CompilerOptions options = new CompilerOptions();\n if (flags.processJqueryPrimitives) {\n options.setCodingConvention(new JqueryCodingConvention());\n } else {\n options.setCodingConvention(new ClosureCodingConvention());\n }\...
[ { "covered_lines": 20, "line_coverage": 0.625, "name": "com.google.javascript.jscomp.CommandLineRunnerTest::testGetMsgWiringNoWarnings", "total_lines": 32 } ]
172
Closure
109
{ "fields": [ { "modifier": "", "original_string": "private final JsDocTokenStream stream;", "type": "JsDocTokenStream", "var_name": "stream" }, { "modifier": "", "original_string": "private final JSDocInfoBuilder jsdocBuilder;", "type": "JSDocInfoBuilder", ...
{ "body": "private Node parseContextTypeExpression(JsDocToken token) {\n if (token == JsDocToken.QMARK) {\n return newNode(Token.QMARK);\n } else {\n return parseBasicTypeExpression(token);\n }\n }", "class_method_signature": "JsDocInfoParser.parseContextTypeExpression(JsDocToken token)", "con...
[ { "covered_lines": 1, "line_coverage": 1, "name": "com.google.javascript.jscomp.parsing.JsDocInfoParserTest::testStructuralConstructor2", "total_lines": 1 }, { "covered_lines": 1, "line_coverage": 1, "name": "com.google.javascript.jscomp.parsing.JsDocInfoParserTest::testStructuralCon...
173
Closure
112
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType FUNCTION_LITERAL_UNDEFINED_THIS =\n DiagnosticType.warning(\n \"JSC_FUNCTION_LITERAL_UNDEFINED_THIS\",\n \"Function literal argument refers to undefined this argument\");", "type": "DiagnosticType", ...
{ "body": "private boolean inferTemplatedTypesForCall(\n Node n, FunctionType fnType) {\n final ImmutableList<TemplateType> keys = fnType.getTemplateTypeMap()\n .getTemplateKeys();\n if (keys.isEmpty()) {\n return false;\n }\n\n // Try to infer the template types\n Map<TemplateType, JS...
[ { "covered_lines": 13, "line_coverage": 0.9286, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue1058", "total_lines": 14 }, { "covered_lines": 13, "line_coverage": 0.9286, "name": "com.google.javascript.jscomp.TypeCheckTest::testTemplatized11", "total_lines": 14 }...
174
Closure
113
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType NULL_ARGUMENT_ERROR = DiagnosticType.error(\n \"JSC_NULL_ARGUMENT_ERROR\",\n \"method \\\"{0}\\\" called without an argument\");", "type": "DiagnosticType", "var_name": "NULL_ARGUMENT_ERROR" }, ...
{ "body": "private void processRequireCall(NodeTraversal t, Node n, Node parent) {\n Node left = n.getFirstChild();\n Node arg = left.getNext();\n if (verifyLastArgumentIsString(t, left, arg)) {\n String ns = arg.getString();\n ProvidedName provided = providedNames.get(ns);\n if (provided == n...
[ { "covered_lines": 12, "line_coverage": 0.5217, "name": "com.google.javascript.jscomp.VarCheckTest::testNoUndeclaredVarWhenUsingClosurePass", "total_lines": 23 } ]
175
Closure
115
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private final Supplier<String> safeNameIdSupplier;", "type": "Supplier<String...
{ "body": "private CanInlineResult canInlineReferenceDirectly(\n Node callNode, Node fnNode) {\n if (!isDirectCallNodeReplacementPossible(fnNode)) {\n return CanInlineResult.NO;\n }\n\n Node block = fnNode.getLastChild();\n\n // CALL NODE: [ NAME, ARG1, ARG2, ... ]\n Node cArg = callNode.getF...
[ { "covered_lines": 16, "line_coverage": 0.5, "name": "com.google.javascript.jscomp.InlineFunctionsTest::testBug4944818", "total_lines": 32 }, { "covered_lines": 22, "line_coverage": 0.6875, "name": "com.google.javascript.jscomp.InlineFunctionsTest::testDoubleInlining1", "total_li...
176
Closure
116
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private final Supplier<String> safeNameIdSupplier;", "type": "Supplier<String...
{ "body": "private CanInlineResult canInlineReferenceDirectly(\n Node callNode, Node fnNode) {\n if (!isDirectCallNodeReplacementPossible(fnNode)) {\n return CanInlineResult.NO;\n }\n\n Node block = fnNode.getLastChild();\n\n boolean hasSideEffects = false; // empty function case\n if (block...
[ { "covered_lines": 14, "line_coverage": 0.5833, "name": "com.google.javascript.jscomp.FunctionInjectorTest::testIssue1101a", "total_lines": 24 }, { "covered_lines": 14, "line_coverage": 0.5833, "name": "com.google.javascript.jscomp.FunctionInjectorTest::testIssue1101b", "total_li...
177
Closure
117
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private final JSTypeRegistry typeRegistry;", "type": "JSTypeRegistry", ...
{ "body": "String getReadableJSTypeName(Node n, boolean dereference) {\n JSType type = getJSType(n);\n if (dereference) {\n ObjectType dereferenced = type.dereference();\n if (dereferenced != null) {\n type = dereferenced;\n }\n }\n\n // The best type name is the actual type name.\n ...
[ { "covered_lines": 10, "line_coverage": 0.3571, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue1047", "total_lines": 28 } ]
178
Closure
122
{ "fields": [ { "modifier": "", "original_string": "static final String GETTER_ERROR_MESSAGE =\n \"getters are not supported in older versions of JavaScript. \" +\n \"If you are targeting newer versions of JavaScript, \" +\n \"set the appropriate language_in option.\";", "type": "...
{ "body": "private void handleBlockComment(Comment comment) {\n Pattern p = Pattern.compile(\"(/|(\\n[ \\t]*))\\\\*[ \\t]*@[a-zA-Z]\");\n if (p.matcher(comment.getValue()).find()) {\n errorReporter.warning(\n SUSPICIOUS_COMMENT_WARNING,\n sourceName,\n comment.getLineno(), \"\", ...
[ { "covered_lines": 2, "line_coverage": 0.5, "name": "com.google.javascript.jscomp.parsing.ParserTest::testSuspiciousBlockCommentWarning3", "total_lines": 4 }, { "covered_lines": 2, "line_coverage": 0.5, "name": "com.google.javascript.jscomp.parsing.ParserTest::testSuspiciousBlockComm...
179
Closure
123
{ "fields": [ { "modifier": "", "original_string": "private static final String LT_ESCAPED = \"\\\\x3c\";", "type": "String", "var_name": "LT_ESCAPED" }, { "modifier": "", "original_string": "private static final String GT_ESCAPED = \"\\\\x3e\";", "type": "String"...
{ "body": "void add(Node n, Context context) {\n if (!cc.continueProcessing()) {\n return;\n }\n\n int type = n.getType();\n String opstr = NodeUtil.opToStr(type);\n int childCount = n.getChildCount();\n Node first = n.getFirstChild();\n Node last = n.getLastChild();\n\n // Handle all bin...
[ { "covered_lines": 2, "line_coverage": 1, "name": "com.google.javascript.jscomp.CodePrinterTest::testPrintInOperatorInForLoop", "total_lines": 2 } ]
180
Closure
124
{ "fields": [], "file": "src/com/google/javascript/jscomp/ExploitAssigns.java", "identifier": "ExploitAssigns", "interfaces": "", "superclass": "AbstractPeepholeOptimization" }
{ "body": "private boolean isSafeReplacement(Node node, Node replacement) {\n // No checks are needed for simple names.\n if (node.isName()) {\n return true;\n }\n Preconditions.checkArgument(node.isGetProp());\n\n while (node.isGetProp()) {\n node = node.getFirstChild();\n }\n if (node...
[ { "covered_lines": 5, "line_coverage": 0.625, "name": "com.google.javascript.jscomp.ExploitAssignsTest::testIssue1017", "total_lines": 8 } ]
181
Closure
125
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType UNEXPECTED_TOKEN = DiagnosticType.error(\n \"JSC_INTERNAL_ERROR_UNEXPECTED_TOKEN\",\n \"Internal Error: Don't know how to handle {0}\");", "type": "DiagnosticType", "var_name": "UNEXPECTED_TOKEN" ...
{ "body": "private void visitNew(NodeTraversal t, Node n) {\n Node constructor = n.getFirstChild();\n JSType type = getJSType(constructor).restrictByNotNullOrUndefined();\n if (type.isConstructor() || type.isEmptyType() || type.isUnknownType()) {\n FunctionType fnType = type.toMaybeFunctionType();\n ...
[ { "covered_lines": 7, "line_coverage": 0.5833, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue1002", "total_lines": 12 } ]
182
Closure
126
{ "fields": [ { "modifier": "", "original_string": "AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" } ], "file": "src/com/google/javascript/jscomp/MinimizeExitPoints.java", "identifier": "MinimizeExitPoints", "interfaces": "CompilerPass", "supe...
{ "body": "void tryMinimizeExits(Node n, int exitType, String labelName) {\n\n // Just an 'exit'.\n if (matchingExitNode(n, exitType, labelName)) {\n NodeUtil.removeChild(n.getParent(), n);\n compiler.reportCodeChange();\n return;\n }\n\n // Just an 'if'.\n if (n.isIf()) {\n Node if...
[ { "covered_lines": 26, "line_coverage": 0.5652, "name": "com.google.javascript.jscomp.MinimizeExitPointsTest::testDontRemoveBreakInTryFinally", "total_lines": 46 }, { "covered_lines": 44, "line_coverage": 0.9565, "name": "com.google.javascript.jscomp.MinimizeExitPointsTest::testFunct...
183
Closure
128
{ "fields": [ { "modifier": "", "original_string": "private static final String LT_ESCAPED = \"\\\\x3c\";", "type": "String", "var_name": "LT_ESCAPED" }, { "modifier": "", "original_string": "private static final String GT_ESCAPED = \"\\\\x3e\";", "type": "String"...
{ "body": "static boolean isSimpleNumber(String s) {\n int len = s.length();\n if (len == 0) {\n return false;\n }\n for (int index = 0; index < len; index++) {\n char c = s.charAt(index);\n if (c < '0' || c > '9') {\n return false;\n }\n }\n return len == 1 || s.charAt(0)...
[ { "covered_lines": 5, "line_coverage": 0.8333, "name": "com.google.javascript.jscomp.CodePrinterTest::testIssue942", "total_lines": 6 } ]
184
Closure
130
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType UNSAFE_NAMESPACE_WARNING =\n DiagnosticType.warning(\n \"JSC_UNSAFE_NAMESPACE\",\n \"incomplete alias created for namespace {0}\");", "type": "DiagnosticType", "var_name": "UNSAFE_NAMESPA...
{ "body": "private void inlineAliases(GlobalNamespace namespace) {\n // Invariant: All the names in the worklist meet condition (a).\n Deque<Name> workList = new ArrayDeque<Name>(namespace.getNameForest());\n while (!workList.isEmpty()) {\n Name name = workList.pop();\n\n // Don't attempt to inline...
[ { "covered_lines": 14, "line_coverage": 0.875, "name": "com.google.javascript.jscomp.CollapsePropertiesTest::testIssue931", "total_lines": 16 } ]
185
Closure
131
{ "fields": [], "file": "src/com/google/javascript/rhino/TokenStream.java", "identifier": "TokenStream", "interfaces": "", "superclass": "" }
{ "body": "public static boolean isJSIdentifier(String s) {\n int length = s.length();\n\n if (length == 0 ||\n Character.isIdentifierIgnorable(s.charAt(0)) ||\n !Character.isJavaIdentifierStart(s.charAt(0))) {\n return false;\n }\n\n for (int i = 1; i < length; i++) {\n ...
[ { "covered_lines": 8, "line_coverage": 0.8889, "name": "com.google.javascript.jscomp.ConvertToDottedPropertiesTest::testQuotedProps", "total_lines": 9 }, { "covered_lines": 9, "line_coverage": 1, "name": "com.google.javascript.jscomp.ConvertToDottedPropertiesTest::testDoNotConvert", ...
186
Closure
132
{ "fields": [ { "modifier": "", "original_string": "private static final int AND_PRECEDENCE = NodeUtil.precedence(Token.AND);", "type": "int", "var_name": "AND_PRECEDENCE" }, { "modifier": "", "original_string": "private static final int OR_PRECEDENCE = NodeUtil.precede...
{ "body": "private Node tryMinimizeIf(Node n) {\n\n Node parent = n.getParent();\n\n Node cond = n.getFirstChild();\n\n /* If the condition is a literal, we'll let other\n * optimizations try to remove useless code.\n */\n if (NodeUtil.isLiteralValue(cond, true)) {\n return n;\n }\n\n N...
[ { "covered_lines": 31, "line_coverage": 0.2214, "name": "com.google.javascript.jscomp.PeepholeSubstituteAlternateSyntaxTest::testIssue925", "total_lines": 140 } ]
187
Closure
133
{ "fields": [ { "modifier": "", "original_string": "private final JsDocTokenStream stream;", "type": "JsDocTokenStream", "var_name": "stream" }, { "modifier": "", "original_string": "private final JSDocInfoBuilder jsdocBuilder;", "type": "JSDocInfoBuilder", ...
{ "body": "private String getRemainingJSDocLine() {\n String result = stream.getRemainingJSDocLine();\n unreadToken = NO_UNREAD_TOKEN;\n return result;\n }", "class_method_signature": "JsDocInfoParser.getRemainingJSDocLine()", "constructor": false, "full_signature": "private String getRemainingJSDocLi...
[ { "covered_lines": 2, "line_coverage": 1, "name": "com.google.javascript.jscomp.parsing.JsDocInfoParserTest::testTextExtents", "total_lines": 2 } ]
188
Closure
134
{ "fields": [ { "modifier": "", "original_string": "private static final Logger logger = Logger.getLogger(\n AmbiguateProperties.class.getName());", "type": "Logger", "var_name": "logger" }, { "modifier": "", "original_string": "private final AbstractCompiler compi...
{ "body": "public void process(Node externs, Node root) {\n NodeTraversal.traverse(compiler, externs, new ProcessExterns());\n NodeTraversal.traverse(compiler, root, new ProcessProperties());\n\n Set<String> reservedNames =\n new HashSet<String>(externedNames.size() + quotedNames.size());\n reserve...
[ { "covered_lines": 36, "line_coverage": 0.9474, "name": "com.google.javascript.jscomp.AmbiguatePropertiesTest::testImplementsAndExtends", "total_lines": 38 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.TypeCheckTest::testIssue86", "total_lines...
189
Closure
135
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" } ], "file": "src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java", "identifier": "DevirtualizePrototypeMethods", "in...
{ "body": "private void replaceReferencesToThis(Node node, String name) {\n if (NodeUtil.isFunction(node)) {\n return;\n }\n\n for (Node child : node.children()) {\n if (NodeUtil.isThis(child)) {\n Node newName = Node.newString(Token.NAME, name);\n newName.setJSType(child.getJSType())...
[ { "covered_lines": 9, "line_coverage": 0.9, "name": "com.google.javascript.jscomp.DevirtualizePrototypeMethodsTest::testRewritePrototypeMethods2", "total_lines": 10 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.TypeCheckTest::testGoodExtends9", ...
190
Closure
136
{ "fields": [ { "modifier": "", "original_string": "final Set<String> externMethods = Sets.newHashSet();", "type": "Set<String>", "var_name": "externMethods" }, { "modifier": "", "original_string": "final Set<String> externMethodsWithoutSignatures = Sets.newHashSet();",...
{ "body": "private void addPossibleSignature(String name, Node node, NodeTraversal t) {\n if (node.getType() == Token.FUNCTION) {\n // The node we're looking at is a function, so we can add it directly\n addSignature(name, node, t.getSourceName());\n } else {\n nonMethodProperties.add(name);\n ...
[ { "covered_lines": 13, "line_coverage": 0.6842, "name": "com.google.javascript.jscomp.InlineGettersTest::testIssue2508576_1", "total_lines": 19 }, { "covered_lines": 12, "line_coverage": 0.6316, "name": "com.google.javascript.jscomp.InlineGettersTest::testIssue2508576_3", "total_...
191
Closure
137
{ "fields": [ { "modifier": "", "original_string": "public static final String ARGUMENTS = \"arguments\";", "type": "String", "var_name": "ARGUMENTS" }, { "modifier": "", "original_string": "private Deque<Renamer> nameStack = new ArrayDeque<Renamer>();", "type": "...
{ "body": "public void enterScope(NodeTraversal t) {\n if (t.inGlobalScope()) {\n return;\n }\n\n referenceStack.push(referencedNames);\n referencedNames = Sets.newHashSet();\n }", "class_method_signature": "MakeDeclaredNamesUnique.enterScope(NodeTraversal t)", "constructor": false, ...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion3", "total_lines": 18 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion4", ...
192
Closure
137
{ "fields": [ { "modifier": "", "original_string": "public static final String ARGUMENTS = \"arguments\";", "type": "String", "var_name": "ARGUMENTS" }, { "modifier": "", "original_string": "private Deque<Renamer> nameStack = new ArrayDeque<Renamer>();", "type": "...
{ "body": "public void exitScope(NodeTraversal t) {\n if (t.inGlobalScope()) {\n return;\n }\n\n for (Iterator<Var> it = t.getScope().getVars(); it.hasNext();) {\n Var v = it.next();\n handleScopeVar(v);\n }\n\n // Merge any names that were referenced but not declared in ...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion3", "total_lines": 3 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion4", ...
193
Closure
137
{ "fields": [ { "modifier": "", "original_string": "public static final String ARGUMENTS = \"arguments\";", "type": "String", "var_name": "ARGUMENTS" }, { "modifier": "", "original_string": "private Deque<Renamer> nameStack = new ArrayDeque<Renamer>();", "type": "...
{ "body": "@Override\n public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {\n return true;\n }", "class_method_signature": "MakeDeclaredNamesUnique.shouldTraverse(NodeTraversal t, Node n, Node parent)", "constructor": false, "full_signature": "@Override\n public boolean shouldTrav...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion3", "total_lines": 13 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion4", ...
194
Closure
137
{ "fields": [ { "modifier": "", "original_string": "public static final String ARGUMENTS = \"arguments\";", "type": "String", "var_name": "ARGUMENTS" }, { "modifier": "", "original_string": "private Deque<Renamer> nameStack = new ArrayDeque<Renamer>();", "type": "...
{ "body": "@Override\n public void visit(NodeTraversal t, Node node, Node parent) {\n if (t.inGlobalScope()) {\n return;\n }\n\n if (NodeUtil.isReferenceName(node)) {\n String name = node.getString();\n // Add all referenced names to the set so it is possible to check for\n ...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion3", "total_lines": 13 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion4", ...
195
Closure
137
{ "fields": [ { "modifier": "", "original_string": "private final AbstractCompiler compiler;", "type": "AbstractCompiler", "var_name": "compiler" }, { "modifier": "", "original_string": "private final boolean assertOnChange;", "type": "boolean", "var_name": ...
{ "body": "@Override\n public void process(Node externs, Node root) {\n NodeTraversal.traverse(compiler, root,\n new NormalizeStatements(compiler, assertOnChange));\n if (MAKE_LOCAL_NAMES_UNIQUE) {\n MakeDeclaredNamesUnique renamer = new MakeDeclaredNamesUnique();\n NodeTraversal t = new NodeT...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion3", "total_lines": 8 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.MakeDeclaredNamesUniqueTest::testOnlyInversion4", ...
196
Closure
138
{ "fields": [ { "modifier": "", "original_string": "private final Visitor<JSType> restrictToArrayVisitor =\n new RestrictByTrueTypeOfResultVisitor() {\n @Override\n protected JSType caseTopType(JSType topType) {\n // Ideally, we would like to return any subtype of Array.\n ...
{ "body": "@Override\n public FlowScope getPreciserScopeKnowingConditionOutcome(Node condition,\n FlowScope blindScope, boolean outcome) {\n if (condition.getType() == CALL && condition.getChildCount() == 2) {\n Node callee = condition.getFirstChild();\n Node param = condition.getLastChild();\n ...
[ { "covered_lines": 7, "line_coverage": 0.4667, "name": "com.google.javascript.jscomp.ClosureReverseAbstractInterpreterTest::testGoogIsArrayOnNull", "total_lines": 15 }, { "covered_lines": 7, "line_coverage": 0.4667, "name": "com.google.javascript.jscomp.ClosureReverseAbstractInterpre...
197
Closure
138
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType TEMPLATE_TYPE_NOT_OBJECT_TYPE =\n DiagnosticType.error(\n \"JSC_TEMPLATE_TYPE_NOT_OBJECT_TYPE\",\n \"The template type must be an object type\");", "type": "DiagnosticType", "var_name": "TEMPLATE...
{ "body": "private FlowScope traverseName(Node n, FlowScope scope) {\n String varName = n.getString();\n Node value = n.getFirstChild();\n JSType type = n.getJSType();\n if (value != null) {\n scope = traverse(value, scope);\n updateScopeForTypeChange(scope, n, n.getJSType() /* could be null */,...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.ClosureReverseAbstractInterpreterTest::testGoogIsArrayOnNull", "total_lines": 16 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.ClosureReverseAbstractInterpreterTest::t...
198
Closure
140
{ "fields": [ { "modifier": "", "original_string": "CompilerOptions options = null;", "type": "CompilerOptions", "var_name": "options" }, { "modifier": "", "original_string": "private PassConfig passes = null;", "type": "PassConfig", "var_name": "passes" ...
{ "body": "public void init(JSSourceFile[] externs, JSModule[] modules,\n CompilerOptions options) {\n initOptions(options);\n\n checkFirstModule(modules);\n fillEmptyModules(modules);\n\n this.externs = makeCompilerInput(externs, true);\n this.modules = modules;\n // Generate the module graph,...
[ { "covered_lines": 8, "line_coverage": 1, "name": "com.google.javascript.jscomp.CrossModuleCodeMotionTest::testEmptyModule", "total_lines": 8 } ]
199
Closure
141
{ "fields": [ { "modifier": "", "original_string": "private static final Set<String> CONSTRUCTORS_WITHOUT_SIDE_EFFECTS =\n new HashSet<String>(Arrays.asList(\n \"Array\",\n \"Date\",\n \"Error\",\n \"Object\",\n \"RegExp\",\n \"XMLHttpRequest\"));", ...
{ "body": "static boolean canBeSideEffected(Node n, Set<String> knownConstants) {\n switch (n.getType()) {\n case Token.CALL:\n case Token.NEW:\n // Function calls or constructor can reference changed values.\n // TODO(johnlenz): Add some mechanism for determining that functions\n //...
[ { "covered_lines": 6, "line_coverage": 0.6667, "name": "com.google.javascript.jscomp.ExpresssionDecomposerTest::testCanExposeExpression2", "total_lines": 9 }, { "covered_lines": 6, "line_coverage": 0.6667, "name": "com.google.javascript.jscomp.ExpresssionDecomposerTest::testCanExpose...
200
Closure
141
{ "fields": [ { "modifier": "", "original_string": "static final DiagnosticType INVALID_NO_SIDE_EFFECT_ANNOTATION =\n DiagnosticType.error(\n \"JSC_INVALID_NO_SIDE_EFFECT_ANNOTATION\",\n \"@nosideeffects may only appear in externs files.\");", "type": "DiagnosticType", ...
{ "body": "private static Collection<Definition> getCallableDefinitions(\n DefinitionProvider definitionProvider, Node name) {\n if (NodeUtil.isGetProp(name) || NodeUtil.isName(name)) {\n List<Definition> result = Lists.newArrayList();\n\n Collection<Definition> decls =\n definitionProvider...
[ { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.ExpresssionDecomposerTest::testCanExposeExpression2", "total_lines": 14 }, { "covered_lines": 0, "line_coverage": 0, "name": "com.google.javascript.jscomp.ExpresssionDecomposerTest::testCanExposeExpressio...