mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-15 17:15:24 +00:00
parent
05fcfa8aa1
commit
ae122c6478
3 changed files with 5 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
|||
//! Take an AST and transform it into bytecode
|
||||
//!
|
||||
//! Inspirational code:
|
||||
//! https://github.com/python/cpython/blob/master/Python/compile.c
|
||||
//! https://github.com/python/cpython/blob/main/Python/compile.c
|
||||
//! https://github.com/micropython/micropython/blob/master/py/compile.c
|
||||
|
||||
use crate::ir::{self, CodeInfo};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! Compile a Python AST or source code into bytecode consumable by RustPython.
|
||||
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustPython/RustPython/master/logo.png")]
|
||||
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustPython/RustPython/main/logo.png")]
|
||||
#![doc(html_root_url = "https://docs.rs/rustpython-compiler/")]
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -4,7 +4,7 @@ This ensures that global and nonlocal keywords are picked up.
|
|||
Then the compiler can use the symbol table to generate proper
|
||||
load and store instructions for names.
|
||||
|
||||
Inspirational file: https://github.com/python/cpython/blob/master/Python/symtable.c
|
||||
Inspirational file: https://github.com/python/cpython/blob/main/Python/symtable.c
|
||||
*/
|
||||
|
||||
use crate::error::{CompileError, CompileErrorType};
|
||||
|
@ -196,7 +196,7 @@ impl std::fmt::Debug for SymbolTable {
|
|||
}
|
||||
|
||||
/* Perform some sort of analysis on nonlocals, globals etc..
|
||||
See also: https://github.com/python/cpython/blob/master/Python/symtable.c#L410
|
||||
See also: https://github.com/python/cpython/blob/main/Python/symtable.c#L410
|
||||
*/
|
||||
fn analyze_symbol_table(symbol_table: &mut SymbolTable) -> SymbolTableResult {
|
||||
let mut analyzer = SymbolTableAnalyzer::default();
|
||||
|
@ -760,7 +760,7 @@ impl SymbolTableBuilder {
|
|||
value,
|
||||
simple,
|
||||
} => {
|
||||
// https://github.com/python/cpython/blob/master/Python/symtable.c#L1233
|
||||
// https://github.com/python/cpython/blob/main/Python/symtable.c#L1233
|
||||
match &target.node {
|
||||
ast::ExprKind::Name { id, .. } if *simple => {
|
||||
self.register_name(id, SymbolUsage::AnnotationAssigned, location)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue