@tishlang/tish 1.0.29 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +1 -0
- package/crates/js_to_tish/src/transform/expr.rs +15 -6
- package/crates/tish/Cargo.toml +1 -1
- package/crates/tish/src/main.rs +1 -1
- package/crates/tish/tests/integration_test.rs +4 -3
- package/crates/tish_ast/src/ast.rs +65 -2
- package/crates/tish_build_utils/src/lib.rs +10 -2
- package/crates/tish_builtins/src/construct.rs +177 -0
- package/crates/tish_builtins/src/globals.rs +3 -5
- package/crates/tish_builtins/src/helpers.rs +2 -3
- package/crates/tish_builtins/src/lib.rs +1 -0
- package/crates/tish_builtins/src/object.rs +3 -4
- package/crates/tish_bytecode/src/compiler.rs +85 -11
- package/crates/tish_bytecode/src/opcode.rs +7 -3
- package/crates/tish_compile/Cargo.toml +1 -0
- package/crates/tish_compile/src/codegen.rs +604 -106
- package/crates/tish_compile/src/infer.rs +236 -0
- package/crates/tish_compile/src/lib.rs +52 -5
- package/crates/tish_compile/src/types.rs +42 -5
- package/crates/tish_compile_js/Cargo.toml +1 -0
- package/crates/tish_compile_js/src/codegen.rs +38 -94
- package/crates/tish_compile_js/src/lib.rs +0 -1
- package/crates/tish_compile_js/src/tests_jsx.rs +68 -0
- package/crates/tish_core/Cargo.toml +4 -0
- package/crates/tish_core/src/console_style.rs +7 -1
- package/crates/tish_core/src/json.rs +1 -2
- package/crates/tish_core/src/macros.rs +2 -3
- package/crates/tish_core/src/value.rs +13 -5
- package/crates/tish_cranelift/src/lib.rs +6 -4
- package/crates/tish_cranelift/src/lower.rs +5 -3
- package/crates/tish_cranelift_runtime/src/lib.rs +4 -2
- package/crates/tish_eval/Cargo.toml +2 -0
- package/crates/tish_eval/src/eval.rs +172 -79
- package/crates/tish_eval/src/http.rs +3 -4
- package/crates/tish_eval/src/lib.rs +7 -0
- package/crates/tish_eval/src/regex.rs +3 -2
- package/crates/tish_eval/src/value.rs +11 -13
- package/crates/tish_eval/src/value_convert.rs +4 -8
- package/crates/tish_fmt/src/lib.rs +49 -10
- package/crates/tish_lexer/src/token.rs +2 -0
- package/crates/tish_lint/src/lib.rs +9 -0
- package/crates/tish_llvm/src/lib.rs +4 -4
- package/crates/tish_lsp/README.md +1 -1
- package/crates/tish_native/src/build.rs +16 -2
- package/crates/tish_native/src/lib.rs +10 -11
- package/crates/tish_opt/src/lib.rs +15 -0
- package/crates/tish_parser/src/lib.rs +101 -1
- package/crates/tish_parser/src/parser.rs +168 -51
- package/crates/tish_runtime/src/http.rs +4 -5
- package/crates/tish_runtime/src/http_fetch.rs +17 -10
- package/crates/tish_runtime/src/lib.rs +9 -2
- package/crates/tish_runtime/src/promise.rs +2 -3
- package/crates/tish_runtime/src/promise_io.rs +2 -3
- package/crates/tish_runtime/src/ws.rs +7 -7
- package/crates/tish_ui/Cargo.toml +17 -0
- package/crates/tish_ui/src/jsx.rs +390 -0
- package/crates/tish_ui/src/lib.rs +16 -0
- package/crates/tish_ui/src/runtime/hooks.rs +122 -0
- package/crates/tish_ui/src/runtime/mod.rs +173 -0
- package/crates/tish_vm/src/vm.rs +121 -27
- package/justfile +3 -3
- package/package.json +1 -1
- package/platform/darwin-arm64/tish +0 -0
- package/platform/darwin-x64/tish +0 -0
- package/platform/linux-arm64/tish +0 -0
- package/platform/linux-x64/tish +0 -0
- package/platform/win32-x64/tish.exe +0 -0
- package/crates/tish_compile_js/src/js_intrinsics.rs +0 -82
|
@@ -80,13 +80,17 @@ pub enum Opcode {
|
|
|
80
80
|
ArrayFilterBinOp = 35,
|
|
81
81
|
/// Load built-in module export. Operands: u16 spec_const_idx, u16 export_name_const_idx. Pushes Value.
|
|
82
82
|
LoadNativeExport = 36,
|
|
83
|
+
/// `new callee(...args)` (operand: u16 arg count). Stack: callee, then args — same as Call.
|
|
84
|
+
Construct = 37,
|
|
85
|
+
/// `new callee(...spread)` — stack: args array, then callee (same order as CallSpread).
|
|
86
|
+
ConstructSpread = 38,
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
impl Opcode {
|
|
86
|
-
/// Decode byte to opcode. Safe for b in 0..=
|
|
90
|
+
/// Decode byte to opcode. Safe for b in 0..=38 (matches #[repr(u8)] discriminants).
|
|
87
91
|
#[inline]
|
|
88
92
|
pub fn from_u8(b: u8) -> Option<Opcode> {
|
|
89
|
-
if b <=
|
|
93
|
+
if b <= 38 {
|
|
90
94
|
Some(unsafe { std::mem::transmute(b) })
|
|
91
95
|
} else {
|
|
92
96
|
None
|
|
@@ -97,7 +101,7 @@ impl Opcode {
|
|
|
97
101
|
pub fn instruction_size(self, code: &[u8], ip: usize) -> Option<usize> {
|
|
98
102
|
let size = match self {
|
|
99
103
|
Opcode::Nop | Opcode::Pop | Opcode::Dup | Opcode::Return | Opcode::ExitTry
|
|
100
|
-
| Opcode::ArrayMapIdentity => 1,
|
|
104
|
+
| Opcode::ArrayMapIdentity | Opcode::CallSpread | Opcode::ConstructSpread => 1,
|
|
101
105
|
Opcode::ArraySortByProperty | Opcode::ArrayMapBinOp | Opcode::ArrayFilterBinOp
|
|
102
106
|
| Opcode::LoadNativeExport => 5,
|
|
103
107
|
_ => 3,
|
|
@@ -18,6 +18,7 @@ ws = []
|
|
|
18
18
|
tishlang_ast = { path = "../tish_ast", version = ">=0.1" }
|
|
19
19
|
tishlang_opt = { path = "../tish_opt", version = ">=0.1" }
|
|
20
20
|
tishlang_parser = { path = "../tish_parser", version = ">=0.1" }
|
|
21
|
+
tishlang_ui = { path = "../tish_ui", default-features = false, features = ["compiler"] }
|
|
21
22
|
serde_json = "1.0"
|
|
22
23
|
|
|
23
24
|
[dev-dependencies]
|