Skip to content

Commit

Permalink
Delete unused method JSChunk.addAndOverrideChunk.
Browse files Browse the repository at this point in the history
While we are here remove an redundant hash lookup in `JSChunk.add`.

PiperOrigin-RevId: 721777438
  • Loading branch information
concavelenz authored and lauraharker committed Jan 31, 2025
1 parent 56e7768 commit 8ebdcf5
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/com/google/javascript/jscomp/JSChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;

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

/**
* Adds a source code input to this chunk. Call only if the input might already be associated with
* a chunk. Otherwise, use add(CompilerInput input).
*/
void addAndOverrideChunk(CompilerInput input) {
String inputName = input.getName();
checkArgument(
!inputs.containsKey(inputName), "%s already exist in chunk %s", inputName, this.getName());
inputs.put(inputName, input);
input.overrideModule(this);
}

/** Adds a dependency on another chunk. */
public void addDependency(JSChunk dep) {
checkNotNull(dep);
Expand Down

0 comments on commit 8ebdcf5

Please sign in to comment.