File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ private IEnumerable<DiagnosticRecord> FindInnerBraceViolations(TokenOperations t
260
260
foreach ( var lCurly in tokenOperations . GetTokenNodes ( TokenKind . LCurly ) )
261
261
{
262
262
if ( lCurly . Next == null
263
- || ! IsPreviousTokenOnSameLine ( lCurly )
263
+ || ! ( lCurly . Previous == null || IsPreviousTokenOnSameLine ( lCurly ) )
264
264
|| lCurly . Next . Value . Kind == TokenKind . NewLine
265
265
|| lCurly . Next . Value . Kind == TokenKind . LineContinuation
266
266
|| lCurly . Next . Value . Kind == TokenKind . RCurly
@@ -616,7 +616,7 @@ private List<CorrectionExtent> GetCorrections(
616
616
}
617
617
618
618
619
- private bool IsPreviousTokenOnSameLine ( LinkedListNode < Token > lparen )
619
+ private static bool IsPreviousTokenOnSameLine ( LinkedListNode < Token > lparen )
620
620
{
621
621
return lparen . Previous . Value . Extent . EndLineNumber == lparen . Value . Extent . StartLineNumber ;
622
622
}
Original file line number Diff line number Diff line change @@ -508,6 +508,10 @@ if ($true) { Get-Item `
508
508
'@
509
509
Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should - Be $null
510
510
}
511
+
512
+ It ' Should not throw when analysing a line starting with a scriptblock' {
513
+ { Invoke-ScriptAnalyzer - ScriptDefinition ' { }' - Settings $settings - ErrorAction Stop } | Should -Not - Throw
514
+ }
511
515
}
512
516
513
517
You can’t perform that action at this time.
0 commit comments