src/compiler/HIR.h
changeset 247 7721042bdb67
parent 246 f9c4371d59d4
child 256 3c184218462d
     1.1 --- a/src/compiler/HIR.h	Thu Dec 27 21:07:03 2012 -0800
     1.2 +++ b/src/compiler/HIR.h	Fri Dec 28 17:13:51 2012 -0800
     1.3 @@ -34,6 +34,7 @@
     1.4      _(Array)                            \
     1.5      _(Store)                            \
     1.6      _(ToRef)                            \
     1.7 +    _(NewDependentArray)                \
     1.8      /* Special LValue types */          \
     1.9      _(Index)                            \
    1.10      _(Local)                            \
    1.11 @@ -306,6 +307,13 @@
    1.12      void load(BytecodeEmitter &emitter_);
    1.13      bool ref(BytecodeEmitter &emitter_);
    1.14  
    1.15 +    HIR *base() const {
    1.16 +        return left_;
    1.17 +    }
    1.18 +    HIR *index() const {
    1.19 +        return right_;
    1.20 +    }
    1.21 +
    1.22    private:
    1.23      HIR *left_;
    1.24      HIR *right_;
    1.25 @@ -515,6 +523,30 @@
    1.26      HIR *in_;
    1.27  };
    1.28  
    1.29 +class HNewDependentArray : public HIR
    1.30 +{
    1.31 +  public:
    1.32 +    HNewDependentArray(AstNode *node, Type *type, HIR *base, HIR *index)
    1.33 +      : HIR(node, type),
    1.34 +        base_(base),
    1.35 +        index_(index)
    1.36 +    {
    1.37 +    }
    1.38 +
    1.39 +    DEFINE_HIR(NewDependentArray);
    1.40 +
    1.41 +    HIR *base() const {
    1.42 +        return base_;
    1.43 +    }
    1.44 +    HIR *index() const {
    1.45 +        return index_;
    1.46 +    }
    1.47 +
    1.48 +  private:
    1.49 +    HIR *base_;
    1.50 +    HIR *index_;
    1.51 +};
    1.52 +
    1.53  #undef DEFINE_HIR
    1.54  
    1.55  void EmitHIR(Zone *zone, BytecodeEmitter &emitter, HIR *hir);