Ver código fonte

Change lang function return type from String to Char

Lucas de Souza 4 anos atrás
pai
commit
2d7119b4d6
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      js/processor/lib/strings.js

+ 2 - 2
js/processor/lib/strings.js

@@ -87,13 +87,13 @@ export function createrCharAtFun () {
       throw ProcessorErrorFactory.invalid_string_index(idx.get().toNumber(), str.get(),
         this.function_call_stack.pop());
     }
-    const temp = new StoreValue(Types.STRING, str.get().charAt(idx.get().toNumber()));
+    const temp = new StoreValue(Types.CHAR, str.get().charAt(idx.get().toNumber()));
     sto.insertStore("$", temp);
     sto.mode = Modes.RETURN;
     return sto;
   }
   const block = new Commands.CommandBlock([],  [new Commands.SysCall(charAtFun)]);
-  const func = new Commands.Function('$charAt', Types.STRING,
+  const func = new Commands.Function('$charAt', Types.CHAR,
     [new Commands.FormalParameter(Types.STRING, 'str', false),
     new Commands.FormalParameter(Types.INTEGER, 'index', false)],
     block);