Samsung / jalangi2

Dynamic analysis framework for JavaScript
Apache License 2.0
435 stars 119 forks source link

TypeError: Cannot read property 'length' of undefined #150

Open RichardHoOoOo opened 5 years ago

RichardHoOoOo commented 5 years ago

TypeError: Cannot read property 'length' of undefined at generateFunctionParams (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:651:34) at generateFunctionBody (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:705:9) at Object.generateMethodDefinition [as MethodDefinition] (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:1234:13) at Object.generateClassBody [as ClassBody] (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:1569:34) at Object.generateClassDeclaration [as ClassDeclaration] (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:1591:32) at Object.generateBlockStatement [as BlockStatement] (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:1526:36) at stmtToJs (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:2143:28) at Object.generateTryStatement [as TryStatement] (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:1858:26) at Object.generateBlockStatement [as BlockStatement] (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:1526:36) at Object.generateWhileStatement [as WhileStatement] (/Users/jiajunhu/Google_Drive/Research/ICSE2020/jalangi2/node_modules/esotope/esotope.js:2103:32)

Test sample:

<script type="text/javascript">

    class myDate extends Date {

        constructor() {
            super();
        }

        getFormattedDate() {
            var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
            return this.getDate() + "-" + months[this.getMonth()] + "-" + this.getFullYear();
        }
    }

function foo(){
        return "foo ";
    }

    function bar(){
        return "bar ";
    }

    function test() {
        var d = new myDate();
  s = ""
        s = d.getFormattedDate();
        for (var i = 0; i < 10; i++){
            if (i%2 === 0){
                s += foo();
            } else {
                s += bar();
            }
        }
        return s;
    }   
</script>
amiduai commented 3 years ago

Same here, anyone has solved it ?