From 3f36c4241cb5729c2c1d17ecaaa0340b47fe21ec Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Wed, 23 Jul 2025 14:38:54 +0300 Subject: [PATCH 1/8] added a method to retrieve source code from a compiledmethod to GRPlatform --- .../GRPlatform.class/instance/compile.into.classified..st | 2 +- .../GRPlatform.class/instance/sourceCodeStringOf..st | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st diff --git a/repository/Grease-Core.package/GRPlatform.class/instance/compile.into.classified..st b/repository/Grease-Core.package/GRPlatform.class/instance/compile.into.classified..st index 419d7169..0f0bbaf0 100644 --- a/repository/Grease-Core.package/GRPlatform.class/instance/compile.into.classified..st +++ b/repository/Grease-Core.package/GRPlatform.class/instance/compile.into.classified..st @@ -1,4 +1,4 @@ -file library +meta-object-protocol compile: aString into: aClass classified: aSymbol "The trick here is to be as silently a possible so that the package is not marked dirty when running WAFileLibrary test. This also makes running tests much faster." diff --git a/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st new file mode 100644 index 00000000..3ed3d44c --- /dev/null +++ b/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st @@ -0,0 +1,5 @@ +meta-object-protocol +sourceCodeStringOf: aCompiledMethod + "Return a String with the source code for a compiled method." + + ^ self convertToSmalltalkNewlines: aCompiledMethod sourceCode \ No newline at end of file From e1dca3bb8fd25d79201afb5bd795a98b78afc489 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Wed, 23 Jul 2025 14:42:00 +0300 Subject: [PATCH 2/8] add test --- .../instance/testCompileAsciiString.st | 2 +- .../instance/testCompileUnicodeString.st | 2 +- .../instance/testSourceCodeStringOf.st | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testSourceCodeStringOf.st diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testCompileAsciiString.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testCompileAsciiString.st index 6b5d9978..cac5ef2b 100644 --- a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testCompileAsciiString.st +++ b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testCompileAsciiString.st @@ -1,4 +1,4 @@ -tests-file library +tests-mop testCompileAsciiString | selector expected source | diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testCompileUnicodeString.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testCompileUnicodeString.st index a02b1ac5..116559bd 100644 --- a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testCompileUnicodeString.st +++ b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testCompileUnicodeString.st @@ -1,4 +1,4 @@ -tests-file library +tests-mop testCompileUnicodeString | selector expected source | selector := #stringMethod. diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testSourceCodeStringOf.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testSourceCodeStringOf.st new file mode 100644 index 00000000..c01f5682 --- /dev/null +++ b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testSourceCodeStringOf.st @@ -0,0 +1,12 @@ +tests-mop +testSourceCodeStringOf + + | sourceCodeString | + sourceCodeString := GRPlatform current sourceCodeStringOf: + GRPlatform >> #sourceCodeStringOf:. + self + assert: sourceCodeString + equals: 'sourceCodeStringOf: aCompiledMethod + "Return a String with the source code for a compiled method." + + ^ self convertToSmalltalkNewlines: aCompiledMethod sourceCode' \ No newline at end of file From d67ab3082264b7efeda437aa8f7a34867482c074 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Wed, 23 Jul 2025 15:49:25 +0300 Subject: [PATCH 3/8] moved implementation of sourcecodeStringOf: to Pharo package --- .../GRPlatform.class/instance/removeSelector.from..st | 2 +- .../GRPlatform.class/instance/sourceCodeStringOf..st | 2 +- .../GRPharoPlatform.class/instance/sourceCodeStringOf..st | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st diff --git a/repository/Grease-Core.package/GRPlatform.class/instance/removeSelector.from..st b/repository/Grease-Core.package/GRPlatform.class/instance/removeSelector.from..st index 2c0c7aed..5e1bfedd 100644 --- a/repository/Grease-Core.package/GRPlatform.class/instance/removeSelector.from..st +++ b/repository/Grease-Core.package/GRPlatform.class/instance/removeSelector.from..st @@ -1,3 +1,3 @@ -file library +meta-object-protocol removeSelector: aSymbol from: aClass self subclassResponsibility \ No newline at end of file diff --git a/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st index 3ed3d44c..d4f5a1dc 100644 --- a/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st +++ b/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st @@ -2,4 +2,4 @@ meta-object-protocol sourceCodeStringOf: aCompiledMethod "Return a String with the source code for a compiled method." - ^ self convertToSmalltalkNewlines: aCompiledMethod sourceCode \ No newline at end of file + self subclassResponsibility \ No newline at end of file diff --git a/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st new file mode 100644 index 00000000..3ed3d44c --- /dev/null +++ b/repository/Grease-Pharo100-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st @@ -0,0 +1,5 @@ +meta-object-protocol +sourceCodeStringOf: aCompiledMethod + "Return a String with the source code for a compiled method." + + ^ self convertToSmalltalkNewlines: aCompiledMethod sourceCode \ No newline at end of file From 79e495111a5e0c3f9dd173670b00dbdc2cad8042 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Wed, 23 Jul 2025 15:56:25 +0300 Subject: [PATCH 4/8] fix test --- .../GRPlatform.class/instance/sourceCodeStringOf..st | 2 +- .../GRPlatformTest.class/instance/testSourceCodeStringOf.st | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st index d4f5a1dc..76902771 100644 --- a/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st +++ b/repository/Grease-Core.package/GRPlatform.class/instance/sourceCodeStringOf..st @@ -2,4 +2,4 @@ meta-object-protocol sourceCodeStringOf: aCompiledMethod "Return a String with the source code for a compiled method." - self subclassResponsibility \ No newline at end of file + self subclassResponsibility \ No newline at end of file diff --git a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testSourceCodeStringOf.st b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testSourceCodeStringOf.st index c01f5682..64a5c334 100644 --- a/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testSourceCodeStringOf.st +++ b/repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testSourceCodeStringOf.st @@ -2,11 +2,10 @@ tests-mop testSourceCodeStringOf | sourceCodeString | - sourceCodeString := GRPlatform current sourceCodeStringOf: - GRPlatform >> #sourceCodeStringOf:. + sourceCodeString := GRPlatform current sourceCodeStringOf: GRPlatform >> #sourceCodeStringOf:. self assert: sourceCodeString equals: 'sourceCodeStringOf: aCompiledMethod "Return a String with the source code for a compiled method." - ^ self convertToSmalltalkNewlines: aCompiledMethod sourceCode' \ No newline at end of file + self subclassResponsibility' \ No newline at end of file From a1e497392b37ca19dbbdffe125b2931b09b88eec Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Wed, 23 Jul 2025 15:59:53 +0300 Subject: [PATCH 5/8] added Squeak and GemStone implementations --- .../GRGemStonePlatform.class/instance/sourceCodeStringOf..st | 5 +++++ .../GRSqueakPlatform.class/instance/sourceCodeStringOf..st | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/sourceCodeStringOf..st create mode 100644 repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/sourceCodeStringOf..st diff --git a/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/sourceCodeStringOf..st new file mode 100644 index 00000000..f4b000aa --- /dev/null +++ b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/sourceCodeStringOf..st @@ -0,0 +1,5 @@ +meta-object-protocol +sourceCodeStringOf: aCompiledMethod + "Return a String with the source code for a compiled method." + + ^ self convertToSmalltalkNewlines: aCompiledMethod source \ No newline at end of file diff --git a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/sourceCodeStringOf..st new file mode 100644 index 00000000..f4b000aa --- /dev/null +++ b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/sourceCodeStringOf..st @@ -0,0 +1,5 @@ +meta-object-protocol +sourceCodeStringOf: aCompiledMethod + "Return a String with the source code for a compiled method." + + ^ self convertToSmalltalkNewlines: aCompiledMethod source \ No newline at end of file From 874b2aa4e4ebe39b0593feb80fa03b1e479c4b3f Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Wed, 23 Jul 2025 16:05:38 +0300 Subject: [PATCH 6/8] correct Squeak version --- .../GRSqueakPlatform.class/instance/sourceCodeStringOf..st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/sourceCodeStringOf..st index f4b000aa..6131cf3d 100644 --- a/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/sourceCodeStringOf..st +++ b/repository/Grease-Squeak6-Core.package/GRSqueakPlatform.class/instance/sourceCodeStringOf..st @@ -2,4 +2,4 @@ meta-object-protocol sourceCodeStringOf: aCompiledMethod "Return a String with the source code for a compiled method." - ^ self convertToSmalltalkNewlines: aCompiledMethod source \ No newline at end of file + ^ self convertToSmalltalkNewlines: aCompiledMethod getSourceFromFile \ No newline at end of file From f5f3d5a68391cfa36a749fe3c35ea1e7a0de4dfa Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Wed, 23 Jul 2025 16:07:39 +0300 Subject: [PATCH 7/8] add to pharo 7-8-9 --- .../GRPharoPlatform.class/instance/sourceCodeStringOf..st | 5 +++++ .../GRPharoPlatform.class/instance/sourceCodeStringOf..st | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st create mode 100644 repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st diff --git a/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st new file mode 100644 index 00000000..3ed3d44c --- /dev/null +++ b/repository/Grease-Pharo70-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st @@ -0,0 +1,5 @@ +meta-object-protocol +sourceCodeStringOf: aCompiledMethod + "Return a String with the source code for a compiled method." + + ^ self convertToSmalltalkNewlines: aCompiledMethod sourceCode \ No newline at end of file diff --git a/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st new file mode 100644 index 00000000..3ed3d44c --- /dev/null +++ b/repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/sourceCodeStringOf..st @@ -0,0 +1,5 @@ +meta-object-protocol +sourceCodeStringOf: aCompiledMethod + "Return a String with the source code for a compiled method." + + ^ self convertToSmalltalkNewlines: aCompiledMethod sourceCode \ No newline at end of file From 25c35297aa3dbe67b5328fd7075e3503e14b9a11 Mon Sep 17 00:00:00 2001 From: Johan Brichau Date: Thu, 24 Jul 2025 16:08:18 +0300 Subject: [PATCH 8/8] fix --- .../GRGemStonePlatform.class/instance/sourceCodeStringOf..st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/sourceCodeStringOf..st b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/sourceCodeStringOf..st index f4b000aa..d34a7e25 100644 --- a/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/sourceCodeStringOf..st +++ b/repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/instance/sourceCodeStringOf..st @@ -2,4 +2,4 @@ meta-object-protocol sourceCodeStringOf: aCompiledMethod "Return a String with the source code for a compiled method." - ^ self convertToSmalltalkNewlines: aCompiledMethod source \ No newline at end of file + ^ self convertToSmalltalkNewlines: aCompiledMethod _sourceString \ No newline at end of file