diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-16 10:09:47 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-16 10:09:47 +0000 |
| commit | e2c65706e61be09ddb7eeb28cd1957acd4317bcf (patch) | |
| tree | 15447a03d67d395a722c5be3f0b05bc9f197197a /lib/CodeGen/CodeGen.cc | |
| parent | 45c9d37eb27d204a6202b33cb37e890af0171357 (diff) | |
feat(constants): implement literal constants with lexical scope
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/CodeGen.cc')
| -rw-r--r-- | lib/CodeGen/CodeGen.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGen.cc b/lib/CodeGen/CodeGen.cc index 6c6f682..b793657 100644 --- a/lib/CodeGen/CodeGen.cc +++ b/lib/CodeGen/CodeGen.cc @@ -117,7 +117,7 @@ void CodeGen::registerSymbol(const std::string &Name, Value *Storage, const std::string &TypeName, bool IsArray) { - Symbols[Name] = {Storage, TypeName, IsArray}; + Symbols[Name] = {Storage, TypeName, IsArray, nullptr, ConstantScopes.back().ID}; } const SymbolInfo *CodeGen::getSymbolInfo(const std::string &Name) const { @@ -243,6 +243,7 @@ bool CodeGen::marshalCallArgs(const std::string &Callee, reportError("Unknown variable %s in BYREF call", Var->getName().c_str()); return false; } + if (!requireWritable(*Info, Var->getName())) return false; // BYREF aliases the storage, so the types must match exactly. if (!Types->sameType(Info->TypeName, TypeName)) { reportError("BYREF argument %s to %s must be of type %s (got %s)", |
