polytronicgr / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

Increment on object property calls against "this" #333

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you increment on a property the generated JavaScript refers to "this" 
instead of the target

    [JsType(JsMode.Clr, Filename = "res/Tester.js")]
    public class Points
    {
        public int Count { get; set; }
        public string Name;
    }

    [JsType(JsMode.Clr, Filename = "res/Tester.js")]
    public class Tester
    {

        public static void TestPropertyIncrement()
        {
            var points = new Points();

            points.Name = "Scan";
            points.Count++;
        }
    }

generates

    TestPropertyIncrement: function ()
    {
        var points = new SharpKitWebApp4.Points.ctor();
        points.Name = "Scan";
        this.set_Count(this.get_Count() + 1);
    }

The name field is correctly placed on "points" but the Count setter ends up 
against "this" which usually fails at run time.

JavaScript runtime error: Object doesn't support property or method 'get_Count'

SharpKit version 5.2.8

Original issue reported on code.google.com by co...@gravill.com on 5 Dec 2013 at 11:22

GoogleCodeExporter commented 8 years ago
Same applies to decrement

Original comment by co...@gravill.com on 5 Dec 2013 at 11:48

GoogleCodeExporter commented 8 years ago

Original comment by DanelK...@gmail.com on 12 Feb 2014 at 12:27

GoogleCodeExporter commented 8 years ago

Original comment by DanelK...@gmail.com on 20 Feb 2014 at 10:31