private void VisitNode(SpecialName node) { Attributes attr = Table.lookup(node.Name.ToString()); node.TypeDescriptor = attr.TypeDescriptor; node.AttributesRef = attr; }
public void VisitNode(SpecialName node) { Console.Write("<" + node.ClassName() + ">: "); Console.ForegroundColor = ConsoleColor.Green; Console.Write(node.Name); Console.ResetColor(); PrintAttribute(node); }
private TypeDescriptor PrimaryExp(AbstractNode node) { AbstractNode child = node.Child; // QualifiedName // NotJustName not implemented QualifiedName name = child as QualifiedName; if (name != null) { Attributes attr = Table.lookup(name.GetStringName()); return(attr.TypeDescriptor); } // Special Name SpecialName specialName = child as SpecialName; if (specialName != null) { return(new ErrorDescriptor("SpecialName not implemented")); } // Complex Primary Expression exp = child as Expression; if (exp != null) { exp.Accept(this); return(exp.TypeDescriptor); } //Complex Primary No Parentheses Literal literal = child as Literal; if (literal != null) { return(literal.TypeDescriptor); } Number num = child as Number; if (num != null) { return(num.TypeDescriptor); } FieldAccess fieldAcc = child as FieldAccess; if (fieldAcc != null) { return(new ErrorDescriptor("FieldAccess not implemented")); } MethodCall methodCall = child as MethodCall; if (methodCall != null) { methodCall.Accept(this); return(methodCall.TypeDescriptor); } return(new ErrorDescriptor("Expected QualifiedName, Expression, " + "Literal or Number as Primary Expression")); }