infer-global-context := λ(: td AST). (: ( (match td ( () ( (Typedef( (Lit( base-type _ )) case-constructors )) ( (let bt (parse-type base-type)) (let size (infer-type-definition( bt case-constructors 0_u64 ))) (match bt ( () ( (TGround( class LEOF )) (index-size-of-class( class size )) ) ( _ () ) )) )) ( (Glb( k_t (Abs( lhs (App( (Lit( ':_s _ )) (App( rhs (AType rhst) )) )) tlt )) )) ( (let lt (typeof-lhs lhs)) (let return-type (guess-representation(without-representation rhst))) (let ft (t3( 'Arrow_s lt return-type ))) (set ft (enrich( ft tlt ))) (if (&&( (non-zero(slot( tlt 'Hook_s ))) (not(non-zero(slot( rhst 'Nil_s )))) )) ( (exit-error( 'Hooks\sMust\sNot\sReturn\sValues._s td )) ) ()) (mark-global-as-seen( k ft tlt )) (ascript-normal( td ft )) (set global-type-context (TCtxBind( (close global-type-context) k ft td ))) )) ( (Frg( k_t (Abs( lhs (App( (Lit( ':_s _ )) (App( rhs (AType rhst) )) )) tlt )) )) ( (let lt (typeof-lhs lhs)) (let ft (t3( 'Arrow_s lt rhst ))) (if (&&( (non-zero(slot( tlt 'Hook_s ))) (not(non-zero(slot( rhst 'Nil_s )))) )) ( (exit-error( 'Hooks\sMust\sNot\sReturn\sBalues._s td )) ) ()) (set ft (enrich( ft tlt ))) (mark-global-as-seen( k ft tlt )) (ascript-normal( td ft )) (set global-type-context (TCtxBind( (close global-type-context) k ft ASTEOF ))) )) ( (Glb( k_t (App( (Lit( ':_s _ )) (App( rhs (AType rhst) )) )) )) ( (let kt (and( (without-representation rhst) (t1 'GlobalVariable_s) ))) (set global-type-context (TCtxBind( (close global-type-context) k kt ASTEOF ))) (mark-global-as-seen( k kt TAny )) (ascript-normal( td kt )) )) ( (Frg( k_t (App( (Lit( ':_s _ )) (App( rhs (AType rhst) )) )) )) ( (set global-type-context (TCtxBind( (close global-type-context) k rhst ASTEOF ))) (mark-global-as-seen( k rhst TAny )) )) ( (Glb( _ _ )) ( (exit-error( 'Global\sBindings\sMust\sBe\sAscripted_s td )) )) ( (Frg( _ _ )) ( (exit-error( 'Global\sBindings\sMust\sBe\sAscripted_s td )) )) ( _ () ) )) ) Nil);