Uh, Updates?
This commit is contained in:
+10
-10
@@ -69,9 +69,9 @@ void VarDeclNode::proto(DeclSeq *d, Environ *e) {
|
||||
|
||||
|
||||
if (!c) ex("Expression must be constant");
|
||||
if (ty == Type::int_type) ty = d_new ConstType(c->intValue());
|
||||
else if (ty == Type::float_type) ty = d_new ConstType(c->floatValue());
|
||||
else ty = d_new ConstType(c->stringValue());
|
||||
if (ty == Type::int_type) ty = new ConstType(c->intValue());
|
||||
else if (ty == Type::float_type) ty = new ConstType(c->floatValue());
|
||||
else ty = new ConstType(c->stringValue());
|
||||
e->types.push_back(ty);
|
||||
delete expr; expr = 0;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ void VarDeclNode::proto(DeclSeq *d, Environ *e) {
|
||||
|
||||
Decl *decl = d->insertDecl(ident, ty, kind, defType);
|
||||
if (!decl) ex("Duplicate variable name");
|
||||
if (expr) sem_var = d_new DeclVarNode(decl);
|
||||
if (expr) sem_var = new DeclVarNode(decl);
|
||||
}
|
||||
|
||||
void VarDeclNode::semant(Environ *e) {
|
||||
@@ -106,9 +106,9 @@ void VarDeclNode::translate(Codegen *g) {
|
||||
//////////////////////////
|
||||
void FuncDeclNode::proto(DeclSeq *d, Environ *e) {
|
||||
Type *t = tagType(tag, e); if (!t) t = Type::int_type;
|
||||
a_ptr<DeclSeq> decls(d_new DeclSeq());
|
||||
a_ptr<DeclSeq> decls(new DeclSeq());
|
||||
params->proto(decls, e);
|
||||
sem_type = d_new FuncType(t, decls.release(), false, false);
|
||||
sem_type = new FuncType(t, decls.release(), false, false);
|
||||
if (!d->insertDecl(ident, sem_type, DECL_FUNC)) {
|
||||
delete sem_type; ex("duplicate identifier");
|
||||
}
|
||||
@@ -117,7 +117,7 @@ void FuncDeclNode::proto(DeclSeq *d, Environ *e) {
|
||||
|
||||
void FuncDeclNode::semant(Environ *e) {
|
||||
|
||||
sem_env = d_new Environ(genLabel(), sem_type->returnType, 1, e);
|
||||
sem_env = new Environ(genLabel(), sem_type->returnType, 1, e);
|
||||
DeclSeq *decls = sem_env->decls;
|
||||
|
||||
int k;
|
||||
@@ -156,7 +156,7 @@ void FuncDeclNode::translate(Codegen *g) {
|
||||
//leave the function
|
||||
g->label(sem_env->funcLabel + "_leave");
|
||||
t = deleteVars(sem_env);
|
||||
if (g->debug) t = d_new TNode(IR_SEQ, call("__bbDebugLeave"), t);
|
||||
if (g->debug) t = new TNode(IR_SEQ, call("__bbDebugLeave"), t);
|
||||
g->leave(t, sem_type->params->size() * 4);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ void FuncDeclNode::translate(Codegen *g) {
|
||||
// Type Declaration //
|
||||
//////////////////////
|
||||
void StructDeclNode::proto(DeclSeq *d, Environ *e) {
|
||||
sem_type = d_new StructType(ident, d_new DeclSeq());
|
||||
sem_type = new StructType(ident, new DeclSeq());
|
||||
if (!d->insertDecl(ident, sem_type, DECL_STRUCT)) {
|
||||
delete sem_type; ex("Duplicate identifier");
|
||||
}
|
||||
@@ -262,7 +262,7 @@ void VectorDeclNode::proto(DeclSeq *d, Environ *env) {
|
||||
sizes.push_back(n + 1);
|
||||
}
|
||||
string label = genLabel();
|
||||
sem_type = d_new VectorType(label, ty, sizes);
|
||||
sem_type = new VectorType(label, ty, sizes);
|
||||
if (!d->insertDecl(ident, sem_type, kind)) {
|
||||
delete sem_type; ex("Duplicate identifier");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user