{"ScriptPreparationCode":"class Parent {\r\n next = null\r\n constructor(next) {\r\n this.next = next\r\n }\r\n foo() {\r\n return \u0022Parent\u0022\r\n }\r\n optimize() {\r\n this.next?.optimize()\r\n }\r\n}\r\nclass Wrapper extends Parent {\r\n foo() {\r\n return this.next.foo()\r\n }\r\n optimize() {\r\n this.next.optimize()\r\n this.foo = this.next.foo\r\n }\r\n}\r\nclass Unwrappable extends Parent {\r\n foo() {\r\n return this.next.foo()\r\n }\r\n}\r\nclass Child1 extends Parent {\r\n foo() {\r\n return \u0022Child1\u0022\r\n }\r\n}\r\nclass Child2 extends Parent {\r\n foo() {\r\n return \u0022Child2\u0022\r\n }\r\n}\r\nvar a = new Wrapper(new Unwrappable(new Wrapper(new Wrapper(new Unwrappable(new Wrapper(new Child2()))))))\r\nvar b = new Wrapper(new Unwrappable(new Wrapper(new Wrapper(new Unwrappable(new Wrapper(new Child1()))))))\r\nb.optimize()","TestCases":[{"Name":"Proxy method","Code":"for (let i = 0; i \u003C 10; \u002B\u002Bi) {\r\n if (a.foo() !== \u0022Child2\u0022) {\r\n throw new Error(\u0022Unexpected result\u0022)\r\n }\r\n}","IsDeferred":false},{"Name":"Replaced method","Code":"for (let i = 0; i \u003C 10; \u002B\u002Bi) {\r\n if (b.foo() !== \u0022Child1\u0022) {\r\n throw new Error(\u0022Unexpected result\u0022)\r\n }\r\n}","IsDeferred":false}]}