本文整理汇总了C++中GlobalAlias::hasParams方法的典型用法代码示例。如果您正苦于以下问题:C++ GlobalAlias::hasParams方法的具体用法?C++ GlobalAlias::hasParams怎么用?C++ GlobalAlias::hasParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobalAlias
的用法示例。
在下文中一共展示了GlobalAlias::hasParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initOverload
static void initOverload(OverloadPtr x) {
EnvPtr env = overloadPatternEnv(x);
PatternPtr pattern = evaluateOnePattern(x->target, env);
ObjectPtr obj = derefDeep(pattern);
if (obj == NULL) {
x->nameIsPattern = true;
addPatternOverload(x);
}
else {
switch (obj->objKind) {
case PROCEDURE : {
Procedure *proc = (Procedure *)obj.ptr();
addProcedureOverload(proc, env, x);
break;
}
case RECORD_DECL : {
RecordDecl *r = (RecordDecl *)obj.ptr();
r->overloads.insert(r->overloads.begin(), x);
break;
}
case VARIANT_DECL : {
VariantDecl *v = (VariantDecl *)obj.ptr();
v->overloads.insert(v->overloads.begin(), x);
break;
}
case TYPE : {
Type *t = (Type *)obj.ptr();
t->overloads.insert(t->overloads.begin(), x);
break;
}
case PRIM_OP : {
if (isOverloadablePrimOp(obj))
addPrimOpOverload((PrimOp *)obj.ptr(), x);
else
error(x->target, "invalid overload target");
break;
}
case GLOBAL_ALIAS : {
GlobalAlias *a = (GlobalAlias*)obj.ptr();
if (!a->hasParams())
error(x->target, "invalid overload target");
a->overloads.insert(a->overloads.begin(), x);
break;
}
case INTRINSIC : {
error(x->target, "invalid overload target");
}
default : {
error(x->target, "invalid overload target");
}
}
}
}
示例2: primOpOverloads
static llvm::ArrayRef<OverloadPtr> callableOverloads(ObjectPtr x)
{
initCallable(x);
switch (x->objKind) {
case TYPE : {
Type *y = (Type *)x.ptr();
return y->overloads;
}
case RECORD_DECL : {
RecordDecl *y = (RecordDecl *)x.ptr();
return y->overloads;
}
case VARIANT_DECL : {
VariantDecl *y = (VariantDecl *)x.ptr();
return y->overloads;
}
case PROCEDURE : {
Procedure *y = (Procedure *)x.ptr();
return y->overloads;
}
case PRIM_OP : {
assert(isOverloadablePrimOp(x));
PrimOp *y = (PrimOp *)x.ptr();
return primOpOverloads(y);
}
case GLOBAL_ALIAS : {
GlobalAlias *a = (GlobalAlias *)x.ptr();
assert(a->hasParams());
return a->overloads;
}
default : {
assert(false);
const vector<OverloadPtr> *ptr = NULL;
return *ptr;
}
}
}