Add builtin types: function and object

This commit is contained in:
Arseny Smirnov 2018-02-15 13:42:26 +03:00
parent a111989860
commit f49077de7f
1 changed files with 4 additions and 1 deletions

View File

@ -2445,6 +2445,8 @@ int tl_parse_builtin_combinator_decl (struct tree *T, int fun) {
if ((!mystrcmp2 (T->c[0]->text, T->c[0]->len, "int") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Int")) ||
(!mystrcmp2 (T->c[0]->text, T->c[0]->len, "long") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Long")) ||
(!mystrcmp2 (T->c[0]->text, T->c[0]->len, "double") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Double")) ||
(!mystrcmp2 (T->c[0]->text, T->c[0]->len, "object") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Object")) ||
(!mystrcmp2 (T->c[0]->text, T->c[0]->len, "function") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Function")) ||
(!mystrcmp2 (T->c[0]->text, T->c[0]->len, "string") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "String"))) {
struct tl_type *t = tl_add_type (T->c[1]->text, T->c[1]->len, 0, 0);
if (!t) {
@ -2951,7 +2953,8 @@ void write_type (struct tl_type *t) {
}
int is_builtin_type (const char *id) {
return !strcmp (id, "int") || !strcmp (id, "long") || !strcmp (id, "double") || !strcmp (id, "string");
return !strcmp (id, "int") || !strcmp (id, "long") || !strcmp (id, "double") || !strcmp (id, "string")
|| !strcmp(id, "object") || !strcmp(id, "function");
}
void write_combinator (struct tl_constructor *c) {