Now that https://github.com/rokucommunity/brighterscript/pull/1225 landed, I think we should convert .getLeadingTrivia() into a getter. This way it is easier for plugins to manipulate the AST without needing to call a function to get the results, and makes it more clear that it's an attribute of a node rather than a return value.
Tasks:
convert all .getLeadingTrivia() methods into get leadingTrivia()
add unit tests to prove we can manipulate the leading trivia and it transpiles properly. something like:
const file = program.setFile<BrsFile>('source/main.brs', `
function test()
end function
`);
file.parser.ast.walk(()=>{
FunctionStatement: (stmt) => {
editor.arrayPush(stmt.leadingTrivia, createCommentToken(''Hello world");
}
});
testTranspile(.....)
Now that https://github.com/rokucommunity/brighterscript/pull/1225 landed, I think we should convert
.getLeadingTrivia()
into a getter. This way it is easier for plugins to manipulate the AST without needing to call a function to get the results, and makes it more clear that it's an attribute of a node rather than a return value.Tasks:
.getLeadingTrivia()
methods intoget leadingTrivia()