cleanup; avoid array creation
This commit is contained in:
parent
829ad9191c
commit
3edb35d95e
|
@ -266,22 +266,19 @@ public abstract class PredictionContext implements Iterable<SingletonPredictionC
|
||||||
payloads[1] = a.invokingState;
|
payloads[1] = a.invokingState;
|
||||||
}
|
}
|
||||||
PredictionContext[] parents = {singleParent, singleParent};
|
PredictionContext[] parents = {singleParent, singleParent};
|
||||||
ArrayPredictionContext joined =
|
return new ArrayPredictionContext(parents, payloads);
|
||||||
new ArrayPredictionContext(parents, payloads);
|
|
||||||
return joined;
|
|
||||||
}
|
}
|
||||||
// parents differ and can't merge them. Just pack together
|
// parents differ and can't merge them. Just pack together
|
||||||
// into array; can't merge. sort, though, by payload
|
// into array; can't merge.
|
||||||
// ax + by = [ax,by]
|
// ax + by = [ax,by]
|
||||||
int[] payloads = {a.invokingState, b.invokingState};
|
int[] payloads = {a.invokingState, b.invokingState};
|
||||||
PredictionContext[] parents = {a.parent, b.parent};
|
PredictionContext[] parents = {a.parent, b.parent};
|
||||||
if ( a.invokingState > b.invokingState ) {
|
if ( a.invokingState > b.invokingState ) { // sort by payload
|
||||||
payloads = new int[] {b.invokingState, a.invokingState};
|
payloads[0] = b.invokingState;
|
||||||
|
payloads[1] = a.invokingState;
|
||||||
parents = new PredictionContext[] {b.parent, a.parent};
|
parents = new PredictionContext[] {b.parent, a.parent};
|
||||||
}
|
}
|
||||||
ArrayPredictionContext joined =
|
return new ArrayPredictionContext(parents, payloads);
|
||||||
new ArrayPredictionContext(parents, payloads);
|
|
||||||
return joined;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue