Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_getDictionaryCreationCode(
to_name=dict_name,
pairs=expression.getNamedArgumentPairs(),
emit=emit,
context=context,
)
else:
dict_name = None
if seq_name is not None:
emit(
"%s = TO_DICT( %s, %s );"
% (value_name, seq_name, "NULL" if dict_name is None else dict_name)
)
getErrorExitCode(
check_name=value_name,
release_names=(seq_name, dict_name),
emit=emit,
context=context,
)
context.addCleanupTempName(value_name)
def getCallCodeNoArgs(to_name, called_name, needs_check, emit, context):
emitLineNumberUpdateCode(emit, context)
emit("%s = CALL_FUNCTION_NO_ARGS( %s );" % (to_name, called_name))
getErrorExitCode(
check_name=to_name,
release_name=called_name,
emit=emit,
needs_check=needs_check,
context=context,
)
context.addCleanupTempName(to_name)
def _getInstanceCallCodePosArgs(
to_name, called_name, called_attribute_name, args_name, needs_check, emit, context
):
emitLineNumberUpdateCode(emit, context)
emit(
"%s = CALL_METHOD_WITH_POSARGS( %s, %s, %s );"
% (to_name, called_name, called_attribute_name, args_name)
)
getErrorExitCode(
check_name=to_name,
release_names=(called_name, args_name),
needs_check=needs_check,
emit=emit,
context=context,
)
context.addCleanupTempName(to_name)
def getBuiltinRefCode(to_name, builtin_name, emit, context):
emit(
"%s = LOOKUP_BUILTIN( %s );" % (
to_name,
getConstantCode(
constant = builtin_name,
context = context
)
)
)
getErrorExitCode(
check_name = to_name,
emit = emit,
context = context
)
def _getSliceLookupIndexesCode(
to_name, lower_name, upper_name, source_name, emit, context
):
emit(
"%s = LOOKUP_INDEX_SLICE(%s, %s, %s);"
% (to_name, source_name, lower_name, upper_name)
)
getErrorExitCode(
check_name=to_name, release_name=source_name, emit=emit, context=context
)
context.addCleanupTempName(to_name)
def getAttributeLookupSpecialCode(
to_name, source_name, attr_name, needs_check, emit, context
):
emit("%s = LOOKUP_SPECIAL(%s, %s);" % (to_name, source_name, attr_name))
getErrorExitCode(
check_name=to_name,
release_names=(source_name, attr_name),
emit=emit,
needs_check=needs_check,
context=context,
)
context.addCleanupTempName(to_name)
source_name=source_name,
filename_name=filename_name,
mode_name=mode_name,
flags_name="NULL",
dont_inherit_name="NULL",
optimize_name="NULL",
emit=emit,
context=context,
)
emit(
"%s = EVAL_CODE( %s, %s, %s );"
% (to_name, compiled_name, globals_name, locals_name)
)
getErrorExitCode(
check_name=to_name,
release_names=(compiled_name, globals_name, locals_name),
emit=emit,
context=context,
)
context.addCleanupTempName(to_name)
else:
with withObjectCodeTemporaryAssignment(
to_name, "op_%s_res" % operator.lower(), expression, emit, context
) as value_name:
emit(
"%s = %s( %s );"
% (
value_name,
helper,
", ".join(str(arg_name) for arg_name in prefix_args + arg_names),
)
)
getErrorExitCode(
check_name=value_name,
release_names=arg_names,
needs_check=needs_check,
emit=emit,
context=context,
)
if ref_count:
context.addCleanupTempName(value_name)
emit(
"%s = %s( NULL%s%s );"
% (
to_name,
function_identifier,
", " if suffix_args else "",
", ".join(str(arg) for arg in suffix_args),
)
)
# Arguments are owned to the called in direct function call.
for arg_name in arg_names:
if context.needsCleanup(arg_name):
context.removeCleanupTempName(arg_name)
getErrorExitCode(
check_name=to_name, emit=emit, needs_check=needs_check, context=context
)
context.addCleanupTempName(to_name)
def getBuiltinInt2Code(to_name, base_name, value_name, emit, context):
emit(
"%s = TO_INT2( %s, %s );" % (
to_name,
value_name,
base_name
)
)
getReleaseCodes(
release_names = (value_name, base_name),
emit = emit,
context = context
)
getErrorExitCode(
check_name = to_name,
emit = emit,
context = context
)
context.addCleanupTempName(to_name)