Implement Record/TupleTypeSpec

This commit is contained in:
Shunsuke Shibayama 2022-10-21 14:42:53 +09:00
parent 9a88266bde
commit b28c6bd118
5 changed files with 83 additions and 4 deletions

View file

@ -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! {};

View 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}