rename special to writable

This commit is contained in:
LoganDark 2021-11-08 13:17:43 -08:00
parent 283a349fb9
commit 87ac5efb77
No known key found for this signature in database
GPG key ID: B8C37CEDE1AC60EA

View file

@ -1277,7 +1277,7 @@ struct Compiler
{ {
const Global* global = globals.find(expr->name); const Global* global = globals.find(expr->name);
return options.optimizationLevel >= 1 && (!global || (!global->written && !global->special)); return options.optimizationLevel >= 1 && (!global || (!global->written && !global->writable));
} }
void compileExprIndexName(AstExprIndexName* expr, uint8_t target) void compileExprIndexName(AstExprIndexName* expr, uint8_t target)
@ -3447,7 +3447,7 @@ struct Compiler
struct Global struct Global
{ {
bool special = false; bool writable = false;
bool written = false; bool written = false;
}; };
@ -3505,7 +3505,7 @@ struct Compiler
{ {
Global* g = globals.find(object->name); Global* g = globals.find(object->name);
return !g || (!g->special && !g->written) ? Builtin{object->name, expr->index} : Builtin(); return !g || (!g->writable && !g->written) ? Builtin{object->name, expr->index} : Builtin();
} }
else else
{ {
@ -3709,7 +3709,7 @@ void compileOrThrow(BytecodeBuilder& bytecode, AstStatBlock* root, const AstName
AstName name = names.get(global); AstName name = names.get(global);
if (name.value) if (name.value)
compiler.globals[name].special = true; compiler.globals[name].writable = true;
} }
if (options.mutableGlobalNames) if (options.mutableGlobalNames)
@ -3718,7 +3718,7 @@ void compileOrThrow(BytecodeBuilder& bytecode, AstStatBlock* root, const AstName
AstName name = names.get(*ptr); AstName name = names.get(*ptr);
if (name.value) if (name.value)
compiler.globals[name].special = true; compiler.globals[name].writable = true;
} }
// this visitor traverses the AST to analyze mutability of locals/globals, filling Local::written and Global::written // this visitor traverses the AST to analyze mutability of locals/globals, filling Local::written and Global::written