src/BytecodeCompiler.cpp
changeset 147 9c544823d090
parent 146 dc7d3b7a918c
child 148 c0740249963c
     1.1 --- a/src/BytecodeCompiler.cpp	Sat Aug 04 17:51:43 2012 -0700
     1.2 +++ b/src/BytecodeCompiler.cpp	Sat Aug 04 19:33:06 2012 -0700
     1.3 @@ -758,12 +758,24 @@
     1.4              __ note_position(node->pos());
     1.5              __ arraycopy();
     1.6          }
     1.7 +    } else if (type->isStruct()) {
     1.8 +        Local<Map> map(zone_, type->newMap());
     1.9 +        if (var->scope()->kind() == Scope::GLOBAL)
    1.10 +            __ newstruct(map, Heap::Tenure_Old);
    1.11 +        else if (var->needsHeapAllocation())
    1.12 +            __ newstruct(map, Heap::Tenure_Default);
    1.13 +        else
    1.14 +            __ newstruct(map, Heap::Tenure_Stack);
    1.15      } else {
    1.16          if (node->initialization()) {
    1.17              node->initialization()->accept(this);
    1.18          } else {
    1.19 -            if (!node->postDimensions())
    1.20 +            if (type->isInt32OrEnum() || type->isBool()) {
    1.21                  __ int_(0);
    1.22 +            } else {
    1.23 +                assert(type->isFloat());
    1.24 +                __ float_(0);
    1.25 +            }
    1.26          }
    1.27      }
    1.28