MCPcopy
hub / github.com/hylang/hy / compile

Method compile

hy/compiler.py:393–412  ·  view source on GitHub ↗
(self, tree)

Source from the content-addressed store, hash-verified

391 return Result() + _model_compilers[type(atom)](self, atom)
392
393 def compile(self, tree):
394 if tree is None:
395 return Result()
396 try:
397 ret = self.compile_atom(tree)
398 return ret
399 except HyCompileError:
400 # compile calls compile, so we're going to have multiple raise
401 # nested; so let's re-raise this exception, let's not wrap it in
402 # another HyCompileError!
403 raise
404 except HyLanguageError as e:
405 # These are expected errors that should be passed to the user.
406 raise e
407 except Exception as e:
408 # These are unexpected errors that will--hopefully--never be seen
409 # by the user.
410 f_exc = traceback.format_exc()
411 exc_msg = "Internal Compiler Bug\n {}".format(f_exc)
412 raise HyCompileError(exc_msg)
413
414 def _syntax_error(self, expr, message):
415 raise HySyntaxError(message, expr, self.filename, self.source)

Callers 15

_compile_collectMethod · 0.95
_compile_branchMethod · 0.95
compile_expressionMethod · 0.95
compile_fcomponentMethod · 0.95
runMethod · 0.80
hy_compileFunction · 0.80
hyc_mainFunction · 0.80
digest_type_paramsFunction · 0.80
compile_eval_foo_compileFunction · 0.80
compile_quoteFunction · 0.80
compile_unary_operatorFunction · 0.80

Calls 3

compile_atomMethod · 0.95
HyCompileErrorClass · 0.90
ResultClass · 0.85

Tested by 2

test_compiler_bare_namesFunction · 0.64