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


C++ FileScopePtr::getName方法代码示例

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


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

示例1: analyzeInclude

void IncludeExpression::analyzeInclude(AnalysisResultPtr ar,
                                       const std::string &include) {
  ASSERT(ar->getPhase() == AnalysisResult::AnalyzeInclude);
  ConstructPtr self = shared_from_this();
  FileScopePtr file = ar->findFileScope(include, true);
  if (!file) {
    ar->getCodeError()->record(self, CodeError::PHPIncludeFileNotFound, self);
    return;
  }
  if (include.find("compiler/") != 0 ||
      include.find("/compiler/") == string::npos) {
    ar->getCodeError()->record(self, CodeError::PHPIncludeFileNotInLib,
                               self, ConstructPtr(),
                               include.c_str());
  }

  if (!isFileLevel()) { // Not unsupported but potentially bad
    ar->getCodeError()->record(self, CodeError::UseDynamicInclude, self);
  }

  ar->getDependencyGraph()->add
    (DependencyGraph::KindOfProgramMaxInclude,
     ar->getName(), file->getName(), StatementPtr());
  ar->getDependencyGraph()->addParent
    (DependencyGraph::KindOfProgramMinInclude,
     ar->getName(), file->getName(), StatementPtr());
  FunctionScopePtr func = ar->getFunctionScope();
  ar->getFileScope()->addIncludeDependency(ar, m_include,
                                           func && func->isInlined());
}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:30,代码来源:include_expression.cpp

示例2: createNewId

int CodeGenerator::createNewId(AnalysisResultPtr ar) {
  FileScopePtr fs = ar->getFileScope();
  if (fs) {
    return createNewId(fs->getName());
  }
  return createNewId("");
}
开发者ID:Neomeng,项目名称:hiphop-php,代码行数:7,代码来源:code_generator.cpp

示例3: addFileScope

void AnalysisResult::addFileScope(FileScopePtr fileScope) {
  assert(fileScope);
  FileScopePtr &res = m_files[fileScope->getName()];
  assert(!res);
  res = fileScope;
  m_fileScopes.push_back(fileScope);
}
开发者ID:fredemmott,项目名称:hhvm,代码行数:7,代码来源:analysis_result.cpp

示例4: createNewId

int CodeGenerator::createNewId(ConstructPtr cs) {
  FileScopePtr fs = cs->getFileScope();
  if (fs) {
    return createNewId(fs->getName());
  }
  return createNewId("");
}
开发者ID:Hywan,项目名称:hhvm,代码行数:7,代码来源:code_generator.cpp

示例5: CheckInclude

std::string IncludeExpression::CheckInclude(ConstructPtr includeExp,
                                            FileScopePtr scope,
                                            ExpressionPtr fileExp,
                                            bool &documentRoot) {
  auto const& container = scope->getName();
  std::string var, lit;
  parse_string_arg(fileExp, var, lit);
  if (lit.empty()) return lit;

  if (var == "__DIR__") {
    var = "";
    // get_include_file_path will check relative to the current file's dir
    // as long as the first char isn't a /
    if (lit[0] == '/') {
      lit = lit.substr(1);
    }
  }

  auto included = get_include_file_path(container, var, lit, documentRoot);
  if (!included.empty()) {
    if (included == container) {
      Compiler::Error(Compiler::BadPHPIncludeFile, includeExp);
    }
    included = FileUtil::canonicalize(included).toCppString();
    if (!var.empty()) documentRoot = true;
  }
  return included;
}
开发者ID:HilayPatel,项目名称:hhvm,代码行数:28,代码来源:include_expression.cpp

示例6: onParse

void FunctionStatement::onParse(AnalysisResultPtr ar, BlockScopePtr scope) {
  // note it's important to add to file scope, not a pushed FunctionContainer,
  // as a function may be declared inside a class's method, yet this function
  // is a global function, not a class method.
  FileScopePtr fileScope = dynamic_pointer_cast<FileScope>(scope);
  if (!fileScope->addFunction(ar, onInitialParse(ar, fileScope, false))) {
    m_ignored = true;
    return;
  }
  ar->recordFunctionSource(m_name, m_loc, fileScope->getName());
}
开发者ID:jahankhanna,项目名称:hiphop-php,代码行数:11,代码来源:function_statement.cpp

示例7: onParse

void FunctionStatement::onParse(AnalysisResultPtr ar) {
   // note it's important to add to file scope, not a pushed FunctionContainer,
  // as a function may be declared inside a class's method, yet this function
  // is a global function, not a class method.
  FileScopePtr fileScope = ar->getFileScope();
  if (!fileScope->addFunction(ar, onParseImpl(ar))) {
    m_ignored = true;
    return;
  }
  ar->recordFunctionSource(m_name, m_loc, fileScope->getName());
}
开发者ID:F4m3uS,项目名称:hiphop-php,代码行数:11,代码来源:function_statement.cpp

示例8: createNewLocalId

int CodeGenerator::createNewLocalId(AnalysisResultPtr ar) {
  FunctionScopePtr func = ar->getFunctionScope();
  if (func) {
    return func->nextInlineIndex();
  }
  FileScopePtr fs = ar->getFileScope();
  if (fs) {
    return createNewId(fs->getName());
  }
  return createNewId("");
}
开发者ID:mukulu,项目名称:hiphop-php,代码行数:11,代码来源:code_generator.cpp

示例9: onParse

void ClassStatement::onParse(AnalysisResultPtr ar, BlockScopePtr scope) {
  ClassScope::KindOf kindOf = ClassScope::KindOfObjectClass;
  switch (m_type) {
  case T_CLASS:     kindOf = ClassScope::KindOfObjectClass;   break;
  case T_ABSTRACT:  kindOf = ClassScope::KindOfAbstractClass; break;
  case T_FINAL:     kindOf = ClassScope::KindOfFinalClass;    break;
  default:
    ASSERT(false);
  }

  FileScopePtr fs = dynamic_pointer_cast<FileScope>(scope);
  vector<string> bases;
  if (!m_parent.empty()) {
    bases.push_back(m_parent);
    ar->addNonFinal(m_parent);
  }
  if (m_base) m_base->getStrings(bases);
  StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this());
  ClassScopePtr classScope(new ClassScope(kindOf, m_originalName, m_parent,
                                          bases, m_docComment,
                                          stmt));
  setBlockScope(classScope);
  if (!fs->addClass(ar, classScope)) {
    m_ignored = true;
    return;
  }
  ar->recordClassSource(m_name, m_loc, fs->getName());

  if (m_stmt) {
    bool seenConstruct = false;
    for (int i = 0; i < m_stmt->getCount(); i++) {
      MethodStatementPtr meth =
        dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]);
      if (meth && meth->getName() == "__construct") {
        seenConstruct = true;
        break;
      }
    }
    for (int i = 0; i < m_stmt->getCount(); i++) {
      if (!seenConstruct) {
        MethodStatementPtr meth =
          dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]);
        if (meth && classScope && meth->getName() == classScope->getName()
         && !meth->getModifiers()->isStatic()) {
          // class-name constructor
          classScope->setAttribute(ClassScope::ClassNameConstructor);
        }
      }
      IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_stmt)[i]);
      ph->onParse(ar, classScope);
    }
  }
}
开发者ID:dipjyotighosh,项目名称:hiphop-php,代码行数:53,代码来源:class_statement.cpp

示例10: createNewLocalId

int CodeGenerator::createNewLocalId(ConstructPtr ar) {
  if (m_wrappedExpression[m_curStream]) {
    return m_localId[m_curStream]++;
  }
  FunctionScopePtr func = ar->getFunctionScope();
  if (func) {
    return func->nextInlineIndex();
  }
  FileScopePtr fs = ar->getFileScope();
  if (fs) {
    return createNewId(fs->getName());
  }
  return createNewId("");
}
开发者ID:Hywan,项目名称:hhvm,代码行数:14,代码来源:code_generator.cpp

示例11: doRewrites

void QueryExpression::doRewrites(AnalysisResultPtr ar,
                                 FileScopePtr fileScope) {
  // Clone the query expression for client rewriting later on.
  auto csqe = static_pointer_cast<QueryExpression>(this->clone());

  // Find expressions that capture client state and turn them into
  // query parameter expression. The original expressions end up in m_queryargs.
  CaptureExtractor ce;
  auto qe = static_pointer_cast<QueryExpression>(
    ce.rewrite(static_pointer_cast<Expression>(shared_from_this())));

  // Expose the argument (capture) expressions to static analysis rather than
  // the original clause list (it is still available in m_originalExpressions).
  m_expressions = static_pointer_cast<ExpressionList>(m_expressions->clone());
  m_expressions->clearElements();
  auto queryArgs = static_pointer_cast<ExpressionList>(m_expressions->clone());
  for (auto e : ce.getCapturedExpressions()) {
    queryArgs->addElement(e);
  }
  assert(queryArgs->getCount() > 0); //syntax requires an initial from clause
  m_expressions->addElement(queryArgs);

  // Rewrite select clauses so that they become tuples of columns when
  // sent to the query provider.
  ServerSideSelectRewriter se;
  se.rewriteQuery(qe);

  // Serialize the rewritten query expression so that it can be sent to
  // the query provider as a string which it can unserialize and turn
  // into a query (unless already cached).
  std::ostringstream serialized;
  CodeGenerator cg(&serialized, CodeGenerator::Output::CodeModel,
                   &fileScope->getName());
  cg.setAstClassPrefix("Code");
  qe->outputCodeModel(cg);
  std::string s(serialized.str().c_str(), serialized.str().length());
  m_querystr = makeStaticString(s);

  // start again with the clone of the original query (not the one
  // that was rewritten for use by the query provider) and rewrite
  // it into a closure expression that is used by the query provider
  // to execute code in the context to the client, not the server.
  auto selectClosure = csqe->clientSideRewrite(ar, fileScope);
  if (selectClosure != nullptr) {
    m_expressions->addElement(selectClosure);
  }
}
开发者ID:RavenB,项目名称:hhvm,代码行数:47,代码来源:query_expression.cpp

示例12: by_filename

static bool by_filename(const FileScopePtr &f1, const FileScopePtr &f2) {
  return f1->getName() < f2->getName();
}
开发者ID:fredemmott,项目名称:hhvm,代码行数:3,代码来源:analysis_result.cpp


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