fn coerce_to_string()

in checker/src/call_visitor.rs [3021:3051]


    fn coerce_to_string(&mut self, path: &Rc<Path>) -> Rc<str> {
        if let PathEnum::Computed { value } = &path.value {
            if let Expression::Reference(path) = &value.expression {
                if let PathEnum::Computed { value } = &path.value {
                    if let Expression::CompileTimeConstant(ConstantDomain::Str(s)) =
                        &value.expression
                    {
                        return s.clone();
                    }
                }
            }
        } else if let Some(value) = self.block_visitor.bv.current_environment.value_at(path) {
            if let Expression::Reference(path) = &value.expression {
                if let PathEnum::Computed { value } = &path.value {
                    if let Expression::CompileTimeConstant(ConstantDomain::Str(s)) =
                        &value.expression
                    {
                        return s.clone();
                    }
                }
            }
        }
        if self.block_visitor.bv.check_for_errors {
            let warning = self.block_visitor.bv.cv.session.struct_span_warn(
                self.block_visitor.bv.current_span,
                "this argument should be a string literal, do not call this function directly",
            );
            self.block_visitor.bv.emit_diagnostic(warning);
        }
        Rc::from("dummy argument")
    }