public object VisitMethodDecl(MethodDecl basetype) { string methodName = (string)basetype.methodName.value; Method m = new Method(methodName, null, null); if (CurrentClass == null) { if (CurrentMethod == null) { // Global scope if (!Environment.Methods.Any(n => n.MethodName == m.MethodName)) { new CompilerException("Method: " + m.MethodName + " Could not be found"); } } else { // Method in global scope if (!CurrentMethod.Methods.Any(n => n.MethodName == m.MethodName)) { new CompilerException("Method: " + m.MethodName + " Could not be found"); } } } else { // In a class if (CurrentMethod == null) { // In a method within a class if (!CurrentClass.Methods.Any(n => n.MethodName == m.MethodName)) { new CompilerException("Method: " + m.MethodName + " Could not be found"); } } else { // In a class and not in a method if (!CurrentMethod.Methods.Any(n => n.MethodName == m.MethodName)) { new CompilerException("Method: " + m.MethodName + " Could not be found"); } } } return(m); }
public string VisitMethodDecl(MethodDecl basetype) { throw new NotImplementedException(); }
public string VisitMethodDecl(MethodDecl basetype) { return(Parenthesize("MethodDecl " + VisitIdentifier(basetype.methodName) + " " + VisitType(basetype.returnType), basetype.arguments.ToArray())); }