MCPcopy Index your code
hub / github.com/RustPython/RustPython / forbidden_name

Method forbidden_name

crates/codegen/src/compile.rs:5887–5897  ·  view source on GitHub ↗
(&mut self, name: &str, ctx: NameUsage)

Source from the content-addressed store, hash-verified

5885 }
5886
5887 fn forbidden_name(&mut self, name: &str, ctx: NameUsage) -> CompileResult<bool> {
5888 if ctx == NameUsage::Store && name == "__debug__" {
5889 return Err(self.error(CodegenErrorType::Assign("__debug__")));
5890 // return Ok(true);
5891 }
5892 if ctx == NameUsage::Delete && name == "__debug__" {
5893 return Err(self.error(CodegenErrorType::Delete("__debug__")));
5894 // return Ok(true);
5895 }
5896 Ok(false)
5897 }
5898
5899 fn compile_error_forbidden_name(&mut self, name: &str) -> CodegenError {
5900 self.error(CodegenErrorType::SyntaxError(format!(

Callers 2

validate_kwd_attrsMethod · 0.80

Calls 2

ErrClass · 0.50
errorMethod · 0.45

Tested by

no test coverage detected