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
260260 foreach ( var lCurly in tokenOperations . GetTokenNodes ( TokenKind . LCurly ) )
261261 {
262262 if ( lCurly . Next == null
263- || ! IsPreviousTokenOnSameLine ( lCurly )
263+ || ! ( lCurly . Previous == null || IsPreviousTokenOnSameLine ( lCurly ) )
264264 || lCurly . Next . Value . Kind == TokenKind . NewLine
265265 || lCurly . Next . Value . Kind == TokenKind . LineContinuation
266266 || lCurly . Next . Value . Kind == TokenKind . RCurly
@@ -616,7 +616,7 @@ private List<CorrectionExtent> GetCorrections(
616616 }
617617
618618
619- private bool IsPreviousTokenOnSameLine ( LinkedListNode < Token > lparen )
619+ private static bool IsPreviousTokenOnSameLine ( LinkedListNode < Token > lparen )
620620 {
621621 return lparen . Previous . Value . Extent . EndLineNumber == lparen . Value . Extent . StartLineNumber ;
622622 }
Original file line number Diff line number Diff line change @@ -508,6 +508,10 @@ if ($true) { Get-Item `
508508'@
509509 Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should - Be $null
510510 }
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+ }
511515 }
512516
513517
You can’t perform that action at this time.
0 commit comments