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;
import java.util.List;
import java.util.TreeSet;
import decaf.symbol.Class;
import decaf.symbol.Function;
import decaf.symbol.FunctionTable;
import decaf.symbol.Symbol;
import decaf.utils.IndentPrintWriter;
......@@ -48,9 +50,12 @@ public class ClassScope extends Scope {
for (Symbol symbol : ss) {
pw.println(symbol);
}
for (Symbol symbol : ss) {
if (symbol.isFunction()) {
((Function) symbol).getAssociatedScope().printTo(pw);
for (Symbol symbol : symbols.values()) {
if (symbol.isFunctionTable()) {
List<Function> functions = ((FunctionTable) symbol).getFunctions();
for (Function func : functions) {
func.getAssociatedScope().printTo(pw);
}
}
}
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