mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 13:41:10 +00:00
Implement Record/TupleTypeSpec
This commit is contained in:
parent
9a88266bde
commit
b28c6bd118
5 changed files with 83 additions and 4 deletions
|
@ -956,6 +956,22 @@ impl Context {
|
|||
}
|
||||
Ok(dict_t(inst_tys.into()))
|
||||
}
|
||||
TypeSpec::Record(rec) => {
|
||||
let mut inst_tys = dict! {};
|
||||
for (k, v) in rec {
|
||||
inst_tys.insert(
|
||||
k.into(),
|
||||
self.instantiate_typespec(
|
||||
v,
|
||||
opt_decl_t,
|
||||
tmp_tv_ctx,
|
||||
mode,
|
||||
not_found_is_qvar,
|
||||
)?,
|
||||
);
|
||||
}
|
||||
Ok(Type::Record(inst_tys))
|
||||
}
|
||||
// TODO: エラー処理(リテラルでない)はパーサーにやらせる
|
||||
TypeSpec::Enum(set) => {
|
||||
let mut new_set = set! {};
|
||||
|
|
13
compiler/erg_compiler/lib/pystd/platform.d.er
Normal file
13
compiler/erg_compiler/lib/pystd/platform.d.er
Normal file
|
@ -0,0 +1,13 @@
|
|||
.architecture!: () => Str
|
||||
.machine!: () => Str
|
||||
.node!: () => Str
|
||||
.platform!: () => Str
|
||||
.processor!: () => Str
|
||||
.python_build!: () => Str
|
||||
.python_compiler!: () => Str
|
||||
.python_branch!: () => Str
|
||||
.python_implementation!: () => Str
|
||||
.python_revision!: () => Str
|
||||
.python_version!: () => Str
|
||||
.python_version_tuple!: () => (Str, Str, Str)
|
||||
.uname!: () => {.system = Str; .node = Str; .release = Str; .version = Str; .machine = Str}
|
Loading…
Add table
Add a link
Reference in a new issue