Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.argumentString fails for Methods with argNames==nil #1320

Closed
eirikblekesaune opened this issue Feb 22, 2015 · 0 comments
Closed

.argumentString fails for Methods with argNames==nil #1320

eirikblekesaune opened this issue Feb 22, 2015 · 0 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library

Comments

@eirikblekesaune
Copy link
Member

The test code below illustrates the bug. In short, all Methods that have .argNames nil fails .argumentString.

(
    ~methodsThatFailed = List.new;
    ~methodsThatPassed = List.new;
    Object.allSubclasses.do({arg item;
        item.methods.do({arg jtem;
            var method = jtem;
            try {
                method.argumentString;
                ".argumentString PASSED for: %".format(method.asString).postln;
                ~methodsThatPassed.add( method);
            } {|err|
                ".argumentString FAILED for: %".format(method.asString).postln;
                ~methodsThatFailed.add(method);
            }
        });
    });
)

//Many failed
~methodsThatFailed.size
//The ones that failed have argNames == nil
~methodsThatFailed.every({arg item; item.argNames == nil})
//The opposite is true for the ones that passed
~methodsThatPassed.every({arg item; item.argNames != nil})

This method was broken in 0552034

This is how I have fixed it on my fork:

    //Method:keyValuePairsFromArgs
    keyValuePairsFromArgs {
        var argNames, argVals;
        if(this.argNames.isNil, { ^[] });
        argNames = this.argNames.drop(1); // first argName is "this"
        argVals = this.prototypeFrame.drop(1).keep(argNames.size);
        ^[argNames, argVals].flop.flatten
    }
@crucialfelix crucialfelix added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library labels Jan 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library
Projects
None yet
Development

No branches or pull requests

2 participants