Skip to content

Commit b7aca84

Browse files
brad4dcopybara-github
authored andcommitted
Rename AstFactory.declareSingleLet() to match other methods
Methods in AstFactory are named createThing() except for declareSingleLet(), so I'm fixing that inconsistency. I'm also dropping the JSType argument, because applying a type other than VOID_TYPE is inconsistent with the type that TypeInference would apply to the declaration. PiperOrigin-RevId: 321803894
1 parent bf776ec commit b7aca84

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/com/google/javascript/jscomp/AstFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,12 @@ Node createThisAliasDeclarationForFunction(String aliasName, Node functionNode)
362362
}
363363

364364
/**
365-
* Creates a new `let` declaration with a type but no value.
365+
* Creates a new `let` declaration for a single variable name with a void type and no JSDoc.
366366
*
367367
* <p>e.g. `let variableName`
368368
*/
369-
Node declareSingleLet(String variableName, JSType type) {
370-
return IR.let(createName(variableName, type));
369+
Node createSingleLetNameDeclaration(String variableName) {
370+
return IR.let(createName(variableName, JSTypeNative.VOID_TYPE));
371371
}
372372

373373
/**

src/com/google/javascript/jscomp/RewriteNullishCoalesceOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private void visitNullishCoalesce(NodeTraversal t, Node n) {
7575
Node left = n.removeFirstChild();
7676
Node right = n.getLastChild().detach();
7777

78-
Node let = astFactory.declareSingleLet(tempVarName, left.getJSType());
78+
Node let = astFactory.createSingleLetNameDeclaration(tempVarName);
7979
Node assignName = astFactory.createName(tempVarName, left.getJSType());
8080
Node assign = astFactory.createAssign(assignName, left);
8181
Node ne = astFactory.createNe(assign, astFactory.createNull());

0 commit comments

Comments
 (0)