From 3eb78b27505b602c1ccfa952c4cc00f942ccb2b9 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Tue, 2 Jul 2024 03:51:59 -0400 Subject: Fix string interning pointer invalidity for AST Fix errorneous string intern compare Add symbol interning tests Optimize non-conversion identifier cases Add `File::size()` Add InstanceOf concept Remove `FlatValue::value(const symbol_interner_type&)` Add `AbstractSyntaxTree::intern/intern_cst(lexy::lexeme)` overload Add `DiagnosticLogger::intern/intern_cstr(lexy::lexeme)` overload Use pinned_vector to maintain string interning pointer validity for buffers Add vmcontainer submodule for pinned_vector pinned_vector reserves virtual memory at runtime using OS APIs to maintain pointer validity Remove Exception and RTTI requirement from range-v3 submodule --- tests/src/v2script/AbstractSyntaxTree.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/src/v2script/AbstractSyntaxTree.cpp') diff --git a/tests/src/v2script/AbstractSyntaxTree.cpp b/tests/src/v2script/AbstractSyntaxTree.cpp index c06da08..ad9382f 100644 --- a/tests/src/v2script/AbstractSyntaxTree.cpp +++ b/tests/src/v2script/AbstractSyntaxTree.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -69,13 +68,13 @@ TEST_CASE("V2Script Nodes", "[v2script-nodes]") { auto* id = ast.create_with_intern("id"); CHECK_IF(id) { CHECK(id->kind() == NodeKind::IdentifierValue); - CHECK(id->value(ast.symbol_interner) == "id"sv); + CHECK(id->value().view() == "id"sv); } auto* str = ast.create_with_intern("str"); CHECK_IF(str) { CHECK(str->kind() == NodeKind::StringValue); - CHECK(str->value(ast.symbol_interner) == "str"sv); + CHECK(str->value().view() == "str"sv); } auto* list = ast.create(); @@ -162,7 +161,7 @@ TEST_CASE("V2Script Nodes Location", "[v2script-nodes-location]") { auto* id = ast.create_with_loc_and_intern(NodeLocation::make_from(&fake_buffer[0], &fake_buffer[1]), "id"); CHECK_IF(id) { - CHECK(id->value(ast.symbol_interner) == "id"sv); + CHECK(id->value().view() == "id"sv); auto location = ast.location_of(id); CHECK_FALSE(location.is_synthesized()); -- cgit v1.2.3-56-ga3b1