AjTalk.Language.Block.TryCompileGet C# (CSharp) Method

TryCompileGet() protected method

protected TryCompileGet ( string name ) : bool
name string
return bool
        protected virtual bool TryCompileGet(string name)
        {
            if (name.Equals("false"))
            {
                this.CompileGetConstant(false);
                return true;
            }

            if (name.Equals("true"))
            {
                this.CompileGetConstant(true);
                return true;
            }

            if (name[0] == Lexer.SpecialDotNetTypeMark)
            {
                this.CompileGetDotNetType(name.Substring(1));
                return true;
            }

            if (name == "self")
            {
                this.CompileByteCode(ByteCode.GetSelf);
                return true;
            }

            if (name == "super")
            {
                this.CompileByteCode(ByteCode.GetSuper);
                return true;
            }

            if (name == "nil" || name == "null")
            {
                this.CompileByteCode(ByteCode.GetNil);
                return true;
            }

            int p;

            if (this.localnames != null)
            {
                p = this.localnames.IndexOf(name);

                if (p >= 0)
                {
                    this.CompileByteCode(ByteCode.GetLocal, (byte)p);

                    return true;
                }
            }

            if (this.argnames != null)
            {
                p = this.argnames.IndexOf(name);

                if (p >= 0)
                {
                    this.CompileByteCode(ByteCode.GetArgument, (byte)p);
                    return true;
                }
            }

            p = this.GetInstanceVariableOffset(name);

            if (p >= 0)
            {
                this.CompileByteCode(ByteCode.GetInstanceVariable, (byte)p);
                return true;
            }

            return false;
        }