logo       

Nice/src/bossa/syntax Node.java,1.64,1.65 funexp.nice,1.3,1.4 methodImpleme: msg#00101

Subject: Nice/src/bossa/syntax Node.java,1.64,1.65 funexp.nice,1.3,1.4 methodImplementation.nice,1.4,1.5 typecheck.nice,1.118,1.119 Function.java,1.6,NONE
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12091/F:/nice/src/bossa/syntax

Modified Files:
        Node.java funexp.nice methodImplementation.nice typecheck.nice 
Removed Files:
        Function.java 
Log Message:
Converted Function.

Index: Node.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Node.java,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** Node.java   20 Dec 2004 20:25:53 -0000      1.64
--- Node.java   30 Dec 2004 20:58:37 -0000      1.65
***************
*** 291,297 ****
    // The current function should be saved in nodes that need it
    // during execution of their typecheck method.
!   static Function currentFunction;
!   static Function getCurrentFunction() { return currentFunction; }
!   static void setCurrentFunction(Function f) { currentFunction = f; }
    
    /** The this parameter of the current function, or null. */
--- 291,297 ----
    // The current function should be saved in nodes that need it
    // during execution of their typecheck method.
!   static /*Function*/Object currentFunction;
!   static /*Function*/Object getCurrentFunction() { return currentFunction; }
!   static void setCurrentFunction(/*Function*/Object f) { currentFunction = f; 
}
    
    /** The this parameter of the current function, or null. */

Index: methodImplementation.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodImplementation.nice,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** methodImplementation.nice   30 Dec 2004 18:49:01 -0000      1.4
--- methodImplementation.nice   30 Dec 2004 20:58:37 -0000      1.5
***************
*** 141,145 ****
      }
      catch (mlsub.typing.TypingEx e) {
!       throw new Function.WrongReturnType(e, 
notNull(declaration).getReturnType());
      }
    }
--- 141,145 ----
      }
      catch (mlsub.typing.TypingEx e) {
!       throw new WrongReturnType(typingException: e, expectedReturnType: 
notNull(declaration).getReturnType());
      }
    }

--- Function.java DELETED ---

Index: funexp.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/funexp.nice,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** funexp.nice 1 Dec 2004 02:00:32 -0000       1.3
--- funexp.nice 30 Dec 2004 20:58:37 -0000      1.4
***************
*** 16,19 ****
--- 16,38 ----
  
  /**
+    A function is either a method body or a lambda expression.
+    
+ */
+ interface Function
+ {
+   /**
+      The expected return type of this function.
+      Can be null if it is not known (e.g. the type is inferred).
+   */
+   ?mlsub.typing.Monotype getExpectedType();
+ 
+   /**
+      Called with each type returned from the function.
+      Can be used for either type checking or type inference.
+    */
+   void checkReturnedType(mlsub.typing.Polytype returned);
+ }
+ 
+ /**
     A functional abstraction expression.
  */
***************
*** 47,51 ****
  
        if (! notNull(_inferredReturnType).trySimplify())
!         throw new Function.IncompatibleReturnType(old);
        }
  
--- 66,70 ----
  
        if (! notNull(_inferredReturnType).trySimplify())
!         throw new IncompatibleReturnType(previouslyInferredType: old);
        }
  
***************
*** 140,141 ****
--- 159,173 ----
    return res;
  }
+ 
+ abstract class ReturnTypeError extends Exception {}
+ 
+ class WrongReturnType extends ReturnTypeError
+ {
+   mlsub.typing.TypingEx typingException;
+   mlsub.typing.Monotype expectedReturnType;
+ }
+ 
+ class IncompatibleReturnType extends ReturnTypeError
+ {
+   mlsub.typing.Polytype previouslyInferredType;
+ }

Index: typecheck.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v
retrieving revision 1.118
retrieving revision 1.119
diff -C2 -d -r1.118 -r1.119
*** typecheck.nice      1 Dec 2004 02:00:32 -0000       1.118
--- typecheck.nice      30 Dec 2004 20:58:37 -0000      1.119
***************
*** 248,252 ****
  typecheck(FunExp e)
  {
!   ?Function saved = Node.getCurrentFunction();
    Node.setCurrentFunction(e);
  
--- 248,252 ----
  typecheck(FunExp e)
  {
!   /* ?Function*/ ?Object saved = Node.getCurrentFunction();
    Node.setCurrentFunction(e);
  
***************
*** 885,889 ****
  typecheck(ReturnStmt r)
  {
!   ?Function function = Node.currentFunction;
    if (function == null)
      throw bossa.util.User.error(r, "This return is not inside a function");
--- 885,889 ----
  typecheck(ReturnStmt r)
  {
!   ?Function function = cast(Node.currentFunction);
    if (function == null)
      throw bossa.util.User.error(r, "This return is not inside a function");
***************
*** 907,916 ****
        function.checkReturnedType(r.returnType());
    }
!   catch(Function.WrongReturnType e){
      if (notNullError(notNull(e.typingException), r, String.valueOf(r.value)))
        wrongReturnType(r, r.returnType().toString(), 
                      valueOf(e.expectedReturnType), 
notNull(e.typingException));
    }
!   catch(Function.IncompatibleReturnType e){
      throw bossa.util.User.error(r, "The returned value is incompatible with 
the return type: " + e.previouslyInferredType);
    }
--- 907,916 ----
        function.checkReturnedType(r.returnType());
    }
!   catch(WrongReturnType e){
      if (notNullError(notNull(e.typingException), r, String.valueOf(r.value)))
        wrongReturnType(r, r.returnType().toString(), 
                      valueOf(e.expectedReturnType), 
notNull(e.typingException));
    }
!   catch(IncompatibleReturnType e){
      throw bossa.util.User.error(r, "The returned value is incompatible with 
the return type: " + e.previouslyInferredType);
    }
***************
*** 919,923 ****
  typecheck(VoidReturnStmt r)
  {
!   ?Function function = Node.currentFunction;
    if (function == null)
      throw bossa.util.User.error(r, "This return is not inside a function");
--- 919,923 ----
  typecheck(VoidReturnStmt r)
  {
!   ?Function function = cast(Node.currentFunction);
    if (function == null)
      throw bossa.util.User.error(r, "This return is not inside a function");
***************
*** 929,937 ****
        function.checkReturnedType(r.returnType());
    }
!   catch(Function.WrongReturnType e){
      wrongReturnType(r, r.returnType().toString(), 
                      valueOf(e.expectedReturnType), 
notNull(e.typingException));
    }
!   catch(Function.IncompatibleReturnType e){
      throw bossa.util.User.error(r, "The returned value is incompatible with 
the return type: " + e.previouslyInferredType);
    }
--- 929,937 ----
        function.checkReturnedType(r.returnType());
    }
!   catch(WrongReturnType e){
      wrongReturnType(r, r.returnType().toString(), 
                      valueOf(e.expectedReturnType), 
notNull(e.typingException));
    }
!   catch(IncompatibleReturnType e){
      throw bossa.util.User.error(r, "The returned value is incompatible with 
the return type: " + e.previouslyInferredType);
    }



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe