Skip to content

Commit 183415e

Browse files
committed
Move bytecode into own crate.
1 parent f0492ee commit 183415e

File tree

12 files changed

+37
-6
lines changed

12 files changed

+37
-6
lines changed

Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "rustpython"
33
version = "0.0.1"
4-
authors = ["Windel Bouwman", "Shing Lyu <shing.lyu@gmail.com>"]
4+
authors = ["Windel Bouwman <windel@windel.nl>", "Shing Lyu <shing.lyu@gmail.com>"]
55
edition = "2018"
66

77
[workspace]
8-
members = [".", "derive", "vm", "wasm/lib", "parser", "compiler"]
8+
members = [".", "derive", "vm", "wasm/lib", "parser", "compiler", "bytecode"]
99

1010
[[bench]]
1111
name = "bench"

bytecode/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "rustpython_bytecode"
3+
version = "0.1.0"
4+
authors = ["Windel Bouwman <windel@windel.nl>"]
5+
edition = "2018"
6+
7+
[dependencies]
8+
bitflags = "1.1"
9+
num-bigint = { version = "0.2", features = ["serde"] }
10+
num-complex = { version = "0.2", features = ["serde"] }
11+
serde = { version = "1.0", features = ["derive"] }
12+
rustpython_parser = { path = "../parser" }

bytecode/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod bytecode;

compiler/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[package]
22
name = "rustpython_compiler"
33
version = "0.1.0"
4-
authors = ["coolreader18 <33094578+coolreader18@users.noreply.github.com>"]
4+
authors = ["coolreader18 <33094578+coolreader18@users.noreply.github.com>", "Windel Bouwman <windel@windel.nl>"]
55
edition = "2018"
66

77
[dependencies]
88
bitflags = "1.1"
9+
rustpython_bytecode = { path = "../bytecode" }
910
rustpython_parser = { path = "../parser" }
1011
serde = { version = "1.0", features = ["derive"] }
1112
num-complex = { version = "0.2", features = ["serde"] }

compiler/src/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
//! https://github.com/python/cpython/blob/master/Python/compile.c
66
//! https://github.com/micropython/micropython/blob/master/py/compile.c
77
8-
use crate::bytecode::{self, CallType, CodeObject, Instruction, Varargs};
98
use crate::error::{CompileError, CompileErrorType};
109
use crate::symboltable::{make_symbol_table, statements_to_symbol_table, SymbolRole, SymbolScope};
1110
use num_complex::Complex64;
11+
use rustpython_bytecode::bytecode::{self, CallType, CodeObject, Instruction, Varargs};
1212
use rustpython_parser::{ast, parser};
1313

1414
struct Compiler {

compiler/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#[macro_use]
55
extern crate log;
66

7-
pub mod bytecode;
87
pub mod compile;
98
pub mod error;
109
mod symboltable;

derive/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ syn = { version = "0.15.29", features = ["full"] }
1212
quote = "0.6.11"
1313
proc-macro2 = "0.4.27"
1414
rustpython_compiler = { path = "../compiler" }
15+
rustpython_bytecode = { path = "../bytecode" }
1516
bincode = "1.1"
1617
proc-macro-hack = "0.5"

derive/src/compile_bytecode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ use crate::{extract_spans, Diagnostic};
1717
use bincode;
1818
use proc_macro2::{Span, TokenStream as TokenStream2};
1919
use quote::quote;
20-
use rustpython_compiler::{bytecode::CodeObject, compile};
20+
use rustpython_bytecode::bytecode::CodeObject;
21+
use rustpython_compiler::compile;
2122
use std::env;
2223
use std::fs;
2324
use std::path::PathBuf;

0 commit comments

Comments
 (0)