Skip to content

Commit 70c6e0e

Browse files
committed
fix: make ci happy
1 parent f85f257 commit 70c6e0e

File tree

10 files changed

+34
-49
lines changed

10 files changed

+34
-49
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"lldb.displayFormat": "auto",
1414
"lldb.showDisassembly": "auto",
1515
"lldb.dereferencePointers": true,
16-
"lldb.consoleMode": "commands"
16+
"lldb.consoleMode": "commands",
1717
// "rust-analyzer.check.targets": [
1818
// "wasm32-unknown-unknown",
1919
// ],

immix

Submodule immix updated 1 file

src/ast/compiler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ pub fn pl_link(llvmmod: Module, oxbjs: Vec<PathBuf>, out: String, op: Options) {
388388

389389
#[cfg(not(feature = "llvm"))]
390390
#[salsa::tracked]
391-
pub fn compile(db: &'db dyn Db, docs: MemDocsInput, out: String, op: Options) {
391+
pub fn compile(db: &dyn Db, docs: MemDocsInput, out: String, op: Options) {
392392
unimplemented!()
393393
}
394394

src/ast/compiler/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,6 @@ pub enum ActionType {
7373
SignatureHelp,
7474
#[cfg(test)]
7575
Completion,
76+
#[cfg(target_arch = "wasm32")]
77+
SemanticTokensFull,
7678
}

src/lsp/mem_docs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl MemDocsInput {
210210
}
211211

212212
impl MemDocs {
213-
#[cfg(test)]
213+
#[cfg(any(target_arch = "wasm32", test))]
214214
pub fn change(&self, db: &mut dyn Db, range: lsp_types::Range, uri: String, text: String) {
215215
use salsa::Setter;
216216
let (doc, txt) = self.change_txt(db, range, &uri, text);

src/lsp/wasm.rs

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
use std::{
2-
borrow::Borrow,
32
cell::RefCell,
4-
fmt::format,
53
sync::{Arc, Mutex},
64
};
75

86
use include_dir::{include_dir, Dir};
97
use lazy_static::lazy_static;
108
use lsp_types::{
11-
notification::DidChangeTextDocument, CompletionParams, Diagnostic, DidChangeTextDocumentParams,
12-
GotoDefinitionParams, Position, SemanticTokens, SemanticTokensDelta, Url,
9+
Diagnostic, DidChangeTextDocumentParams, Position, SemanticTokens, SemanticTokensDelta, Url,
1310
};
1411
use rustc_hash::FxHashMap;
12+
use salsa::Setter;
1513
use wasm_bindgen::prelude::wasm_bindgen;
1614

1715
use crate::{
@@ -22,9 +20,8 @@ use crate::{
2220
compiler::{compile_dry, ActionType},
2321
range::Pos,
2422
},
25-
db::{self, Database},
23+
db::Database,
2624
lsp::semantic_tokens::diff_tokens,
27-
Db,
2825
};
2926

3027
use super::{
@@ -101,17 +98,18 @@ pub unsafe fn on_change_doc(req: &str) -> String {
10198
docin.set_file(db).to(f);
10299

103100
docin.set_action(db).to(ActionType::Diagnostic);
104-
let re = compile_dry(db, docin);
101+
let _ = compile_dry(db, docin);
105102
// log::trace!("mod {:#?}", re.plmod(db));
106103
// completions = compile_dry::accumulated::<Completions>(db, docin);
107104
let diags = compile_dry::accumulated::<Diagnostics>(db, docin);
108105
let mut m = FxHashMap::<String, Vec<Diagnostic>>::default();
109-
for (p, diags) in &diags {
106+
for d in &diags {
107+
let (p, diags) = &d.0;
110108
diags.iter().for_each(|x| x.get_diagnostic(p, &mut m));
111109
}
112110
let comps = compile_dry::accumulated::<Completions>(db, docin);
113111
if comps.len() > 0 {
114-
COMPLETIONS.inner.replace(comps[0].clone());
112+
COMPLETIONS.inner.replace(comps[0].0.clone());
115113
} else {
116114
COMPLETIONS.inner.replace(vec![]);
117115
}
@@ -197,12 +195,13 @@ pub fn set_init_content(content: &str) -> String {
197195
docin.set_file(db).to(LSP_DEMO_URI.to_string());
198196

199197
docin.set_action(db).to(ActionType::Diagnostic);
200-
let re = compile_dry(db, docin);
198+
let _ = compile_dry(db, docin);
201199
// log::trace!("mod {:#?}", re.plmod(db));
202200
// completions = compile_dry::accumulated::<Completions>(db, docin);
203201
let diags = compile_dry::accumulated::<Diagnostics>(db, docin);
204202
let mut m = FxHashMap::<String, Vec<Diagnostic>>::default();
205-
for (p, diags) in &diags {
203+
for d in &diags {
204+
let (p, diags) = &d.0;
206205
diags.iter().for_each(|x| x.get_diagnostic(p, &mut m));
207206
}
208207
log::trace!("diags: {:#?}", diags);
@@ -236,7 +235,10 @@ pub fn get_semantic_tokens() -> String {
236235
docin.set_params(db).to(Some((Default::default(), None)));
237236
compile_dry(db, docin);
238237
// let docs = DOCIN.docs(db);
239-
let mut newtokens = compile_dry::accumulated::<PLSemanticTokens>(db, docin);
238+
let mut newtokens = compile_dry::accumulated::<PLSemanticTokens>(db, docin)
239+
.drain(..)
240+
.map(|x| x.0)
241+
.collect::<Vec<_>>();
240242
if newtokens.is_empty() {
241243
newtokens.push(SemanticTokens::default());
242244
}
@@ -260,7 +262,10 @@ pub fn get_semantic_tokens_full() -> String {
260262
docin.set_params(db).to(Some((Default::default(), None)));
261263
compile_dry(db, docin);
262264
// let docs = DOCIN.docs(db);
263-
let mut newtokens = compile_dry::accumulated::<PLSemanticTokens>(db, docin);
265+
let mut newtokens = compile_dry::accumulated::<PLSemanticTokens>(db, docin)
266+
.drain(..)
267+
.map(|x| x.0)
268+
.collect::<Vec<_>>();
264269
if newtokens.is_empty() {
265270
newtokens.push(SemanticTokens::default());
266271
}
@@ -290,7 +295,10 @@ pub fn get_inlay_hints() -> String {
290295
let docin = *DOCIN;
291296
let binding = &DB.inner;
292297
let db = &mut *binding.borrow_mut();
293-
let mut hints = compile_dry::accumulated::<Hints>(db, docin);
298+
let mut hints = compile_dry::accumulated::<Hints>(db, docin)
299+
.drain(..)
300+
.map(|x| x.0)
301+
.collect::<Vec<_>>();
294302
if hints.is_empty() {
295303
hints.push(vec![]);
296304
}
@@ -304,7 +312,7 @@ pub fn get_doc_symbol() -> String {
304312
let db = &mut *binding.borrow_mut();
305313
let doc_symbols = compile_dry::accumulated::<DocSymbols>(db, docin);
306314
let symbol = &doc_symbols[0];
307-
return serde_json::to_value(symbol).unwrap().to_string();
315+
return serde_json::to_value(&symbol.0).unwrap().to_string();
308316
}
309317

310318
#[wasm_bindgen]
@@ -325,7 +333,7 @@ pub fn go_to_def(req: &str) -> String {
325333
.unwrap()
326334
.to_string();
327335
}
328-
let def = &defs[0];
336+
let def = &defs[0].0;
329337
return serde_json::to_value(def).unwrap().to_string();
330338
}
331339

@@ -341,7 +349,10 @@ pub fn get_refs(req: &str) -> String {
341349
docin.set_action(db).to(ActionType::FindReferences);
342350
docin.set_params(db).to(Some((pos, None)));
343351
compile_dry(db, docin);
344-
let refs = compile_dry::accumulated::<PLReferences>(db, docin);
352+
let refs = compile_dry::accumulated::<PLReferences>(db, docin)
353+
.drain(..)
354+
.map(|x| x.0)
355+
.collect::<Vec<_>>();
345356
let mut rf = vec![];
346357
for r in refs {
347358
for r in r.clone().iter() {

vm/src/lib.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ fn printi64ln(i: i64) {
2525
println!("{}", i);
2626
}
2727

28-
/// see https://lang.pivotstudio.cn/docs/systemlib/vm.html#jit-invalid-memory-access-issue
29-
#[cfg(feature = "jit")]
30-
pub fn reg() {
31-
gc::reg();
32-
libcwrap::reg();
33-
mutex::reg();
34-
time::reg();
35-
}
36-
3728
#[is_runtime]
3829
fn pl_panic() {
3930
println!("pivot lang panic occured!");

vm/src/libcwrap/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ extern crate winapi;
55
use internal_macro::is_runtime;
66

77
struct LibC {}
8-
#[cfg(feature = "jit")]
9-
pub fn reg() {
10-
add_symbol_consts();
11-
add_symbol_impl_libc();
12-
}
138

149
#[cfg(not(target_os = "windows"))]
1510
#[no_mangle]

vm/src/mutex/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ use std::{
66

77
use internal_macro::is_runtime;
88

9-
/// see https://lang.pivotstudio.cn/docs/systemlib/vm.html#jit-invalid-memory-access-issue
10-
#[cfg(feature = "jit")]
11-
pub fn reg() {
12-
add_symbol_create_mutex();
13-
add_symbol_lock_mutex();
14-
add_symbol_unlock_mutex();
15-
add_symbol_drop_mutex();
16-
}
17-
189
struct MutexContainer {
1910
mutex: Mutex<()>,
2011
guard: Cell<Option<MutexGuard<'static, ()>>>,

vm/src/time/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,3 @@ fn pl_clock_gettime(sec: *mut i64, nano: *mut u32) {
1818
*nano = t.subsec_nanos();
1919
}
2020
}
21-
22-
#[cfg(feature = "jit")]
23-
pub fn reg() {
24-
add_symbol_unixtime();
25-
}

0 commit comments

Comments
 (0)