本文整理汇总了C++中ASTType::getObjectClass方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTType::getObjectClass方法的具体用法?C++ ASTType::getObjectClass怎么用?C++ ASTType::getObjectClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTType
的用法示例。
在下文中一共展示了ASTType::getObjectClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isDerivedFrom
bool ASTType::isDerivedFrom(const ASTType& that) const
{
if ( !isUnknown() && !that.isUnknown() )
{
return that.getObjectClass().isBase(getObjectClass())
|| that.getObjectClass().isImplementing(getObjectClass());
}
return false;
}
示例2: greater
/// \brief Test whether that is greater than this type
bool ASTType::greater(const ASTType& that) const
{
if ( isNull() && (that.isObject() || that.isArray() || that.isString() || that.isGeneric()) )
{
return true;
}
else if ( isObject() && that.isObject() )
{
// check if 'that' is a extending or implemented this
if ( !(mTypeArguments == that.mTypeArguments) )
{
return false;
}
return getObjectClass().isBase(that.getObjectClass())
|| getObjectClass().isImplementing(that.getObjectClass());
}
else if ( isArray() && that.isArray() )
{
return mpArrayType->equals(*that.mpArrayType) && mArrayDimension == that.mArrayDimension;
}
else if ( isGeneric() )
{
if ( that.isObject() )
{
return that.getObjectName() == UTEXT("system.Object"); // object is greater than a generic (its da uber type)
}
else if ( that.isGeneric() )
{
return mObjectName == that.mObjectName;
}
}
else if ( !isObject() && !that.isObject() )
{
switch ( that.mKind )
{
case eBoolean:
return mKind == eBoolean;
case eInt:
return mKind == eInt;
case eReal:
return mKind == eInt || mKind == eReal;
case eChar:
return mKind == eChar;
case eString:
return mKind == eString || mKind == eInt || mKind == eReal || mKind == eBoolean || mKind == eChar;
default:
break;
}
}
// no implicit primitive to basic or vs yet
return false;
}
示例3: visit
void CodeGeneratorVisitor::visit(const ASTAccess& ast)
{
switch ( ast.getKind() )
{
case ASTAccess::eVariable:
{
switch ( ast.getAccess() )
{
case ASTAccess::eField:
case ASTAccess::eRefField:
{
const ASTField& field = ast.getField();
if ( ast.getAccess() == ASTAccess::eField && !field.getVariable().getModifiers().isStatic() )
{
// only emit loading this for current fields
// with reference the object is already there
mBuilder.emit(CIL_ldarg, 0);
}
handleField(field);
}
break;
case ASTAccess::eArgument:
case ASTAccess::eLocal:
{
const ASTVariable& var = ast.getVariable();
handleVariable(var);
}
break;
default:
break;
}
const ASTType& type = ast.getVariable().getType();
if ( mCurrentType.isValid() && type.isGeneric() )
{
const ASTTypeVariable& typevariable = type.getTypeVariable();
if ( ast.getTypeArguments().size() > 0 )
{
mCurrentType = ast.getTypeArguments()[typevariable.getIndex()];
}
else
{
mCurrentType = mCurrentType.getTypeArguments()[typevariable.getIndex()];
}
}
else
mCurrentType = type;
}
break;
case ASTAccess::eArray:
{
// the array object is now on top of the stack
mExpr = 1;
ASTType before = mCurrentType;
// add indices on stack
reverseVisitChildren(ast);
mBuilder.emit(CIL_ldelem, ast.getArguments().size());
}
break;
case ASTAccess::eFunction:
{
const ASTFunction& function = ast.getFunction();
if ( !mCurrentType.isValid() )
{
mBuilder.emit(CIL_ldarg, 0); // this
}
ASTType before = mCurrentType;
visitChildren(ast);
if ( mWasSuper )
{
String name = function.getClass().getFullName() + '.' + function.getPrototype();
mBuilder.emit(CIL_call, name);
mWasSuper = false;
}
else if ( function.getModifiers().isPureNative() )
{
const String qualifiedname = function.getClass().getFullName() + '.' + function.getPrototype();
mBuilder.emit(CIL_call_native, qualifiedname);
}
else if ( function.getModifiers().isStatic() ) // first check for static so native statics are possible as well
{
String name = (before.isValid() ? before.getObjectClass().getFullName() : mpClass->getFullName()) + '.' + function.getPrototype();
mBuilder.emit(CIL_call, name);
}
else
{
if ( before.isObject() && before.getObjectClass().getKind() == ASTClass::eInterface )
{
//.........这里部分代码省略.........