Significantly reduce the tendrils of DeclSpecs/Declarator/Declaration code
The stuff in decl.h/decl.cpp is messy, largely due to its close mapping to C-style variable declarations. This checkin has updated code throughout all of the declaration statement, variable, and function code that operates on symbols and types directly. Thus, Decl* related stuff is now localized to decl.h/decl.cpp and the parser. Issue #13.
This commit is contained in:
12
stmt.h
12
stmt.h
@@ -82,11 +82,19 @@ public:
|
||||
};
|
||||
|
||||
|
||||
struct VariableDeclaration {
|
||||
VariableDeclaration(Symbol *s = NULL, Expr *i = NULL) {
|
||||
sym = s; init = i;
|
||||
}
|
||||
Symbol *sym;
|
||||
Expr *init;
|
||||
};
|
||||
|
||||
/** @brief Statement representing a single declaration (which in turn may declare
|
||||
a number of variables. */
|
||||
class DeclStmt : public Stmt {
|
||||
public:
|
||||
DeclStmt(SourcePos pos, Declaration *declaration, SymbolTable *symbolTable);
|
||||
DeclStmt(const std::vector<VariableDeclaration> &v, SourcePos pos);
|
||||
|
||||
void EmitCode(FunctionEmitContext *ctx) const;
|
||||
void Print(int indent) const;
|
||||
@@ -95,7 +103,7 @@ public:
|
||||
Stmt *TypeCheck();
|
||||
int EstimateCost() const;
|
||||
|
||||
Declaration *declaration;
|
||||
std::vector<VariableDeclaration> vars;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user