当前位置: 首页>>代码示例>>C#>>正文


C# IAnalysisSet类代码示例

本文整理汇总了C#中IAnalysisSet的典型用法代码示例。如果您正苦于以下问题:C# IAnalysisSet类的具体用法?C# IAnalysisSet怎么用?C# IAnalysisSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IAnalysisSet类属于命名空间,在下文中一共展示了IAnalysisSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BinaryOperation

 public override IAnalysisSet BinaryOperation(Node node, AnalysisUnit unit, PythonOperator operation, IAnalysisSet rhs) {
     switch (operation) {
         case PythonOperator.GreaterThan:
         case PythonOperator.LessThan:
         case PythonOperator.LessThanOrEqual:
         case PythonOperator.GreaterThanOrEqual:
         case PythonOperator.Equal:
         case PythonOperator.NotEqual:
         case PythonOperator.Is:
         case PythonOperator.IsNot:
             return ProjectState.ClassInfos[BuiltinTypeId.Bool].Instance;
         case PythonOperator.TrueDivide:
         case PythonOperator.Add:
         case PythonOperator.Subtract:
         case PythonOperator.Multiply:
         case PythonOperator.MatMultiply:
         case PythonOperator.Divide:
         case PythonOperator.Mod:
         case PythonOperator.BitwiseAnd:
         case PythonOperator.BitwiseOr:
         case PythonOperator.Xor:
         case PythonOperator.LeftShift:
         case PythonOperator.RightShift:
         case PythonOperator.Power:
         case PythonOperator.FloorDivide:
             return ConstantInfo.NumericOp(node, this, unit, operation, rhs) ?? CallReverseBinaryOp(node, unit, operation, rhs);
     }
     return CallReverseBinaryOp(node, unit, operation, rhs);
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:29,代码来源:NumericInstanceInfo.cs

示例2: Call

        public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
            if (args.Length == 1) {
                var res = unit.Scope.GetOrMakeNodeValue(
                    node,
                    (node_) => MakeFromIndexes(node_, unit.ProjectEntry)
                ) as SequenceInfo;

                List<IAnalysisSet> seqTypes = new List<IAnalysisSet>();
                foreach (var type in args[0]) {
                    SequenceInfo seqInfo = type as SequenceInfo;
                    if (seqInfo != null) {
                        for (int i = 0; i < seqInfo.IndexTypes.Length; i++) {
                            if (seqTypes.Count == i) {
                                seqTypes.Add(seqInfo.IndexTypes[i].Types);
                            } else {
                                seqTypes[i] = seqTypes[i].Union(seqInfo.IndexTypes[i].Types);
                            }
                        }
                    } else {
                        var defaultIndexType = type.GetIndex(node, unit, ProjectState.GetConstant(0));
                        if (seqTypes.Count == 0) {
                            seqTypes.Add(defaultIndexType);
                        } else {
                            seqTypes[0] = seqTypes[0].Union(defaultIndexType);
                        }
                    }
                }

                res.AddTypes(unit, seqTypes.ToArray());

                return res;
            }

            return base.Call(node, unit, args, keywordArgNames);
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:35,代码来源:SequenceBuiltinClassInfo.cs

示例3: BinaryOperation

 public override IAnalysisSet BinaryOperation(Node node, AnalysisUnit unit, PythonOperator operation, IAnalysisSet rhs) {
     var res = AnalysisSet.Empty;
     foreach (var member in _members) {
         res = res.Union(member.BinaryOperation(node, unit, operation, rhs));
     }
     return res;
 }
开发者ID:smallwave,项目名称:PTVS,代码行数:7,代码来源:MultipleMemberInfo.cs

示例4: Call

 public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
     var res = AnalysisSet.Empty;
     foreach (var member in _members) {
         res = res.Union(member.Call(node, unit, args, keywordArgNames));
     }
     return res;
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:7,代码来源:MultipleMemberInfo.cs

示例5: SetMember

 /// <summary>
 /// Performs a SetMember operation for the given name and propagates the
 /// given values types for the provided member name.
 /// </summary>
 public static void SetMember(this IAnalysisSet self, Node node, AnalysisUnit unit, string name, IAnalysisSet value) {
     if (name != null && name.Length > 0) {
         foreach (var ns in self) {
             ns.SetMember(node, unit, name, value);
         }
     }
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:11,代码来源:AnalysisSetExtensions.cs

示例6: BinaryOperation

        public override IAnalysisSet BinaryOperation(Node node, AnalysisUnit unit, Parsing.PythonOperator operation, IAnalysisSet rhs) {
            if (_original == null) {
                return base.BinaryOperation(node, unit, operation, rhs);
            }

            return _original.BinaryOperation(node, unit, operation, rhs);
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:7,代码来源:SpecializedNamespace.cs

示例7: Call

        public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
            var res = (DictionaryInfo)unit.Scope.GetOrMakeNodeValue(
                node,
                NodeValueKind.Dictionary,
                (node_) => new DictionaryInfo(unit.ProjectEntry, node)
            );

            if (keywordArgNames.Length > 0) {
                for (int i = 0; i < keywordArgNames.Length; i++) {
                    var curName = keywordArgNames[i].Name;
                    var curArg = args[args.Length - keywordArgNames.Length + i];
                    if (curName == "**") {
                        foreach (var value in curArg) {
                            CopyFrom(args, res);
                        }
                    } else if (curName != "*") {
                        res.AddTypes(
                            node,
                            unit,
                            ProjectState.GetConstant(curName),
                            curArg
                        );
                    }
                }
            } else if (args.Length == 1) {
                foreach (var value in args[0]) {
                    CopyFrom(args, res);
                }
            }
            return res;
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:31,代码来源:DictBuiltinClassInfo.cs

示例8: AddTypes

 internal bool AddTypes(Node node, AnalysisUnit unit, IAnalysisSet key, IAnalysisSet value, bool enqueue = true) {
     if (_keysAndValues.AddTypes(unit, key, value, enqueue)) {
         if (_keysVariable != null) {
             _keysVariable.MakeUnionStrongerIfMoreThan(ProjectState.Limits.DictKeyTypes, value);
             if (_keysVariable.AddTypes(unit, key, enqueue)) {
                 if (_keysIter != null) {
                     _keysIter.UnionType = null;
                 }
                 if (_keysList != null) {
                     _keysList.UnionType = null;
                 }
             }
         }
         if (_valuesVariable != null) {
             _valuesVariable.MakeUnionStrongerIfMoreThan(ProjectState.Limits.DictValueTypes, value);
             if (_valuesVariable.AddTypes(unit, value, enqueue)) {
                 if (_valuesIter != null) {
                     _valuesIter.UnionType = null;
                 }
                 if (_valuesList != null) {
                     _valuesList.UnionType = null;
                 }
             }
         }
         if (_keyValueTuple != null) {
             _keyValueTuple.IndexTypes[0].MakeUnionStrongerIfMoreThan(ProjectState.Limits.DictKeyTypes, key);
             _keyValueTuple.IndexTypes[1].MakeUnionStrongerIfMoreThan(ProjectState.Limits.DictValueTypes, value);
             _keyValueTuple.IndexTypes[0].AddTypes(unit, key, enqueue);
             _keyValueTuple.IndexTypes[1].AddTypes(unit, value, enqueue);
         }
         return true;
     }
     return false;
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:34,代码来源:DictionaryInfo.cs

示例9: Construct

        public override IAnalysisSet Construct(Node node, AnalysisUnit unit, IAnalysisSet[] args) {
            var result = Call(node, unit, _instance.Proxy, args);
            if (result.Count != 0) {
                // function returned a value, we want to return any values
                // which are typed to object.
                foreach (var resultValue in result) {
                    if (!resultValue.Value.IsObject) {
                        // we need to do some filtering
                        var tmpRes = AnalysisSet.Empty;
                        foreach (var resultValue2 in result) {
                            if (resultValue2.Value.IsObject) {
                                tmpRes = tmpRes.Add(resultValue2);
                            }
                        }
                        result = tmpRes;
                        break;
                    }
                }

                if (result.Count != 0) {
                    return result;
                }
            }
            // we didn't return a value or returned a non-object
            // value.  The result is our newly created instance object.
            return _instance.Proxy;
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:27,代码来源:FunctionValue.cs

示例10: CloneSpecializationImpl

        private static IAnalysisSet CloneSpecializationImpl(FunctionValue func, Node node, AnalysisUnit unit, IAnalysisSet @this, IAnalysisSet[] args) {
            if (args.Length > 0) {
                return args[0];
            }

            return AnalysisSet.Empty;            
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:7,代码来源:OverviewWalker.Specializations.cs

示例11: 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;
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:27,代码来源:SetInfo.cs

示例12: GetIndex

            public override IAnalysisSet GetIndex(Node node, AnalysisUnit unit, IAnalysisSet index) {
                var res = base.GetIndex(node, unit, index);

                var names = index.OfType<ConstantInfo>()
                    .Select(ci => ci.GetConstantValueAsString())
                    .Where(s => !string.IsNullOrEmpty(s))
                    .Distinct()
                    .ToArray();

                if (names.Length != 1) {
                    // Unless you request a specific module by string literal,
                    // you won't get any object out of sys.modules.
                    return AnalysisSet.Empty;
                }

                var name = names[0];

                lock (_owner.Modules) {
                    IAnalysisSet knownValues;
                    if (_owner.Modules.TryGetValue(name, out knownValues) &&
                        knownValues != null &&
                        knownValues.Any()
                    ) {
                        return knownValues;
                    }
                }

                ModuleReference modRef;
                if (unit.ProjectState.Modules.TryImport(name, out modRef)) {
                    return modRef.AnalysisModule;
                }

                return AnalysisSet.Empty;
            }
开发者ID:omnimark,项目名称:PTVS,代码行数:34,代码来源:SysModuleInfo.cs

示例13: BinaryOperation

 public override IAnalysisSet BinaryOperation(Node node, AnalysisUnit unit, Parsing.PythonOperator operation, IAnalysisSet rhs) {
     var res = AnalysisSet.Empty;
     switch (operation) {
         case PythonOperator.Add:
             foreach (var type in rhs) {
                 if (type.IsOfType(ClassInfo)) {
                     res = res.Union(ClassInfo.Instance);
                 } else {
                     res = res.Union(type.ReverseBinaryOperation(node, unit, operation, SelfSet));
                 }
             }
             break;
         case PythonOperator.Mod:
             if (_supportsMod) {
                 res = SelfSet;
             }
             break;
         case PythonOperator.Multiply:
             foreach (var type in rhs) {
                 if (type.IsOfType(ProjectState.ClassInfos[BuiltinTypeId.Int]) || type.IsOfType(ProjectState.ClassInfos[BuiltinTypeId.Long])) {
                     res = res.Union(ClassInfo.Instance);
                 } else {
                     var partialRes = ConstantInfo.NumericOp(node, this, unit, operation, rhs);
                     if (partialRes != null) {
                         res = res.Union(partialRes);
                     }
                 }
             }
             break;
     }
     return res ?? base.BinaryOperation(node, unit, operation, rhs);
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:32,代码来源:SequenceBuiltinInstanceInfo.cs

示例14: ListInsert

        private IAnalysisSet ListInsert(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
            if (args.Length == 2) {
                AppendItem(node, unit, args[1]);
            }

            return unit.ProjectState._noneInst;
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:7,代码来源:ListInfo.cs

示例15: Call

        public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
            if (_original == null) {
                return base.Call(node, unit, args, keywordArgNames);
            }

            return _original.Call(node, unit, args, keywordArgNames);
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:7,代码来源:SpecializedNamespace.cs


注:本文中的IAnalysisSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。