gkz / grasp

JavaScript structural search, replace, and refactor
http://graspjs.com
MIT License
1.28k stars 33 forks source link

Cannot read property 'nodes' of undefined (caused by switch ?) #90

Open ainthek opened 8 years ago

ainthek commented 8 years ago

function test() {

// unrem this and run: grasp 'if[consequent=:not(block)]' -r samples/if/s-query-problem.js 
// you will get Cannot read property 'nodes' of undefined
// switch (propName) { 
//     case "1":
//         return 1;
// }

if (propName)    // match
    return 0;
else {
    return 1;
}

if (propName){  // not match
    return 0;
}
else {
    return 1;
}

};