本文整理汇总了C#中AnalysisValue类的典型用法代码示例。如果您正苦于以下问题:C# AnalysisValue类的具体用法?C# AnalysisValue怎么用?C# AnalysisValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnalysisValue类属于命名空间,在下文中一共展示了AnalysisValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnionMergeTypes
internal override AnalysisValue UnionMergeTypes(AnalysisValue av, int strength) {
if (strength >= MergeStrength.ToBaseClass) {
return _analyzer._zeroIntValue;
}
return base.UnionMergeTypes(av, strength);
}
示例2: UnionMergeTypes
internal override AnalysisValue UnionMergeTypes(AnalysisValue av, int strength) {
if (strength >= StringUnionStrength) {
return _analyzer._emptyStringValue;
}
return base.UnionMergeTypes(av, strength);
}
示例3: GetInstanceShortDescription
private static string GetInstanceShortDescription(AnalysisValue ns) {
var bci = ns as BuiltinClassInfo;
if (bci != null) {
return bci.Instance.ShortDescription;
}
return ns.ShortDescription;
}
示例4: UnionEquals
internal override bool UnionEquals(AnalysisValue ns, int strength) {
var tns = ns as TestNamespace;
if (tns == null) {
return false;
}
return Name.Equals(tns.Name);
}
示例5: UnionMergeTypes
internal override AnalysisValue UnionMergeTypes(AnalysisValue ns, int strength) {
var tns = ns as TestNamespace;
if (tns == null || object.ReferenceEquals(this, tns)) {
return this;
}
return new TestNamespace { _name = Name, Value = MergeCount > tns.MergeCount ? Value : tns.Value, MergeCount = MergeCount + tns.MergeCount };
}
示例6: ObjectValue
public ObjectValue(ProjectEntry projectEntry, AnalysisValue prototype = null, string description = null)
: base(projectEntry) {
if (prototype != null) {
Add("__proto__", prototype.SelfSet);
}
#if DEBUG
_description = description;
#endif
}
示例7: InterpreterScope
protected InterpreterScope(AnalysisValue av, InterpreterScope cloned, bool isCloned) {
Debug.Assert(isCloned);
_av = av;
Children.AddRange(cloned.Children);
_nodeScopes = cloned._nodeScopes;
_nodeValues = cloned._nodeValues;
_variables = cloned._variables;
_linkedVariables = cloned._linkedVariables;
}
示例8: UnionMergeTypes
internal override AnalysisValue UnionMergeTypes(AnalysisValue ns, int strength) {
if (strength >= MergeStrength.ToObject) {
if (ns is InstanceValue) {
return ProjectState._immutableObject;
}
}
return base.UnionMergeTypes(ns, strength);
}
示例9: UnionEquals
internal override bool UnionEquals(AnalysisValue ns, int strength) {
if (strength >= MergeStrength.ToObject) {
if (ns is InstanceValue) {
return true;
}
}
return base.UnionEquals(ns, strength);
}
示例10: PushProtoLookup
internal static bool PushProtoLookup(AnalysisValue value){
if (_hitCount == null) {
_hitCount = new Dictionary<AnalysisValue, int>();
}
int count;
if (!_hitCount.TryGetValue(value, out count)) {
_hitCount[value] = 1;
return true;
} else {
_hitCount[value] = count + 1;
}
return false;
}
示例11: UnionMergeTypes
internal override AnalysisValue UnionMergeTypes(AnalysisValue av, int strength) {
if (strength >= MergeStrength.ToBaseClass) {
var literal = av as ObjectLiteralValue;
if (literal != null) {
return this;
}
}
if (strength >= MergeStrength.ToBaseClass) {
var literal = av as ObjectLiteralValue;
if (literal != null && literal._node == _node) {
return this;
}
}
return base.UnionMergeTypes(av, strength);
}
示例12: UnionEquals
internal override bool UnionEquals(AnalysisValue av, int strength) {
if (strength >= MergeStrength.ToBaseClass) {
var literal = av as ObjectLiteralValue;
if (literal != null) {
return true;
}
}
if (strength >= MergeStrength.ToBaseClass) {
var literal = av as ObjectLiteralValue;
if (literal != null) {
// two literals from the same node, these
// literals were created by independent function
// analysis, merge them together now.
return literal._node == _node;
}
}
return base.UnionEquals(av, strength);
}
示例13: GetTestCaseMembers
/// <summary>
/// Get Test Case Members for a class. If the class has 'test*' tests
/// return those. If there aren't any 'test*' tests return (if one at
/// all) the runTest overridden method
/// </summary>
private static IEnumerable<KeyValuePair<string, IAnalysisSet>> GetTestCaseMembers(
ModuleAnalysis analysis,
AnalysisValue classValue
) {
var methodFunctions = classValue.GetAllMembers(analysis.InterpreterContext)
.Where(v => v.Value.Any(m => m.MemberType == PythonMemberType.Function || m.MemberType == PythonMemberType.Method));
var tests = methodFunctions.Where(v => v.Key.StartsWith("test"));
var runTest = methodFunctions.Where(v => v.Key.Equals("runTest"));
if (tests.Any()) {
return tests;
} else {
return runTest;
}
}
示例14: GetMember
public override IAnalysisSet GetMember(Node node, AnalysisUnit unit, string name) {
// Must unconditionally call the base implementation of GetMember
var res = base.GetMember(node, unit, name);
switch(name) {
case "next":
if (unit.ProjectState.LanguageVersion.Is2x()) {
return _nextMethod = _nextMethod ?? new SpecializedCallable(
res.OfType<BuiltinNamespace<IPythonType>>().FirstOrDefault(),
GeneratorNext,
false
);
}
break;
case "__next__":
if (unit.ProjectState.LanguageVersion.Is3x()) {
return _nextMethod = _nextMethod ?? new SpecializedCallable(
res.OfType<BuiltinNamespace<IPythonType>>().FirstOrDefault(),
GeneratorNext,
false
);
}
break;
case "send":
return _sendMethod = _sendMethod ?? new SpecializedCallable(
res.OfType<BuiltinNamespace<IPythonType>>().FirstOrDefault(),
GeneratorSend,
false
);
}
return res;
}
示例15: GetMember
public override IAnalysisSet GetMember(Node node, AnalysisUnit unit, string name) {
// Must unconditionally call the base implementation of GetMember
var res = base.GetMember(node, unit, name);
switch (name) {
case "append":
return _appendMethod = _appendMethod ?? new SpecializedCallable(
res.OfType<BuiltinNamespace<IPythonType>>().FirstOrDefault(),
ListAppend,
false
);
case "pop":
return _popMethod = _popMethod ?? new SpecializedCallable(
res.OfType<BuiltinNamespace<IPythonType>>().FirstOrDefault(),
ListPop,
false
);
case "insert":
return _insertMethod = _insertMethod ?? new SpecializedCallable(
res.OfType<BuiltinNamespace<IPythonType>>().FirstOrDefault(),
ListInsert,
false
);
case "extend":
return _extendMethod = _extendMethod ?? new SpecializedCallable(
res.OfType<BuiltinNamespace<IPythonType>>().FirstOrDefault(),
ListExtend,
false
);
}
return res;
}