Пример #1
0
  void Resolver::visit(MatchExpr& expr, int dummy)
  {
    // Resolve the value.
    resolve(expr.value());

    // Resolve each case.
    for (int i = 0; i < expr.cases().count(); i++)
    {
      Scope caseScope(this);
      const MatchClause& clause = expr.cases()[i];
      
      // Resolve the pattern (will be null for the else case).
      if (!clause.pattern().isNull())
      {
        scope_->resolve(*clause.pattern());
      }

      // Resolve the body.
      resolve(clause.body());
      caseScope.end();
    }
  }
Пример #2
0
 void ExprCompiler::visit(MatchExpr& expr, int dest)
 {
   compile(expr.value(), dest);
   compileMatch(expr.cases(), dest);
 }