Changeset 27410

Show
Ignore:
Timestamp:
12/25/08 22:43:59 (4 years ago)
Author:
fujidig
Message:

compileParamater の戻り値がバグってたのを修正

Location:
lang/javascript/hsp-on-js
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/hsp-on-js/branches/int-immediate/src/compiler.js

    r27396 r27410  
    486486        でも、変数として受け取ることがないパラメータの場合、それは無駄である。 
    487487        このパラメータを true にすれば値そのものを積む命令を生成する。 
     488         
     489        戻り値: パラメータが単一の変数であり、 
     490                変数を積む命令を生成したとき true 、そうでないとき false 
    488491        */ 
    489492        compileParameter: function compileParameter(sequence, notReceiveVar) { 
     
    521524                                break; 
    522525                        case Token.Type.STRUCT: 
    523                                 usedPushVar = this.compileStruct(sequence, notReceiveVar || !this.isOnlyVar(this.tokensPos, headPos)); 
     526                                var onlyVar = this.isOnlyVar(this.tokensPos, headPos); 
     527                                var result = this.compileStruct(sequence, notReceiveVar || !onlyVar); 
     528                                if(onlyVar) usedPushVar = result; 
    524529                                break; 
    525530                        case Token.Type.LABEL: 
  • lang/javascript/hsp-on-js/branches/int-immediate/src/evaluator.js

    r27396 r27410  
    765765                                        push('if(frame.userDefFunc && frame.userDefFunc.isCType) {'); 
    766766                                        if(usedPushVar) { 
    767                                                 // なんか単一の変数でない式なのに true になっていることがあるっぽいので後で調べる 
    768                                                 push('    stack[stack.length - 1] = toValue(stack[stack.length - 1]);'); 
     767                                                push('    stack[stack.length - 1] = stack[stack.length - 1].toValue();'); 
    769768                                        } 
    770769                                        push('} else {'); indent ++ 
  • lang/javascript/hsp-on-js/trunk/src/compiler.js

    r27213 r27410  
    487487        でも、変数として受け取ることがないパラメータの場合、それは無駄である。 
    488488        このパラメータを true にすれば値そのものを積む命令を生成する。 
     489         
     490        戻り値: パラメータが単一の変数であり、 
     491                変数を積む命令を生成したとき true 、そうでないとき false 
    489492        */ 
    490493        compileParameter: function compileParameter(sequence, notReceiveVar) { 
     
    522525                                break; 
    523526                        case Token.Type.STRUCT: 
    524                                 usedPushVar = this.compileStruct(sequence, notReceiveVar || !this.isOnlyVar(this.tokensPos, headPos)); 
     527                                var onlyVar = this.isOnlyVar(this.tokensPos, headPos); 
     528                                var result = this.compileStruct(sequence, notReceiveVar || !onlyVar); 
     529                                if(onlyVar) usedPushVar = result; 
    525530                                break; 
    526531                        case Token.Type.LABEL: