   FunctionExpressionExit: (node) ->
     @popStack()
     node
+
+###
+# Extends a class `dest`'s prototype with those from other classes in `classes`.
+# Throws an error if there's a clash.
+###
+
+safeExtend = (dest, classes) ->
+  added = {}
+  classes.forEach (klass) ->
+    for key, fn of klass::
+      if klass::hasOwnProperty(key)
+        if added[key] and key isnt 'constructor'
+          throw new Error("Conflict with member '#{key}'")
+        dest::[key] = fn
+        added[key] = true
+  dest


module.exports =
class TransformerBase
  @run: (ast, options, classes, ctx) ->
    Xformer = class extends TransformerBase
    
    classes.forEach (klass) ->
      extend(Xformer.prototype, klass.prototype)

    xform = new Xformer(ast, options)
    result = xform.run()

    ctx.warnings ?= []
    ctx.warnings = ctx.warnings.concat(xform.warnings)

    result

  constructor: (@ast, @options) ->

  buildError
  clone
} = require('../helpers')

###**
# TransformerBase:
