Exemplo n.º 1
0
        /// <inheritdoc />
        protected override void OnRevert(ControlFlowGraphEditContext <TInstruction> context)
        {
            var origin = context.FindNode(OriginOffset);
            var target = context.FindNodeOrSplit(TargetOffset, out _);

            origin.ConnectWith(target, EdgeType);
        }
Exemplo n.º 2
0
 /// <inheritdoc />
 public void Apply(ControlFlowGraphEditContext <TInstruction> context)
 {
     if (_isApplied)
     {
         throw new InvalidOperationException("Operation is already applied.");
     }
     context.FindNodeOrSplit(SplitOffset, out _hasSplit);
     _isApplied = true;
 }
Exemplo n.º 3
0
        /// <inheritdoc />
        public void Apply(ControlFlowGraphEditContext <TInstruction> context)
        {
            if (_isApplied)
            {
                throw new InvalidOperationException("Operation is already applied.");
            }

            var node = context.FindNode(BranchOffset);

            // Save original fallthrough node offset.
            _oldFallThroughOffset = node.FallThroughNeighbour?.Offset;

            // Set new fallthrough neighbour.
            node.FallThroughNeighbour = NewFallThroughOffset.HasValue
                ? context.FindNodeOrSplit(NewFallThroughOffset.Value, out _hasSplit)
                : null;

            _isApplied = true;
        }