Пример #1
0
// visitForNode impl
void BytecodeGenerator::throwIfNotRangeOp(ForNode *node) {
    AstNode* inExp = node->inExpr();
    uint32_t nodePos = node->position();
    if(!inExp->isBinaryOpNode()) {
        throw ExceptionWithPos(wrongInExprMsg(), nodePos);
    }
    TokenKind inExprOpKind = inExp->asBinaryOpNode()->kind();
    if(inExprOpKind != tRANGE) {
        throw ExceptionWithPos(wrongInExprMsg(), nodePos);
    }
}
Пример #2
0
  void insideBlock(BlockNode* node) {
    variableDeclaration(node->scope());
    functionDeclaration(node->scope());

    for (uint32_t i = 0; i < node->nodes(); i++) {
      indent();
      AstNode* current = node->nodeAt(i);
      current->visit(this);
      if (current->isCallNode() || current->isBinaryOpNode() ||
          current->isUnaryOpNode() || current->isStringLiteralNode() ||
          current->isDoubleLiteralNode() || current->isIntLiteralNode() ||
          current->isLoadNode())
        _output << ";";
      _output << endl;
    }
  }