Age | Commit message (Collapse) | Author | Files | Lines |
|
This is a refactoring/cleanup effort to stop using raw fields of
HIR::Items. It also removes an old set of locals since before the TyTy
module and move to HIR from the AST::Function.
|
|
Function definitions can have substations (generics) where as function
pointers cannot. These are distinct elements and their separation is
important to support wildcards (inference variables) on BareFunctionTypes.
To fix this the patch leverages the wrapper TyCtx which denotes a type that
must be infered.
Fixes #269
|
|
|
|
ArrayTypes for example can have an inference variable for an element type
which requires the Type system to lookup what type it is when requested.
TyCtx acts as this wrapper that takes an HirId reference that cleans up the
code for ArrayTypes, ReferenceTypes and TupleTypes where elements can be
inference variables.
|
|
Getting mappings can be const in order to get mappings info on Types.
|
|
When we have a General inference G? variable as part of an array that is
unified with integeral inference variables I? the context left the General
inference variable but really this changed to tbe I? and can default to
i32.
Fixes #258
|
|
fix #98
|
|
This gives the apropriate reference type over const char *.
Fixes #85
|
|
|
|
There was a subtle tweak to checking wether this is the actual final
statement of the block to verify the types.
|
|
CallExpr is only used for TupleStructs, so this needs to refelect rustc
behaviour.
|
|
When the assembler comes along Foo::new as a symbol name it will fail
we need name mangling to fix this properly.
|
|
|
|
|
|
|
|
|
|
With AST and HIR using the same operator enum, we no longer need to
perform conversions. Except for CompoundAssignmentExpr, which gets
compiled away and therefore still needs conversion.
|
|
Missed a few lines in the last attempt. Whoops.
|
|
|
|
Now that everyone uses the 4 enums in the global namespace, the process
of lowering HIR to Bexpression can be simplified by removing the
intermediate translation.
|
|
Gcc_backend::unary_expression and Gcc_backend::binary_expression has
been split into 4 smaller functions corresponding to the 4 enums.
It turns out that keeping the 4 enums distinct helps simplify the logic
a lot. A lot of if-else branches were eliminated just by inlining the
type infomation.
There were also some minor cleanup. `operator_to_tree_code` function has
been modified to omit the `tree` parameter and offload floating-point
check to the caller.
|
|
`operator.h` has been rewritten from scratch. 5 enums are extracted from
the AST namespace, while only 4 of them are used in the HIR namespace.
There're still code that uses the old Operator enum. We also need to
change code that uses the AST enum to point to the new global enum.
|
|
|
|
Check for wrong number of arguments and fix crash with invalid Type
specified as generic argument.
|
|
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
|