uhop / dcl

Elegant minimalistic implementation of OOP with mixins + AOP in JavaScript for node.js and browsers.
http://www.dcljs.org/
Other
76 stars 10 forks source link

typos in advise.js (dcl v2) #26

Closed wkeese closed 6 years ago

wkeese commented 6 years ago

I'm getting exceptions when removing advice in dcl v2. Looks like it's due to a typo in the code... In advise.js you have three places that call convert() and then reference result.handles (with an s):

result = convert(null, advice, instance, name, 'value');
prop.value = result.value;
handles.push(result.handles);

Yet if you look at that convert() method, it returns "handle" not "handles":

function convert (value, advice, instance, name, type) {
    if (!value || !(value.node instanceof Node)) {
        value = makeStub(value);
        value.node.instance = instance;
        value.node.name = name;
        value.node.type = type;
    }
    var node = value.node.addAdvice(advice, instance, name, type);
    return {value: value, handle: node};
}

I saw the error running the regression tests for ibm-js/decor (like the getSetObserver test in tests/unit/Stateful.js) but I didn't bother making a minimal test case.