AjTalk.Language.Method.GetInstanceVariableName C# (CSharp) Method

GetInstanceVariableName() public method

public GetInstanceVariableName ( int n ) : string
n int
return string
        public override string GetInstanceVariableName(int n)
        {
            return ((IClassDescription)this.mthclass).GetInstanceVariableNames().ElementAt(n);
        }

Usage Example

Esempio n. 1
0
        public void Compile()
        {
            Machine machine = new Machine();
            IClass cls = machine.CreateClass("TestClass");
            cls.DefineClassVariable("count");
            cls.DefineInstanceVariable("x");

            Method mth;

            mth = new Method(cls, "x:");
            mth.CompileArgument("newX");
            mth.CompileGet("newX");
            mth.CompileSet("x");

            cls.DefineInstanceMethod(mth);

            Assert.AreEqual(mth, cls.GetInstanceMethod("x:"));
            Assert.AreEqual("x", mth.GetInstanceVariableName(0));
        }