Пример #1
0
 def generate_storage_code(self, code_builder: OpCodeBuilder):
     if code_builder.is_global(self.id_number):
         glob = code_builder.get_global(self.id_number)
         code_builder.add(codes.StGlob(glob))
     else:
         loc = code_builder.get_local(self.id_number)
         code_builder.add(codes.StLoc(loc))
Пример #2
0
 def generate_code(self, code_builder: OpCodeBuilder):
     if isinstance(self.declaration, decl.VarDecl):
         self.declaration.expression.generate_code(code_builder)
         loc = code_builder.get_local(self.declaration.id_number)
         code_builder.add(codes.StLoc(loc))