예제 #1
0
void
Parser::elaborate_coroutine_definition(Coroutine_decl &decl){
  Enter_scope scope(cxt);
  for(Decl& d: decl.parameters())
    declare(cxt, d);
  Function_def* def = dynamic_cast<Function_def*>(&decl.definition());
  if (def == nullptr){
    std::cout << "ERROR\n";
  }


  Stmt& stmt = elaborate_compound_statement(def->statement());
  def->stmt_ = &stmt;
  decl.def_ = def;
}
예제 #2
0
void
Parser::elaborate_function_definition(Function_decl& decl, Function_def& def)
{
  // Declare parameters as local variables prior to elaborating
  // the definition.
  //
  // TODO: Should we be using a specifici kind of scope here?
  Enter_scope scope(cxt);
  for (Decl& d : decl.parameters())
    declare(cxt, d);

  // Elaborate the definition's statement, possibly parsing it.
  Stmt& stmt = elaborate_compound_statement(def.statement());

  // Update the definition with the new statement. We don't need
  // to update the declaration.
  def.stmt_ = &stmt;
}
예제 #3
0
 void operator()(Function_def& d)   { elab.statement(d.statement()); }