Skip to content

Commit

Permalink
Use simpler overloads of SyntaxFactory methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Nov 19, 2014
1 parent a4bb44d commit c84786a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/NullParameterCheckRefactoring.VB/CodeRefactoringProvider.vb
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,14 @@ Friend Class NullCheck_CodeRefactoringCodeRefactoringProvider
' Note: If I can find the nameof feature in VB.net, then I'll change this line to reflect that
Dim _paramname_ = SyntaxFactory.StringLiteralExpression(
SyntaxFactory.Literal(parameterStmt.Identifier.Identifier.Text))
Dim st = SyntaxFactory.ObjectCreationExpression(Nothing,
SyntaxFactory.ParseTypeName(GetType(ArgumentNullException).FullName),
SyntaxFactory.ArgumentList().AddArguments(
SyntaxFactory.SimpleArgument(_paramname_)
),
Nothing)
Dim st = SyntaxFactory.ObjectCreationExpression(
SyntaxFactory.ParseTypeName(GetType(ArgumentNullException).FullName)).WithArgumentList(
SyntaxFactory.ArgumentList().AddArguments(SyntaxFactory.SimpleArgument(_paramname_)))

Dim throwExpr = SyntaxFactory.ThrowStatement(st)

Dim if_ = SyntaxFactory.SingleLineIfStatement(
SyntaxFactory.Token(SyntaxKind.IfKeyword),
_IsExpr_,
SyntaxFactory.Token(SyntaxKind.ThenKeyword),
New SyntaxList(Of StatementSyntax)().Add(throwExpr),
Nothing).WithAdditionalAnnotations(Formatting.Formatter.Annotation)

Expand Down

0 comments on commit c84786a

Please sign in to comment.