本文整理汇总了C++中ParameterExpressionPtr::hasUserType方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterExpressionPtr::hasUserType方法的具体用法?C++ ParameterExpressionPtr::hasUserType怎么用?C++ ParameterExpressionPtr::hasUserType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterExpressionPtr
的用法示例。
在下文中一共展示了ParameterExpressionPtr::hasUserType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onParseRecur
void MethodStatement::onParseRecur(AnalysisResultConstPtr ar,
ClassScopePtr classScope) {
FunctionScopeRawPtr fs = getFunctionScope();
const bool isNative = fs->isNative();
if (m_modifiers) {
if (classScope->isInterface()) {
if (m_modifiers->isProtected() || m_modifiers->isPrivate() ||
m_modifiers->isAbstract() || m_modifiers->isFinal() ||
isNative) {
m_modifiers->parseTimeFatal(
Compiler::InvalidAttribute,
"Access type for interface method %s::%s() must be omitted",
classScope->getOriginalName().c_str(), getOriginalName().c_str());
}
}
if (m_modifiers->isAbstract()) {
if (m_modifiers->isPrivate() || m_modifiers->isFinal() || isNative) {
m_modifiers->parseTimeFatal(
Compiler::InvalidAttribute,
"Cannot declare abstract method %s::%s() %s",
classScope->getOriginalName().c_str(),
getOriginalName().c_str(),
m_modifiers->isPrivate() ? "private" :
(m_modifiers->isFinal() ? "final" : "native"));
}
if (!classScope->isInterface() && !classScope->isAbstract()) {
/* note that classScope->isAbstract() returns true for traits */
m_modifiers->parseTimeFatal(Compiler::InvalidAttribute,
"Class %s contains abstract method %s and "
"must therefore be declared abstract",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
if (getStmts()) {
parseTimeFatal(Compiler::InvalidAttribute,
"Abstract method %s::%s() cannot contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
}
if (isNative) {
if (getStmts()) {
parseTimeFatal(Compiler::InvalidAttribute,
"Native method %s::%s() cannot contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
if (!m_retTypeAnnotation) {
parseTimeFatal(Compiler::InvalidAttribute,
"Native method %s::%s() must have a return type hint",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
}
}
if ((!m_modifiers || !m_modifiers->isAbstract()) &&
!getStmts() && !classScope->isInterface() && !isNative) {
parseTimeFatal(Compiler::InvalidAttribute,
"Non-abstract method %s::%s() must contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
classScope->addFunction(ar, fs);
m_className = classScope->getName();
m_originalClassName = classScope->getOriginalName();
setSpecialMethod(classScope);
if (Option::DynamicInvokeFunctions.find(getFullName()) !=
Option::DynamicInvokeFunctions.end()) {
fs->setDynamicInvoke();
}
if (m_params) {
for (int i = 0; i < m_params->getCount(); i++) {
ParameterExpressionPtr param =
dynamic_pointer_cast<ParameterExpression>((*m_params)[i]);
param->parseHandler(classScope);
if (isNative && !param->hasUserType()) {
parseTimeFatal(Compiler::InvalidAttribute,
"Native method calls must have type hints on all args");
}
}
}
FunctionScope::RecordFunctionInfo(m_name, fs);
}
示例2: onParseRecur
//.........这里部分代码省略.........
getOriginalName().c_str(),
m_modifiers->isPrivate() ? "private" :
(m_modifiers->isFinal() ? "final" : "native"));
}
if (!classScope->isInterface() && !classScope->isAbstract()) {
/* note that classScope->isAbstract() returns true for traits */
m_modifiers->parseTimeFatal(fileScope,
Compiler::InvalidAttribute,
"Class %s contains abstract method %s and "
"must therefore be declared abstract",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
if (getStmts()) {
parseTimeFatal(fileScope,
Compiler::InvalidAttribute,
"Abstract method %s::%s() cannot contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
if (m_modifiers->isAsync()) {
m_modifiers->parseTimeFatal(
fileScope,
Compiler::InvalidAttribute,
Strings::ASYNC_WITHOUT_BODY,
"abstract", classScope->getOriginalName().c_str(),
getOriginalName().c_str()
);
}
}
if (!m_modifiers->isStatic() && classScope->isStaticUtil()) {
m_modifiers->parseTimeFatal(
fileScope,
Compiler::InvalidAttribute,
"Class %s contains non-static method %s and "
"therefore cannot be declared 'abstract final'",
classScope->getOriginalName().c_str(),
getOriginalName().c_str()
);
}
if (isNative) {
if (getStmts()) {
parseTimeFatal(fileScope,
Compiler::InvalidAttribute,
"Native method %s::%s() cannot contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
auto is_ctordtor = isNamed("__construct") || isNamed("__destruct");
if (!m_retTypeAnnotation && !is_ctordtor) {
parseTimeFatal(fileScope,
Compiler::InvalidAttribute,
"Native method %s::%s() must have a return type hint",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
} else if (m_retTypeAnnotation &&
is_ctordtor &&
(m_retTypeAnnotation->dataType() != KindOfNull)) {
parseTimeFatal(fileScope,
Compiler::InvalidAttribute,
"Native method %s::%s() must return void",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
}
}
if ((!m_modifiers || !m_modifiers->isAbstract()) &&
!getStmts() && !classScope->isInterface() && !isNative) {
parseTimeFatal(fileScope,
Compiler::InvalidAttribute,
"Non-abstract method %s::%s() must contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
classScope->addFunction(ar, fileScope, funcScope);
setSpecialMethod(fileScope, classScope);
if (Option::DynamicInvokeFunctions.count(getOriginalFullName())) {
funcScope->setDynamicInvoke();
}
if (m_params) {
auto nParams = m_params->getCount();
for (int i = 0; i < nParams; i++) {
ParameterExpressionPtr param =
dynamic_pointer_cast<ParameterExpression>((*m_params)[i]);
param->parseHandler(fileScope, classScope);
// Variadic capture params don't need types because they'll
// be treated as Arrays as far as HNI is concerned.
if (isNative && !param->hasUserType() && !param->isVariadic()) {
parseTimeFatal(fileScope,
Compiler::InvalidAttribute,
"Native method calls must have type hints on all args");
}
}
}
FunctionScope::RecordFunctionInfo(m_originalName, funcScope);
}
示例3: onParseRecur
//.........这里部分代码省略.........
}
if (m_modifiers->isAsync()) {
m_modifiers->parseTimeFatal(
Compiler::InvalidAttribute,
Strings::ASYNC_WITHOUT_BODY,
"interface", classScope->getOriginalName().c_str(),
getOriginalName().c_str()
);
}
if (getStmts()) {
getStmts()->parseTimeFatal(
Compiler::InvalidMethodDefinition,
"Interface method %s::%s() cannot contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
}
if (m_modifiers->isAbstract()) {
if (m_modifiers->isPrivate() || m_modifiers->isFinal() || isNative) {
m_modifiers->parseTimeFatal(
Compiler::InvalidAttribute,
"Cannot declare abstract method %s::%s() %s",
classScope->getOriginalName().c_str(),
getOriginalName().c_str(),
m_modifiers->isPrivate() ? "private" :
(m_modifiers->isFinal() ? "final" : "native"));
}
if (!classScope->isInterface() && !classScope->isAbstract()) {
/* note that classScope->isAbstract() returns true for traits */
m_modifiers->parseTimeFatal(Compiler::InvalidAttribute,
"Class %s contains abstract method %s and "
"must therefore be declared abstract",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
if (getStmts()) {
parseTimeFatal(Compiler::InvalidAttribute,
"Abstract method %s::%s() cannot contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
if (m_modifiers->isAsync()) {
m_modifiers->parseTimeFatal(
Compiler::InvalidAttribute,
Strings::ASYNC_WITHOUT_BODY,
"abstract", classScope->getOriginalName().c_str(),
getOriginalName().c_str()
);
}
}
if (isNative) {
if (getStmts()) {
parseTimeFatal(Compiler::InvalidAttribute,
"Native method %s::%s() cannot contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
if (!m_retTypeAnnotation) {
parseTimeFatal(Compiler::InvalidAttribute,
"Native method %s::%s() must have a return type hint",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
}
}
if ((!m_modifiers || !m_modifiers->isAbstract()) &&
!getStmts() && !classScope->isInterface() && !isNative) {
parseTimeFatal(Compiler::InvalidAttribute,
"Non-abstract method %s::%s() must contain body",
classScope->getOriginalName().c_str(),
getOriginalName().c_str());
}
classScope->addFunction(ar, fs);
m_className = classScope->getName();
m_originalClassName = classScope->getOriginalName();
setSpecialMethod(classScope);
if (Option::DynamicInvokeFunctions.find(getFullName()) !=
Option::DynamicInvokeFunctions.end()) {
fs->setDynamicInvoke();
}
if (m_params) {
auto nParams = m_params->getCount();
for (int i = 0; i < nParams; i++) {
ParameterExpressionPtr param =
dynamic_pointer_cast<ParameterExpression>((*m_params)[i]);
param->parseHandler(classScope);
// Variadic capture params don't need types because they'll
// be treated as Arrays as far as HNI is concerned.
if (isNative && !param->hasUserType() && !param->isVariadic()) {
parseTimeFatal(Compiler::InvalidAttribute,
"Native method calls must have type hints on all args");
}
}
}
FunctionScope::RecordFunctionInfo(m_name, fs);
}