1.1 --- a/jitcraft/AST.h Sat Jun 30 20:20:39 2012 -0700
1.2 +++ b/jitcraft/AST.h Sat Jun 30 22:31:14 2012 -0700
1.3 @@ -176,6 +176,31 @@
1.4 }
1.5 };
1.6
1.7 +class Parameter : public PoolObject
1.8 +{
1.9 + Variable *variable_;
1.10 + Name *tag_;
1.11 + bool reference_;
1.12 +
1.13 + public:
1.14 + Parameter(Variable *var, Name *tag, bool reference)
1.15 + : variable_(var),
1.16 + tag_(tag),
1.17 + reference_(reference)
1.18 + {
1.19 + }
1.20 +
1.21 + Name *tag() const {
1.22 + return tag_;
1.23 + }
1.24 + Variable *variable() const {
1.25 + return variable_;
1.26 + }
1.27 + bool reference() const {
1.28 + return reference_;
1.29 + }
1.30 +};
1.31 +
1.32 class NameProxy : public Expression
1.33 {
1.34 Name *name_;
1.35 @@ -528,17 +553,21 @@
1.36 }
1.37 };
1.38
1.39 +typedef std::vector<Parameter *> ParameterList;
1.40 +
1.41 class FunctionStatement : public Statement
1.42 {
1.43 Scope *scope_;
1.44 NamedFunction *fun_;
1.45 Statement *body_;
1.46 + ParameterList *parameters_;
1.47
1.48 public:
1.49 - FunctionStatement(Scope *scope, NamedFunction *fun, Statement *body)
1.50 + FunctionStatement(Scope *scope, NamedFunction *fun, Statement *body, ParameterList *parameters)
1.51 : scope_(scope),
1.52 fun_(fun),
1.53 - body_(body)
1.54 + body_(body),
1.55 + parameters_(parameters)
1.56 {
1.57 }
1.58
1.59 @@ -554,6 +583,9 @@
1.60 Statement *body() const {
1.61 return body_;
1.62 }
1.63 + ParameterList *parameters() const {
1.64 + return parameters_;
1.65 + }
1.66 void accept(AstVisitor *visitor) {
1.67 visitor->visit(this);
1.68 }