Skip to content

Commit

Permalink
SelectLiteral isn't tied to the requester's subject: it has its own. (p…
Browse files Browse the repository at this point in the history
…antsbuild#4293)

### Problem

`SelectLiteral` doesn't care about the requester's subject: it carries its own output value along with it. But currently we're creating a new instance of the `SelectLiteral` per caller.

### Solution

Drop the excess subject value from `SelectLiteral` to avoid creating one per unique requesting subject.
  • Loading branch information
Stu Hood authored Feb 28, 2017
1 parent 8d6b0a0 commit 66fcfb8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/python/pants/engine/subsystem/native_engine_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e5b11346a458240934cc6136e40faa62b75f79ff
f3ae10a39f2b893026b4ebfa20c2e45dc8b293ee
4 changes: 1 addition & 3 deletions src/rust/engine/src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ impl From<Select> for NodeKey {

#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct SelectLiteral {
subject: Key,
variants: Variants,
selector: selectors::SelectLiteral,
}
Expand Down Expand Up @@ -609,7 +608,6 @@ impl Task {
}),
Selector::SelectLiteral(s) =>
context.get(SelectLiteral {
subject: self.subject.clone(),
variants: self.variants.clone(),
selector: s,
}),
Expand Down Expand Up @@ -677,7 +675,7 @@ impl NodeKey {
pub fn subject(&self) -> &Key {
match self {
&NodeKey::Select(ref s) => &s.subject,
&NodeKey::SelectLiteral(ref s) => &s.subject,
&NodeKey::SelectLiteral(ref s) => &s.selector.subject,
&NodeKey::SelectDependencies(ref s) => &s.subject,
&NodeKey::SelectProjection(ref s) => &s.subject,
&NodeKey::Task(ref t) => &t.subject,
Expand Down

0 comments on commit 66fcfb8

Please sign in to comment.