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

CompileSend() public method

public CompileSend ( string msgname ) : void
msgname string
return void
        public void CompileSend(string msgname)
        {
            if (msgname[0] == Lexer.SpecialDotNetInvokeMark)
            {
                this.CompileInvokeDotNet(msgname);
                return;
            }

            if (msgname == "basicInstSize")
                this.CompileByteCode(ByteCode.BasicInstSize);
            else if (msgname == "basicInstVarAt:")
                this.CompileByteCode(ByteCode.BasicInstVarAt);
            else if (msgname == "basicInstVarAt:put:")
                this.CompileByteCode(ByteCode.BasicInstVarAtPut);
            else if (msgname == "basicNew")
                this.CompileByteCode(ByteCode.NewObject);
            else if (msgname == "basicSize")
                this.CompileByteCode(ByteCode.BasicSize);
            else if (msgname == "basicAt:")
                this.CompileByteCode(ByteCode.BasicAt);
            else if (msgname == "basicAt:put:")
                this.CompileByteCode(ByteCode.BasicAtPut);
            else if (msgname == "value")
                this.CompileByteCode(ByteCode.Value);
            else if (msgname.StartsWith("value:") && IsValueMessage(msgname))
                this.CompileByteCode(ByteCode.MultiValue, MessageArity(msgname));
            else if (msgname == "class")
                this.CompileByteCode(ByteCode.GetClass);
            else if (msgname == "raise")
                this.CompileByteCode(ByteCode.RaiseException);
            else
                this.CompileByteCode(ByteCode.Send, this.CompileConstant(msgname), MessageArity(msgname));
        }

Usage Example

Example #1
0
        public void CompileAndExecuteNewDotNetObject()
        {
            Block block;

            block = new Block();
            block.CompileGetDotNetType("System.IO.FileInfo");
            block.CompileGetConstant("FooBar.txt");
            block.CompileSend("!new:");
            block.CompileByteCode(ByteCode.ReturnPop);

            object obj = block.Execute(null, null);

            Assert.IsNotNull(obj);
            Assert.IsInstanceOfType(obj, typeof(System.IO.FileInfo));
        }
All Usage Examples Of AjTalk.Language.Block::CompileSend