Skip to content

Commit aec9754

Browse files
committed
fix faulty method equality check
1 parent 46ad1f1 commit aec9754

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/wsh/host.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function encodePotentialMethod( target, prop) {
112112
var item;
113113
for( i in REFERENCES) {
114114
item = REFERENCES[ i];
115-
if( item.type === 'potential-method' && item.target === target, item.prop === prop)
115+
if( item.type === 'potential-method' && item.target === target && item.prop === prop)
116116
return { type: 'funref', value: i};
117117
}
118118
i = '' + nextRefId++;
@@ -176,9 +176,9 @@ function decodePotentialMethod( encoded) {
176176
args = decode( input[ 3]);
177177
if( target[ 'potential-method']) {
178178
if( thisArg === undefined)
179-
throw new Error( 'potentially a method, can only be used as such');
179+
throw new Error( 'potentially a method, use with a "this"');
180180
if( thisArg !== target.target)
181-
throw new Error( 'potentially a method, can only be used as such');
181+
throw new Error( 'potentially a method, "this" has changed');
182182
switch( args.length) {
183183
case 0: output = [ 'value', encode( target.target[ target.prop]())]; break;
184184
case 1: output = [ 'value', encode( target.target[ target.prop]( args[ 0]))]; break;

0 commit comments

Comments
 (0)