Changeset 134

Show
Ignore:
Timestamp:
09/06/07 01:38:05 (5 years ago)
Author:
Gregor
Message:

Implemented: aarray[index], better typeinfo generation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tdcsrc/expression.cc

    r133 r134  
    534534                        e2->toElem(irs)->toC() + "])"); 
    535535 
     536    } else if (e1->type->ty == Taarray) { 
     537        e2->type->vtinfo->toObjFile(); 
     538        return new elem("(*((" + e1->type->pointerTo()->toCtype()->toC("") + ") _aaGet(" + 
     539                        e1->toElem(irs)->toC() + ", (void *) &" + 
     540                        e2->type->vtinfo->mangle() + ", sizeof(" + 
     541                        type->toCtype()->toC("") + "), " + 
     542                        e2->toElem(irs)->toC() + ")))"); 
     543 
    536544    } else { 
    537545        return new elem("(" + e1->toElem(irs)->toC() + "[" + 
     
    808816elem *VarExp::toElem(IRState *irs) 
    809817{ 
     818    // make sure it's genreated 
     819    if (var->parent && var->parent->isModule()) 
     820        var->toObjFile(); 
     821 
    810822    /* if this is in a function scope, we need to figure out what parent level 
    811823     * it is */ 
  • trunk/tdcsrc/module.cc

    r123 r134  
    8282    tdc_func_def = ""; 
    8383    tdc_var_def = ""; 
     84    handled.clear(); 
    8485 
    8586    // then output the content 
  • trunk/tdcsrc/objfile.cc

    r132 r134  
    169169 
    170170    // this may be extern 
    171     if (storage_class & STCextern || !fbody) { 
     171    if (storage_class & STCextern || 
     172        !fbody || 
     173        getModule() != tdc_cur_mod) { 
    172174        // in which case we're done 
    173175        return; 
     
    255257{ 
    256258    CHECK_HANDLED_VOID((void *) this); 
    257     if (tinfo->builtinTypeInfo()) return; 
    258259 
    259260    switch (tinfo->ty) { 
     
    269270                    mangle()); 
    270271            tdc_var_decl += "extern " + def + ";\n"; 
     272            if (tinfo->builtinTypeInfo()) return; 
    271273 
    272274            // the actual typeinfo 
     
    290292                    mangle()); 
    291293            tdc_var_decl += "extern " + def + ";\n"; 
     294            if (tinfo->builtinTypeInfo()) return; 
    292295 
    293296            def += string(" = {\n&") + 
     
    300303            return; 
    301304        } 
     305 
     306        default: 
     307        { 
     308            if (tinfo->builtinTypeInfo()) { 
     309                // we just need a reference 
     310                Type::typeinfo->toObjFile(); 
     311                tdc_var_decl += "extern struct " + 
     312                    Type::typeinfo->type->toCtype()->toC(mangle()) + ";\n"; 
     313                return; 
     314            } 
     315        } 
    302316    } 
    303317 
  • trunk/tdcsrc/tdc_c.h

    r133 r134  
    194194 
    195195void _aaDel(void *aa, void *keyti, ...); 
     196void* _aaGet(void *aa, void *keyti, size_t valuesize, ...); 
    196197void _d_assert(struct Array, uint32_t); 
    197198void _d_assert_msg(struct Array, struct Array, uint32_t);