 
   return detectConflicts(affectedKeys)
 
+# Creates a patch to the outputAddress of the given outputValue and appends it to either memoryPatches or ioPatches
+# TODO: what an unweildy function, with more parameters than lines! Need to refactor it somehow
+GE.derivePatches = (bindings, path, evaluationContext, memoryPatches, ioPatches, outputAddress, outputValue) -> 
+  pathParts = GE.resolveBindingAddresses(bindings, GE.splitAddress(outputAddress))
+  # Get the original value to compare the output against
+  [parent, key] = GE.getParentAndKey(evaluationContext, pathParts)
+  # Find which list to apply patches to (memory or io)
+  destinationList = if pathParts[0] is "memory" then memoryPatches else ioPatches
+  # Drop "memory" or "io" off the prefix for patches
+  prefix = GE.joinPathParts(pathParts[1..])
+  # Obtain patches and append them to the destination list
+  GE.makePatches(parent[key], outputValue, path, prefix, destinationList)
+
 # Set default values in pinDefs
 GE.fillPinDefDefaults = (pinDefs) ->
   # Cannot use normal "for key, value of" loop because cannot handle replace null values

  # TODO: compile expressions ahead of time
  evaluationContext = new GE.EvaluationContext(constants, bindings)
  GE.fillPinDefDefaults(switchChip.pinDefs)
  evaluatedPins = GE.evaluateInputPinExpressions(path, evaluationContext, switchChip.pinDefs, chip.pins)

  # check which children should be activated
  activeChildren = null

  result = new GE.ChipVisitorResult()
  GE.transformersLogger = GE.makeLogFunction(path, result.logMessages)

  evaluationContext = GE.makeEvaluationContext(constants, bindings)
  GE.fillPinDefDefaults(processor.pinDefs)
  evaluatedPins = GE.evaluateInputPinExpressions(path, constants, evaluationContext, processor.pinDefs, chip.pins)

  try
    methodResult = processor.update(evaluatedPins, constants.transformers, GE.transformersLogger)
