本文整理汇总了C#中IAnalysisSet.Where方法的典型用法代码示例。如果您正苦于以下问题:C# IAnalysisSet.Where方法的具体用法?C# IAnalysisSet.Where怎么用?C# IAnalysisSet.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAnalysisSet
的用法示例。
在下文中一共展示了IAnalysisSet.Where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BinaryOperation
public override IAnalysisSet BinaryOperation(Node node, AnalysisUnit unit, PythonOperator operation, IAnalysisSet rhs) {
IAnalysisSet res;
switch (operation) {
case PythonOperator.BitwiseOr:
var seq = (SetInfo)unit.Scope.GetOrMakeNodeValue(
node,
_ => new SetInfo(ProjectState, node, unit.ProjectEntry)
);
seq.AddTypes(unit, GetEnumeratorTypes(node, unit));
foreach (var type in rhs.Where(t => t.IsOfType(ClassInfo))) {
seq.AddTypes(unit, type.GetEnumeratorTypes(node, unit));
}
res = seq;
break;
case PythonOperator.BitwiseAnd:
case PythonOperator.ExclusiveOr:
case PythonOperator.Subtract:
res = this;
break;
default:
res = CallReverseBinaryOp(node, unit, operation, rhs);
break;
}
return res;
}
示例2: BinaryOperation
public override IAnalysisSet BinaryOperation(Node node, AnalysisUnit unit, PythonOperator operation, IAnalysisSet rhs) {
SequenceInfo seq = null;
VariableDef idx = null;
var res = AnalysisSet.Empty;
switch (operation) {
case PythonOperator.Add:
foreach (var type in rhs.Where(t => !t.IsOfType(ClassInfo))) {
res = res.Union(CallReverseBinaryOp(node, unit, operation, rhs));
}
foreach (var type in rhs.Where(t => t.IsOfType(ClassInfo))) {
if (seq == null) {
seq = (SequenceInfo)unit.Scope.GetOrMakeNodeValue(node,
NodeValueKind.Sequence,
_ => new SequenceInfo(new[] { new VariableDef() }, ClassInfo, node, unit.ProjectEntry)
);
idx = seq.IndexTypes[0];
idx.AddTypes(unit, GetEnumeratorTypes(node, unit), true, DeclaringModule);
}
idx.AddTypes(unit, type.GetEnumeratorTypes(node, unit), true, DeclaringModule);
}
if (seq != null) {
res = res.Union(seq);
}
break;
case PythonOperator.Multiply:
foreach (var type in rhs) {
var typeId = type.TypeId;
if (typeId == BuiltinTypeId.Int || typeId == BuiltinTypeId.Long) {
res = res.Union(this);
} else {
res = res.Union(CallReverseBinaryOp(node, unit, operation, type));
}
}
break;
default:
res = CallReverseBinaryOp(node, unit, operation, rhs);
break;
}
return res;
}