Skip to content

Commit

Permalink
Update parser and IR
Browse files Browse the repository at this point in the history
  • Loading branch information
srydell committed May 11, 2022
1 parent 98d49de commit e8a912e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 11 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(
Frontend.wasm
VERSION 0.5.0
VERSION 0.5.1
LANGUAGES CXX)

configure_file(docs/ReleaseNotes/version.in
Expand Down Expand Up @@ -36,7 +36,7 @@ include(FetchContent)
FetchContent_Declare(
IRSpecification
GIT_REPOSITORY https://github.com/Tolc-Software/IntermediateRepresentation.git
GIT_TAG v0.14.0)
GIT_TAG v0.15.1)

FetchContent_MakeAvailable(IRSpecification)

Expand Down
6 changes: 6 additions & 0 deletions docs/ReleaseNotes/v0.5.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# News #

## Minor ##

* Updated Parser to v0.5.6
* Updated IR to v0.15.1
2 changes: 1 addition & 1 deletion src/Embind/Builders/classBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ buildClass(IR::Struct const& cppClass, Embind::Proxy::TypeInfo& typeInfo) {
typeInfo);
}
jsClass.addMemberVariable(
variable.m_name, getter, setter, variable.m_type.m_isStatic);
variable.m_name, getter, setter, variable.m_isStatic);
}

// Add default constructor
Expand Down
2 changes: 1 addition & 1 deletion src/Embind/Proxy/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void Function::allowPointers() {
void Function::setAsVirtual(std::string const& base) {
m_polymorphic = fmt::format(
R"_tolc_delimiter(, optional_override([]({base}& self, {arguments}) {{
return self.{base}::{functionName}({argumentsNames});
return self.{base}::{functionName}({argumentNames});
}}))_tolc_delimiter",
fmt::arg("base", base),
fmt::arg("arguments", getArgumentTypes(true)),
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include_guard()

include(${modules}/GetParser.cmake)
get_parser(VERSION v0.4.1)
get_parser(VERSION v0.5.6)

# Set the include path for the system library in the variable
# We are using the standard library shipped
Expand Down
19 changes: 14 additions & 5 deletions tests/Embind/Builders/classBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ struct Var {
TEST_CASE("Class with vector in member function gives the correct register",
"[classBuilder]") {
auto constructor = TestUtil::getFunction("SomeClass");
constructor.m_arguments.push_back({"myVar", "", TestUtil::getVector()});
IR::Argument arg;
arg.m_name = "myVar";
arg.m_type = TestUtil::getVector();
constructor.m_arguments.push_back(arg);
constructor.m_returnType = TestUtil::getMap();

auto s = TestUtil::getStruct("SomeClass");
Expand All @@ -37,7 +40,10 @@ TEST_CASE("Class with vector in member function gives the correct register",

TEST_CASE("Class with a constructor", "[classBuilder]") {
auto constructor = TestUtil::getFunction("SomeClass");
constructor.m_arguments.push_back({"myVar", "", TestUtil::getVector()});
IR::Argument arg;
arg.m_name = "myVar";
arg.m_type = TestUtil::getVector();
constructor.m_arguments.emplace_back(arg);

auto s = TestUtil::getStruct("SomeClass");
s.m_public.m_constructors.push_back(constructor);
Expand Down Expand Up @@ -117,7 +123,7 @@ TEST_CASE("Class with functions", "[classBuilder]") {
for (auto const& [function, type] : functions) {
IR::Function f = TestUtil::getFunction(function);

IR::Variable v;
IR::Argument v;
v.m_name = "myVar";

IR::Type arg;
Expand Down Expand Up @@ -148,8 +154,11 @@ TEST_CASE("Class with vector in constructor gives the correct register command",
"[classBuilder]") {
IR::Struct s = TestUtil::getStruct("MyStruct");
IR::Function constructor = TestUtil::getFunction("MyStruct");
IR::Type arg = TestUtil::getVector();
constructor.m_arguments.push_back({"myVar", "", arg});
IR::Type v = TestUtil::getVector();
IR::Argument arg;
arg.m_name = "myVar";
arg.m_type = v;
constructor.m_arguments.push_back(arg);
s.m_public.m_functions.push_back(constructor);
Embind::Proxy::TypeInfo typeInfo;
auto c = Embind::Builders::buildClass(s, typeInfo);
Expand Down
1 change: 0 additions & 1 deletion tests/TestUtil/include/TestUtil/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ IR::Type getType(IR::BaseType base = IR::BaseType::Int) {
t.m_type = v;
t.m_isConst = false;
t.m_isReference = false;
t.m_isStatic = false;
t.m_numPointers = 0;
t.m_representation = getAsString(base);
return t;
Expand Down

0 comments on commit e8a912e

Please sign in to comment.