Browse Source

Merge branch 'fixReturn' of LInE/ivprog into master

Lucas de Souza 6 years ago
parent
commit
7f73f99e04
1 changed files with 2 additions and 2 deletions
  1. 2 2
      js/processor/ivprogProcessor.js

+ 2 - 2
js/processor/ivprogProcessor.js

@@ -416,7 +416,7 @@ export class IVProgProcessor {
 
 
   executeReturn (store, cmd) {
   executeReturn (store, cmd) {
     try {
     try {
-      const funcType = store.applyStore('$');
+      const funcType = store.applyStore('$').type;
       const $value = this.evaluateExpression(store, cmd.expression);
       const $value = this.evaluateExpression(store, cmd.expression);
       const funcName = store.name;
       const funcName = store.name;
       return $value.then(vl => {
       return $value.then(vl => {
@@ -425,7 +425,7 @@ export class IVProgProcessor {
           return Promise.resolve(store);
           return Promise.resolve(store);
         }
         }
 
 
-        if (vl === null || !funcType.type.isCompatible(vl.type)) {
+        if (vl === null || !funcType.isCompatible(vl.type)) {
           // TODO: Better error message -- Inform line and column from token!!!!
           // TODO: Better error message -- Inform line and column from token!!!!
           // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
           // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
           return Promise.reject(new Error(`Function ${funcName} must return ${funcType.type} instead of ${vl.type}.`));
           return Promise.reject(new Error(`Function ${funcName} must return ${funcType.type} instead of ${vl.type}.`));