コード例 #1
0
        public static void AddMemberReference(this IPythonType type, string name, IExpressionEvaluator eval, Location location)
        {
            var m = type.GetMember(name);

            if (m is LocatedMember lm)
            {
                lm.AddReference(location);
            }
            else if (type is IPythonClassType cls)
            {
                using (eval.OpenScope(cls.DeclaringModule, cls.ClassDefinition)) {
                    eval.LookupNameInScopes(name, out _, out var v, LookupOptions.Local);
                    v?.AddReference(location);
                }
            }
        }
コード例 #2
0
        public static void AddMemberReference(this IPythonType type, string name, IExpressionEvaluator eval, Location location)
        {
            var m = type.GetMember(name);

            if (m is LocatedMember lm)
            {
                lm.AddReference(location);
            }
            else if (type is IPythonClassType cls)
            {
                using (eval.OpenScope(cls)) {
                    eval.LookupNameInScopes(name, out _, out var v, LookupOptions.Local);
                    v?.AddReference(location);
                }
            }
            else if (type is IPythonModule module && module.GlobalScope != null && module.GlobalScope.Variables.TryGetVariable(name, out var variable))
            {
                variable.AddReference(location);
            }
        }
コード例 #3
0
 public static IMember LookupNameInScopes(this IExpressionEvaluator eval, string name, LookupOptions options = LookupOptions.Normal)
 => eval.LookupNameInScopes(name, out _, out _, options);