#FEATURE by exept
class: Tools::NewSystemBrowser
added: #selectorMenuShowGeneratedSTCCode
class: Tools::NewSystemBrowser class
changed: #selectorMenuCompareGenerateDebugSlice
--- a/Tools__NewSystemBrowser.st Fri Aug 16 11:15:30 2019 +0200
+++ b/Tools__NewSystemBrowser.st Fri Aug 16 11:51:38 2019 +0200
@@ -11850,6 +11850,11 @@
itemValue: selectorMenuDecompile
)
(MenuItem
+ enabled: hasSingleMethodWithBytecodeSelectedHolder
+ label: 'Show C-code generated by stc'
+ itemValue: selectorMenuShowGeneratedSTCCode
+ )
+ (MenuItem
label: '-'
)
(MenuItem
@@ -51130,6 +51135,26 @@
^ self selectMethodsWhere:[:mthd | self shouldImplement ]
!
+selectorMenuShowGeneratedSTCCode
+ "compile the current method via the stc compiler,
+ and show the generated C-code"
+
+ |m cls sel cFile|
+
+ (m := self theSingleSelectedMethod) isNil ifTrue:[^ self].
+ cls := m mclass.
+ sel := m selector.
+
+ cFile := STCCompilerInterface new
+ parserFlags:(ParserFlags new);
+ compileToMachineCode:(self codeView contents)
+ forClass:cls selector:sel inCategory:m category
+ notifying:nil install:false skipIfSame:false silent:false
+ generateCOnly:true.
+
+ FileBrowser default openOn:cFile.
+!
+
selectorMenuSpawnExtensionsProject
"open a new browser showing the selected extension methods' project(s)"