Компилятор жалуется на неизвестный идентификатор, кажется, что он не распознает ни одно из моих многочисленных объявлений, где я не прав?
if attached {INTEGER_REF} field.item as l_int
or attached {INTEGER_64} field.item as l_int
or ( attached {TUPLE} field.item as l_tuple and then attached {INTEGER_64} l_tuple.item (1) as l_int ) then
Result.put_integer (l_int.to_integer_64, primary_key_db_column_name)
elseif attached {STRING} field.item as l_s then
Result.put_string (l_s, primary_key_db_column_name)
end
Обновлять
Поскольку это выражение кажется допустимым, я подумал, что если в каждой ветке моего или объявлено l_int
, я смогу использовать его в области then.
Но кажется, что это выражение действительно
if attached a.b as l_b and then attached l_b.c as l_c then
l_c.is_available_in_this_scope
l_b.is_available_in_this_scope
else
io.putstring ("you are wrong dear and either l_b and l_c are not available!")
end
А этот нет!
if attached a.b as l_b and then attached l_b.c as l_c
or attached a.x as l_b and then attached l_x.d as l_c then
l_c.is_available_in_this_scope -- Compiler complain about l_c
l_b.is_available_in_this_scope -- Compiler complain about l_b
else
io.putstring ("you are wrong dear and either l_b and l_c are not available!")
end
С моим кодом
Это компилирует
if attached {INTEGER_REF} field.item as l_int then
Result.put_integer (l_int.to_integer_64, primary_key_db_column_name)
elseif attached {INTEGER_64} field.item as l_int then
Result.put_integer (l_int, primary_key_db_column_name)
elseif attached {TUPLE} field.item as l_tuple and then attached {INTEGER_64} l_tuple.item (1) as l_int then
Result.put_integer (l_int, primary_key_db_column_name)
elseif attached {STRING} field.item as l_s then
Result.put_string (l_s, primary_key_db_column_name)
else
logger.write_error ("to_json-> Type not found in matching:" + field.item.out)
check
not_found_item_type: False
end
end
Хотя это не
if attached {INTEGER_REF} field.item as l_int then
Result.put_integer (l_int.to_integer_64, primary_key_db_column_name)
elseif attached {INTEGER_64} field.item as l_int
or attached {TUPLE} field.item as l_tuple and then attached {INTEGER_64} l_tuple.item (1) as l_int then
Result.put_integer (l_int, primary_key_db_column_name) -- Unknown identifier `l_int`
elseif attached {STRING} field.item as l_s then
Result.put_string (l_s, primary_key_db_column_name)
else
logger.write_error ("to_json-> Type not found in matching:" + field.item.out)
check
not_found_item_type: False
end
end