Skip to content

Commit

Permalink
BaselineOfGToolkitPrerequisites>>applyPatchForFT2Face check method hash
Browse files Browse the repository at this point in the history
  • Loading branch information
akgrant43 committed May 21, 2024
1 parent 8ca72dd commit 13455e3
Showing 1 changed file with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,46 @@ BaselineOfGToolkitPrerequisites class >> apply: compileBlock toVersions: aCollec
^ compileBlock value.
]

{ #category : #accessing }
BaselineOfGToolkitPrerequisites class >> apply: compileBlock toVersionsFrom: aNumber [

(aNumber >= SystemVersion current major) ifFalse: [ ^ self ].
^ compileBlock value.
]

{ #category : #accessing }
BaselineOfGToolkitPrerequisites class >> assertMethod: aCompiledMethod hasHash: aString [

self assert: aCompiledMethod sha256HashString = aString
description: [ 'Unexpected hash for: ', aCompiledMethod printString ].
]

{ #category : #accessing }
BaselineOfGToolkitPrerequisites class >> source: source withPatchPragma: aSymbol [
"Answer the source code, ensuring that the supplied gtPharoPatch: pragma is present"
| ast smaccSource pragmaValue pragmaSource |

smaccSource := SmaCCString on: source trimRight.
pragmaValue := '#', aSymbol.
ast := GtPharoParser
parseWithErrors: smaccSource
startingAt: GtPharoParser startingStateForMethod.
ast pragmas
detect: [ :pragma | pragma values first value value = pragmaValue ]
ifFound: [ :pragma | ^ source ].
pragmaSource := String streamContents: [ :stream |
stream
<< '<gtPharoPatch: #';
<< aSymbol;
<< '>';
cr ].
ast body leftBar ifNil:
[ smaccSource insert: (String tab, pragmaSource) at: (ast pattern stopPosition + 2) ]
ifNotNil:
[ smaccSource insert: (pragmaSource, String tab) at: ast body leftBar startPosition ].
^ smaccSource asString.
]

{ #category : #accessing }
BaselineOfGToolkitPrerequisites >> applyPatchForFT2Face [
| source compileBlock |
Expand Down Expand Up @@ -52,8 +85,9 @@ BaselineOfGToolkitPrerequisites >> applyPatchForFT2Face [
compileBlock := [
self class assertMethod: FT2Face >> #newFaceFromExternalMemory:index:
hasHash: 'd09db5da25526bf306c3e7f110aa73154225b866b25577e1f6253d935539e2d6'.
FT2Face compile: source classified: 'gt-pharo-patch' ].
self class apply: compileBlock toVersions: #(11 12).
FT2Face compile: (self class source: source withPatchPragma: #Pharo11)
classified: 'gt-pharo-patch' ].
self class apply: compileBlock toVersionsFrom: 11.
]

{ #category : #accessing }
Expand Down

0 comments on commit 13455e3

Please sign in to comment.