     value = @value.unwrapAll().compileExpression o
     variable = o.namespace.find name
     if @context is ":="
-      throw SyntaxError "variable \"#{name}\" is already declared" if variable?
+      throw SyntaxError "variable \"#{name}\" is already declared" if variable?.namespace is o.namespace
       variable = o.namespace.createVariable name, value.type
       variable.asm = ":#{variable.mangledName()} dat 0"
     else

    {type: getType(new Type "func"), access: @func.label}

  compileFunc: (o) ->
    code = "; TODO function body here"
    ":#{@func.label}\n#{code}"

  children: ['params', 'body']



  # A **Block** is the only node that can serve as the root.
  compileRoot: ->
    o = {namespace: new GlobalNamespace}
    o.namespace.createVariable("printc", getType new Type "func", [intType]).asm = stdlib.printc
    o.namespace.createVariable("prints", getType new Type "func", [stringType]).asm = stdlib.prints
    code = @compileStatement o
