Skip to content

Commit

Permalink
Remove obsolete error.
Browse files Browse the repository at this point in the history
As far as I can tell this is never reported anymore, or if it is, then it's only reported in cases which are disallowed by VarCheck.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146966995
  • Loading branch information
tbreisacher authored and blickly committed Feb 9, 2017
1 parent db7a7b4 commit 7394659
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/com/google/javascript/jscomp/DiagnosticGroups.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ public DiagnosticGroup forName(String name) {

public static final DiagnosticGroup AMBIGUOUS_FUNCTION_DECL =
DiagnosticGroups.registerGroup("ambiguousFunctionDecl",
VariableReferenceCheck.AMBIGUOUS_FUNCTION_DECL,
StrictModeCheck.BAD_FUNCTION_DECLARATION);

public static final DiagnosticGroup UNKNOWN_DEFINES =
Expand Down
18 changes: 0 additions & 18 deletions src/com/google/javascript/jscomp/VariableReferenceCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ class VariableReferenceCheck implements HotSwapCompilerPass {
static final DiagnosticType REDECLARED_VARIABLE =
DiagnosticType.warning("JSC_REDECLARED_VARIABLE", "Redeclared variable: {0}");

static final DiagnosticType AMBIGUOUS_FUNCTION_DECL =
DiagnosticType.error("AMBIGUOUS_FUNCTION_DECL", "Ambiguous use of a named function: {0}.");

static final DiagnosticType EARLY_REFERENCE_ERROR =
DiagnosticType.error(
"JSC_REFERENCE_BEFORE_DECLARE_ERROR",
Expand Down Expand Up @@ -216,7 +213,6 @@ private void checkShadowParam(Var v, Scope functionScope, List<Reference> refere
private void checkVar(Var v, List<Reference> references) {
blocksWithDeclarations.clear();
boolean isDeclaredInScope = false;
boolean isUnhoistedNamedFunction = false;
boolean hasErrors = false;
boolean isRead = false;
Reference hoistedFn = null;
Expand All @@ -229,8 +225,6 @@ private void checkVar(Var v, List<Reference> references) {
isDeclaredInScope = true;
hoistedFn = reference;
break;
} else if (NodeUtil.isFunctionDeclaration(reference.getNode().getParent())) {
isUnhoistedNamedFunction = true;
}
}

Expand Down Expand Up @@ -331,18 +325,6 @@ private void checkVar(Var v, List<Reference> references) {
isRead = true;
}

if (isUnhoistedNamedFunction && !isDeclaration && isDeclaredInScope) {
// Only allow an unhoisted named function to be used within the
// block it is declared.
for (BasicBlock declaredBlock : blocksWithDeclarations) {
if (!declaredBlock.provablyExecutesBefore(basicBlock)) {
compiler.report(JSError.make(referenceNode, AMBIGUOUS_FUNCTION_DECL, v.name));
hasErrors = true;
break;
}
}
}

boolean isUndeclaredReference = false;
if (!isDeclaration && !isDeclaredInScope) {
// Don't check the order of refer in externs files.
Expand Down

0 comments on commit 7394659

Please sign in to comment.