Opened on 04/25/2017 at 02:08:49 PM

Closed on 04/27/2017 at 12:14:31 PM

#5185 closed change (fixed)

[emscripten] More compact definition of class prototypes

Reported by: trev Assignee: trev
Priority: P4 Milestone:
Module: Core Keywords:
Cc: Blocked By:
Blocking: #4122 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29421701/

Description

Background

The bindings will currently declare a class as follows:

exports.InvalidFilter = createClass(exports.Filter, 0);
exports.InvalidFilter.prototype.foo = ...;
exports.InvalidFilter.prototype.bar = ...;

This is unnecessarily verbose.

What to change

Pass in all properties to be declared on the prototype to the createClass function:

exports.InvalidFilter = createClass(exports.Filter, 0, {
  foo: ...,
  bar: ...,
});

The createClass function can then call Object.getOwnPropertyDescriptors() in order to copy these properties to the class prototype (this will work for getters and setters as well).

Attachments (0)

Change History (3)

comment:1 Changed on 04/25/2017 at 02:17:07 PM by trev

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed on 04/27/2017 at 12:13:56 PM by abpbot

A commit referencing this issue has landed:
Issue 5185 - [emscripten More compact definition of class prototypes]

comment:3 Changed on 04/27/2017 at 12:14:31 PM by trev

  • Resolution set to fixed
  • Status changed from reviewing to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from trev.
 
Note: See TracTickets for help on using tickets.