fix up usage of IDENT_FLAG_UNKNOWN

master
Daniel Kolesa 2021-03-28 00:38:41 +01:00
parent 99f227bfd9
commit 71f45b2f07
5 changed files with 13 additions and 7 deletions

View File

@ -239,7 +239,9 @@ static void compilelookup(codegen_state &gs, int ltype, int prevargs = MAX_RESUL
if (lookup.empty()) goto invalid; if (lookup.empty()) goto invalid;
lookup.push_back('\0'); lookup.push_back('\0');
lookupid: lookupid:
ident *id = gs.ts.pstate->new_ident(lookup.str_term()); ident *id = gs.ts.pstate->new_ident(
lookup.str_term(), IDENT_FLAG_UNKNOWN
);
if (id) { if (id) {
switch (id->get_type()) { switch (id->get_type()) {
case ident_type::IVAR: case ident_type::IVAR:
@ -531,7 +533,9 @@ static bool compileblocksub(codegen_state &gs, int prevargs) {
} }
lookup.push_back('\0'); lookup.push_back('\0');
lookupid: lookupid:
ident *id = gs.ts.pstate->new_ident(lookup.str_term()); ident *id = gs.ts.pstate->new_ident(
lookup.str_term(), IDENT_FLAG_UNKNOWN
);
if (id) { if (id) {
switch (id->get_type()) { switch (id->get_type()) {
case ident_type::IVAR: case ident_type::IVAR:
@ -1224,7 +1228,9 @@ static void compilestatements(codegen_state &gs, int rettype, int brak, int prev
gs.next_char(); gs.next_char();
if (!idname.empty()) { if (!idname.empty()) {
idname.push_back('\0'); idname.push_back('\0');
ident *id = gs.ts.pstate->new_ident(idname.str_term()); ident *id = gs.ts.pstate->new_ident(
idname.str_term(), IDENT_FLAG_UNKNOWN
);
if (id) { if (id) {
switch (id->get_type()) { switch (id->get_type()) {
case ident_type::ALIAS: case ident_type::ALIAS:

View File

@ -117,7 +117,7 @@ struct codegen_state {
} }
void gen_ident(std::string_view word) { void gen_ident(std::string_view word) {
gen_ident(ts.pstate->new_ident(word)); gen_ident(ts.pstate->new_ident(word, IDENT_FLAG_UNKNOWN));
} }
void gen_value( void gen_value(

View File

@ -79,7 +79,7 @@ state::state(alloc_func func, void *data) {
new_ident(static_cast<char const *>(buf), IDENT_FLAG_ARG); new_ident(static_cast<char const *>(buf), IDENT_FLAG_ARG);
} }
ident *id = new_ident("//dummy"); ident *id = new_ident("//dummy", IDENT_FLAG_UNKNOWN);
if (id->get_index() != ID_IDX_DUMMY) { if (id->get_index() != ID_IDX_DUMMY) {
throw internal_error{"invalid dummy index"}; throw internal_error{"invalid dummy index"};
} }

View File

@ -274,7 +274,7 @@ ident *any_value::force_ident(state &cs) {
default: default:
break; break;
} }
auto *id = cs.new_ident(get_str()); auto *id = cs.new_ident(get_str(), IDENT_FLAG_UNKNOWN);
set_ident(id); set_ident(id);
return id; return id;
} }

View File

@ -729,7 +729,7 @@ std::uint32_t *vm_exec(
any_value &arg = args.back(); any_value &arg = args.back();
ident *id = ts.istate->identmap[ID_IDX_DUMMY]; ident *id = ts.istate->identmap[ID_IDX_DUMMY];
if (arg.get_type() == value_type::STRING) { if (arg.get_type() == value_type::STRING) {
id = cs.new_ident(arg.get_str()); id = cs.new_ident(arg.get_str(), IDENT_FLAG_UNKNOWN);
} }
if ( if (
(id->get_flags() & IDENT_FLAG_ARG) && (id->get_flags() & IDENT_FLAG_ARG) &&