harsher compile error

This commit is contained in:
2026-02-20 12:52:40 -06:00
parent 8d449e6fc6
commit e6d05abd03
2 changed files with 74 additions and 3 deletions

View File

@@ -1864,6 +1864,7 @@ var streamline = function(ir, log) {
var cs = null
var argc = null
var known_arity = null
var load_field_null = false
// Build module_slots map from ir._module_summaries
if (ir._module_summaries != null) {
@@ -2007,12 +2008,15 @@ var streamline = function(ir, log) {
// --- Warning checks (likely bug) ---
load_field_null = false
if (op == "load_field") {
obj_type = cur_types[instr[2]]
if (obj_type == T_ARRAY) {
emit("warning", line, col, "named property access on array — always returns null")
load_field_null = true
} else if (obj_type == T_TEXT) {
emit("warning", line, col, "named property access on text — always returns null")
load_field_null = true
}
// Cross-module: check if obj is a module with known exports
ms = module_slots[text(instr[2])]
@@ -2044,6 +2048,11 @@ var streamline = function(ir, log) {
// Update types for this instruction
track_types(cur_types, instr)
// Override: load_field on array/text always returns null
if (load_field_null) {
cur_types[instr[1]] = T_NULL
}
i = i + 1
}