'From Squeak6.0alpha of 6 September 2020 [latest update: #19838] on 14 September 2020 at 2:25:07 pm'! Error subclass: #SyntaxErrorNotification instanceVariableNames: 'inClass code doitFlag location newSource' classVariableNames: '' poolDictionaries: '' category: 'Compiler-Exceptions'! !DecompilerTests methodsFor: 'utilities' stamp: 'ct 9/14/2020 14:21'! checkDecompileMethod: oldMethod | cls selector oldMethodNode methodNode newMethod oldCodeString newCodeString | cls := oldMethod methodClass. selector := oldMethod selector. oldMethodNode := (cls decompilerClass new withTempNames: oldMethod methodNode schematicTempNamesString) decompile: selector in: cls method: oldMethod methodForDecompile. [oldMethodNode properties includesKey: #warning] whileTrue: [oldMethodNode properties removeKey: #warning]. oldCodeString := oldMethodNode decompileString. methodNode := [[| compiler | compiler := cls newCompiler. compiler parser encoderClass: oldMethod encoderClass. compiler compile: oldCodeString in: cls notifying: nil ifFail: []] on: SyntaxErrorNotification do: [:ex| ex messageText = 'Cannot store into' ifTrue: [ex return: #badStore]. ex pass]] on: OutOfScopeNotification do: [:ex| ex return: #badStore]. "Ignore cannot store into block arg errors; they're not our issue." methodNode ~~ #badStore ifTrue: [newMethod := methodNode generate. newCodeString := ((cls decompilerClass new withTempNames: methodNode schematicTempNamesString) decompile: selector in: cls method: newMethod methodForDecompile) decompileString. "(StringHolder new textContents: (TextDiffBuilder buildDisplayPatchFrom: oldCodeString to: newCodeString)) openLabel: 'Decompilation Differences for ', cls name,'>>',selector" "(StringHolder new textContents: (TextDiffBuilder buildDisplayPatchFrom: oldMethod abstractSymbolic to: newMethod abstractSymbolic)) openLabel: 'Bytecode Differences for ', cls name,'>>',selector" self assert: (oldCodeString = newCodeString or: [(Scanner new scanTokens: oldCodeString) = (Scanner new scanTokens: newCodeString)]) description: cls name asString, ' ', selector asString resumable: true]! ! !SyntaxError methodsFor: 'text menu support' stamp: 'ct 9/14/2020 14:21'! errorMessageInterval "To understand this format, see Parser >> #notify:at:." ^ notification location to: notification location + '"' size + notification messageText size - 1 + ' ->"' size! ! !SyntaxErrorNotification methodsFor: '*60Deprecated-accessing' stamp: 'ct 9/14/2020 14:19'! errorMessage self deprecated: 'ct: Use #messageText instead.'. ^ self messageText! ! !SyntaxErrorNotification methodsFor: 'accessing' stamp: 'ct 9/14/2020 14:19'! setClass: aClass code: codeString doitFlag: aBoolean errorMessage: errorString location: anInteger inClass := aClass. code := codeString. doitFlag := aBoolean. self messageText: errorString. location := anInteger! ! SyntaxErrorNotification removeSelector: #messageText! !SyntaxErrorNotification reorganize! ('*60Deprecated-accessing' errorMessage) ('accessing' doitFlag errorClass errorCode isResumable location newSource newSource: reparse:notifying:ifFail: resume: setClass:code:doitFlag:errorMessage:location: tryNewSourceIfAvailable) ('*System-exceptionDescription' defaultAction) !