Skip to content

Commit

Permalink
Deletes redundant NodeTraversal::makeError methods.
Browse files Browse the repository at this point in the history
This change also cleans up the many unnecessary parameters/args that were used to call these methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=233625094
  • Loading branch information
nreid260 authored and tjgq committed Feb 12, 2019
1 parent 28059c6 commit 7ee68cd
Show file tree
Hide file tree
Showing 32 changed files with 427 additions and 535 deletions.
14 changes: 7 additions & 7 deletions src/com/google/javascript/jscomp/AngularPass.java
Expand Up @@ -200,19 +200,19 @@ private List<Node> createStringsFromParamList(Node params) {
} }


@Override @Override
public void visit(NodeTraversal t, Node n, Node parent) { public void visit(NodeTraversal unused, Node n, Node parent) {
JSDocInfo docInfo = n.getJSDocInfo(); JSDocInfo docInfo = n.getJSDocInfo();
if (docInfo != null && docInfo.isNgInject()) { if (docInfo != null && docInfo.isNgInject()) {
addNode(n, t); addNode(n);
} }
} }


/** /**
* Add node to the list of injectables. * Add node to the list of injectables.
*
* @param n node to add. * @param n node to add.
* @param t node traversal instance.
*/ */
private void addNode(Node n, NodeTraversal t) { private void addNode(Node n) {
Node target = null; Node target = null;
Node fn = null; Node fn = null;
String name = null; String name = null;
Expand All @@ -223,7 +223,7 @@ private void addNode(Node n, NodeTraversal t) {
// a = b = c = function() {} // a = b = c = function() {}
case ASSIGN: case ASSIGN:
if (!n.getFirstChild().isQualifiedName()) { if (!n.getFirstChild().isQualifiedName()) {
compiler.report(t.makeError(n, INJECTED_FUNCTION_ON_NON_QNAME)); compiler.report(JSError.make(n, INJECTED_FUNCTION_ON_NON_QNAME));
return; return;
} }
name = n.getFirstChild().getQualifiedName(); name = n.getFirstChild().getQualifiedName();
Expand Down Expand Up @@ -289,14 +289,14 @@ private void addNode(Node n, NodeTraversal t) {
} }


if (fn == null || !fn.isFunction()) { if (fn == null || !fn.isFunction()) {
compiler.report(t.makeError(n, INJECT_NON_FUNCTION_ERROR)); compiler.report(JSError.make(n, INJECT_NON_FUNCTION_ERROR));
return; return;
} }
// report an error if the function declaration did not take place in a block or global scope // report an error if the function declaration did not take place in a block or global scope
if (!target.getParent().isScript() if (!target.getParent().isScript()
&& !target.getParent().isBlock() && !target.getParent().isBlock()
&& !target.getParent().isModuleBody()) { && !target.getParent().isModuleBody()) {
compiler.report(t.makeError(n, INJECT_IN_NON_GLOBAL_OR_BLOCK_ERROR)); compiler.report(JSError.make(n, INJECT_IN_NON_GLOBAL_OR_BLOCK_ERROR));
return; return;
} }
// checks that name is present, which must always be the case unless the // checks that name is present, which must always be the case unless the
Expand Down

0 comments on commit 7ee68cd

Please sign in to comment.