Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/Elaborator/types/overloadlit.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/Elaborator/types/overloadlit.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1680, Sat Oct 30 16:02:13 2004 UTC revision 1681, Mon Nov 8 23:03:24 2004 UTC
# Line 6  Line 6 
6  sig  sig
7    
8    (* functions for setting up, recording, and resolving literal overloadings *)    (* functions for setting up, recording, and resolving literal overloadings *)
9    val reset : unit -> unit    val new : unit -> { push : Types.ty -> unit, resolve : unit -> unit }
   val push  : Types.ty -> unit  
   val resolve : unit -> unit  
10    
11    (* isLiteralTy is for checking compatability when instantiating    (* isLiteralTy is for checking compatability when instantiating
12       overloaded literal type variables *)       overloaded literal type variables *)
13    val isLiteralTy : Types.litKind * Types.ty -> bool    val isLiteralTy : Types.litKind * Types.ty -> bool
   
   val debugging : bool ref  
   
14  end  (* signature OVERLOADLIT *)  end  (* signature OVERLOADLIT *)
15    
16  structure OverloadLit : OVERLOADLIT =  structure OverloadLit : OVERLOADLIT =
# Line 25  Line 20 
20    structure BT = BasicTypes    structure BT = BasicTypes
21    structure TU = TypesUtil    structure TU = TypesUtil
22    
   (* debugging *)  
   val say = Control_Print.say  
   val debugging = ref false  
   fun debugmsg (msg: string) = if !debugging then (say msg; say "\n") else ()  
   fun bug msg = ErrorMsg.impossible("OverloadLit: "^msg)  
   
   (* list ref storing literal types for a given typecheck call *)  
   val lits = ref(nil: T.ty list)  
   
   fun reset () =  
       lits := []  
   
   fun push x = lits := x :: !lits  
   
23    (* eventually, these may be defined elsewhere, perhaps via some    (* eventually, these may be defined elsewhere, perhaps via some
24       compiler configuration mechanism *)       compiler configuration mechanism *)
25    val intTypes = [BT.intTy, BT.int32Ty, BT.intinfTy]    val intTypes = [BT.intTy, BT.int32Ty, BT.intinfTy]
# Line 61  Line 42 
42      | default T.CHAR = BT.charTy      | default T.CHAR = BT.charTy
43      | default T.STRING = BT.stringTy      | default T.STRING = BT.stringTy
44    
45      fun new () = let
46          val lits = ref []
47          fun push x = lits := x :: !lits
48    fun resolve () =    fun resolve () =
49        let fun resolveLit ty =        let fun resolveLit ty =
50                case TU.prune ty                case TU.prune ty
# Line 69  Line 53 
53                   | _ => () (* ok, must have been successfully instantiated *)                   | _ => () (* ok, must have been successfully instantiated *)
54         in app resolveLit (!lits)         in app resolveLit (!lits)
55        end        end
56      in { push = push, resolve = resolve }
57      end
58    
59  end (* structure OverloadLit *)  end (* structure OverloadLit *)
   

Legend:
Removed from v.1680  
changed lines
  Added in v.1681

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0