File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -547,12 +547,29 @@ private IEnumerable<DiagnosticRecord> FindOperatorViolations(TokenOperations tok
547
547
else if ( tokenHasBinaryFlag // binary flag is set but not unary
548
548
// include other (non-expression) binary operators
549
549
|| TokenTraits . HasTrait ( tokenNode . Value . Kind , TokenFlags . AssignmentOperator )
550
+ || tokenNode . Value . Kind == TokenKind . Redirection
550
551
|| tokenNode . Value . Kind == TokenKind . AndAnd
551
552
|| tokenNode . Value . Kind == TokenKind . OrOr
553
+ #if ! ( NET452 || PSV6 ) // include both parts of ternary operator but only for PS7+
554
+ || TokenTraits . HasTrait ( tokenNode . Value . Kind , TokenFlags . TernaryOperator )
555
+ || tokenNode . Value . Kind == TokenKind . Colon
556
+ #endif
552
557
) {
553
558
checkLeftSide = true ;
554
559
checkRightSide = true ;
555
560
}
561
+ // Treat call and dot source operators as unary with operand on right.
562
+ else if ( ( tokenNode . Value . Kind == TokenKind . Dot || tokenNode . Value . Kind == TokenKind . Ampersand )
563
+ && tokenOperations . GetAstPosition ( tokenNode . Value ) is CommandAst )
564
+ {
565
+ checkRightSide = true ;
566
+ }
567
+ #if ! ( NET452 ) // Treat background operator as unary with operand on left (only exists in PS6+)
568
+ else if ( tokenNode . Value . Kind = = TokenKind . Ampersand )
569
+ {
570
+ checkLeftSide = true ;
571
+ }
572
+ #endif
556
573
else // Token is not an operator
557
574
{
558
575
continue ;
You can’t perform that action at this time.
0 commit comments