Skip to content

Commit

Permalink
Remove deprecated useSourceInfoWithoutLengthIfMissingFrom() method.
Browse files Browse the repository at this point in the history
Only real use is in the "*ForTree()" version, so just inline it there.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170942701
  • Loading branch information
brad4d authored and dimvar committed Oct 4, 2017
1 parent 447a69b commit be781f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
19 changes: 3 additions & 16 deletions src/com/google/javascript/rhino/Node.java
Expand Up @@ -2242,14 +2242,13 @@ public final Node cloneTree(boolean cloneTypeExprs) {
}

/**
* Copies source file and name information from the other
* node given to the current node. Used for maintaining
* debug information across node append and remove operations.
* Copies source file and name information from the other node to the
* entire tree rooted at this node.
* @return this
*/
// TODO(nicksantos): The semantics of this method are ill-defined. Delete it.
@Deprecated
public final Node useSourceInfoWithoutLengthIfMissingFrom(Node other) {
public final Node useSourceInfoWithoutLengthIfMissingFromForTree(Node other) {
if (getStaticSourceFile() == null) {
setStaticSourceFileFrom(other);
sourcePosition = other.sourcePosition;
Expand All @@ -2259,18 +2258,6 @@ public final Node useSourceInfoWithoutLengthIfMissingFrom(Node other) {
putProp(ORIGINALNAME_PROP, other.getProp(ORIGINALNAME_PROP));
}

return this;
}

/**
* Copies source file and name information from the other node to the
* entire tree rooted at this node.
* @return this
*/
// TODO(nicksantos): The semantics of this method are ill-defined. Delete it.
@Deprecated
public final Node useSourceInfoWithoutLengthIfMissingFromForTree(Node other) {
useSourceInfoWithoutLengthIfMissingFrom(other);
for (Node child = first; child != null; child = child.next) {
child.useSourceInfoWithoutLengthIfMissingFromForTree(other);
}
Expand Down
4 changes: 2 additions & 2 deletions test/com/google/javascript/rhino/NodeTest.java
Expand Up @@ -468,14 +468,14 @@ public void testUseSourceInfoWithoutLengthIfMissingFrom() {

Node lhs = assign.getFirstChild();
lhs.setLength(21);
lhs.useSourceInfoWithoutLengthIfMissingFrom(assign);
lhs.useSourceInfoWithoutLengthIfMissingFromForTree(assign);
assertEquals(99, lhs.getSourcePosition());
assertEquals("foo.js", lhs.getSourceFileName());
assertEquals(21, lhs.getLength());

assign.setSourceEncodedPosition(101);
assign.setSourceFileForTesting("bar.js");
lhs.useSourceInfoWithoutLengthIfMissingFrom(assign);
lhs.useSourceInfoWithoutLengthIfMissingFromForTree(assign);
assertEquals(99, lhs.getSourcePosition());
assertEquals("foo.js", lhs.getSourceFileName());
assertEquals(21, lhs.getLength());
Expand Down

0 comments on commit be781f0

Please sign in to comment.