MyScript.st 574 B

1234567891011121314151617181920212223
  1. Object subclass: #MyScript
  2. instanceVariableNames: ''
  3. category: 'MyScript'!
  4. !MyScript class methodsFor: 'main'!
  5. main
  6. | klass compiler method |
  7. Object subclass: #Dummy instanceVariableNames: '' category: 'Dummy'.
  8. klass := smalltalk at: #Dummy.
  9. compiler := Compiler new.
  10. method := compiler load: 'foo ^ 10' forClass: klass.
  11. method category: 'foo'.
  12. klass addCompiledMethod: method.
  13. method := compiler load: 'bar ^ self foo * 2' forClass: klass.
  14. method category: 'foo'.
  15. klass addCompiledMethod: method.
  16. console log: (Exporter new exportCategory: 'Dummy')
  17. ! !