/// <summary> /// Returns <paramref name="set"/> with a comparer with increased /// strength. If the strength cannot be increased, <paramref /// name="set"/> is returned unmodified. /// </summary> /// <param name="set">The set to increase the strength of.</param> public static IAnalysisSet AsStrongerUnion(this IAnalysisSet set) { var comparer = set.Comparer as UnionComparer; if (comparer != null) { return(set.AsUnion(comparer.Strength + 1)); } else { return(set.AsUnion(0)); } }
internal bool MakeUnion(int strength) { bool wasChanged; _types = _types.AsUnion(strength, out wasChanged); return(wasChanged); }
public CallArgs(IAnalysisSet @this, IAnalysisSet[] args, bool overflowed) { if (!overflowed) { for (int i = 0; i < args.Length; i++) { if (args[i].Count >= 10) { overflowed = true; break; } } if (@this != null && @this.Count >= 10) { overflowed = true; } } if (overflowed) { for (int i = 0; i < args.Length; i++) { args[i] = args[i].AsUnion(MergeStrength.ToObject); } if (@this != null) { @this = @this.AsUnion(MergeStrength.ToObject); } } This = @this; Args = args; }
public IterableProtocol(ProtocolInfo self, IAnalysisSet yielded) : base(self) { _yielded = yielded.AsUnion(1); var iterator = new ProtocolInfo(Self.DeclaringModule, Self.State); iterator.AddProtocol(new IteratorProtocol(iterator, _yielded)); _iterator = iterator; }
public CallableProtocol(ProtocolInfo self, string qualname, IReadOnlyList <IAnalysisSet> arguments, IAnalysisSet returnType, PythonMemberType memberType = PythonMemberType.Function) : base(self) { Name = qualname ?? "callable"; Arguments = arguments; ReturnType = returnType.AsUnion(1); _overloads = new Lazy <OverloadResult[]>(GenerateOverloads); MemberType = memberType; }
private static IAnalysisSet ReduceArgs(IAnalysisSet args, int limit) { for (int j = 0; j <= UnionComparer.MAX_STRENGTH; ++j) { if (args.Count > limit) { args = args.AsUnion(j); } else { break; } } return(args); }
public LazyIndexableInfo(Node node, IAnalysisSet indexTypes, Func <IAnalysisSet> fallback) : base(node) { _indexTypes = indexTypes.AsUnion(1); _fallback = fallback; }
public GeneratorProtocol(ProtocolInfo self, IAnalysisSet yields, IAnalysisSet sends, IAnalysisSet returns) : base(self, yields) { Sent = sends.AsUnion(1); Returned = returns.AsUnion(1); }
public MappingProtocol(ProtocolInfo self, IAnalysisSet keys, IAnalysisSet values, IAnalysisSet items) : base(self, keys) { _keyType = keys.AsUnion(1); _valueType = values.AsUnion(1); _itemType = items.AsUnion(1); }
public GetItemProtocol(ProtocolInfo self, IAnalysisSet keys, IAnalysisSet values) : base(self) { _keyType = (keys ?? self.AnalysisUnit.State.ClassInfos[BuiltinTypeId.Int].Instance).AsUnion(1); _valueType = values.AsUnion(1); }
public IteratorProtocol(ProtocolInfo self, IAnalysisSet yielded) : base(self) { _yielded = yielded.AsUnion(1); }
/// <summary> /// Returns <paramref name="set"/> with a comparer with the specified /// strength. If the strength does not need to be changed, <paramref /// name="set"/> is returned unmodified. /// </summary> /// <param name="set">The set to convert to a union.</param> /// <param name="strength">The strength of the union.</param> public static IAnalysisSet AsUnion(this IAnalysisSet set, int strength) { bool dummy; return(set.AsUnion(strength, out dummy)); }
private static IAnalysisSet ReduceArgs(IAnalysisSet args, int limit) { for (int j = 0; j <= UnionComparer.MAX_STRENGTH; ++j) { if (args.Count > limit) { args = args.AsUnion(j); } else { break; } } return args; }