Fix Syntax Errors (3.0)
Scott Wallace
Scott.Wallace at disney.com
Mon Feb 5 01:45:03 UTC 2001
Jerry,
Thank you, this was a valuable service! And you did accurately
intuit what the corrected code should be for
EToyVocabulary.initialize.
-- Scott
At 8:19 PM -0500 2/4/01, JArchibald at aol.com wrote:
>All--
>
>While clearing the underbrush to create a shrunken version of Squeak 3.0, I
>stumbled across a syntax error that occurred when running #abandonSources
>(which Parses all methods as part of supplying an temporary variable
>dictionary). I finally decided to run #abandonSources against the entire
>image (I wonder if that's ever been done before) to see if there where any
>more syntax errors. This ferreted out one more.
>
>These are in change sets that were released just a few days ago, so it wasn't
>likely that anyone would have bumped into them. Apparently improvements in
>the compiler parsing algorithms followed them in the update stream, as they
>otherwise would have been caught earlier.
>
>These updates are just my best guess at what the correct code should be;
>particularly in the case of EToyVocabulary>>initialize I had to intuit freely
>to come up with I thought was correct. Original authors should check these
>for proper semantics.
>
>EToyVocabulary>>initialize
>sw Scott Wallace 1/26/2001 23:03
>
>MethodFinder>>constEquiv
>tk Ted Kaehler 1/8/2001 17:48
>
>Cheers,
>Jerry.
>
>____________________________
>
>Jerry L. Archibald
>systemObjectivesIncorporated
>____________________________
>
>'From Squeak3.0 of 4 February 2001 [latest update: #3414] on 4
>February 2001 at 8:19:50 pm'!
>"Change Set: FixSyntaxErrors
>Date: 4 February 2001
>Author: Jerry Archibald
>
>While clearing the underbrush to create a shrunken version of Squeak
>3.0, I stumbled across a syntax error that occurred when running
>#abandonSources (which parses all methods as part of supplying an
>temporary variable dictionary). I finally decided to run
>#abandonSources against the entire image (I wonder if that's ever
>been done before) to see if there where any more syntax errors. This
>ferreted out one more.
>
>These are in change sets that were released just a few days ago, so
>it wasn't likely that anyone would have bumped into them. Apparently
>improvements in the compiler parsing algorithms followed them in the
>update stream, as they otherwise would have been caught earlier.
>
>These updates are just my best guess at what the correct code should
>be; particularly in the case of EToyVocabulary>>initialize I had to
>intuit freely to come up with I thought was correct. Original
>authors should check these for proper semantics.
>
>EToyVocabulary>>initialize
>sw Scott Wallace 1/26/2001 23:03
>
>MethodFinder>>constEquiv
>tk Ted Kaehler 1/8/2001 17:48"!
>
>!EToyVocabulary methodsFor: 'initialization' stamp: 'jla 2/4/2001 19:24'!
>initialize
> "Initialize the receiver (automatically called when instances
>are created via 'new')"
>
> | classes aMethodCategory selector selectors categorySymbols |
> super initialize.
> self vocabularyName: #eToy.
> self documentation: '"EToy" is a vocabulary that provides the
>equivalent of the 1997-2000 etoy prototype'.
> categorySymbols _ Set new.
> classes _ Smalltalk allImplementorsOf: #additionsToViewerCategories.
> classes do:
> [:anItem |
> MessageSet parse: anItem toClassAndSelector:
> [:aClass :aSelector |
> categorySymbols addAll: aClass soleInstance basicNew
>categoriesForViewer]].
>
> categorySymbols asOrderedCollection do:
> [:aCategorySymbol |
> aMethodCategory _ ElementCategory new
>categoryName: aCategorySymbol.
> classes _ (Smalltalk
>allImplementorsOf: #additionsToViewerCategories) collect:
> [:anItem | MessageSet parse:
>anItem toClassAndSelector: [:aMetaClass :aSelector | aMetaClass
>soleInstance]].
>
> selectors _ Set new.
> classes do:
> [:aClass |
> (aClass
>additionsToViewerCategory: aCategorySymbol) do:
> [:anElement |
> anElement
>first == #command
> ifTrue:
>
> [selectors add: (selector _ anElement second).
>
> (methodInterfaces includesKey: selector) ifFalse:
>
> [methodInterfaces at: selector put: (MethodInterface
>new initializeFromEToyCommandSpec: anElement category:
>aCategorySymbol)]]
>
> ifFalse: "#slot format"
>
> [selectors add: (selector _ anElement seventh). "the getter"
>
> selectors add: (anElement at: 9) "the setter".
>
> (methodInterfaces includesKey: selector) ifFalse:
>
> [self addGetterAndSetterInterfacesFromOldSlotSpec:
>anElement]]]].
> (selectors copyWithout: #unused) asSortedArray do:
> [:aSelector |
> aMethodCategory elementAt:
>aSelector put: (methodInterfaces at: aSelector)].
>
> self addCategory: aMethodCategory].
>
> #(scripts 'instance variables') do: [:sym | self
>addCategoryNamed: sym].
> self setCategoryDocumentationStrings! !
>
>
>!MethodFinder methodsFor: 'find a constant' stamp: 'jla 2/4/2001 18:30'!
>constEquiv
> | const subTest got jj |
> "See if (data1 = C) or (data1 ~= C) is the answer"
>
> "quick test"
> ((answers at: 1) class superclass == Boolean) ifFalse: [^ false].
> 2 to: answers size do: [:ii |
> ((answers at: ii) class superclass == Boolean)
>ifFalse: [^ false]].
>
> const _ (thisData at: 1) at: 1.
> got _ (subTest _ MethodFinder new copy: self addArg: const)
> searchForOne isEmpty not.
> got ifFalse: ["try other polarity for ~~ "
> (jj _ answers indexOf: (answers at: 1) not) > 0 ifTrue: [
> const _ (thisData at: jj) at: 1.
> got _ (subTest _ MethodFinder new copy: self addArg: const)
> searchForOne isEmpty not]].
> got ifFalse: [^ false].
>
> "replace data2 with const in expressions"
> subTest expressions do: [:exp |
> expressions add: (exp copyReplaceAll: 'data2' with:
>const printString)].
> selector addAll: subTest selectors.
> ^ true! !
More information about the Squeak-dev
mailing list
|