Make some clone methods statically accessible.
Change-Id: I5943c30d239a26869fefec608cb8e4a27a31aaaa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
ba3f356040
commit
91d4a02300
|
@ -950,7 +950,7 @@ ExprList *CloneExpr::clone(ExprList *list)
|
|||
|
||||
void CloneExpr::visitConst(Const *e)
|
||||
{
|
||||
cloned = block->CONST(e->type, e->value);
|
||||
cloned = cloneConst(e, block->function);
|
||||
}
|
||||
|
||||
void CloneExpr::visitString(String *e)
|
||||
|
@ -965,17 +965,12 @@ void CloneExpr::visitRegExp(RegExp *e)
|
|||
|
||||
void CloneExpr::visitName(Name *e)
|
||||
{
|
||||
if (e->id)
|
||||
cloned = block->NAME(*e->id, e->line, e->column);
|
||||
else
|
||||
cloned = block->NAME(e->builtin, e->line, e->column);
|
||||
cloned = cloneName(e, block->function);
|
||||
}
|
||||
|
||||
void CloneExpr::visitTemp(Temp *e)
|
||||
{
|
||||
Temp *t = block->function->New<Temp>();
|
||||
t->init(e->kind, e->index, e->scope);
|
||||
cloned = t;
|
||||
cloned = cloneTemp(e, block->function);
|
||||
}
|
||||
|
||||
void CloneExpr::visitClosure(Closure *e)
|
||||
|
|
|
@ -855,6 +855,33 @@ public:
|
|||
return static_cast<_Expr *>(c);
|
||||
}
|
||||
|
||||
static Const *cloneConst(Const *c, Function *f)
|
||||
{
|
||||
Const *newConst = f->New<Const>();
|
||||
newConst->init(c->type, c->value);
|
||||
return newConst;
|
||||
}
|
||||
|
||||
static Name *cloneName(Name *n, Function *f)
|
||||
{
|
||||
Name *newName = f->New<Name>();
|
||||
newName->type = n->type;
|
||||
newName->id = n->id;
|
||||
newName->builtin = n->builtin;
|
||||
newName->global = n->global;
|
||||
newName->line = n->line;
|
||||
newName->column = n->column;
|
||||
return newName;
|
||||
}
|
||||
|
||||
static Temp *cloneTemp(Temp *t, Function *f)
|
||||
{
|
||||
Temp *newTemp = f->New<Temp>();
|
||||
newTemp->init(t->kind, t->index, t->scope);
|
||||
newTemp->type = t->type;
|
||||
return newTemp;
|
||||
}
|
||||
|
||||
protected:
|
||||
V4IR::ExprList *clone(V4IR::ExprList *list);
|
||||
|
||||
|
|
Loading…
Reference in New Issue