private Symbols.ParamVar ParseParameterDeclaration() { Token first_token = scan.Peek(); Symbols.Type type = ParseTypeSpecifier(); Symbols.ParamVar variable = null; if (type != null) { Pair <Symbols.Var, Pair <Symbols.RefType, Symbols.RefType> > res; res = ParseDeclarator(parse_parameter: true); variable = (Symbols.ParamVar)res.first; if (res.last != null) { res.last.last.SetType(type); type = res.last.first; } if (type is Symbols.VOID) { this.logger.Add(new Symbols.Exception("недопустимо использование типа \"void\"", first_token.GetIndex(), first_token.GetLine())); type = new Symbols.SuperType(); } if (variable == null) { variable = new Symbols.ParamVar("", type.GetIndex(), type.GetLine()); } } variable.SetType(type); return(variable); }
private Symbols.ParamVar ParseParameterDeclaration() { Token first_token = scan.Peek(); Symbols.Type type = ParseTypeSpecifier(); Symbols.ParamVar variable = null; if (type != null) { Pair<Symbols.Var, Pair<Symbols.RefType, Symbols.RefType>> res; res = ParseDeclarator(parse_parameter:true); variable = (Symbols.ParamVar)res.first; if (res.last != null) { res.last.last.SetType(type); type = res.last.first; } if (type is Symbols.VOID) { this.logger.Add(new Symbols.Exception("недопустимо использование типа \"void\"", first_token.GetIndex(), first_token.GetLine())); type = new Symbols.SuperType(); } if (variable == null) { variable = new Symbols.ParamVar("", type.GetIndex(), type.GetLine()); } } variable.SetType(type); return variable; }