本文整理汇总了C#中DataType.isUnknownType方法的典型用法代码示例。如果您正苦于以下问题:C# DataType.isUnknownType方法的具体用法?C# DataType.isUnknownType怎么用?C# DataType.isUnknownType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataType
的用法示例。
在下文中一共展示了DataType.isUnknownType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindIterator
// iterator
public void BindIterator(Analyzer analyzer, Exp target, Exp iter, DataType iterType, BindingKind kind)
{
if (iterType is ListType)
{
this.Bind(analyzer, target, ((ListType) iterType).eltType, kind);
}
else if (iterType is TupleType)
{
this.Bind(analyzer, target, ((TupleType) iterType).toListType().eltType, kind);
}
else
{
ISet<Binding> ents = iterType.Table.LookupAttribute("__iter__");
if (ents != null)
{
foreach (Binding ent in ents)
{
if (ent == null || !(ent.type is FunType))
{
if (!iterType.isUnknownType())
{
analyzer.putProblem(iter, "not an iterable type: " + iterType);
}
this.Bind(analyzer, target, DataType.Unknown, kind);
}
else
{
this.Bind(analyzer, target, ((FunType) ent.type).getReturnType(), kind);
}
}
}
else
{
this.Bind(analyzer, target, DataType.Unknown, kind);
}
}
}
示例2: setAttrType
private static void setAttrType(Analyzer analyzer, AttributeAccess attr, DataType targetType, DataType attrType)
{
if (targetType.isUnknownType())
{
analyzer.putProblem(attr, "Can't set attribute for UnknownType");
return;
}
ISet<Binding> bs = targetType.Table.LookupAttribute(attr.FieldName.Name);
if (bs != null)
{
analyzer.addRef(attr, targetType, bs);
}
targetType.Table.Insert(analyzer, attr.FieldName.Name, attr, attrType, BindingKind.ATTRIBUTE);
}
示例3: Bind
public void Bind(Analyzer analyzer, List<Exp> xs, DataType rvalue, BindingKind kind)
{
if (rvalue is TupleType)
{
List<DataType> vs = ((TupleType) rvalue).eltTypes;
if (xs.Count != vs.Count)
{
ReportUnpackMismatch(analyzer, xs, vs.Count);
}
else
{
for (int i = 0; i < xs.Count; i++)
{
this.Bind(analyzer, xs[i], vs[i], kind);
}
}
}
else
{
if (rvalue is ListType)
{
Bind(analyzer, xs, ((ListType) rvalue).toTupleType(xs.Count), kind);
}
else if (rvalue is DictType)
{
Bind(analyzer, xs, ((DictType) rvalue).toTupleType(xs.Count), kind);
}
else if (rvalue.isUnknownType())
{
foreach (Exp x in xs)
{
this.Bind(analyzer, x, DataType.Unknown, kind);
}
}
else if (xs.Count > 0)
{
analyzer.putProblem(xs[0].Filename,
xs[0].Start,
xs[xs.Count - 1].End,
"unpacking non-iterable: " + rvalue);
}
}
}