File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ function Command(cmd) {
190190}
191191
192192Command .prototype = Object .create (Argument .prototype );
193- Command .prototype .constructor = Argument ;
193+ Command .prototype .constructor = Command ;
194194
195195/* !
196196 * @brief Event Class
@@ -200,7 +200,7 @@ function Event(event) {
200200}
201201
202202Event .prototype = Object .create (Argument .prototype );
203- Event .prototype .constructor = Argument ;
203+ Event .prototype .constructor = Event ;
204204```
205205
206206Output pseudo code:
@@ -263,7 +263,7 @@ Here some things to notice:
263263* Base class is determined by next code:
264264
265265 ```javascript
266- Event.prototype.constructor = Argument;
266+ Event.prototype = Object.create( Argument.prototype) ;
267267 ```
268268
269269 Here `Argument` will be used as base class of `Event`.
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ describe('extractToken', () => {
66 const function_line = 'function foo() {}' ;
77 const class_constructor_line = 'function Class(args) {}' ;
88 const class_method_line = 'Class.prototype.foo = function(arg) {}' ;
9- const base_class_line = 'Class.prototype.constructor = BaseClass' ;
9+ const base_class_line = 'Class.prototype = Object.create( BaseClass.prototype) ' ;
1010
1111 it ( 'extracts global variable' , ( ) => {
1212 expect ( extractToken . extractVariable ( variable_line ) ) . toEqual ( {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ const extractClass = line => {
4949} ;
5050
5151const extractBaseClass = line => {
52- const base_class_expr = / ^ \s * ( \w + ) \. p r o t o t y p e \. c o n s t r u c t o r \ s* \= \s * ( \w + ) / ;
52+ const base_class_expr = / ^ \s * ( \w + ) \. p r o t o t y p e \s * \= \s * O b j e c t \. c r e a t e \( ( \w + ) \. p r o t o t y p e \ )/ ;
5353 const base_class_match = line . match ( base_class_expr ) ;
5454
5555 if ( base_class_match ) {
You can’t perform that action at this time.
0 commit comments