本文整理汇总了C++中BlockScopePtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockScopePtr::get方法的具体用法?C++ BlockScopePtr::get怎么用?C++ BlockScopePtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockScopePtr
的用法示例。
在下文中一共展示了BlockScopePtr::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inferAndCheck
TypePtr SimpleVariable::inferAndCheck(AnalysisResultPtr ar, TypePtr type,
bool coerce) {
IMPLEMENT_INFER_AND_CHECK_ASSERT(getScope());
resetTypes();
TypePtr ret;
ConstructPtr construct = shared_from_this();
BlockScopePtr scope = getScope();
VariableTablePtr variables = scope->getVariables();
// check function parameter that can occur in lval context
if (m_sym && m_sym->isParameter() &&
m_context & (LValue | RefValue | DeepReference |
UnsetContext | InvokeArgument | OprLValue | DeepOprLValue)) {
m_sym->setLvalParam();
}
if (coerce && m_sym && type && type->is(Type::KindOfAutoSequence)) {
TypePtr t = m_sym->getType();
if (!t || t->is(Type::KindOfVoid) ||
t->is(Type::KindOfSome) || t->is(Type::KindOfArray)) {
type = Type::Array;
}
}
if (m_this) {
ret = Type::Object;
ClassScopePtr cls = getOriginalClass();
if (cls && (hasContext(ObjectContext) || !cls->derivedByDynamic())) {
ret = Type::CreateObjectType(cls->getName());
}
if (!hasContext(ObjectContext) &&
variables->getAttribute(VariableTable::ContainsDynamicVariable)) {
if (variables->getAttribute(VariableTable::ContainsLDynamicVariable)) {
ret = Type::Variant;
}
ret = variables->add(m_sym, ret, true, ar,
construct, scope->getModifiers());
}
} else if ((m_context & (LValue|Declaration)) &&
!(m_context & (ObjectContext|RefValue))) {
if (m_globals) {
ret = Type::Array;
} else if (m_superGlobal) {
ret = m_superGlobalType;
} else if (m_superGlobalType) { // For system
ret = variables->add(m_sym, m_superGlobalType,
((m_context & Declaration) != Declaration), ar,
construct, scope->getModifiers());
} else {
ret = variables->add(m_sym, type,
((m_context & Declaration) != Declaration), ar,
construct, scope->getModifiers());
}
} else {
if (m_superGlobalType) {
ret = m_superGlobalType;
} else if (m_globals) {
ret = Type::Array;
} else if (scope->is(BlockScope::ClassScope)) {
assert(getClassScope().get() == scope.get());
// ClassVariable expression will come to this block of code
ret = getClassScope()->checkProperty(getScope(), m_sym, type, true, ar);
} else {
TypePtr tmpType = type;
if (m_context & RefValue) {
tmpType = Type::Variant;
coerce = true;
}
ret = variables->checkVariable(m_sym, tmpType, coerce, ar, construct);
if (ret && (ret->is(Type::KindOfSome) || ret->is(Type::KindOfAny))) {
ret = Type::Variant;
}
}
}
// if m_assertedType is set, then this is a type assertion node
TypePtr inType = m_assertedType ?
GetAssertedInType(ar, m_assertedType, ret) : ret;
TypePtr actual = propagateTypes(ar, inType);
setTypes(ar, actual, type);
if (Type::SameType(actual, ret)) {
m_implementedType.reset();
} else {
m_implementedType = ret;
}
return actual;
}