~tomleb/public-inbox

fix for strings::fromutf8 changes v1 PROPOSED

Rosie K Languet: 1
 fix for strings::fromutf8 changes

 3 files changed, 9 insertions(+), 9 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~tomleb/public-inbox/patches/38567/mbox | git am -3
Learn more about email & git

[PATCH] fix for strings::fromutf8 changes Export this patch

---
 cmd/harepls/lsp.ha    | 10 +++++-----
 hare/traversal/dfs.ha |  4 ++--
 lsp/protocol/parse.ha |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cmd/harepls/lsp.ha b/cmd/harepls/lsp.ha
index 0200fd9..60b1158 100644
--- a/cmd/harepls/lsp.ha
+++ b/cmd/harepls/lsp.ha
@@ -155,9 +155,9 @@ fn lsp_text_document_definition(s: *lsp::server, params: *lsp::text_document_pos
	const content = io::drain(content)!;
	defer free(content);

	const loc = lsp_to_lex(strings::fromutf8(content), params.position);
	const loc = lsp_to_lex(strings::fromutf8(content)!, params.position);
	log::printfln("looking for ident at {}:{}", loc.line, loc.col);
	const result = match (find_definition(&client.store, path, strings::fromutf8(content), loc)) {
	const result = match (find_definition(&client.store, path, strings::fromutf8(content)!, loc)) {
	case let result: store::result =>
		yield result;
	case void =>
@@ -185,7 +185,7 @@ fn lsp_text_document_definition(s: *lsp::server, params: *lsp::text_document_pos
	let buf = io::drain(fd)!;
	defer free(buf);

	const pos = lex_to_lsp(strings::fromutf8(buf), info.1);
	const pos = lex_to_lsp(strings::fromutf8(buf)!, info.1);
	// FIXME: We'll need to lex again here to get the proper
	// starting position probably but this is probably good enough
	// too.
@@ -224,9 +224,9 @@ fn lsp_text_document_hover(s: *lsp::server, params: *lsp::hover_params) (lsp::ho
	const content = io::drain(content)!;
	defer free(content);

	const loc = lsp_to_lex(strings::fromutf8(content), params.position);
	const loc = lsp_to_lex(strings::fromutf8(content)!, params.position);
	log::printfln("looking for ident at {}:{}", loc.line, loc.col);
	const result = match (find_definition(&client.store, path, strings::fromutf8(content), loc)) {
	const result = match (find_definition(&client.store, path, strings::fromutf8(content)!, loc)) {
	case let result: store::result =>
		yield result;
	case void =>
diff --git a/hare/traversal/dfs.ha b/hare/traversal/dfs.ha
index 29b3bb7..8f8fa0c 100644
--- a/hare/traversal/dfs.ha
+++ b/hare/traversal/dfs.ha
@@ -239,8 +239,8 @@ fn visit_type(v: *visitor, __type: *ast::_type) step = {
	case let pointer_type: ast::pointer_type =>
		yield visit_type(v, pointer_type.referent);
	case let struct_type: ast::struct_type =>
		yield visit_type_struct_member(v, struct_type);
	case let union_type: ast::struct_type =>
		yield visit_type_struct_member(v, struct_type.members);
	case let union_type: ast::union_type =>
		yield visit_type_struct_member(v, union_type);
	case let tagged: ast::tagged_type =>
		for (let i = 0z; i < len(tagged); i += 1) {
diff --git a/lsp/protocol/parse.ha b/lsp/protocol/parse.ha
index a1606ce..b5c729e 100644
--- a/lsp/protocol/parse.ha
+++ b/lsp/protocol/parse.ha
@@ -43,7 +43,7 @@ export fn next(p: *parser) (message | more | error) = {
		};

		// FIXME: The spec defines the header part as using ascii encoding
		const line = match (strings::try_fromutf8(p.buf[..i])) {
		const line = match (strings::fromutf8(p.buf[..i])) {
		case let s: str =>
			yield s;
		case utf8::invalid =>
@@ -63,7 +63,7 @@ export fn next(p: *parser) (message | more | error) = {
			reset(p);
		};

		const content = match (strings::try_fromutf8(p.buf[..length])) {
		const content = match (strings::fromutf8(p.buf[..length])) {
		case let s: str =>
			yield s;
		case utf8::invalid =>
-- 
2.39.1