浏览代码

add assignment to has_type field in a couple places

Jeremy G. Siek 1 年之前
父节点
当前提交
d01e2bc3ff
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      book.tex

+ 3 - 1
book.tex

@@ -26,7 +26,7 @@
 
 \def\racketEd{0}
 \def\pythonEd{1}
-\def\edition{0}
+\def\edition{1}
 
 % material that is specific to the Racket edition of the book
 \newcommand{\racket}[1]{{\if\edition\racketEd{#1}\fi}}
@@ -14417,6 +14417,7 @@ class TypeCheckLarray(TypeCheckLtup):
             raise Exception('len expected a tuple, not ' + repr(tup_t))
       case Subscript(tup, index, Load()):
         tup_ty = self.type_check_exp(tup, env)
+        tup.has_type = tup_ty
         index_ty = self.type_check_exp(index, env)
         self.check_type_equal(index_ty, IntType(), index)
         match tup_ty:
@@ -14456,6 +14457,7 @@ class TypeCheckLarray(TypeCheckLtup):
     match ss[0]:
       case Assign([Subscript(tup, index, Store())], value):
         tup_t = self.type_check_exp(tup, env)
+        tup.has_type = tup_t
         value_t = self.type_check_exp(value, env)
         index_ty = self.type_check_exp(index, env)
         self.check_type_equal(index_ty, IntType(), index)