Age | Commit message (Collapse) | Author | Files | Lines |
|
Type binding still not supported here but the same generic support is added
to tuples.
Fixes #236
|
|
This removes StructFieldType from the TyTy base as it is not a type that
can be unified against.
It adds in a substition mapper implementation which will likely change
over time when this this support is extended over to Functions and
TupleStructs.
Note generic argument binding is not supported as part of this yet.
Fixes #235
|
|
|
|
Signed-off-by: Akshat Agarwal <humancalico@disroot.org>
|
|
|
|
Now the base(pointer to Ty) is only stored in derived rules. It is
accessible in `BaseRules` with `get_base` method, which is implemented
in derived rules.
|
|
Initially I thought `equals` is a better name because it fits the java
usage. However there will be another `can_eq` method that adjust types,
and in that case `is_equal` is a more consistent name.
|
|
The resulting code looks quite similar to `unify`, except that it
doesn't save refs, so it should be more efficient. However the
introduced complexity is a bit worrying.
This commit also adjusted some const qualifiers of `BaseType`
methods where necessary.
|
|
|
|
|
|
|
|
Signed-off-by: Akshat Agarwal <humancalico@disroot.org>
This commit formats all files in gcc/rust using clang-format.
|
|
This adds in a debugging interface for the backend IR to help diagnose
issues with the tree.
|
|
Signed-off-by: Akshat Agarwal <humancalico@disroot.org>
Fixes: #99
|
|
This also adds in the mising InferenceType _ which was mostly implemented
before as part of Data Structures 1.
We create GENERIC REFERENCE_TYPES for these this is the building block
to finish work on mutability rules and pointers.
Fixes: #196
Addresses: #169 #170
|
|
This might need changes in the Lexer to allow for wchar_t to be preserved.
Addresses #85
|
|
|
|
We made an implicit loop begin label that can be referenced in a goto to
restart the loop.
Fixes #188
|
|
We create a LoopExpr comprising of:
LOOP_EXPR {
EXIT_EXPR (while loop predicate)
{
<LOOP_BODY>
}
}
Fixes #109
|
|
If a while loop is part of an expression it needs to know it does not need
to skip token.
|
|
|
|
This adds support to make the break value assignable such that the loop
now becomes akin to a BlockExpr
Fixes #108 #106
|
|
This will be needed to stop the compiler proceding to continue and break
expressions without a loop context.
|
|
This allows for the Rust refernece example for loop labels to be compiled.
Fixes #107
|
|
The parser has the same bug as in #225 for break expressions. This
tidies up the type resolver and GENERIC translation to handle the
case where there is no return expression as well.
Fixes #226
|
|
This reuses GENERICS LOOP_EXPR and EXIT_EXPR to implement the infinite
loop.
Addresses: #106 #108
|
|
Labels are in their own namesapce so they do not affect types and normal
values within a program.
Addresses #107
|
|
The null_denotion function expects to find the beginning of an expression
but breaks can be empty and the parser will fail with unexpected ';'.
Fixes #225
|
|
This is the building block for the rest of loops where we have a basic
infinite loop. Break/Continue reliest on the resolution of labels and
breaks can also make a loop into a BlockExpr
Fixes #106
|
|
For example this fixes the form of: let x = loop { ... };
Fixes #219
|
|
We output each debug IR to file which makes it easier to debug larger
test cases. Beaware not all dumps are complete such as name resolution
is not implemented yet, HIR is badly formatted and type resolution dump is
not finished.
|
|
Fixes #173
|
|
When we have a function that is for example a FieldAccessExpression the
compiler must resolve and compile that field into a reference which can be
called. This is not simple direct call to a function in that senario.
Fixes #217
|
|
This allows for rust style ternery expressions.
Fixes #214
|
|
When we compile if blocks the else gives us a final branch that can
resolve. Single IfExpr cannot resolve as there is no final branch.
This also fixes a small regression in compiling elif blocks where the
gimple body was empty.
Fixes #213
|
|
|
|
Further testing found regressions with implicit returns and type
resolution.
This unifies the type resolution in block expressions to be more strict
and ensure everything bar the final statement should be UnitType.
|
|
|
|
|
|
|
|
There is more work to be done here with adjustments to the self argument
such as borrows and mutability checking.
Method resolution is basic, for now there is code to scan for all possible
matches but traits are not supported at the moment so this resolves quite
simply for now.
Fixes #191 #112
|
|
This is simply a type reference so we can use the name resolver to resolve
Self as a type reference back to the Type used for the impl block.
Fixes #204
|
|
When we have a nested struct this must resolve to the existing compiled
struct and not create a new record type.
|
|
Methods are resolved as part of type resolution so scanning ribs early
on will results in false warnings about unused methods.
|
|
We keep temporary's for each block in order for the result to be
referenced. For example:
let x = { test() + 1 };
This can be resolved into:
{
let x:i32;
_tmp1:i32;
{
_tmp2:i32 = test();
_tmp1 = _tmp2 + 1;
}
x = _tmp1;
}
Fixes #189
|
|
Rust does not allow functions/methods/constants/static definitions to
shadow otherwise you end up with unuseable items.
|
|
|
|
|
|
|
|
|