Phase 8.2.4: Lifetime syntax ('a) support
- Lexer tokenizes 'a as tkLifetime - Parser accepts lifetimes in type params <'a> and reference types &'a T / &'a mut T - AST TypeExpr has refLifetime field for tekRef/tekMutRef - TypeParam gains isLifetime flag for generic monomorphization - Sema infers lifetime params as no-op dummy values; unwraps pointee types for params inside refs - HIR lower skips lifetime params when generating mangled names and substitution tables - &mut expr syntax supported in parser (consumed as part of unary &)
This commit is contained in:
@@ -47,6 +47,7 @@ type
|
||||
sliceSize*: Expr ## nil for unsized slices T[]
|
||||
of tekOwn, tekPointer, tekRef, tekMutRef:
|
||||
pointerPointee*: TypeExpr
|
||||
refLifetime*: string ## only meaningful for tekRef/tekMutRef
|
||||
of tekDynRef:
|
||||
dynInterface*: string
|
||||
of tekTuple:
|
||||
@@ -300,6 +301,7 @@ type
|
||||
TypeParam* = object
|
||||
name*: string
|
||||
bounds*: seq[string] ## e.g. ["Comparable"] for <T: Comparable>
|
||||
isLifetime*: bool ## true for lifetime params like 'a
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Declarations
|
||||
|
||||
Reference in New Issue
Block a user