               portIdentifier = "#{outport}[#{idx}]"
               unforwarded = @getForwardableContexts inport, portIdentifier, context
               continue unless unforwarded.length
+              forwardedOpens = []
               for ctx in unforwarded
+                debugBrackets "#{@nodeId} openBracket from '#{inport}' to '#{portIdentifier}': '#{ctx.ip.data}'"
                 ipClone = ctx.ip.clone()
                 ipClone.index = parseInt idx
-                idxIps.unshift ipClone
-                debugBrackets "#{@nodeId} openBracket from '#{inport}' to '#{portIdentifier}': '#{ctx.ip.data}'"
+                forwardedOpens.push ipClone
                 ctx.ports.push portIdentifier
+                @getBracketContext('out', outport, ctx.ip.scope, idx).push ctx
+              forwardedOpens.reverse()
+              idxIps.unshift ip for ip in forwardedOpens
             continue
           # Don't register ports we're only sending brackets to
           datas = ips.filter (ip) -> ip.type is 'data'
           continue unless datas.length
           unforwarded = @getForwardableContexts inport, outport, context
           continue unless unforwarded.length
+          forwardedOpens = []
           for ctx in unforwarded
-            ips.unshift ctx.ip.clone()
             debugBrackets "#{@nodeId} openBracket from '#{inport}' to '#{outport}': '#{ctx.ip.data}'"
+            forwardedOpens.push ctx.ip.clone()
             ctx.ports.push outport
+            @getBracketContext('out', outport, ctx.ip.scope).push ctx
+          forwardedOpens.reverse()
+          ips.unshift ip for ip in forwardedOpens
 
     if result.__bracketClosingAfter?.length
       for context in result.__bracketClosingAfter

      return unless @isForwardingOutport inport, name
      # We have already forwarded this context to this outport
      return unless ctx.ports.indexOf(outport) is -1
      forwardable.unshift ctx
    return forwardable

  addBracketForwards: (result) ->

    return

  getBracketContext: (type, port, scope, idx) ->
    {name, index} = ports.normalizePortName port
    portsList = if type is 'in' then @inPorts else @outPorts
    if portsList[name].isAddressable() and idx
      port = "#{port}[#{idx}]"
    # Ensure we have a bracket context for the current scope
    @bracketContext[type][port] = {} unless @bracketContext[type][port]
    @bracketContext[type][port][scope] = [] unless @bracketContext[type][port][scope]
    return @bracketContext[type][port][scope]

  addToResult: (result, port, ip, before = false) ->
    {name, index} = ports.normalizePortName port
