fixed image generation

This commit is contained in:
weckyy702
2021-04-25 14:22:03 +02:00
parent 45cb5c0467
commit 968bb53883
2 changed files with 61 additions and 56 deletions

View File

@@ -211,7 +211,7 @@ class JavaInterpreter:
return generic_instruction(f"declare variable '{var_name}' of type {var_type}"), idx
return generic_instruction(f"declare variable '{var_name}' of type {var_type} with value {var_value}"), idx
def _handle_instruction(self, line: str, idx:int) -> Tuple[Union[Iinstruction, List[Iinstruction]], int]:
def _handle_instruction(self, line: str, idx:int) -> Tuple[Union[instruction, List[instruction]], int]:
if line.startswith("while("):
logging.debug("Found while construct in line: %i", idx+1)
return self._handle_while(line, idx)
@@ -236,8 +236,8 @@ class JavaInterpreter:
logging.debug("Found generic instruction in line %i", idx+1)
return generic_instruction(line), idx
def _get_instructions_in_scope(self, idx: int=0) -> Tuple[List[Iinstruction], int]:
scope: List[Iinstruction] = []
def _get_instructions_in_scope(self, idx: int=0) -> Tuple[List[instruction], int]:
scope: List[instruction] = []
i = idx
while i < len(self._lines):
line = self._lines[i]
@@ -267,7 +267,7 @@ class JavaInterpreter:
fname = groups["name"]
return ftype, fname, fargs
def _get_function_instructions(self, function_header: str) -> List[Iinstruction]:
def _get_function_instructions(self, function_header: str) -> List[instruction]:
idx = self._lines.index(function_header)
brace_offset = self._get_scope_start_offset(idx)
return self._get_instructions_in_scope(idx+brace_offset)[0]