Closed hexadecimal-chocolate closed 3 years ago
Oh, and error messages show 0:0 as the coords every time, macro
s in other files don't list them as such, and Failed to find funtion overload of
is a typo.
Also, I cannot seem to pass custom types in constexpr
functions. StrVec2
compiles fine, but calling the function doesn't.
Failed to find funtion overload of StrVec2::constructor
Unable to satisfy arguments types: (StrVec2)
Tried candidates:
StrVec2::constructor(StrVec2 &this, string a, string c)
StrVec2::constructor(StrVec2 &this, StrVec2 other)
Just realized that I can make a pr whoops
Thanks for the suggestions :) I agree with most of these, I didn't want to introduce a null
value, I created Maybe<T>
to represent a value that may or may not exist.
intrinsic_extension is really just for internal usage (I hope that most things can be replaced with ir
statements eventually).
Definitely need to improve error messages and reporting. Most errors are to guide me to iron out bugs in the compiler, rather than to point out errors in input code.
Regarding your StrVec2, it sounds like you've added overloaded constructors, which means the implicit "default constructor" is not created (consistent with C++: https://en.cppreference.com/w/cpp/language/default_constructor) see: https://github.com/simon816/Command-Block-Assembly/blob/b54c2afee3ea7bdfddfe619b9b207ce30d160e45/cbl/cbl_type.py#L219-L222
You'll either need to create a default constructor, or ensure StrVec2 is not default-constructed. examples of where default construction can occur are:
void main() {
StrVec2 foo; // default constructor
}
type MyType {
StrVec2 foo;
// implicitly defined default constructor for MyType calls the default constructor for type StrVec2
}
PRs are welcome, apologies that the code isn't well documented!
Sorry for the late reply. I really enjoyed looking through the code to add a couple of things. I was able to do forceload (kind of) as an ir instruction. I think that with a little tweaking, this could be a very good tool. It already is. I think that CBL and c/asm need a little work by adding commands, but the ir just needs a couple of instructions like forceload.
Some QOL features:
int
tostring
inconstexpr
Entity
s to be used inboolean
conditions to check if they exist A work around for the point above:if (exists) { // If true }