internal ConstructorDeclarationSyntax ParseConstructor( IClassDeclarationSyntax declaringType, ModifierParser modifiers) { var accessModifer = modifiers.ParseAccessModifier(); modifiers.ParseEndOfModifiers(); var newKeywordSpan = Tokens.Expect <INewKeywordToken>(); var identifier = Tokens.AcceptToken <IIdentifierToken>(); Name?name = identifier is null ? null : (Name)identifier.Value; var bodyParser = BodyParser(); // Implicit self parameter is taken to be after the current token which is expected to be `(` var selfParameter = new SelfParameterSyntax(Tokens.Current.Span.AtEnd(), true); var parameters = bodyParser.ParseParameters(bodyParser.ParseConstructorParameter); var body = bodyParser.ParseFunctionBody(); // For now, just say constructors have no annotations var reachabilityAnnotations = new ReachabilityAnnotationsSyntax(Tokens.Current.Span.AtStart(), null, null); var span = TextSpan.Covering(newKeywordSpan, body.Span); return(new ConstructorDeclarationSyntax(declaringType, span, File, accessModifer, TextSpan.Covering(newKeywordSpan, identifier?.Span), name, selfParameter, parameters, reachabilityAnnotations, body)); }
public virtual void VisitSelfParameter(SelfParameterSyntax selfParameter, A args) { }