Skip to content

Commit 8ebdcf5

Browse files
concavelenzlauraharker
authored andcommitted
Delete unused method JSChunk.addAndOverrideChunk.
While we are here remove an redundant hash lookup in `JSChunk.add`. PiperOrigin-RevId: 721777438
1 parent 56e7768 commit 8ebdcf5

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

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

+3-15
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import static com.google.common.base.Preconditions.checkArgument;
2020
import static com.google.common.base.Preconditions.checkNotNull;
21+
import static com.google.common.base.Preconditions.checkState;
2122

2223
import com.google.common.base.Preconditions;
2324
import com.google.common.collect.ImmutableList;
@@ -148,24 +149,11 @@ public void add(SourceFile file) {
148149
/** Adds a source code input to this chunk. */
149150
public void add(CompilerInput input) {
150151
String inputName = input.getName();
151-
checkArgument(
152-
!inputs.containsKey(inputName), "%s already exist in chunk %s", inputName, this.getName());
153-
inputs.put(inputName, input);
152+
CompilerInput previous = inputs.put(inputName, input);
153+
checkState(previous == null, "%s already exist in chunk %s", inputName, this.getName());
154154
input.setChunk(this);
155155
}
156156

157-
/**
158-
* Adds a source code input to this chunk. Call only if the input might already be associated with
159-
* a chunk. Otherwise, use add(CompilerInput input).
160-
*/
161-
void addAndOverrideChunk(CompilerInput input) {
162-
String inputName = input.getName();
163-
checkArgument(
164-
!inputs.containsKey(inputName), "%s already exist in chunk %s", inputName, this.getName());
165-
inputs.put(inputName, input);
166-
input.overrideModule(this);
167-
}
168-
169157
/** Adds a dependency on another chunk. */
170158
public void addDependency(JSChunk dep) {
171159
checkNotNull(dep);

0 commit comments

Comments
 (0)