Browse Source

Fix repeat untill command not showing the correct name in the menu

Fix a bug that prevent a return inside the main function
Lucas de Souza 5 years ago
parent
commit
e79a7f541f
2 changed files with 6 additions and 2 deletions
  1. 1 1
      i18n/pt/ui.json
  2. 5 1
      js/processor/ivprogProcessor.js

+ 1 - 1
i18n/pt/ui.json

@@ -67,7 +67,7 @@
   "text_repeatNtimes": "Repita N vezes",
   "text_receives": "recebe",
   "text_whiletrue": "Enquanto verdadeiro",
-  "text_dowhiletrue": "Faça até que verdadeiro",
+  "text_dowhiletrue": "Repita até que verdadeiro",
   "text_switch": "Escolha",
   "text_functioncall": "Chamada de função",
   "text_value": "Valor",

+ 5 - 1
js/processor/ivprogProcessor.js

@@ -109,6 +109,9 @@ export class IVProgProcessor {
 
   findFunction (name) {
     if(name.match(/^\$.+$/)) {
+      if(name === IVProgProcessor.MAIN_INTERNAL_ID) {
+        return this.findMainFunction();
+      }
       const fun = LanguageDefinedFunction.getFunction(name);
       if(!fun) {
         throw ProcessorErrorFactory.not_implemented(name);
@@ -458,7 +461,8 @@ export class IVProgProcessor {
     try {
       const funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? 
         LanguageDefinedFunction.getMainFunctionName() : store.name;
-      const func = this.findFunction(funcName);
+      console.log(funcName,  store.name === IVProgProcessor.MAIN_INTERNAL_ID);
+      const func = this.findFunction(store.name);
       const funcType = func.returnType;
       const $value = this.evaluateExpression(store, cmd.expression);