Пример #1
0
  void PatternCompiler::visit(TypePattern& pattern, int value)
  {
    // Evaluate the expected type.
    int expected = compiler_.makeTemp();
    compiler_.compile(pattern.type(), expected);

    // Test if the value matches the expected type.
    compiler_.write(pattern.pos(), OP_IS, value, expected, expected);
    writeTest(pattern, expected);

    compiler_.releaseTemp();
  }
Пример #2
0
 void Scope::visit(TypePattern& pattern, int dummy)
 {
   // Resolve the type expression.
   resolver_.resolve(pattern.type());
 }