本文整理汇总了C++中IParseHandlerPtr::onParse方法的典型用法代码示例。如果您正苦于以下问题:C++ IParseHandlerPtr::onParse方法的具体用法?C++ IParseHandlerPtr::onParse怎么用?C++ IParseHandlerPtr::onParse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParseHandlerPtr
的用法示例。
在下文中一共展示了IParseHandlerPtr::onParse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onParse
void ClassVariable::onParse(AnalysisResultPtr ar) {
ModifierExpressionPtr modifiers =
ar->getScope()->setModifiers(m_modifiers);
for (int i = 0; i < m_declaration->getCount(); i++) {
VariableTablePtr variables = ar->getScope()->getVariables();
ExpressionPtr exp = (*m_declaration)[i];
if (exp->is(Expression::KindOfAssignmentExpression)) {
AssignmentExpressionPtr assignment =
dynamic_pointer_cast<AssignmentExpression>(exp);
ExpressionPtr var = assignment->getVariable();
const std::string &name =
dynamic_pointer_cast<SimpleVariable>(var)->getName();
if (variables->isPresent(name)) {
ar->getCodeError()->record(CodeError::DeclaredVariableTwice, exp);
}
IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>(exp);
ph->onParse(ar);
} else {
const std::string &name =
dynamic_pointer_cast<SimpleVariable>(exp)->getName();
if (variables->isPresent(name)) {
ar->getCodeError()->record(CodeError::DeclaredVariableTwice, exp);
}
variables->add(name, TypePtr(), false, ar, exp, m_modifiers);
}
}
ar->getScope()->setModifiers(modifiers);
}
示例2: onParse
void ClassStatement::onParse(AnalysisResultPtr ar) {
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);
}
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, ar->getFileScope()));
m_classScope = classScope;
if (!ar->getFileScope()->addClass(ar, classScope)) {
m_ignored = true;
return;
}
ar->recordClassSource(m_name, ar->getFileScope()->getName());
if (m_stmt) {
ar->pushScope(classScope);
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);
}
ar->popScope();
}
}
示例3: onParse
void InterfaceStatement::onParse(AnalysisResultPtr ar, BlockScopePtr scope) {
vector<string> bases;
if (m_base) m_base->getStrings(bases);
FileScopePtr fs = dynamic_pointer_cast<FileScope>(scope);
StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this());
ClassScopePtr classScope
(new ClassScope(ClassScope::KindOfInterface, m_name, "", bases,
m_docComment, stmt));
setBlockScope(classScope);
fs->addClass(ar, classScope);
if (m_stmt) {
for (int i = 0; i < m_stmt->getCount(); i++) {
IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_stmt)[i]);
ph->onParse(ar, classScope);
}
}
}
示例4: onParse
void InterfaceStatement::onParse(AnalysisResultPtr ar) {
vector<string> bases;
if (m_base) m_base->getStrings(bases);
StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this());
ClassScopePtr classScope(new ClassScope(ClassScope::KindOfInterface,
m_name, "", bases, m_docComment, stmt,
ar->getFileScope()));
m_classScope = classScope;
ar->getFileScope()->addClass(ar, classScope);
ar->getDependencyGraph()->addParent(DependencyGraph::KindOfProgramUserClass,
"", m_originalName, stmt);
if (m_stmt) {
ar->pushScope(classScope);
for (int i = 0; i < m_stmt->getCount(); i++) {
IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_stmt)[i]);
ph->onParse(ar);
}
ar->popScope();
}
}
示例5: onParse
void ClassConstant::onParse(AnalysisResultPtr ar) {
for (int i = 0; i < m_exp->getCount(); i++) {
IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_exp)[i]);
ph->onParse(ar);
}
}