mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-01 09:22:50 +00:00
Merge branch 'main' into py-method-decl
This commit is contained in:
commit
b10f486040
2 changed files with 6 additions and 0 deletions
|
@ -151,6 +151,7 @@ fn is_python_global(name: &str) -> bool {
|
|||
| "enumerate"
|
||||
| "eval"
|
||||
| "exec"
|
||||
| "exit"
|
||||
| "filter"
|
||||
| "float"
|
||||
| "format"
|
||||
|
@ -259,6 +260,7 @@ fn convert_to_python_name(name: Str) -> Str {
|
|||
"input!" => Str::ever("input"),
|
||||
"log" => Str::ever("print"), // TODO: log != print (prints after executing)
|
||||
"open!" => Str::ever("open"),
|
||||
"panic" => Str::ever("exit"),
|
||||
"print!" => Str::ever("print"),
|
||||
"py" | "pyimport" => Str::ever("__import__"),
|
||||
"quit" | "exit" => Str::ever("quit"),
|
||||
|
|
|
@ -1621,17 +1621,21 @@ impl Context {
|
|||
None,
|
||||
module(mono_q_tp("Path")),
|
||||
);
|
||||
let t_panic = nd_func(vec![param_t("err_message", Str)], None, NoneType);
|
||||
let t_pyimport = quant(t_pyimport, set! {static_instance("Path", Str)});
|
||||
let t_quit = func(vec![], None, vec![param_t("code", Int)], NoneType);
|
||||
let t_exit = t_quit.clone();
|
||||
self.register_builtin_impl("abs", t_abs, Immutable, Private);
|
||||
self.register_builtin_impl("assert", t_assert, Const, Private); // assert casting に悪影響が出る可能性があるため、Constとしておく
|
||||
self.register_builtin_impl("classof", t_classof, Immutable, Private);
|
||||
self.register_builtin_impl("compile", t_compile, Immutable, Private);
|
||||
self.register_builtin_impl("cond", t_cond, Immutable, Private);
|
||||
self.register_builtin_impl("discard", t_discard, Immutable, Private);
|
||||
self.register_builtin_impl("exit", t_exit, Immutable, Private);
|
||||
self.register_builtin_impl("if", t_if, Immutable, Private);
|
||||
self.register_builtin_impl("log", t_log, Immutable, Private);
|
||||
self.register_builtin_impl("import", t_import, Immutable, Private);
|
||||
self.register_builtin_impl("panic", t_panic, Immutable, Private);
|
||||
if cfg!(feature = "debug") {
|
||||
self.register_builtin_impl("py", t_pyimport.clone(), Immutable, Private);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue