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


C# VariableDef.AddTypes方法代码示例

本文整理汇总了C#中VariableDef.AddTypes方法的典型用法代码示例。如果您正苦于以下问题:C# VariableDef.AddTypes方法的具体用法?C# VariableDef.AddTypes怎么用?C# VariableDef.AddTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VariableDef的用法示例。


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

示例1: FunctionScope

 public FunctionScope(
     FunctionInfo function,
     Node node,
     InterpreterScope declScope,
     IPythonProjectEntry declModule
 )
     : base(function, node, declScope) {
     ReturnValue = new VariableDef();
     if (Function.FunctionDefinition.IsCoroutine) {
         Coroutine = new CoroutineInfo(function.ProjectState, declModule);
         ReturnValue.AddTypes(function.ProjectEntry, Coroutine.SelfSet, false);
     } else if (Function.FunctionDefinition.IsGenerator) {
         Generator = new GeneratorInfo(function.ProjectState, declModule);
         ReturnValue.AddTypes(function.ProjectEntry, Generator.SelfSet, false);
     }
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:16,代码来源:FunctionScope.cs

示例2: FunctionScope

 public FunctionScope(FunctionInfo function, Node node, InterpreterScope declScope)
     : base(function, node, declScope)
 {
     ReturnValue = new VariableDef();
     if (Function.FunctionDefinition.IsGenerator) {
         Generator = new GeneratorInfo(function.ProjectState, Function.FunctionDefinition);
         ReturnValue.AddTypes(function.ProjectEntry, Generator.SelfSet, false);
     }
 }
开发者ID:borota,项目名称:JTVS,代码行数:9,代码来源:FunctionScope.cs

示例3: PropagateIsInstanceTypes

        private void PropagateIsInstanceTypes(Node node, AnalysisUnit unit, IAnalysisSet typeSet, VariableDef variable) {
            foreach (var typeObj in typeSet) {
                ClassInfo classInfo;
                BuiltinClassInfo builtinClassInfo;
                SequenceInfo seqInfo;

                if ((classInfo = typeObj as ClassInfo) != null) {
                    variable.AddTypes(unit, classInfo.Instance, false);
                } else if ((builtinClassInfo = typeObj as BuiltinClassInfo) != null) {
                    variable.AddTypes(unit, builtinClassInfo.Instance, false);
                } else if ((seqInfo = typeObj as SequenceInfo) != null) {
                    if (seqInfo.Push()) {
                        try {
                            foreach (var indexVar in seqInfo.IndexTypes) {
                                PropagateIsInstanceTypes(node, unit, indexVar.Types, variable);
                            }
                        } finally {
                            seqInfo.Pop();
                        }
                    }
                }
            }
        }
开发者ID:RussBaz,项目名称:PTVS,代码行数:23,代码来源:IsInstanceScope.cs

示例4: GetMember

        public override IAnalysisSet GetMember(Node node, AnalysisUnit unit, string name) {
            var res = AnalysisSet.Empty;

            if (name == "func") {
                AddReference(node, unit);
                return _function;
            } else if (name == "args") {
                AddReference(node, unit);
                if (_argsTuple == null) {
                    _argsTuple = new SequenceInfo(_args.Take(_args.Length - _keywordArgNames.Length)
                        .Select(v => {
                            var vd = new VariableDef();
                            vd.AddTypes(unit, v, false, DeclaringModule);
                            return vd;
                        }).ToArray(),
                        unit.ProjectState.ClassInfos[BuiltinTypeId.Tuple],
                        node,
                        unit.ProjectEntry
                    );
                }
                return _argsTuple;
            } else if (name == "keywords") {
                AddReference(node, unit);
                if (_keywordsDict == null) {
                    var dict = new DictionaryInfo(unit.ProjectEntry, node);
                    _keywordsDict = dict;
                    for (int i = 0; i < _keywordArgNames.Length; ++i) {
                        int j = i + _args.Length - _keywordArgNames.Length;
                        if (j >= 0 && j < _args.Length) {
                            dict._keysAndValues.AddTypes(
                                unit,
                                unit.ProjectState.GetConstant(_keywordArgNames[i].Name),
                                _args[j],
                                false
                            );
                        }
                    }
                }
                return _keywordsDict;
            }
            return res;
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:42,代码来源:PartialFunctionInfo.cs

示例5: SpecializeVariableDef

        private static void SpecializeVariableDef(VariableDef def, CallDelegate callable, bool mergeOriginalAnalysis) {
            List<AnalysisValue> items = new List<AnalysisValue>();
            foreach (var v in def.TypesNoCopy) {
                if (!(v is SpecializedNamespace) && v.DeclaringModule != null) {
                    items.Add(v);
                }
            }

            def._dependencies = default(SingleDict<IVersioned, ReferenceableDependencyInfo>);
            foreach (var item in items) {
                def.AddTypes(item.DeclaringModule, new SpecializedCallable(item, callable, mergeOriginalAnalysis).SelfSet);
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:13,代码来源:ModuleInfo.cs

示例6: ReturnsListOfString

 IAnalysisSet ReturnsListOfString(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) {
     return unit.Scope.GetOrMakeNodeValue(node, n => {
         var vars = new VariableDef();
         vars.AddTypes(unit, unit.ProjectState.ClassInfos[BuiltinTypeId.Str].Instance);
         return new ListInfo(
             new[] { vars },
             unit.ProjectState.ClassInfos[BuiltinTypeId.List],
             node,
             unit.ProjectEntry
         );
     });
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:12,代码来源:PythonAnalyzer.Specializations.cs

示例7: AssignVariableWorker

 /// <summary>
 /// Handles the base assignment case for assign to a variable, minus variable creation.
 /// </summary>
 protected static bool AssignVariableWorker(Node location, AnalysisUnit unit, IAnalysisSet values, VariableDef vars) {
     vars.AddAssignment(location, unit);
     vars.MakeUnionStrongerIfMoreThan(unit.ProjectState.Limits.AssignedTypes, values);
     return vars.AddTypes(unit, values);
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:8,代码来源:InterpreterScope.cs

示例8: SpecializeVariableDef

        private static void SpecializeVariableDef(Func<CallExpression, AnalysisUnit, INamespaceSet[], NameExpression[], INamespaceSet> dlg, VariableDef def, bool analyze)
        {
            List<Namespace> items = new List<Namespace>();
            foreach (var v in def.TypesNoCopy) {
                if (!(v is SpecializedNamespace) && v.DeclaringModule != null) {
                    items.Add(v);
                }
            }

            def._dependencies = default(SingleDict<IProjectEntry, TypedDependencyInfo<Namespace>>);
            foreach (var item in items) {
                def.AddTypes(item.DeclaringModule, SpecializedCallable.MakeSpecializedCallable(dlg, analyze, item).SelfSet);
            }
        }
开发者ID:borota,项目名称:JTVS,代码行数:14,代码来源:ModuleInfo.cs


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