BCompiler.st
changeset 20 f8dd8ba75205
parent 19 84a1ddf215a5
child 25 865d6cfaf90d
--- a/BCompiler.st	Wed Mar 30 12:10:24 1994 +0200
+++ b/BCompiler.st	Thu Jun 02 22:26:28 1994 +0200
@@ -22,15 +22,32 @@
 !
 
 ByteCodeCompiler comment:'
-
 COPYRIGHT (c) 1989 by Claus Gittinger
              All Rights Reserved
-
-$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.10 1994-03-30 10:09:41 claus Exp $
 '!
 
 !ByteCodeCompiler class methodsFor:'documentation'!
 
+copyright
+"
+ COPYRIGHT (c) 1989 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.11 1994-06-02 20:25:49 claus Exp $
+"
+!
+
 documentation
 "
     This class performs compilation into ByteCodes.
@@ -73,6 +90,7 @@
          notifying:nil
            install:true
         skipIfSame:false
+            silent:false
 !
 
 compile:aString forClass:aClass inCategory:cat
@@ -85,11 +103,12 @@
          notifying:nil
            install:true
         skipIfSame:false
+            silent:false
 !
 
 compile:methodText forClass:classToCompileFor notifying:someOne
     "compile a source-string for a method in classToCompileFor.
-     errors are forwarded to someOne."
+     Errors are forwarded to someOne."
 
     ^ self compile:methodText
           forClass:classToCompileFor
@@ -97,6 +116,7 @@
          notifying:someOne
            install:true
         skipIfSame:false
+            silent:false
 !
 
 compile:aString forClass:aClass inCategory:cat notifying:someOne
@@ -110,31 +130,56 @@
          notifying:someOne
            install:true
         skipIfSame:false
+            silent:false
 !
 
-compile:aString forClass:aClass inCategory:cat notifying:someOne
-                                                 install:install
+compile:aString forClass:aClass inCategory:cat notifying:someOne install:install
+    "compile a source-string for a method in classToCompileFor.
+     The install-argument controls if the method is to be installed into the
+     classes method-dictionary, or just to be compiled and a method object to be returned.
+     Errors are forwarded to someOne. The method will get cat as category"
+
     ^ self compile:aString
           forClass:aClass
         inCategory:cat
          notifying:someOne
            install:true
         skipIfSame:false
+            silent:false
 !
 
 compile:aString forClass:aClass inCategory:cat notifying:someOne
                  install:install skipIfSame:skipIfSame
+    "compile a source-string for a method in classToCompileFor.
+     The install-argument controls if the method is to be installed into the
+     classes method-dictionary, or just to be compiled and a method object to be returned.
+     Errors are forwarded to someOne. The method will get cat as category.
+     If skipIsSame is true, and the source is the same as an existing
+     methods source, this is a noop (for fast fileIn)."
 
-    "the basic workhorse method for compiling.
+    ^ self compile:aString
+          forClass:aClass
+        inCategory:cat
+         notifying:someOne
+           install:true
+        skipIfSame:skipIfSame
+            silent:false
+!
+
+compile:aString forClass:aClass inCategory:cat notifying:someOne
+                 install:install skipIfSame:skipIfSame silent:silent
+
+    "the basic workhorse method for compiling:
      compile a source-string for a method in classToCompileFor.
      errors are forwarded to someOne (report on Transcript and return
      #Error, if someOne is nil).
 
-     The new method will get cat as category. If install is true, the method
-     will go into the classes method-table, otherwise the method is simply
-     returned (for anonymous methods).
+     The new method will get cat as category. 
+     If install is true, the method will go into the classes method-table, 
+     otherwise the method is simply returned (for anonymous methods).
      If skipIsSame is true, and the source is the same as an existing
-     methods source, this is a noop (for fast fileIn)."
+     methods source, this is a noop (for fast fileIn).
+     The argument, silent controls if errors are to be reported."
 
     |compiler newMethod tree lits symbolicCodeArray oldMethod lazy|
 
@@ -158,7 +203,7 @@
             oldMethod := aClass compiledMethodAt:(compiler selector).
             oldMethod notNil ifTrue:[
                 oldMethod source = aString ifTrue:[
-                    Smalltalk silentLoading == true ifFalse:[
+                    (silent or:[Smalltalk silentLoading == true]) ifFalse:[
                         Transcript showCr:('unchanged: ',aClass name,' ',compiler selector)
                     ].
                     ^ oldMethod
@@ -248,7 +293,7 @@
         aClass addSelector:(compiler selector) withMethod:newMethod
     ].
 
-    Smalltalk silentLoading == true ifFalse:[
+    (silent or:[Smalltalk silentLoading == true]) ifFalse:[
         Transcript showCr:('compiled: ',aClass name,' ',compiler selector)
     ].
 
@@ -699,7 +744,7 @@
         ((class == Float) or:[class == Fraction]) ifTrue:[
             index := litArray indexOf:anObject.
         ].
-        (index == 0) ifTrue:[
+        ((index == 0) or:[(litArray at:index) class ~~ class]) ifTrue:[
             litArray := litArray copyWith:anObject.
             ^ litArray size
         ].