public bool Visit(CallableHeader node) { _symStack.Push(); //this will be function local namespace var callable = new CallableSymbol(node.Name.ToString()) { ReturnSymType = null }; if (node.ReturnType != null) { node.ReturnType.Accept(this); callable.ReturnSymType = _symStack.FindType(node.ReturnType.ToString()); _symStack.AddVariable(true, "result", callable.ReturnSymType); } foreach (var paramSection in node.ParamList) { paramSection.Accept(this); foreach (var parameter in paramSection.ParamList) { callable.ParametersTypes.Add(new Tuple <string, SymType>(paramSection.ParamModifier, _symStack.FindIdentInScope(parameter.ToString()).VarSymType)); } } callable.IsForward = true; callable.Local = _symStack.Pop(); node.CallableSymbol = callable; // if (!_symStack.PrepareFunction(callable)) // { // throw new Exception(string.Format("({0}, {1}) semantic error: duplicate declaration of {2} '{3}' ", // node.Name.Token.Line, node.Name.Token.Column, // callable.ReturnSymType == null ? "procedure" : "function", // node.GetSignature())); // } return(true); }