Add TypeVar.rust_expr().

Generate a Rust expression that computes the value of a derived type
variable.
This commit is contained in:
Jakob Stoklund Olesen
2016-11-10 14:46:42 -08:00
parent bf1568035f
commit 5c9a12f101
4 changed files with 55 additions and 22 deletions

View File

@@ -197,6 +197,16 @@ class Var(Expr):
return False
return self.typevar is self.original_typevar
def rust_type(self):
# type: () -> str
"""
Get a Rust expression that computes the type of this variable.
It is assumed that local variables exist corresponding to the free type
variables.
"""
return self.typevar.rust_expr()
def constrain_typevar(self, sym_typevar, sym_ctrl, ctrl_var):
# type: (TypeVar, TypeVar, Var) -> None
"""