Commit df2bb8d4 by Tianqi Yang

feat(symbol): add symbol FunctionTable to store the table of a function

- Add symbol FunctionTable to store the overload table of a function - Add function isFunctionTable in Symbol to check the type
parent 2451ba12
package decaf.symbol;
import java.util.*;
import decaf.scope.ClassScope;
import decaf.type.FuncType;
public class FunctionTable extends Symbol {
private List<Function> functions;
public FunctionTable (String name) {
this.name = name;
functions = new ArrayList<Function>();
}
public void appendFunction(Function func) {
functions.add(func);
}
/**
* @return the functions
*/
public List<Function> getFunctions() {
return functions;
}
@Override
public ClassScope getScope() {
return (ClassScope) definedIn;
}
@Override
public FuncType getType() {
return null;
}
@Override
public boolean isFunction() {
return false;
}
@Override
public boolean isFunctionTable() {
return true;
}
@Override
public String toString() {
return "";
}
@Override
public boolean isClass() {
return false;
}
@Override
public boolean isVariable() {
return false;
}
}
......@@ -73,5 +73,10 @@ public abstract class Symbol {
public abstract boolean isFunction();
public boolean isFunctionTable()
{
return false;
}
public abstract String toString();
}
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