List<stmtType> peek = stackBody.peek();
if (newStmt instanceof FunctionDef) {
int size = peek.size();
if (size > 0) {
stmtType existing = peek.get(size - 1);
if (existing.beginColumn < newStmt.beginColumn) {
//we don't want to add a method inside a method at this point.
//all the items added should have the same column.
return;
}
}
} else if (newStmt instanceof Assign) {
Assign assign = (Assign) newStmt;
exprType target = assign.targets[0];
//an assign could be in a method or in a class depending on where we're right now...
int size = peek.size();
if (size > 0) {
stmtType existing = peek.get(size - 1);
if (existing.beginColumn < assign.beginColumn) {
//add the assign to the correct place
if (existing instanceof FunctionDef) {
FunctionDef functionDef = (FunctionDef) existing;