Commit 4dbdfeb7 by Tianqi Yang

fix(ClassScope): fix the output of ClassScope

Fix the output of ClassScope to iterate over all Functions in all FunctionTables
parent 586f66a3
package decaf.scope; package decaf.scope;
import java.util.List;
import java.util.TreeSet; import java.util.TreeSet;
import decaf.symbol.Class; import decaf.symbol.Class;
import decaf.symbol.Function; import decaf.symbol.Function;
import decaf.symbol.FunctionTable;
import decaf.symbol.Symbol; import decaf.symbol.Symbol;
import decaf.utils.IndentPrintWriter; import decaf.utils.IndentPrintWriter;
...@@ -48,9 +50,12 @@ public class ClassScope extends Scope { ...@@ -48,9 +50,12 @@ public class ClassScope extends Scope {
for (Symbol symbol : ss) { for (Symbol symbol : ss) {
pw.println(symbol); pw.println(symbol);
} }
for (Symbol symbol : ss) { for (Symbol symbol : symbols.values()) {
if (symbol.isFunction()) { if (symbol.isFunctionTable()) {
((Function) symbol).getAssociatedScope().printTo(pw); List<Function> functions = ((FunctionTable) symbol).getFunctions();
for (Function func : functions) {
func.getAssociatedScope().printTo(pw);
}
} }
} }
pw.decIndent(); pw.decIndent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment