jitcraft/Parser.cpp
changeset 57 8f1e74d35718
parent 56 abb4ae5bc915
child 59 b7d61ddb3c8d
     1.1 --- a/jitcraft/Parser.cpp	Sat Jul 07 20:58:13 2012 -0700
     1.2 +++ b/jitcraft/Parser.cpp	Sat Jul 07 21:01:39 2012 -0700
     1.3 @@ -33,7 +33,7 @@
     1.4      scope_(NULL),
     1.5      unbound_(NULL)
     1.6  {
     1.7 -    unbound_ = new std::vector<NameProxy *>();
     1.8 +    unbound_ = new (pool_) PoolList<NameProxy *>();
     1.9  }
    1.10  
    1.11  bool
    1.12 @@ -69,8 +69,8 @@
    1.13  {
    1.14      BoundName *bound = scope_->lookup(name);
    1.15      NameProxy *proxy = new (pool_) NameProxy(scanner_.begin(), name, bound);
    1.16 -    if (!bound)
    1.17 -        unbound_->push_back(proxy);
    1.18 +    if (!bound && !unbound_->append(proxy))
    1.19 +        return NULL;
    1.20      return proxy;
    1.21  }
    1.22  
    1.23 @@ -804,7 +804,7 @@
    1.24              return NULL;
    1.25      }
    1.26  
    1.27 -    EnumStatement::EntryList *entries = new EnumStatement::EntryList();
    1.28 +    EnumStatement::EntryList *entries = new (pool_) EnumStatement::EntryList();
    1.29  
    1.30      if (!expect(TOK_LBRACE))
    1.31          return NULL;
    1.32 @@ -832,7 +832,8 @@
    1.33                  return NULL;
    1.34          }
    1.35  
    1.36 -        entries->push_back(EnumStatement::Entry(constant, expr));
    1.37 +        if (!entries->append(EnumStatement::Entry(constant, expr)))
    1.38 +            return NULL;
    1.39      } while (match(TOK_COMMA));
    1.40      if (!expect(TOK_RBRACE))
    1.41          return NULL;
    1.42 @@ -864,7 +865,7 @@
    1.43      if (!scope)
    1.44          return NULL;
    1.45  
    1.46 -    ParameterList *parameters = new ParameterList();
    1.47 +    ParameterList *parameters = new (pool_) ParameterList();
    1.48  
    1.49      if (!expect(TOK_LPAREN))
    1.50          return NULL;
    1.51 @@ -886,7 +887,8 @@
    1.52  
    1.53              Local<String> tag(zone_);
    1.54              Parameter *parameter = new (pool_) Parameter(arg, tag, ref);
    1.55 -            parameters->push_back(parameter);
    1.56 +            if (!parameters->append(parameter))
    1.57 +                return NULL;
    1.58  
    1.59              if (!match(TOK_COMMA))
    1.60                  break;
    1.61 @@ -1080,7 +1082,7 @@
    1.62          prefix();
    1.63          fprintf(fp_, "[ EnumStatement (%s)\n", node->name() ? node->name()->chars() : "<anonymous>");
    1.64          indent();
    1.65 -        for (size_t i = 0; i < node->entries()->size(); i++) {
    1.66 +        for (size_t i = 0; i < node->entries()->length(); i++) {
    1.67              prefix();
    1.68              fprintf(fp_, "%s =\n", node->entries()->at(i).name->name()->chars());
    1.69              if (node->entries()->at(i).expr) {