本文整理汇总了C#中IAnalysisSet.Union方法的典型用法代码示例。如果您正苦于以下问题:C# IAnalysisSet.Union方法的具体用法?C# IAnalysisSet.Union怎么用?C# IAnalysisSet.Union使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAnalysisSet
的用法示例。
在下文中一共展示了IAnalysisSet.Union方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryInvokeMethod
private bool TryInvokeMethod(Node node, AnalysisUnit unit, string name, IAnalysisSet[] args, out IAnalysisSet res) {
res = AnalysisSet.Empty;
bool invoked = false;
var members = GetTypeMember(node, unit, name);
foreach (var member in members) {
if (ShouldInvokeMethod(member, name)) {
invoked = true;
res = res.Union(
member.Call(
node,
unit,
args,
ExpressionEvaluator.EmptyNames
)
);
}
}
return invoked;
}
示例2: TestImmutableSet
private static void TestImmutableSet(IAnalysisSet emptySet) {
int count = emptySet.Count;
var projectEntry = CreateProjectEntry();
var value = new TestAnalysisValue(projectEntry);
var newSet = emptySet.Add(value.Proxy);
Assert.AreNotEqual(emptySet, newSet);
Assert.AreEqual(count, emptySet.Count);
Assert.AreEqual(count + 1, newSet.Count);
bool wasChanged;
newSet = emptySet.Add(value.Proxy, out wasChanged);
Assert.AreNotEqual(emptySet, newSet);
Assert.IsTrue(wasChanged);
Assert.AreEqual(count, emptySet.Count);
Assert.AreEqual(count + 1, newSet.Count);
newSet = emptySet.Union(new[] { value.Proxy });
Assert.AreNotEqual(emptySet, newSet);
Assert.AreEqual(count, emptySet.Count);
Assert.AreEqual(count + 1, newSet.Count);
newSet = emptySet.Union(new[] { value.Proxy }, out wasChanged);
Assert.IsTrue(wasChanged);
Assert.AreNotEqual(emptySet, newSet);
Assert.AreEqual(count, emptySet.Count);
Assert.AreEqual(count + 1, newSet.Count);
Assert.AreEqual(emptySet, emptySet.Clone());
Assert.IsFalse(emptySet.Contains(value.Proxy));
}
示例3: IsSpecialRequire
private static bool IsSpecialRequire(AnalysisUnit unit, CallNode n, ref IAnalysisSet res) {
bool hitLiteral = false;
if (n.Arguments.Length == 1) {
var ee = new ExpressionEvaluator(unit);
foreach (var name in ee.MergeStringLiterals(n.Arguments[0])) {
hitLiteral = true;
res = res.Union(
unit.Analyzer.Modules.RequireModule(
n,
unit,
name,
unit.DeclaringModuleEnvironment.Name
)
);
}
}
return hitLiteral;
}