kswoll / WootzJs

C# to Javascript Compiler implemented via Roslyn
MIT License
110 stars 21 forks source link

Property Inlining not Working #14

Closed Danielku15 closed 10 years ago

Danielku15 commented 10 years ago

It seems the JavaScript inlining of Properties does not work: C#

    [Js(Name = "Array", Export = false)]
    public class FastList<T>
    {
        [Js(Inline = "[]")]
        public FastList()
        {
        }

        public int Count
        {
            [Js(Inline = "@this.length", Export = false)]
            get
            {
                return 0;
            }
        }
    }

    class Program
    {
        public static void Main(string[] args)
        {
            FastList<int> list = new FastList<int>();
            if (list.Count == 0)
            {
                return;
            }
        }
    }

In JavaScript there is list.Count called instead of `list.length:

    $t.Main = function(args) {
        var list = [];
        if (list.Count == 0) {
            return;
        }
    };
kswoll commented 10 years ago

Thanks for the catch, hadn't coded for get/set. Should be fixed now.