class: ChangeSet
authorClaus Gittinger <cg@exept.de>
Mon, 20 Apr 2015 00:29:09 +0200
changeset 3856 f75fb195e35a
parent 3855 ea6eae92e1ab
child 3857 878ff5dde744
child 3858 9f725ed4f3b8
class: ChangeSet changed: #fromStream:while: classDefinitionChange: return nil for superclassName if there is no super class.
ChangeSet.st
--- a/ChangeSet.st	Mon Apr 20 00:28:16 2015 +0200
+++ b/ChangeSet.st	Mon Apr 20 00:29:09 2015 +0200
@@ -723,23 +723,23 @@
 fromStream:aStream while:aConditionBlock
     "build a changeSet from a stream, containing chunks.
      (i.e. either a classes sourceFile or a change-file).
-     Pass each change to the conditionBlock and stop whenever that
-     returns false. This allows skipping reamaining chunks, and speeding up
-     reading, if only parts need to be extracted
+     Pass each change to the conditionBlock and stop whenever that returns false. 
+     This allows skipping reamaining chunks, 
+     and thus speeding up reading, if only parts need to be extracted
      (for example: only documentation methods).
-     Return the changeSet."
+     Returns the changeSet."
 
     |changeSet|
 
     changeSet := self new.
     self
-	changesFromStream:aStream
-	for:changeSet
-	reader:(ChangeFileReader new)
-	do:[:aChange :lineNumberOrNil :posOrNil |
-	    changeSet add:aChange.
-	    (aConditionBlock value:aChange) ifFalse:[^ changeSet].
-	].
+        changesFromStream:aStream
+        for:changeSet
+        reader:(ChangeFileReader new)
+        do:[:aChange :lineNumberOrNil :posOrNil |
+            (aConditionBlock value:aChange) ifFalse:[^ changeSet].
+            changeSet add:aChange.
+        ].
 
     ^ changeSet
 
@@ -785,6 +785,7 @@
     "Created: / 27.10.1997 / 13:52:54 / cg"
 ! !
 
+
 !ChangeSet class methodsFor:'Compatibility-VW'!
 
 component: component definition: anObject change: changeSymbol
@@ -3722,68 +3723,70 @@
     topClassName := nil.
     "Pass 1 - collect classes"
     changeSetBeingSaved do:[:change|
-	| pkg |
-	pkg := change package.
-	packageName isNil ifTrue:[
-	    packageName := pkg.
-	] ifFalse:[
-	    "/Just a defensive check...
-	    self assert: (pkg isNil or:[pkg = packageName]) description: 'STC does not support multiple packages in source files'.
-	].
-
-	change isClassDefinitionChange ifTrue:[
-	    | nm ns |
-
-
-
-	    nm := change className.
-	    (nm endsWith:' class') ifFalse:[
-		(classInfos includesKey: nm) ifTrue:[
-		    self error:'Multiple definitions of class ', nm.
-		    ^self.
-		].
-		classInfos at: nm put: (ClassInfo new name: nm).
-		metaInfos at: nm put: (ClassInfo new name: nm , ' class').
-		change isPrivateClassDefinitionChange ifFalse:[
-		    topClassName notNil ifTrue:[
-			self error: ('Multiple top class definitions (%1 vs %2)' bindWith: topClassName with: nm).
-			^self.
-		    ].
-		    topClassName := nm.
-		    namespaceName := change nameSpaceName.
-
-		]
-	    ]
-	]
+        | pkg |
+        pkg := change package.
+        packageName isNil ifTrue:[
+            packageName := pkg.
+        ] ifFalse:[
+            "/Just a defensive check...
+            self assert: (pkg isNil or:[pkg = packageName]) description: 'STC does not support multiple packages in source files'.
+        ].
+
+        change isClassDefinitionChange ifTrue:[
+            | nm ns |
+
+
+
+            nm := change className.
+            (nm endsWith:' class') ifFalse:[
+                (classInfos includesKey: nm) ifTrue:[
+                    self error:'Multiple definitions of class ', nm.
+                    ^self.
+                ].
+                classInfos at: nm put: (ClassInfo new name: nm).
+                metaInfos at: nm put: (ClassInfo new name: nm , ' class').
+                change isPrivateClassDefinitionChange ifFalse:[
+                    topClassName notNil ifTrue:[
+                        self error: ('Multiple top class definitions (%1 vs %2)' bindWith: topClassName with: nm).
+                        ^self.
+                    ].
+                    topClassName := nm.
+                    namespaceName := change nameSpaceName.
+
+                ]
+            ]
+        ]
     ].
 
     "/ Could be an extension container...
     topClassName isNil ifTrue:[
-	^self
+        ^self
     ].
 
     "Pass 2: fill in infos"
     changeSetBeingSaved do:[:change|
-	change isClassChange ifTrue:[
-	    | nm info |
-
-	    nm := change className.
-	    (nm endsWith: ' class') ifTrue:[
-		info := metaInfos at: (nm copyButLast:(' class' size)).
-	    ] ifFalse:[
-		info := classInfos at: nm.
-		"Fill superclass info..."
-		change isClassDefinitionChange ifTrue:[
-		    | superNm |
-		    superNm := change superClassName.
-		    (classInfos includesKey: superNm) ifTrue:[
-			info superclass: (classInfos at: superNm).
-			(metaInfos at: nm) superclass: (classInfos at: superNm).
-		    ].
-		].
-	    ].
-	    info addChange: change.
-	]
+        change isClassChange ifTrue:[
+            | nm info |
+
+            nm := change className.
+            (nm endsWith: ' class') ifTrue:[
+                info := metaInfos at: (nm copyButLast:(' class' size)).
+            ] ifFalse:[
+                info := classInfos at: nm.
+                "Fill superclass info..."
+                change isClassDefinitionChange ifTrue:[
+                    | superNm |
+                    superNm := change superClassName.
+                    superNm notNil ifTrue:[
+                        (classInfos includesKey: superNm) ifTrue:[
+                            info superclass: (classInfos at: superNm).
+                            (metaInfos at: nm) superclass: (classInfos at: superNm).
+                        ].
+                    ].
+                ].
+            ].
+            info addChange: change.
+        ]
     ].
 
     classInfos do:[:info|info namespace: namespaceName].
@@ -3791,10 +3794,10 @@
 
 
     "
-	ChangeSet::ClassSourceWriter new
-	    changeSetBeingSaved: (ChangeSet forExistingClass: ChangeSet);
-	    analyze;
-	    yourself
+        ChangeSet::ClassSourceWriter new
+            changeSetBeingSaved: (ChangeSet forExistingClass: ChangeSet);
+            analyze;
+            yourself
 
     "
 
@@ -4340,7 +4343,7 @@
 !
 
 version_SVN
-    ^ '$Id: ChangeSet.st,v 1.261 2015-04-14 11:04:58 cg Exp $'
+    ^ '$Id: ChangeSet.st,v 1.262 2015-04-19 22:29:09 cg Exp $'
 ! !
 
 !ChangeSet::ClassSourceWriter::ClassInfo class methodsFor:'instance creation'!
@@ -5019,11 +5022,11 @@
 !ChangeSet class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.261 2015-04-14 11:04:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.262 2015-04-19 22:29:09 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.261 2015-04-14 11:04:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.262 2015-04-19 22:29:09 cg Exp $'
 !
 
 version_HG
@@ -5032,6 +5035,6 @@
 !
 
 version_SVN
-    ^ '$Id: ChangeSet.st,v 1.261 2015-04-14 11:04:58 cg Exp $'
+    ^ '$Id: ChangeSet.st,v 1.262 2015-04-19 22:29:09 cg Exp $'
 ! !