Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 18 Nov 2016 21:21:39 +0000
branchjv
changeset 4056 d75b18246677
parent 4055 129adc2a45a5 (current diff)
parent 4039 a31a6da554f4 (diff)
child 4061 ebdd14acce2d
Merge
Explainer.st
ObjectFileLoader.st
Parser.st
ParserFlags.st
stx_libcomp.st
--- a/Explainer.st	Fri Nov 18 21:20:51 2016 +0000
+++ b/Explainer.st	Fri Nov 18 21:21:39 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
               All Rights Reserved
@@ -273,7 +271,7 @@
         implMethod := implClass compiledMethodAt:selector.
         clsName := implClass name.
         clsName := self asLink:clsName to:(self actionToBrowseClass:implClass selector:selector).
-        info := '%1 » %2' bindWith:clsName "allBold" with:selectorString.
+        info := '%1  %2' bindWith:clsName "allBold" with:selectorString.
         info := self asLink:info to:(action1 := self actionToBrowseClass:implClass selector:selector info:nil).
         
         redefiningClasses size > 0 ifTrue:[
@@ -2335,7 +2333,7 @@
 !
 
 actionToBrowseImplementorsOf:selector
-    ^ self actionToBrowseImplementorsOf:selector in:Smalltalk allClasses
+    ^ self actionToBrowseImplementorsOf:selector in:[Smalltalk allClasses]
 !
 
 actionToBrowseImplementorsOf:selector in:classes
@@ -2346,11 +2344,11 @@
                     spawnMethodImplementorsBrowserFor:{ selector }
                     match:false
                     in:openHow
-                    classes:classes
+                    classes:classes value
                     label:('Implementors of %1' bindWith:selector)
             ]
         ]
-        info:nil
+        info:('Click to browse implementors')
 !
 
 actionToBrowseInstvarRefsTo:instVarName inClass:class
@@ -2421,7 +2419,8 @@
         ^ 'No %1classes' bindWith:prefix.
     ].
 
-    classNames := aCollectionOfClasses asIdentitySet asOrderedCollection collect:[:each | each theNonMetaclass name].
+    classNames := aCollectionOfClasses asIdentitySet asOrderedCollection 
+                        collect:[:each | each theNonMetaclass name].
 
     nClassNames := classNames size.
 
@@ -2598,7 +2597,7 @@
         implementors notEmpty ifTrue:[
             implementors := implementors collect:[:mthd | mthd mclass ? mthd getMclass].
             implementors notEmpty ifTrue:[
-                msg := 'Also implemented in '.
+                msg := 'Also ',(self asLink:'implemented' to:(self actionToBrowseImplementorsOf:aMethod selector)),' in '.
                 msg := msg , (self infoStringForClasses:implementors withPrefix:'other ').
                 msg := msg , '.'.
             ]
@@ -2647,7 +2646,7 @@
                         to:(self actionToOpenMethodFinderFor:sel)) 
             with:(self 
                     asLink:inheritedClass name "allBold" 
-                    info:('Browse %1 » %2' bindWith:inheritedClass name with:sel)
+                    info:('Browse %1  %2' bindWith:inheritedClass name with:sel)
                     to:(self actionToBrowseClass:inheritedClass selector:sel)).
     ].
 
--- a/ObjectFileLoader.st	Fri Nov 18 21:20:51 2016 +0000
+++ b/ObjectFileLoader.st	Fri Nov 18 21:21:39 2016 +0000
@@ -4041,13 +4041,13 @@
      install all of its classes) or for a single incrementally compiled methdod
      (it should then NOT install it, but return the method object instead).
 
-     DANGER: Internal & highly specialized. Dont use in your programs.
-	     This interface may change without notice."
+     DANGER: Internal & highly specialized. Don't use in your programs.
+             This interface may change without notice."
 
     |moduleID retVal oldSpaceReserve|
 
     handle notNil ifTrue:[
-	moduleID := handle moduleID
+        moduleID := handle moduleID
     ].
     "/
     "/ for various reasons, classes, methods, literals, methodDicts etc.
@@ -4066,58 +4066,58 @@
     int wasBlocked = 1;
 
     if (__isInteger(address)) {
-	if (_isSmallInteger(argument)) {
-	    arg = __intVal(argument);
-
-	    addr = (OBJFUNC)(__longIntVal(address));
-
-	    /*
-	     * allow function to be interrupted
-	     */
-	    if (interruptable != true) {
-		wasBlocked = (__BLOCKINTERRUPTS() == true);
-	    }
-
-	    force = (forceOld == true);
-	    if (force) {
-		int reserve = __intVal(oldSpaceReserve);
-		if ((__oldSpaceSize() - __oldSpaceUsed()) < reserve) {
-		    __moreOldSpace(__thisContext, reserve);
-		}
-		prevSpace = __allocForceSpace(OLDSPACE);
-	    }
-
-	    if (@global(Verbose) == true) {
-		console_printf("calling initfunc %lx(%lx) ...\n", (long)addr, (long)arg);
-	    }
-
-	    if (special == true) {
-		if (__isSmallInteger(moduleID)) {
-		    __SET_MODULE_ID(__intVal(moduleID));
-		}
-		retVal = (*addr)(arg, __pRT__);
-		__SET_MODULE_ID(0);
-		if (returnsObject != true) {
-		    retVal = nil;
-		}
-	    } else {
-		if (returnsObject == true) {
-		    retVal = (*addr)(arg);
-		} else {
-		    ret = (INT) ((*addr)(arg));
-		    retVal = __mkSmallInteger(ret);
-	       }
-	    }
-
-	    if (force) {
-		__allocForceSpace(prevSpace);
-	    }
-
-	    if (! wasBlocked) {
-		__UNBLOCKINTERRUPTS();
-	    }
-	    RETURN (retVal);
-	}
+        if (_isSmallInteger(argument)) {
+            arg = __intVal(argument);
+
+            addr = (OBJFUNC)(__longIntVal(address));
+
+            /*
+             * allow function to be interrupted
+             */
+            if (interruptable != true) {
+                wasBlocked = (__BLOCKINTERRUPTS() == true);
+            }
+
+            force = (forceOld == true);
+            if (force) {
+                int reserve = __intVal(oldSpaceReserve);
+                if ((__oldSpaceSize() - __oldSpaceUsed()) < reserve) {
+                    __moreOldSpace(__thisContext, reserve);
+                }
+                prevSpace = __allocForceSpace(OLDSPACE);
+            }
+
+            if (@global(Verbose) == true) {
+                console_printf("calling initfunc %lx(%lx) ...\n", (long)addr, (long)arg);
+            }
+
+            if (special == true) {
+                if (__isSmallInteger(moduleID)) {
+                    __SET_MODULE_ID(__intVal(moduleID));
+                }
+                retVal = (*addr)(arg, __pRT__);
+                __SET_MODULE_ID(0);
+                if (returnsObject != true) {
+                    retVal = nil;
+                }
+            } else {
+                if (returnsObject == true) {
+                    retVal = (*addr)(arg);
+                } else {
+                    ret = (INT) ((*addr)(arg));
+                    retVal = __mkSmallInteger(ret);
+               }
+            }
+
+            if (force) {
+                __allocForceSpace(prevSpace);
+            }
+
+            if (! wasBlocked) {
+                __UNBLOCKINTERRUPTS();
+            }
+            RETURN (retVal);
+        }
     }
 %}.
     self primitiveFailed
--- a/ParseError.st	Fri Nov 18 21:20:51 2016 +0000
+++ b/ParseError.st	Fri Nov 18 21:21:39 2016 +0000
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libcomp' }"
 
+"{ NameSpace: Smalltalk }"
+
 ProceedableError subclass:#ParseError
 	instanceVariableNames:'errorMessage startPosition endPosition lineNumber'
 	classVariableNames:''
@@ -40,7 +42,7 @@
     (originally, I wanted to subclass this from compilationError,
     and raise different error for code generator issues (i.e. method too
     big, etc.) But all users of the parser in the system (RB-stuff, Lint stuff,
-    fileIn etc.) always handle the ParseError, and I dont want them to be forced to change.
+    fileIn etc.) always handle the ParseError, and I don't want them to be forced to change.
     So we subclass the codeGenerator issues from this one.
 "
 ! !
@@ -105,10 +107,10 @@
 !ParseError class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ParseError.st,v 1.2 2013-04-03 17:21:30 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/ParseError.st,v 1.2 2013-04-03 17:21:30 cg Exp $'
+    ^ '$Header$'
 ! !
 
--- a/Parser.st	Fri Nov 18 21:20:51 2016 +0000
+++ b/Parser.st	Fri Nov 18 21:21:39 2016 +0000
@@ -221,7 +221,7 @@
     by some other method (using #at:put:). Since the array-return is actually a return of
     a reference to the compiler created array, the next invokation of the method will
     return the modified array. These are hard to find bugs.
-    By an option, the compiler can generate immutable arrays, which dont allow modification
+    By an option, the compiler can generate immutable arrays, which don't allow modification
     of its elements. For clean code, you should enable this option during development.
 
     As mentioned above, this is experimental. If it is reported to be a useful feature,
@@ -2766,7 +2766,7 @@
 
     note := self plausibilityCheck:aNode.
     note notNil ifTrue:[
-        "/ this is a hack (which I dont like)
+        "/ this is a hack (which I don't like)
         (note includesString:'missing ''.''') ifTrue:[
             fixes := { CorrectByInsertingPeriod }
         ] ifFalse:[
@@ -4227,7 +4227,7 @@
             ] ifFalse:[(((recType := receiver type) == #GlobalVariable)
                         or:[recType == #PrivateClass]) ifTrue:[
                 rec := receiver evaluate.
-                "/ dont check autoloaded classes - it may work after loading
+                "/ don't check autoloaded classes - it may work after loading
                 (rec isNil
                  or:[rec isBehavior and:[rec isLoaded not]]) ifTrue:[
                     ^ aSelectorString
@@ -4440,7 +4440,7 @@
             "if the receiver is a global, we check it too ..."
 
             Error handle:[:ex | ] do:[ nodeVal := aNode evaluate ].
-            "/ dont check autoloaded classes
+            "/ don't check autoloaded classes
             "/ - it may work after loading
             (nodeVal isNil
              or:[nodeVal isBehavior and:[nodeVal isLoaded not]]) ifTrue:[
@@ -4757,7 +4757,7 @@
                     checkAction:[:e |
                         e problemMethod notNil
                         and:[(e problemMethod usedGlobals includes:aName)
-                        and:[(Smalltalk includesKey:aName) not]] ].
+                        and:[(Smalltalk includesKey:aName asSymbol) not]] ].
             ].
         ].
     ].
--- a/ParserFlags.st	Fri Nov 18 21:20:51 2016 +0000
+++ b/ParserFlags.st	Fri Nov 18 21:21:39 2016 +0000
@@ -2158,10 +2158,14 @@
 !
 
 allowOldStyleAssignment
+    "return true, if underscore-assignment (pre ST-80v4 syntax) are to be allowed"
+
     ^ allowOldStyleAssignment
 !
 
 allowOldStyleAssignment:aBoolean
+    "return true, if underscore-assignment (pre ST-80v4 syntax) are to be allowed"
+    
     allowOldStyleAssignment := aBoolean
 !
 
--- a/Scanner.st	Fri Nov 18 21:20:51 2016 +0000
+++ b/Scanner.st	Fri Nov 18 21:21:39 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -145,7 +143,7 @@
 extendedBinarySelectorCharacters
     "return a collection of characters which are optionally allowed in binary selectors"
 
-"/    ^ '±×·÷«»'.
+"/    ^ '±×·÷«»'.
     ^ String
         with:(Character value:16rB1)  "/ plus-minus
         with:(Character value:16rD7)  "/ times
@@ -2506,7 +2504,7 @@
     ].
 
     "this allows excla to be used as binop -
-     I dont know, if this is correct ..."
+     I don't know, if this is correct ..."
 
 "/    tokenName := token := '!!'.
 "/    tokenType := #BinaryOperator.
@@ -2676,7 +2674,7 @@
     ].
 
     "this allows hash to be used as binop -
-     I dont know, if this is correct ..."
+     I don't know, if this is correct ..."
     tokenName := token := '#'.
     tokenType := #BinaryOperator.
     ^ tokenType
@@ -2763,8 +2761,8 @@
     nextChar := source peekOrNil.
 
     (((nextChar == $_) and:[allowUnderscoreInIdentifier]) 
-    or:[((nextChar == $$ ) and:[allowDollarInIdentifier])
-    or:[(nextChar notNil and:[nextChar isNationalLetter]) and:[allowNationalCharactersInIdentifier]]]) ifTrue:[
+    or:[(allowDollarInIdentifier and:[nextChar == $$ ])
+    or:[allowNationalCharactersInIdentifier and:[ nextChar notNil and:[nextChar isNationalLetter]]]]) ifTrue:[
         pos := source position + 1.
         nextChar == $_ ifTrue:[
             self warnUnderscoreAt:pos.
@@ -2864,7 +2862,7 @@
 
 nextMantissaAndScaledPartWithRadix:radix
     "read the mantissa of a radix number.
-     Since we dont know yet if this is for a Float, LongFloat or a FixedPoint,
+     Since we don't know yet if this is for a Float, LongFloat or a FixedPoint,
      return info which is useful for all: an array consisting of
      the mantissa as float/longFloat, the numerator and the scale for a fixedPoint."
 
@@ -3106,12 +3104,13 @@
             thirdChar := source peekOrNil.
             thirdChar notNil ifTrue:[
                 (self isSpecialOrExtendedSpecialCharacter:thirdChar) ifTrue:[
+                    p := source position.
+                    source next.
+                    fourthChar := source peekOrNil.
+                    source position:p.
+                    
                     (thirdChar == $-) ifTrue:[
                         "special- look if minus belongs to number following"
-                        p := source position.
-                        source next.
-                        fourthChar := source peekOrNil.
-                        source position:p.
                         fourthChar isDigit ifTrue:[
                             tokenName := token := string.
                             tokenType := #BinaryOperator.
@@ -3120,8 +3119,16 @@
                                 position:p+1 
                                 to:p+1.
                             ^ tokenType
-                        ]
+                        ].
                     ].
+                    thirdChar == $# ifTrue:[
+                        fourthChar isSeparator ifFalse:[
+                            "/ in sth. like ->#foo, the binop is NOT ->#
+                            tokenName := token := string.
+                            tokenType := #BinaryOperator.
+                            ^ tokenType
+                        ].    
+                    ].    
                     source next.
                     string := string copyWith:thirdChar.
                 ].
--- a/UnaryNode.st	Fri Nov 18 21:20:51 2016 +0000
+++ b/UnaryNode.st	Fri Nov 18 21:21:39 2016 +0000
@@ -221,7 +221,7 @@
 
 plausibilityCheckIn:aParser
     "check for funny selector - careful to do string compare instead
-     of symbol identity compare: I dont want to introduce these as symbols
+     of symbol identity compare: I don't want to introduce these as symbols
      into the system (would make the '... is nowhere implemented' warning
      go away.
      TODO: rewite to use lint/lint rules and apply them before accepting"
--- a/stx_libcomp.st	Fri Nov 18 21:20:51 2016 +0000
+++ b/stx_libcomp.st	Fri Nov 18 21:21:39 2016 +0000
@@ -43,12 +43,19 @@
     This library contains the Smalltalk parser and bytecode compiler,
     and related support classes (AST representation).
 
-    This compiler is used when code is changed within the running IDE or application.
-    It generates bytecode methods, which are further translated to machine code by the VM,
-    when first executed. 
-    This is not to be confused with the stc-compiler, which generates plain machine code, which
-    is packaged in compiled class libraries. Usually, end user applications are deployed as 
-    stc-compiled binary code. And only patches or dynamically generated code uses bytecode methods.
+    This compiler is used when code is changed within the running IDE or application,
+    and when source code is loaded.
+    It generates bytecode methods, which are (typically) further translated to machine code by the VM,
+    when first executed 
+    (although for some architectures, no JITTER is available, and the bytecode will be interpreted, 
+     which is of course much slower).
+     
+    This is not to be confused with the stc-compiler, which generates plain machine code, 
+    which is packaged into compiled class libraries and runs with very good performance. 
+    Usually, end user applications are deployed as stc-compiled binary code. 
+    And only patches or dynamically generated code uses bytecode methods.
+    Therefore, the speed of the bytecode interpreter is usually not at all relevant to a deployed app's 
+    overall speed (and also not to the ST/X IDE itself, as it also consists of precompiled machine code).
 "
 ! !