GetMember() public method

public GetMember ( String name, BindingFlags bindingAttr ) : MemberInfo[]
name String
bindingAttr BindingFlags
return MemberInfo[]
Exemplo n.º 1
0
        private void BindName()
        {
            int          lexLevel         = 0;
            int          evalLexLevel     = 0;
            ScriptObject scope            = Globals.ScopeStack.Peek();
            BindingFlags flags            = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            bool         staticClassFound = false;                  // is there a static class on the scope chain
            bool         enclosingClassForStaticClassFound = false; // has the class enclosing a static nested class been found

            while (scope != null)
            {
                MemberInfo[] members   = null;
                WithObject   withScope = scope as WithObject;
                if (withScope != null && enclosingClassForStaticClassFound)
                {
                    members = withScope.GetMember(this.name, flags, false);
                }
                else
                {
                    members = scope.GetMember(this.name, flags);
                }
                this.members = members;
                if (members.Length > 0)
                {
                    break;
                }
                if (scope is WithObject)
                {
                    this.isFullyResolved = this.isFullyResolved && ((WithObject)scope).isKnownAtCompileTime;
                    lexLevel++;
                }
                else if (scope is ActivationObject)
                {
                    this.isFullyResolved = this.isFullyResolved && ((ActivationObject)scope).isKnownAtCompileTime;
                    if (scope is BlockScope || (scope is FunctionScope && ((FunctionScope)scope).mustSaveStackLocals))
                    {
                        lexLevel++;
                    }
                    if (scope is ClassScope)
                    {
                        if (staticClassFound)
                        {
                            enclosingClassForStaticClassFound = true;
                        }
                        if (((ClassScope)scope).owner.isStatic)
                        {
                            flags           &= ~BindingFlags.Instance;
                            staticClassFound = true;
                        }
                    }
                }
                else if (scope is StackFrame)
                {
                    lexLevel++;
                }
                evalLexLevel++;
                scope = scope.GetParent();
            }
            if (this.members.Length > 0)
            {
                this.lexLevel     = lexLevel;
                this.evalLexLevel = evalLexLevel;
            }
        }
Exemplo n.º 2
0
        private void BindName()
        {
            int          num         = 0;
            int          num2        = 0;
            ScriptObject parent      = base.Globals.ScopeStack.Peek();
            BindingFlags bindingAttr = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
            bool         flag        = false;
            bool         flag2       = false;

            while (parent != null)
            {
                MemberInfo[] member = null;
                WithObject   obj3   = parent as WithObject;
                if ((obj3 != null) && flag2)
                {
                    member = obj3.GetMember(base.name, bindingAttr, false);
                }
                else
                {
                    member = parent.GetMember(base.name, bindingAttr);
                }
                base.members = member;
                if (member.Length > 0)
                {
                    break;
                }
                if (parent is WithObject)
                {
                    base.isFullyResolved = base.isFullyResolved && ((WithObject)parent).isKnownAtCompileTime;
                    num++;
                }
                else if (parent is ActivationObject)
                {
                    base.isFullyResolved = base.isFullyResolved && ((ActivationObject)parent).isKnownAtCompileTime;
                    if ((parent is BlockScope) || ((parent is FunctionScope) && ((FunctionScope)parent).mustSaveStackLocals))
                    {
                        num++;
                    }
                    if (parent is ClassScope)
                    {
                        if (flag)
                        {
                            flag2 = true;
                        }
                        if (((ClassScope)parent).owner.isStatic)
                        {
                            bindingAttr &= ~BindingFlags.Instance;
                            flag         = true;
                        }
                    }
                }
                else if (parent is StackFrame)
                {
                    num++;
                }
                num2++;
                parent = parent.GetParent();
            }
            if (base.members.Length > 0)
            {
                this.lexLevel     = num;
                this.evalLexLevel = num2;
            }
        }