     (output[key]: val) for key, val of input
     output
 
+# Merge objects.
+merge: (src, dest) ->
+  dest[key]: val for key, val of src
+  dest
+
 # Delete a key from an object, returning the value.
 del: (obj, key) ->
   val: obj[key]
   delete obj[key]
   val
 
+# Quickie inheritance convenience wrapper to reduce typing.
+inherit: (parent, props) ->
+  klass: props.constructor
+  delete props.constructor
+  klass extends parent
+  klass.prototype[name]: prop for name, prop of props
+  klass
+
 # # Provide a quick implementation of a children method.
 # children: (klass, attrs...) ->
 #   klass::children: ->

  false

# Default implementations of the common node methods.
Node::unwrap:         -> this
Node::children:       []
Node::statement:      -> false
Node::statement_only: -> false
Node::top_sensitive:  -> false


# A collection of nodes, each one representing an expression.
Expressions: exports.Expressions: (nodes...) ->
  @expressions: flatten nodes
  @children: @expressions

Expressions extends Node
statement Expressions

# Wrap up a node as an Expressions, unless it already is.
Expressions::wrap: (nodes...) ->
  return nodes[0] if nodes.length is 1 and nodes[0] instanceof Expressions
  new Expressions(nodes...)

# Tack an expression on to the end of this expression list.
Expressions::push: (node) ->
  @expressions.push(node)
  this

# Tack an expression on to the beginning of this expression list.
Expressions::unshift: (node) ->
  @expressions.unshift(node)
  this

# If this Expressions consists of a single node, pull it back out.
Expressions::unwrap: ->
  if @expressions.length is 1 then @expressions[0] else this

# Is this an empty block of code?
Expressions::empty: ->
  @expressions.length is 0

# Is the node last in this block of expressions?
Expressions::is_last: (node) ->
  l: @expressions.length
  @last_index ||= if @expressions[l - 1] instanceof CommentNode then -2 else -1
  node is @expressions[l - @last_index]

Expressions::compile: (o) ->
  if o.scope then super(o) else @compile_root(o)

# Compile each expression in the Expressions body.
Expressions::compile_node: (o) ->
  (@compile_expression(node, dup(o)) for node in @expressions).join("\n")

# If this is the top-level Expressions, wrap everything in a safety closure.
Expressions::compile_root: (o) ->
  o.indent: @indent: indent: if o.no_wrap then '' else TAB
  o.scope: new Scope(null, this, null)
  code: if o.globals then @compile_node(o) else @compile_with_declarations(o)
  code: code.replace(TRAILING_WHITESPACE, '')
  if o.no_wrap then code else "(function(){\n"+code+"\n})();"


































# Mark a node as a statement, or a statement only.
statement: (klass, only) ->
  klass::is_statement:       -> true
  klass::is_statement_only:  -> true if only


# The abstract base class for all CoffeeScript nodes.
