ConstructorDeclarationSyntax AddBody(CXCursor compountStmt, ConstructorDeclarationSyntax ctorDecl) { ctorDecl = ctorDecl.AddBodyStatements (new StatementSyntax[0]); SyntaxToken cl = ctorDecl.Body.CloseBraceToken.WithLeadingTrivia (FetchTrivias (compountStmt)); return ctorDecl.ReplaceToken(ctorDecl.Body.CloseBraceToken, cl); }
private void CreateVariablesAndConstructorSyntax() { m_constructor = MySyntaxFactory.Constructor(m_scriptClassDeclaration); var variables = m_navigator.OfType<MyVisualSyntaxVariableNode>(); foreach (var variableNode in variables) { m_fieldDeclarations.Add(variableNode.CreateFieldDeclaration()); m_constructor = m_constructor.AddBodyStatements(variableNode.CreateInitializationSyntax()); } }