def final_definition( self, module: str, name: str, typ: RType, emitter: Emitter) -> str: static_name = emitter.static_name(name, module) # Here we rely on the fact that undefined value and error value are always the same if isinstance(typ, RTuple): # We need to inline because initializer must be static undefined = '{{ {} }}'.format(''.join(emitter.tuple_undefined_value_helper(typ))) else: undefined = emitter.c_undefined_value(typ) return '{}{} = {};'.format(emitter.ctype_spaced(typ), static_name, undefined)
def define_finals(self, final_names: Iterable[Tuple[str, RType]], emitter: Emitter) -> None: for name, typ in final_names: static_name = emitter.static_name(name, 'final') # Here we rely on the fact that undefined value and error value are always the same if isinstance(typ, RTuple): # We need to inline because initializer must be static undefined = '{{ {} }}'.format(''.join(emitter.tuple_undefined_value_helper(typ))) else: undefined = emitter.c_undefined_value(typ) emitter.emit_line('{}{} = {};'.format(emitter.ctype_spaced(typ), static_name, undefined))