File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -348,7 +348,7 @@ private ScriptBlockExpressionAst GetDscResourceBody(CommandAst cmdAst)
348348 && bodyPipeline . PipelineElements . Count == 1
349349 && bodyPipeline . PipelineElements [ 0 ] is CommandExpressionAst bodyExpression )
350350 {
351- if ( HasStatementTerminator ( pipeline , bodyPipeline )
351+ if ( HasSemicolonSeparator ( pipeline , bodyPipeline )
352352 || bodyExpression . Redirections . Count != 0 )
353353 {
354354 return null ;
@@ -364,7 +364,7 @@ private ScriptBlockExpressionAst GetDscResourceBody(CommandAst cmdAst)
364364 return null ;
365365 }
366366
367- private bool HasStatementTerminator ( Ast statement , Ast nextStatement )
367+ private bool HasSemicolonSeparator ( Ast statement , Ast nextStatement )
368368 {
369369 int separatorStart = statement . Extent . EndOffset ;
370370 int separatorLength = nextStatement . Extent . StartOffset - separatorStart ;
@@ -375,6 +375,11 @@ private bool HasStatementTerminator(Ast statement, Ast nextStatement)
375375
376376 string script = statement . Extent . EndScriptPosition . GetFullScript ( ) ;
377377 string separator = script . Substring ( separatorStart , separatorLength ) ;
378+ if ( separator . IndexOf ( ';' ) < 0 )
379+ {
380+ return false ;
381+ }
382+
378383 Parser . ParseInput ( separator , out Token [ ] tokens , out ParseError [ ] errors ) ;
379384 return tokens . Any ( token => token . Kind == TokenKind . Semi ) ;
380385 }
You can’t perform that action at this time.
0 commit comments