Figured it out with help from this post: Compile Error: Variable does not exist: o.CloseDateCompile Error: Variable does not exist: o.CloseDate
I had a newline/line break between the line between FROM and {:
FROM OpportunityLineItem WHERE OpportunityId IN :oppyIds])
{
revPipeline.add(new Revenue_Pipeline__c(
The correct code is:
FROM OpportunityLineItem WHERE OpportunityId IN :oppyIds])
{
revPipeline.add(new Revenue_Pipeline__c(
So if only the first line is considered in the loop and there is a blank space then the rest is out of the loop and thus error. Removing the space allows the code to be compiled.