#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Fri, 16 Aug 2019 11:51:38 +0200
changeset 18994 00a79ea6b31f
parent 18993 cb062ed8dff9
child 18995 0757b688a56f
#FEATURE by exept class: Tools::NewSystemBrowser added: #selectorMenuShowGeneratedSTCCode class: Tools::NewSystemBrowser class changed: #selectorMenuCompareGenerateDebugSlice
Tools__NewSystemBrowser.st
--- 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)"