private void emitVariableDefinition(FunctionDefinitionNode function,IAssemblyEmitter writer, VariableDefinition def) 
    {
        final DataType type = def.getDataType();
        
        final LabelDefinition label = labelManager.defineLabel( def );
        final boolean hasValue = def.hasChildren();

        final String debug = ( def.isGlobalVariable() ? "global" : "" )+" var init: "+def;
        if ( type.isPtr() || ! def.isArrayDefinition() ) 
        {
            if ( type.isPtr() && type.getPtrCount() > 1 ) {
                throw new RuntimeException("ptr type "+type+" with more than one level of indirection currently not supported");
            }
            
            // direct value assignment
            writer.outputValues( label , Collections.singletonList("0") , debug );
            
            if ( hasValue ) 
            {
                emit( function , def.getScope() , def.child(0) , writer );
                SlotMapping target = writer.getHandle( def ); 
                writer.storeValue( target , "assignment: "+def.getDataType()+" "+def.getName()+" = ...");
            } 
            writer.endOfStatement(def);
            return;
        }
        
        // array assignment
        if ( ! hasValue ) {
        
            // just reserve elements
            writer.reserveUninitializedMemory( label , def.getElementCount() , debug );
        } else {
            writer.outputValues( label , valuesToString( def.getChildren() ) );
        }
        writer.endOfStatement(def);
    }