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/FLINT/trans/matchcomp.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/FLINT/trans/matchcomp.sml

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

revision 245, Sat Apr 17 18:47:12 1999 UTC revision 411, Fri Sep 3 00:25:03 1999 UTC
# Line 1181  Line 1181 
1181  (*  (*
1182   * Entry point for compiling matches induced by val declarations   * Entry point for compiling matches induced by val declarations
1183   * (e.g., val listHead::listTail = list).  match is a two   * (e.g., val listHead::listTail = list).  match is a two
1184   * element list.  If the control flag Control.MC.bindExhaustive   * element list.  If the control flag Control.MC.bindNonExhaustiveWarn
1185   * is set, and match is inexhaustive a warning is printed.  If the control   * is set, and match is nonexhaustive a warning is printed.  If the control
1186   * flag Control.MC.bindContainsVar is set, and the first pattern   * flag Control.MC.bindNoVariableWarn is set, and the first pattern
1187   * (i.e., the only non-dummy pattern) of match contains no variables or   * (i.e., the only non-dummy pattern) of match contains no variables or
1188   * wildcards, a warning is printed.    Arguably, a pattern containing no   * wildcards, a warning is printed.    Arguably, a pattern containing no
1189   * variables, but one or more wildcards, should also trigger a warning,   * variables, but one or more wildcards, should also trigger a warning,
# Line 1197  Line 1197 
1197        val (code, _, _, exhaustive) =        val (code, _, _, exhaustive) =
1198          doMatchCompile(rules, finish, rootv, toTcLt, err)          doMatchCompile(rules, finish, rootv, toTcLt, err)
1199    
1200        val inexhaustiveF = !bindExhaustive andalso not exhaustive        val nonexhaustiveF = !bindNonExhaustiveWarn andalso not exhaustive
1201        val noVarsF = !bindContainsVar andalso noVarsIn rules        val noVarsF = !bindNoVariableWarn andalso noVarsIn rules
1202    
1203     in if inexhaustiveF     in if nonexhaustiveF
1204        then err EM.WARN "binding not exhaustive" (bindPrint(env,rules))        then err EM.WARN ("binding not exhaustive" ^
1205                            (if noVarsF then " and contains no variables" else ""))
1206                           (bindPrint(env,rules))
1207        else if noVarsF        else if noVarsF
1208             then err EM.WARN "binding contains no variables"             then err EM.WARN "binding contains no variables"
1209                        (bindPrint(env,rules))                        (bindPrint(env,rules))
# Line 1248  Line 1250 
1250   * Control.MC.matchRedundantWarn is set, and match is redundant, a warning   * Control.MC.matchRedundantWarn is set, and match is redundant, a warning
1251   * is printed; if Control.MC.matchRedundantError is also set, the warning   * is printed; if Control.MC.matchRedundantError is also set, the warning
1252   * is promoted to an error. If the control flag Control.MC.matchExhaustive   * is promoted to an error. If the control flag Control.MC.matchExhaustive
1253   * is set, and match is inexhaustive, a warning is printed.   * is set, and match is nonexhaustive, a warning is printed.
1254   *)   *)
1255  fun matchCompile (env, rules, finish, rootv, toTcLt, err) =  fun matchCompile (env, rules, finish, rootv, toTcLt, err) =
1256    let val _ =    let val _ =
# Line 1295  Line 1297 
1297  end (* structure MatchComp *)  end (* structure MatchComp *)
1298    
1299  (*  (*
1300   * $Log$   * $Log: matchcomp.sml,v $
1301     * Revision 1.1.1.1  1998/04/08 18:39:42  george
1302     * Version 110.5
1303     *
1304   *)   *)

Legend:
Removed from v.245  
changed lines
  Added in v.411

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