当前位置: 首页>>代码示例>>C++>>正文


C++ gc::isNull方法代码示例

本文整理汇总了C++中gc::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ gc::isNull方法的具体用法?C++ gc::isNull怎么用?C++ gc::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gc的用法示例。


在下文中一共展示了gc::isNull方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: error

  void ErrorReporter::error(gc<SourcePos> pos, const char* format, ...)
  {
    // If we're just waiting for more input, don't show any errors.
    if (needMoreLines_) return;
    
    numErrors_++;

    // TODO(bob): Hackish. Need to figure out if we want C-style, C++-style or
    // Magpie GC strings.
    char message[512];

    va_list args;
    va_start(args, format);
    vsprintf(message, format, args);
    va_end(args);

    // If we don't have any position information, just show the message.
    if (pos.isNull())
    {
      std::cerr << "Error: " << message << std::endl;
      return;
    }
    
    std::cerr << "[" << pos->file()->path() << "] Error: " << message << std::endl;

    if (pos->startLine() == pos->endLine())
    {
      // Show the line and highlight the error.
      std::cerr << pos->startLine() << ": "
                << pos->file()->getLine(pos->startLine()) << std::endl;

      // TODO(bob): Lame hack!
      int line = pos->startLine();
      while (line > 0)
      {
        std::cerr << " ";
        line /= 10;
      }

      std::cerr << "  ";
      for (int i = 1; i < pos->endCol(); i++)
      {
        std::cerr << (i < pos->startCol() ? " " : "^");
      }

      std::cerr << std::endl;
    }
    else
    {
      // Show all of the lines.
      for (int i = pos->startLine(); i <= pos->endLine(); i++)
      {
        // TODO(bob): Should pad line number so they all line up.
        std::cerr << i << ": " << pos->file()->getLine(i) << std::endl;
      }
    }
  }
开发者ID:relrod,项目名称:magpie,代码行数:57,代码来源:ErrorReporter.cpp

示例2: allocateSlotsForParam

 void Resolver::allocateSlotsForParam(gc<Pattern> pattern)
 {
   // No parameter so do nothing.
   if (pattern.isNull()) return;
   
   RecordPattern* record = pattern->asRecordPattern();
   if (record != NULL)
   {
     // Allocate each field.
     for (int i = 0; i < record->fields().count(); i++)
     {
       makeParamSlot(record->fields()[i].value);
     }
   }
   else
   {
     // If we got here, the pattern isn't a record, so it's a single slot.
     makeParamSlot(pattern);
   }
 }
开发者ID:relrod,项目名称:magpie,代码行数:20,代码来源:Resolver.cpp

示例3: destructureParam

 void Resolver::destructureParam(gc<Pattern> pattern)
 {
   // No parameter so do nothing.
   if (pattern.isNull()) return;
   
   RecordPattern* record = pattern->asRecordPattern();
   if (record != NULL)
   {
     // Resolve each field.
     for (int i = 0; i < record->fields().count(); i++)
     {
       resolveParam(record->fields()[i].value);
     }
   }
   else
   {
     // If we got here, the pattern isn't a record, so its a single slot.
     resolveParam(pattern);
   }
 }
开发者ID:relrod,项目名称:magpie,代码行数:20,代码来源:Resolver.cpp

示例4: compileArg

  int ExprCompiler::compileArg(gc<Expr> arg)
  {
    // No arg so do nothing.
    if (arg.isNull()) return 0;

    RecordExpr* record = arg->asRecordExpr();
    if (record != NULL)
    {
      // Compile each field.
      for (int i = 0; i < record->fields().count(); i++)
      {
        compile(record->fields()[i].value, makeTemp());
      }

      return record->fields().count();
    }

    // If we got here, the arg isn't a record, so its a single value.
    compile(arg, makeTemp());
    return 1;
  }
开发者ID:joshuawarner32,项目名称:magpie,代码行数:21,代码来源:ExprCompiler.cpp

示例5: compileParam

  void ExprCompiler::compileParam(PatternCompiler& compiler,
                                    gc<Pattern> param, int& slot)
  {
    // No parameter so do nothing.
    if (param.isNull()) return;

    RecordPattern* record = param->asRecordPattern();
    if (record != NULL)
    {
      // Compile each field.
      for (int i = 0; i < record->fields().count(); i++)
      {
        compileParamField(compiler, record->fields()[i].value, slot++);
      }
    }
    else
    {
      // If we got here, the pattern isn't a record, so it's a single slot.
      compileParamField(compiler, param, slot++);
    }
  }
开发者ID:joshuawarner32,项目名称:magpie,代码行数:21,代码来源:ExprCompiler.cpp

示例6: compile

  void PatternCompiler::compile(gc<Pattern> pattern, int slot)
  {
    if (pattern.isNull()) return;

    pattern->accept(*this, slot);
  }
开发者ID:joshuawarner32,项目名称:magpie,代码行数:6,代码来源:ExprCompiler.cpp


注:本文中的gc::isNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。