Пример #1
0
        private void AddPreBoundElements <T>(BoundItemsBag <T> bag, BoundBlock block) where T : class, IPhpOperation
        {
            var preBoundElements = bag.PreBoundStatements;

            if (!preBoundElements.IsEmpty)
            {
                preBoundElements.Foreach(block.Add);
            }
        }
Пример #2
0
        private BoundBlock ConnectBoundItemsBagBlocks <T>(BoundItemsBag <T> bag, BoundBlock block) where T : class, IPhpOperation
        {
            if (bag.IsOnlyBoundElement)
            {
                return(block);
            }

            Connect(block, bag.PreBoundBlockFirst);
            return(bag.PreBoundBlockLast);
        }
Пример #3
0
        private CaseBlock /*!*/ NewBlock(SwitchItem item)
        {
            BoundItemsBag <BoundExpression> caseValueBag = item is CaseItem caseItem
                ? _binder.BindWholeExpression(caseItem.CaseVal, BoundAccess.Read)
                : BoundItemsBag <BoundExpression> .Empty; // BoundItem -eq null => DefaultItem

            return(WithNewOrdinal(new CaseBlock(caseValueBag)
            {
                PhpSyntax = item, Naming = _naming
            }));
        }
Пример #4
0
 internal CaseBlock Update(BoundItemsBag <BoundExpression> caseValue, List <BoundStatement> statements, Edge nextEdge)
 {
     if (caseValue == _caseValue && statements == Statements && nextEdge == NextEdge)
     {
         return(this);
     }
     else
     {
         return(new CaseBlock(caseValue, statements)
         {
             NextEdge = nextEdge
         }
                .WithLocalPropertiesFrom(this));
     }
 }
Пример #5
0
 private CaseBlock(BoundItemsBag <BoundExpression> caseValue, List <BoundStatement> statements)
     : base(statements)
 {
     _caseValue = caseValue;
 }
Пример #6
0
 public CaseBlock(BoundItemsBag <BoundExpression> caseValue)
     : this(caseValue, new List <BoundStatement>())
 {
 }
Пример #7
0
 private void ConnectBoundItemsBagBlocksToCurrentBlock <T>(BoundItemsBag <T> bag) where T : class, IPhpOperation
 => _current = ConnectBoundItemsBagBlocks(bag, _current);
Пример #8
0
 private void Add(BoundItemsBag <BoundStatement> stmtBag)
 {
     ConnectBoundItemsBagBlocksToCurrentBlock(stmtBag);
     _current.Add(stmtBag.BoundElement);
 }
Пример #9
0
 public CaseBlock(BoundItemsBag <BoundExpression> caseValue)
 {
     _caseValue = caseValue;
 }
Пример #10
0
 private void AddPreBoundElements <T>(BoundItemsBag <T> bag) where T : class, IPhpOperation
 => AddPreBoundElements(bag, _current);
Пример #11
0
 private void Add(BoundItemsBag <BoundStatement> stmtBag)
 {
     AddPreBoundElements(stmtBag);
     _current.Add(stmtBag.BoundElement);
 }