Переглянути джерело

Merge remote-tracking branch 'upstream/master' into include-grunt-init

Herbert Vojčík 10 роки тому
батько
коміт
a7315050e0
100 змінених файлів з 99386 додано та 0 видалено
  1. 19 0
      .gitignore
  2. 6 0
      .travis.yml
  3. 249 0
      API-CHANGES.txt
  4. 327 0
      CHANGELOG
  5. 104 0
      CONTRIBUTING.md
  6. 90 0
      Gruntfile.js
  7. 22 0
      LICENSE
  8. 58 0
      README.md
  9. 18 0
      RELEASING.md
  10. 2 0
      bin/amberc
  11. 1 0
      bin/amberc.bat
  12. 34 0
      bin/release-worker.sh
  13. 9 0
      bin/release.sh
  14. 21 0
      bin/setversion.sh
  15. 22 0
      bower.json
  16. 546 0
      css/amber.css
  17. 134 0
      css/niflheim.css
  18. BIN
      favicon.ico
  19. 24 0
      grunt/tasks/grunt-peg.js
  20. BIN
      images/amber.png
  21. 706 0
      images/amber.svg
  22. BIN
      images/amber_small.png
  23. BIN
      images/off.amber.png
  24. BIN
      images/offHover.amber.png
  25. BIN
      images/sprite.amber.png
  26. BIN
      images/tinylogo.amber.png
  27. 24 0
      index.html
  28. 37 0
      package.json
  29. 297 0
      src/Benchfib.js
  30. 124 0
      src/Benchfib.st
  31. 2676 0
      src/Compiler-AST.js
  32. 842 0
      src/Compiler-AST.st
  33. 1148 0
      src/Compiler-Core.js
  34. 353 0
      src/Compiler-Core.st
  35. 220 0
      src/Compiler-Exceptions.js
  36. 109 0
      src/Compiler-Exceptions.st
  37. 4109 0
      src/Compiler-IR.js
  38. 1299 0
      src/Compiler-IR.st
  39. 1746 0
      src/Compiler-Inlining.js
  40. 636 0
      src/Compiler-Inlining.st
  41. 2738 0
      src/Compiler-Interpreter.js
  42. 975 0
      src/Compiler-Interpreter.st
  43. 1953 0
      src/Compiler-Semantic.js
  44. 625 0
      src/Compiler-Semantic.st
  45. 2003 0
      src/Compiler-Tests.js
  46. 781 0
      src/Compiler-Tests.st
  47. 118 0
      src/Examples.js
  48. 55 0
      src/Examples.st
  49. 655 0
      src/Helios-Announcements.js
  50. 326 0
      src/Helios-Announcements.st
  51. 4383 0
      src/Helios-Browser.js
  52. 1557 0
      src/Helios-Browser.st
  53. 799 0
      src/Helios-Commands-Browser.js
  54. 341 0
      src/Helios-Commands-Browser.st
  55. 1002 0
      src/Helios-Commands-Core.js
  56. 345 0
      src/Helios-Commands-Core.st
  57. 1965 0
      src/Helios-Commands-Tools.js
  58. 718 0
      src/Helios-Commands-Tools.st
  59. 6966 0
      src/Helios-Core.js
  60. 2336 0
      src/Helios-Core.st
  61. 1483 0
      src/Helios-Debugger.js
  62. 543 0
      src/Helios-Debugger.st
  63. 16 0
      src/Helios-Exceptions.js
  64. 21 0
      src/Helios-Exceptions.st
  65. 1221 0
      src/Helios-Helpers.js
  66. 497 0
      src/Helios-Helpers.st
  67. 1449 0
      src/Helios-Inspector.js
  68. 452 0
      src/Helios-Inspector.st
  69. 2280 0
      src/Helios-KeyBindings.js
  70. 737 0
      src/Helios-KeyBindings.st
  71. 603 0
      src/Helios-Layout.js
  72. 201 0
      src/Helios-Layout.st
  73. 1138 0
      src/Helios-References.js
  74. 388 0
      src/Helios-References.st
  75. 67 0
      src/Helios-SUnit.js
  76. 25 0
      src/Helios-SUnit.st
  77. 242 0
      src/Helios-Transcript.js
  78. 99 0
      src/Helios-Transcript.st
  79. 30 0
      src/Helios-Workspace-Tests.js
  80. 13 0
      src/Helios-Workspace-Tests.st
  81. 2372 0
      src/Helios-Workspace.js
  82. 863 0
      src/Helios-Workspace.st
  83. 3809 0
      src/IDE.js
  84. 2391 0
      src/IDE.st
  85. 890 0
      src/Kernel-Announcements.js
  86. 429 0
      src/Kernel-Announcements.st
  87. 2414 0
      src/Kernel-Classes.js
  88. 886 0
      src/Kernel-Classes.st
  89. 6867 0
      src/Kernel-Collections.js
  90. 2332 0
      src/Kernel-Collections.st
  91. 596 0
      src/Kernel-Exceptions.js
  92. 226 0
      src/Kernel-Exceptions.st
  93. 2544 0
      src/Kernel-ImportExport.js
  94. 948 0
      src/Kernel-ImportExport.st
  95. 3720 0
      src/Kernel-Infrastructure.js
  96. 1402 0
      src/Kernel-Infrastructure.st
  97. 2110 0
      src/Kernel-Methods.js
  98. 784 0
      src/Kernel-Methods.st
  99. 4242 0
      src/Kernel-Objects.js
  100. 1403 0
      src/Kernel-Objects.st

+ 19 - 0
.gitignore

@@ -0,0 +1,19 @@
+# Ignoring compiled files in examples etc
+server/FileServer*.js
+
+# Ignoring Mac Finder files
+.DS_Store
+
+# Ignoring test runner
+test/amber_test_runner.js
+test/run.js
+test_runner.js
+
+# In case amber is also saved in a local Subversion
+.svn
+
+# Ignoring local NPM modules
+/node_modules/*
+
+# Ignoring local bower modules
+/bower_components/*

+ 6 - 0
.travis.yml

@@ -0,0 +1,6 @@
+language: node_js
+node_js:
+  - "0.8"
+  - "0.10"
+before_script:
+  - npm install -g grunt-cli

+ 249 - 0
API-CHANGES.txt

@@ -0,0 +1,249 @@
+0.12.4:
+
+* Package Canvas renamed to Web
+
+* Object >> try:catch: deprecated in favour of BlockClosure >> tryCatch:
+
++ Announcer >>
+  + on:do:for:
++ Node >>
+  + navigationNodeAt:ifAbsent:
++ BlockClosure >>
+  + tryCatch:
++ Environment >>
+  + evaluate:for:
++ AmberCli >>
+  + version:
++ Object >>
+  + deprecatedAPI:
+- Environment >>
+  - eval:on:
+  - evaluateString:on:
+
+
+0.12.3:
+
+* Package Import-Export renamed to Kernel-ImportExport
+* A dozen of methods moved from Object to ProtoObject
+
+* HashedCollection >> at:ifAbsentPut: pushed up to SequenceableCollection
+* HashedCollection >> , is now allowed (removed shouldNotImplement)
+* HashedCollection and Dictionary both subclasses of AssociativeCollection
+* Smalltalk class moved to SmalltalkImage class, Smalltalk is now global var
+* Smalltalk current deprecated in favour of Smalltalk
+* Smalltalk at:[put:] deprecated in favour of Smalltalk globals at:[put:]
+* <smalltalk.ClassName> deprecated in favour of <globals.ClassName>
+
++ CompiledMethod >>
+  + defaultProtocol
++ Behavior >>
+  + compile:protocol:
+  + removeProtocolIfEmpty:
++ Package >>
+  + load
+  + loadFromNamespace:
++ Package class >>
+  + load:
+  + load:fromNamespace:
++ PackageTransport >> load
++ PackageHandler >> load:
++ AmdPackageHandler >> load:
++ Set >> removeAll
++ AssociativeCollection class
++ BucketStore class
++ SmalltalkImage >>
+  + globals
+  + vm
+  + settings
++ Setting class
++ String >>
+  + asSetting
+  + asSettingIfAbsent:
+  + settingValue
+  + settingValueIfAbsent:
+  + settingValue:
++ Smalltalk global variable
+
+- CompiledMethod >>
+  - category: (use #protocol:)
+  - defaultCategory
+- Behavior >> compile:category:
+- HTMLCanvas class >>
+  - browserVersion
+  - isMSIE
+  - isMozilla
+  - isOpera
+  - isWebkit
+
+
+0.12.2:
+
+* Collection >> contains: is deprecated in favor of anySatisfy:
+
+
++ Announcer >> on:doOnce:
++ String >>
+  + uriEncoded
+  + uriDecoded
+  + uriComponentEncoded
+  + uriComponentDecoded
++ Collection >>
+  + removeAll
+  + ifEmpty:ifNotEmpty:
+  + ifNotEmpty:ifEmpty:
+  + anyOne
+  + noneSatisfy:
+  + anySatisfy:
+  + allSatisfy:
+
+
+0.12.0:
+
+* SmalltalkMethodContext.prototype.fillBlock() takes a third 'index' parameter
+* Existing classes moved to new KernelInfrastructure package
+* ImporterExporter
+  * are now StreamExporters
+  * aware of AMD namespaces
+  * support transport types and commit channels
+
+
++ Node >>
+  + nextChild
+  + method
+  + postCopy
+  + isCascadeNode
+  + isLastChild
++ BlockNode >>
+  + nextNode:
+  + nextChild
++ SendNode >>
+  + isCascadeSendNode
+  + shouldBeAliased
++ CompiledMethod >> sendTo:arguments:
++ Array >>
+  + addFirst:
+  + removeLast
++ Number >>
+  + ceiling
+  + floor
+  + asNumber
+  + //
+  + cos
+  + sin
+  + tan
+  + arcCos
+  + arcSin
+  + arcTan
+  + log
+  + log:
+  + raisedTo:
+  + sign
+  + **
+  + ln
+  + e
++ String class >> esc
++ String >>
+  + asMutator
+  + capitalized
+  + isCapitalized
++ JSProxy >> printString
++ Behavior >>
+  + ownProtocols
+  + ownMethods
++ JSStream >> nextPutSendIndexFor:
++ InterfacingObject class
++ Interpreter class
++ DocumentFragmentTag class
++ AbstractExporter class
++ PlatformInterface class
+
+
+- Node >> extent
+- JSStream >> nextPutStatement:with:
+- Smalltalk.installSuperclass()
+- ClassReferenceNode class (now handled via VariableNode)
+
+
+0.11.0:
+
+* AnnouncementSubscription use #valuable: instead of #block: (deprecated)
+* AbstractCodeGenerator inherits from Object, not NodeVisitor
+* Object>>printString
+* replace >>printString with >>printOn:
+* replace >>storeString with >>printString
+* PackageLoader is now PackageHandler (>>commit: >>setupPackagenamed:prefix: >>ajaxPutAt:data:
+* Package>>fetch: is now Package>>load:
+* Package>>fetch:prefix: is now Package>>load:prefix:
+* Queue>>front replaced by Queue>>next
+* Queue>>frontIfAbsent: replaced by Queue>>nextIfAbsent:
+* Queue>>back: replaced by Queue>>nextPut:
+* smalltalk.addMethod() does not use explicit JS selector
+* JSObjectProxy>>canForwardMessage: replaced by use of JSObjectProxy>>lookupProperty: with asJavaScriptSelector
+* JSObjectProxy>>forwardMessage: replaced by explicit JSObjectProxy>>forwardMessage:withArguments:
+* String>>asJavaScriptSelector moved to Kernel-Objects package
+
++ Object>>asString
++ Object>>putOn:
++ String>>isVowel
++ Collection>>putOn:
++ CharacterArray>>putOn:
++ Stream>><<
++ Stream>>write
++ SequenceableCollection>>newStream
++ SequenceableCollection>>readStream
++ SequenceableCollection>>stream
++ SequenceableCollection>>streamClass
++ SequenceableCollection>>writeStream
++ Collection>>isImmutable
++ Stream>>nextPutString:
++ StringStream>>nextPutString:
++ JSStream>>nextPutClassRefFunction:
++ String>>crlfSanitized
++ inlined Block now also responds to >>value:
++ Parser: split literal into runtimeLiteral and parseTimeLiteral
++ Parser: write #(4 #(5 6 #()) 7) as #(4 (5 6 ()) 7)
++ Parser: write #(#on:do: #Object) as #(on:do: Object)
++ Parser: Symbols for binarie selectores
++ Package>>commit
++ AIContext>>initializeLocals
++ ASTInterpreter>>withBlockContext:
++ smalltalk.allSelectors()
++ Object>>isCompiledMethod
++ Object>>isPackage
++ Object>>isBehavior
++ ClassMoved Announcemen class
++ Behavior>>includesBehavior:
++ Environment>>classes
++ Environment>>allSelectors
++ Environment>>removeProtocol:
++ Environment>>renameProtocol:to:in:
++ CompiledMethod>>protocol:
++ Smalltalk>>globalJsVariables
++ Smalltalk>>addGlobalJsVariable:
++ Smalltalk>>deleteGlobalJsVariable:
+
+
+- Object>>storeOn:
+- Object>>log:block:
+- Object>>printNl
+- Compiler-IR.st >>javascriptSelector
+- Compiler-IR.st >>nextPutVar:
+- Kernel-Collections.st >>asSuperSelector
+- Collection>>readStream
+- Collection>>stream
+- Collection>>streamClass
+- Collection>>writeStream
+- Symbol class (replaced with String)
+- IRInlinedNonLocalReturn class
+- IRInlinedSend>>nonLocalReturnInliner
+- IRNonLocalReturnInliner class
+- Package>>dependencies
+- Package>>dependencies:
+- Package>>properties
+- Package>>jsProperties
+- Package>>jsProperties:
+- Package>>propertiesAsJSON
+- Package>>propertyAt:
+- Package>>propertyAt:ifAbsent:
+- Package>>propertyAt:put:
+- Browser>>ajaxPutAt:data:

+ 327 - 0
CHANGELOG

@@ -0,0 +1,327 @@
+XXnd XXX 2014 - Release 0.12.5
+===================================
+
+Highlights:
+
+* `amber` and `amberc` cli moved to dedicated repository.
+
+Commits: https://github.com/amber-smalltalk/amber/compare/0.12.4...0.12.5
+Issues:  https://github.com/amber-smalltalk/amber/issues?milestone=13&state=closed
+
+For the most important API related changes see the file API-CHANGES.txt.
+
+
+11th April 2014 - Release 0.12.4
+===================================
+
+Highlights:
+
+* Fixed backward compatibility for pre-0.12.3 loader syntax.
+* `namespace/_source` is not needed to map and is recommended
+  not to use; `.st` files are by default committed to the `.js` location.
+* All sources, including js files into the src/ directory
+* Many improvements in Helios, especially in its debugger and
+  inspector, as well as UI-related improvements
+* New Helios dark theme by @BenjaminVanRyseghem
+
+Commits: https://github.com/amber-smalltalk/amber/compare/0.12.3...0.12.4
+Issues:  https://github.com/amber-smalltalk/amber/issues?milestone=12&state=closed
+
+For the most important API related changes see the file API-CHANGES.txt.
+
+
+22nd Jan 2014 - Release 0.12.3
+===================================
+
+Highlights:
+
+* JQuery updated to ~1.10.2; jquery-ui updated to match
+* Subclasses of `nil` can be created
+* Several fixes for IE8
+* amber.js can be loaded asynchronously (it must
+  have an id 'amber-path-mapper' in that case)
+* CodeMirror updated to ~3.20.0
+
+Commits: https://github.com/amber-smalltalk/amber/compare/0.12.2...0.12.3
+Issues:  https://github.com/amber-smalltalk/amber/issues?milestone=11&state=closed
+
+For the most important API related changes see the file API-CHANGES.txt.
+
+
+03rd December 2013 - Release 0.12.2
+===================================
+
+Highlights:
+
+* Loading Amber in nested pages now possible (via additional `data-libs` attribute of the `<script>` tag which loads `amber.js`)
+* IDE related fixes
+* Contributions Guide
+* Improved Collections
+* Amber Server responds with `not found` instead of `internal server error` if `index.html` could not be found
+
+Commits: https://github.com/amber-smalltalk/amber/compare/0.12.1...0.12.2
+Issues:  https://github.com/amber-smalltalk/amber/issues?milestone=10&state=closed
+
+For the most important API related changes see the file API-CHANGES.txt.
+
+
+14th November 2013 - Release 0.12.1
+===================================
+
+Fixes a bug in Helios preventing class definitions from being compiled
+
+Commits: https://github.com/amber-smalltalk/amber/compare/0.12.0...0.12.1
+Issues:  https://github.com/amber-smalltalk/amber/issues?milestone=9&state=closed
+
+
+11th November 2013 - Release 0.12.0
+===================================
+
+After 3 months of work we are pleased to announce the 0.12.0 release of Amber.
+
+Besides the usual bug fixes a lot of new features have emerged.
+
+The biggest change is the switch to RequireJS to specify Amber package dependencies
+and for loading the packages as AMD modules.
+Amber is now additionally available as Bower [2] component.
+Bower is also used to manage required JavaScript libraries which don't have to be kept
+around in the repository anymore.
+
+The repository layout was restructured to provide a cleaner separation of different Amber parts:
+* Smalltalk code is located in 'st'
+* Compiled Amber packages are located in 'js'
+* Supporting JavaScript code is located in 'support'
+
+Together with the RequireJS changes the specifying their dependencies the Brickz [3]
+reconfigurable micro composition system was introduced.
+This is used for
+
+On the Smalltalk side support has been added for writing exponential numbers of the form 2e5.
+
+Helios (the new IDE) is progressing nicely and has seen a lot of improvements.
+One of the great parts is the new stepping debugger which is also making progress.
+To try Helios, open the helios.html page or
+evaluate in any other amber page `require('amber/helpers').popupHelios()`.
+
+The last enhancements target the commandline compiler which can be used as
+`amberc` (an executable script) or as a Grunt task.
+The following features have been added:
+ * generation of shebang line (#!/usr/bin/env node)
+ * specification of target namespace (`-n` flag; `amd_namespace` option in Grunt)
+ * specification of additional library directories (`-L` flag; `library_dirs` option in Grunt)
+The following features have been removed:
+ * creation of *.deploy.js files (`-d` flag; `deploy` option in Grunt)
+ * optimization passes via Closure compiler (`-o`/`-O` flags; `closure_jar` option in Grunt)
+   The same behavior can be achieved by using specific Grunt tasks
+
+Additionally, the Grunt task now handles the -v/--verbose flag which triggers the same behavior
+as the `verbose` option which can be specified in the Gruntfile.
+
+
+Some numbers about this release (starting from 0.11.0):
+
+* 660 commits
+* 10 committers
+* 66 unit tests added
+* 152 issues were closed
+* 379 unit tests in total
+
+
+Commits: https://github.com/amber-smalltalk/amber/compare/0.11.0...0.12.0
+Issues: https://github.com/amber-smalltalk/amber/issues?direction=desc&milestone=8&page=1&sort=updated&state=closed
+
+For the most important API related changes see the file API-CHANGES.txt.
+
+
+* Installing Amber from NPM
+
+To install Amber from NPM, run
+
+    npm install amber
+
+* Installing Amber from Bower
+
+To install Amber from Bower, run
+
+    bower install amber
+
+* Migration from Amber 0.11.0
+
+First, the loading of JavaScript files must be adapted. The custom loader has been replaced with
+requirejs for loading files in the browser. New loader code is thouroughly
+explained in [4].
+
+After updating the loader part, `.st` files need to be recompiled
+into new AMD `.js` files. During loader changes, a namespace was choosen and will be needed for recompilation.
+
+Go to your directory with `.st` files and issue this from the shell:
+
+```sh
+<path-to-amber>/bin/amberc -l SUnit,Canvas -n <chosen-namespace> -D <path-for-compiled-js-files> *.st
+```
+
+In windows, use `\` as path separator, the rest is identical.
+
+The `-l SUnit,Canvas` is just a general guess, if your code depends on more (or less) non-kernel packages from amber, list them here accordingly.
+
+This migrate scenario only covers simple deployments with your project's code and amber.
+If your project is more complicated, using libraries and packages from multiple sources,
+it is hard to give general advices to migrate - you must do it library by library,
+giving each location its own namespace, and `-L` option of `amberc`
+comes handy when integrating; ask on the mailing list if problems arise.
+
+[1] http://requirejs.org/
+[2] http://bower.io/
+[3] https://github.com/amber-smalltalk/brikz
+[4] https://github.com/amber-smalltalk/amber/wiki/How-to-load-amber
+
+
+09th July 2013 - Release 0.11.0
+===============================
+
+Three months have passed and we are happy to announce the release
+of Amber 0.11.0!
+
+Some numbers about this release:
+
+* 494 commits
+* 13 committers
+* increasing the number of core committers to 25
+* 50 unit tests added to the kernel
+* 313 unit tests in total
+
+Since the last release 60 issues were closed, bringing us to 499
+issues closed.
+
+This release includes a lot of bug fixes, improvements to the
+CLI, as well as a preview of the next IDE, named Helios. Amber
+now also uses a CI server [1].
+
+To try the Helios, the new IDE, open the helios.html page, or
+evaluate in any other amber page `amber.loadHelios()`.
+
+The compiler also received some improvements, especially
+regarding message send optimisations and super sends.
+
+Here's the list of commits and closed issues:
+https://github.com/amber-smalltalk/amber/compare/0.10.0...0.11.0
+https://github.com/amber-smalltalk/amber/issues?direction=desc&milestone=6&page=1&sort=updated&state=closed
+
+There is a lot more to come with Helios, a stepping debugger
+based on the AST is in progress and currently in the 'debugger'
+branch on GitHub.
+
+* Installing Amber from NPM
+
+To install amber from NPM, run
+
+    npm install amber
+
+
+* Migration from Amber 0.10.0
+
+Amber compiled code should be compatible with Amber 0.10.0, but
+recompiling is needed in order to get contexts working:
+
+    Compiler new recompile: (Package named: 'MyPackage') classes.
+    (Package named: 'MyPackage') commit
+
+For API related changes see the file API-CHANGES.txt.
+
+
+13th March 2013 - Release 0.10.0
+================================
+
+Here's a summary of change since the 0.9.1 release:
+
+- Travis CI jobs
+- Almost 300 issues closed
+- 150 new unit tests written
+- All classes in the Kernel are documented
+
+- New and much improved compiler toolchain, providing:
+  - Semantic analysis
+  - AST Node annotation
+  - Intermediate representation (easier to optimize)
+  - Better inlining
+  - an AST interpreter
+  - support for blocks contexts
+
+- New build system based on grunt.js, replacing the old makefiles
+- New bin/amberc compiler written in Amber/Node.js
+- SUnit improvements and cleanup, with support for async assertions
+- Improved ClassBuilder with better class migration support
+- Improved loader for third party packages
+- New: Announcements
+- Classes can be augmented by light-weight methods created from blocks
+- Snippets of HTML can be marked to become virtual tags in HTMLCanvas
+- Amber server supports Basic HTTP authentication (not recommended for production environments/unencrypted connections)
+- New IDE on it's way for Amber 1.0
+
+
+
+16th January 2012 - Release 0.9.1
+=================================
+
+Here's a summary of changes since the 0.9 release:
+
+- 80 new unit tests written
+- 52 issues fixed
+- All classes in Kernel-Objects, Kernel-Classes and Kernel-Methods has been documented
+- New documentation framework (see http://amber-lang.net/documentation.html)
+- Better class organisations, "Kernel" package split into several packages
+- First class packages have replaced class categories
+- Internet Explorer 7+ compatibility
+- New Announcement framework ported from Pharo
+- New console-based REPL written in Amber using node.js
+- Symbol class implemented together with object identity and #==
+- New OrderedCollection and Set implementation
+- Dictionary can now have any kind of object as keys. String-key dictionary has been renamed HashedCollection
+- New TwitterWall example
+- Improved HTML Canvas, now compatible with IE7
+- Improved JSObjectProxy for seamless JavaScript objects access from Amber
+- No more jQuery binding. Amber is fully capable of sending messages to JavaScript objects
+
+13th September 2011 - Release 0.9
+=================================
+Amber has been evolving furiously since the presentation at ESUG 2011 in Edinburgh less than 3 weeks ago.
+
+This is a summary:
+
+Language, compiler and runtime
+
+- New 100x faster parser built using PEGjs instead of the old parser built using PetitParser.
+- New much faster ChunkParser implementation in handwritten Amber instead of using PetitParser.
+- Improved parsing error report with quoted source code plus marker pinpointing parsing error.
+- Removed PetitParser since it is no longer needed by Amber itself.
+- Added compiler optimizations in the form of speculative inlining of specific messages and control structures.
+- Added support for dynamic Arrays, just like in Squeak/Pharo.
+- Added support for similar dynamic Dictionaries, not seen in other Smalltalks.
+- Added & and | as allowed binary selectors and implemented them in Boolean.
+- Added a Set implementation.
+- Added first basic support for real Packages with dependency information.
+
+...and various extensions, enhancements and bug fixes to the library classes.
+
+
+Development environment
+
+- A working Debugger with integrated inspector, proceed etc.
+- A new structure with
+- A working amberc command line compiler including a Makefile for recompiling the whole Amber.
+- Enabled TestRunner in the IDE for running unit tests based on SUnit.
+- Added "File in" button in Workspace to easily paste and filein source code in chunk format in the IDE.
+
+
+Example code and ports
+
+- Ported ProfStef interactive tutorial, available on Amber homepage but also in examples directory.
+- Included the ESUG presentation as an example also in the examples directory.
+- Several new examples running on Node.js and webOS included, all with Makefiles.
+
+
+Various other things
+
+- Issue tracker on github now used as primary source, closed a bunch of reported issues.
+- Wiki pages on github with information on how to port code from other Smalltalks, lists of articles, tutorials, roadmap and more.
+

+ 104 - 0
CONTRIBUTING.md

@@ -0,0 +1,104 @@
+Start Contributing by talking about Amber
+=========================================
+
+* Join our [Mailinglist/Google Group](http://groups.google.com/group/amber-lang)
+* Talk to us on [the #amber-lang IRC channel](irc://irc.freenode.net/amber-lang)
+* Follow [@AmberSmalltalk](https://twitter.com/AmberSmalltalk) on Twitter
+* Circle Amber Smalltalk on [Google+](https://plus.google.com/u/0/107038882958653788078) 
+
+
+Filing Issues
+=============
+
+If you think Amber is not working as expected, You can start by asking on IRC or the Mailinglist.
+Please make sure that you have first checked the following guides:
+
+* [Getting Started](https://github.com/amber-smalltalk/amber/wiki/Getting-started)
+* [Writing My First App](https://github.com/amber-smalltalk/amber/wiki/Writing-my-first-app)
+* [How To Load Amber](https://github.com/amber-smalltalk/amber/wiki/How-to-load-amber)
+* [Amber FAQ](https://github.com/amber-smalltalk/amber/wiki/FAQ)
+
+If the issue can not be resolved you should file an issue on the respective tracker.
+
+Before reporting an issue, try to reduce the issue to the bare minimum required to reproduce it.
+This allows us to track down and fix the issue in an easier and faster way.
+
+Additionally, you should give us enough information to reproduce the issue.
+Therefore, include versions of your OS, Amber, Node.js, Grunt, and possibly used libraries as well as sample code.
+If you don't list the exact steps required to reproduce the issue we won't be able to fix it.
+
+Afterwards, report the issue on one of the following trackers:
+
+* [Amber Issues](https://github.com/amber-smalltalk/amber/issues)
+* [Amber Examples Issues](https://github.com/amber-smalltalk/amber-examples/issues)
+* [Amber Website Issues](https://github.com/amber-smalltalk/amber-website/issues)
+
+
+Developing Amber
+================
+
+If you want to get started developing Amber itself there are a few links to get you started
+
+* [The Roadmap](https://github.com/amber-smalltalk/amber/wiki/Roadmap) gives a rough idea about where Amber is heading towards
+* [The Contributions Page](https://github.com/amber-smalltalk/amber/wiki/Contributions) contains some ideas which we would love to integrate into Amber
+* [The Amber FAQ](https://github.com/amber-smalltalk/amber/wiki/FAQ) contains Answers to commonly arising questions
+* [The Amber CookBook](https://github.com/amber-smalltalk/amber/wiki/Amber-cookbook) contains recipies about working with Amber and its IDE
+* [The Amber Porting Guide](https://github.com/amber-smalltalk/amber/wiki/Porting-code-from-other-Smalltalk-dialects) contains information about porting code from other Smalltalk dialects
+* [The Amber JavaScript Guide](https://github.com/amber-smalltalk/amber/wiki/From-smalltalk-to-javascript-and-back) contains information about how Amber and JavaScript are mapped to each other
+
+If you want to get serious with Amber development you should read the [Coding Conventions](https://github.com/amber-smalltalk/amber/wiki/Coding-conventions)
+and check if you have all development dependencies installed (as indicated in [Getting Started](https://github.com/amber-smalltalk/amber/wiki/Getting-started)):
+
+* Git (to get a clone of the repository)
+* Node.js (to run the Amber development server)
+* NPM (to install required Node.js packages)
+* Bower (to install required client side libraries)
+* Grunt-Cli (to compile Amber on the commandline)
+
+ 
+Setup your Amber clone
+----------------------
+
+1. Create a fork of the repository on GitHub
+2. Clone the repository
+3. Run ```npm install``` to install dependencies listed in package.json (See [here](https://www.npmjs.org/doc/cli/npm-install.html for more info) for more info)
+4. Run ```bower install``` to install dependencies listed in bower.json (See [here](http://bower.io/) for more info)
+  - requires bower to be installed via ```npm install -g bower```
+5. Run ```${Amber_DIR}/bin/amber serve```
+
+Now you should be able to commit changes to your computer.
+
+
+Creating a Pull Request
+-----------------------
+
+The Amber development model currently revolves around Pull Requests which are created through GitHub
+
+1. Update to latest Amber master (```git pull```)
+2. Develop your feature or bugfix in a local branch (not in ```master```)
+3. Create unittest for your feature or bugfix (your feature/fix will be integrated a lot faster if unittests are present)
+4. Enhance/fix Amber
+5. Run the unittests
+6. Commit your changes to disk if all tests are green
+7. Try to split your fix into small Git commits if multiple changes are involved (this makes it easier for us to review the changes)
+8. If you created / deleted / moved API, update API-CHANGES.txt appropriately and commit.
+8. Push the changes to your fork on GitHub ```git push <your repo> <your branchname>```
+9. Submit Pull Request (usually for the Amber master branch)
+
+
+Compiling Amber with Grunt
+--------------------------
+
+Amber uses [Grunt.js](http://gruntjs.com/) as build system since version `0.10.0`.
+
+To install Grunt.js v0.4.x on the commandline execute the following commands:
+
+    npm install -g grunt-cli
+
+Make sure that you have installed all required dependencies via `npm` and `bower`.
+Then you can finally compile Amber using the following command:
+
+    cd ${Amber_DIR}
+    grunt
+
+For Windows support check the [Grunt.js on Windows](http://gruntjs.com/frequently-asked-questions#does-grunt-work-on-windows) page.

+ 90 - 0
Gruntfile.js

@@ -0,0 +1,90 @@
+module.exports = function(grunt) {
+
+  grunt.loadTasks('./grunt/tasks');
+  grunt.loadNpmTasks('amber-dev');
+
+  grunt.loadNpmTasks('grunt-contrib-jshint');
+
+  grunt.registerTask('default', ['peg', 'amberc:all']);
+
+  grunt.initConfig({
+    pkg: grunt.file.readJSON('package.json'),
+
+    meta: {
+      banner: '/*!\n <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> \n License: <%= pkg.license.type %> \n*/\n'
+    },
+
+    peg: {
+      amber_parser: {
+        options: {
+          cache: true,
+          export_var: 'globals.SmalltalkParser'
+        },
+        src: 'support/parser.pegjs',
+        dest: 'support/parser.js',
+      }
+    },
+
+    amberc: {
+      options: {
+        amber_dir: process.cwd(),
+        closure_jar: ''
+      },
+      all: {
+        output_dir : 'src',
+        src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',
+              'src/Kernel-Infrastructure.st', 'src/Kernel-Exceptions.st', 'src/Kernel-Transcript.st', 'src/Kernel-Announcements.st',
+              'src/Kernel-ImportExport.st', 'src/Compiler-Exceptions.st', 'src/Compiler-Core.st', 'src/Compiler-AST.st',
+              'src/Compiler-IR.st', 'src/Compiler-Inlining.st', 'src/Compiler-Semantic.st', 'src/Compiler-Interpreter.st',
+              'src/Web.st', 'src/SUnit.st', 'src/IDE.st',
+              'src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st',
+              'src/Helios-Core.st', 'src/Helios-Exceptions.st', 'src/Helios-Announcements.st',
+              'src/Helios-KeyBindings.st', 'src/Helios-Layout.st',
+              'src/Helios-Commands-Core.st', 'src/Helios-Commands-Tools.st', 'src/Helios-Commands-Browser.st',
+              'src/Helios-References.st', 'src/Helios-Inspector.st', 'src/Helios-Browser.st',
+              'src/Helios-Transcript.st', 'src/Helios-Workspace.st', 'src/Helios-Debugger.st',
+              'src/Helios-Workspace-Tests.st',
+              'src/Benchfib.st', 'src/Examples.st', 'src/Spaces.st'
+              ],
+        jsGlobals: ['navigator']
+      },
+      amber_kernel: {
+        output_dir : 'src',
+        src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',
+              'src/Kernel-Infrastructure.st', 'src/Kernel-Exceptions.st', 'src/Kernel-Transcript.st', 'src/Kernel-Announcements.st']
+      },
+      amber_web: {
+        output_dir : 'src',
+        src: ['src/Web.st', 'src/SUnit.st']
+      },
+      amber_IDE: {
+        output_dir : 'src',
+        src: ['src/IDE.st'],
+        libraries: ['Web']
+      },
+      amber_tests: {
+        output_dir : 'src',
+        src: ['src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st'],
+        libraries: ['SUnit']
+      },
+      test_runner: {
+        src: ['node_modules/amber-dev/lib/Test.st'],
+        libraries: [
+        'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
+        'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
+        'SUnit', 'Kernel-ImportExport',
+        'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'],
+        main_class: 'NodeTestRunner',
+        output_name: 'test_runner'
+      }
+    },
+
+    jshint: {
+      amber: ['src/*.js'],
+      server: ['server/*.js'],
+      repl: ['repl/*.js'],
+      tests: ['test/*.js'],
+      grunt: ['grunt.js', 'grunt/**/*.js']
+    }
+  });
+};

+ 22 - 0
LICENSE

@@ -0,0 +1,22 @@
+Copyright (C) 2011-2014 Nicolas Petton <petton.nicolas@gmail.com>
+Copyright (C) 2011-2014 Amber contributors https://github.com/NicolasPetton/amber/contributors
+
+Parts of Amber take ideas from Clamato (http://clamato.net), written by Avi Bryant.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

+ 58 - 0
README.md

@@ -0,0 +1,58 @@
+Amber [![Travis CI Status](https://secure.travis-ci.org/amber-smalltalk/amber.png)](https://travis-ci.org/#!/amber-smalltalk/amber)
+=====
+
+By Nicolas Petton <petton.nicolas@gmail.com> and [Amber contributors](https://github.com/amber-smalltalk/amber/contributors)
+
+Amber is an implementation of the Smalltalk language that runs on top of the JavaScript runtime. It is designed to make client-side development faster and easier.
+
+Overview
+--------
+
+Amber is written in itself, including the parser and compiler. Amber compiles into efficient JavaScript, mapping one-to-one with the equivalent JavaScript. There is no interpretation at runtime.
+
+Some highlights:
+
+-    Amber features an IDE with a Class browser, Workspace, Transcript, a ReferencesBrowser supporting senders/implementors and class references, basic Inspector and even a beginning of a Debugger and a unit TestRunner.
+-    [Pharo Smalltalk](http://www.pharo-project.org) is considered as the reference implementation.
+-    Amber includes a canvas to generate HTML, like [Seaside](http://www.seaside.st)
+-    Amber can use Javascript libraries and the current IDE is built on [jQuery](http://www.jquery.com)
+-    You can inline Javascript code and there are many ways to interact between Amber and Javascript
+
+Getting Amber
+-------------
+
+Amber is shipped as a [npm](http://npmjs.org) package for its CLI tools and as a [bower](https://github.com/bower/bower) package for the client-side.
+
+    # Install the CLI tool `amber`
+    npm install -g amber
+    
+    # Initialize your project as bower package
+    cd /path/to/myproject
+    bower init
+
+    # Load amber via bower in your project
+    bower install amber --save
+    
+    # Serve amber on localhost:4000
+    amber serve
+
+The [Getting started](https://github.com/amber-smalltalk/amber/wiki/Getting-started) page shows more details on ways to obtain Amber and start a project.
+
+Building Amber
+--------------
+
+This step is only used by people developing Amber itself.
+Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) for further details.
+It explains the Amber development setup and how to contribute.
+
+
+License
+-------
+
+Amber is released under the MIT license. All contributions made for inclusion are considered to be under MIT.
+
+
+More infos
+----------
+
+More on the [project page](http://amber-lang.net)

+ 18 - 0
RELEASING.md

@@ -0,0 +1,18 @@
+Release Guide for Amber
+=======================
+
+The following steps are required to make a release of Amber:
+
+1. check that all tests are green
+2. check that the examples are up-to-date
+3. check that `API-CHANGES.txt` is up-to-date; remove the 'work in progress' from version
+4. check the `CHANGELOG` file and update the release notes, check the milestone index in issues link
+5. log in to npm with write access for the Amber package
+6. execute `cli/support/release.sh`
+7. answer the question about the version number used for the release
+8. answer the question about the version number for the upcoming release
+9. merge the created tag into the `stable` branch
+10. update the homepage to point to the latest tag on GitHub
+11. send announcement to mailinglists (Amber, Pharo, what else?)
+12. send announcement on Twitter
+13. send announcement on G+

+ 2 - 0
bin/amberc

@@ -0,0 +1,2 @@
+#!/bin/sh
+amberc -d `dirname $0`/.. $@

+ 1 - 0
bin/amberc.bat

@@ -0,0 +1 @@
+@amberc -d "%~dp0\.." %*

+ 34 - 0
bin/release-worker.sh

@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# ATTENTION: Be logged into npm before running this script,
+# as a user with write access to amber npm package.
+
+git reset --hard
+git checkout master
+git clean -d -x -f
+npm install
+echo -n "Which version are you going to publish [0 to skip]? "
+VER=`head -n 1`
+if [ "$VER" = "0" ]; then :; else
+	echo "Publishing version $VER"
+	bin/setversion.sh "$VER"
+	cp package.json package.json.bak
+	sed -e 's@/amber.git.*"@/amber.git#'"$VER"'"@' package.json.bak >package.json
+	rm package.json.bak
+	git add package.json
+	git commit -a -m "Release version $VER"
+	git tag -a "$VER" -m "Release version $VER"
+# bower does not publish explicitly but implictly via semver tag
+	echo npm publish
+fi
+echo -n "Which version are you going to work on? "
+VERF=`head -n 1`
+VER="${VERF}-pre"
+echo "Setting version $VER"
+bin/setversion.sh "$VER"
+cp package.json package.json.bak
+sed -e 's@/amber.git.*"@/amber.git"@' package.json.bak >package.json
+rm package.json.bak
+git add package.json
+git commit -a -m "Working on $VERF"
+git push --tags

+ 9 - 0
bin/release.sh

@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# ATTENTION: Be logged into npm before running this script,
+# as a user with write access to amber npm package.
+
+cd `dirname "$0"`
+cp release-worker.sh /tmp
+cd ..
+exec sh /tmp/release-worker.sh

+ 21 - 0
bin/setversion.sh

@@ -0,0 +1,21 @@
+#!/bin/sh
+
+VERSION=$1
+cd `dirname "$0"`/..
+AMBER_BASE=`pwd`
+
+cd $AMBER_BASE/src
+# replace version number
+cp Kernel-Infrastructure.st Kernel-Infrastructure.st.bak
+sed -e "/^version\$/,/^\! \!\$/ s/\^ '[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\(-pre\)\{0,1\}'\$/^ '$VERSION'/" Kernel-Infrastructure.st.bak >Kernel-Infrastructure.st
+rm Kernel-Infrastructure.st.bak
+
+# compile Kernel-Infrastructure
+cd $AMBER_BASE
+bin/amberc -D src -l Kernel-Objects,Kernel-Collections src/Kernel-Infrastructure.st
+# set version in all json files (bower, npm)
+for F in *.json; do
+  cp $F $F.bak
+  sed -e 's/"version": "[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\(-pre\)\{0,1\}"/"version": "'"$VERSION"'"/' $F.bak >$F
+  rm $F.bak
+done

+ 22 - 0
bower.json

@@ -0,0 +1,22 @@
+{
+  "name": "amber",
+  "version": "0.13.0-pre",
+  "main": "support/amber.js",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "test",
+    "tests"
+  ],
+  "dependencies": {
+    "jquery": "~1.10.2",
+    "jquery-ui": "~1.10.3",
+    "bootstrap": "http://getbootstrap.com/2.3.2/assets/bootstrap.zip",
+    "jquery-tabby": "git://github.com/alanhogan/Tabby",
+    "es5-shim": "~2.1.0",
+    "codemirror": "~3.20.0",
+    "showdown": "~0.3.1",
+    "require-css": "~0.0.8"
+  }
+}

+ 546 - 0
css/amber.css

@@ -0,0 +1,546 @@
+body.amberBody {
+    margin-bottom: 350px;
+}
+
+#amberTabs, #amber .amber_tabs {
+    margin: 0;
+    padding: 0;
+    background: url("../images/sprite.amber.png") #DBD9C9 0 -27px;
+    height: 22px;
+    width: 100%;
+    list-style: none;
+    font-weight: bold;
+}
+
+#amberTabs li, #amber .amber_tabs li {
+    padding: 0 1px;
+    cursor: pointer;
+    color: #565656;
+	max-width: 200px;
+	float:left;
+}
+#amber li {
+	line-height: 14px;
+
+}
+#amber .ltab, #amber .rtab, #amber .mtab {
+    height: 22px;
+    float: left;
+}
+
+#amber .ltab, #amber .rtab {
+    width: 8px;
+}
+
+#amber .rtab {
+    margin-right: 1px;
+}
+
+#amber .mtab {
+    line-height: 20px;
+}
+
+#amberTabs li:hover .ltab,
+#amber .amber_tabs li:hover .ltab {
+    background: url("../images/sprite.amber.png") -16px -96px;
+}
+
+#amberTabs li:hover .mtab,
+#amber .amber_tabs li:hover .mtab {
+    background: url("../images/sprite.amber.png") 0 -73px;
+}
+
+#amberTabs li:hover .rtab,
+#amber .amber_tabs li:hover .rtab {
+    background: url("../images/sprite.amber.png") -24px -96px;
+}
+
+#amberTabs li.selected,
+#amber .amber_tabs li.selected {
+    color: #111;
+}
+
+#amberTabs li.selected .ltab,
+#amber .amber_tabs li.selected .ltab {
+    background: url("../images/sprite.amber.png") 0px -96px;
+}
+
+#amberTabs li.selected .mtab,
+#amber .amber_tabs li.selected .mtab {
+    background: url("../images/sprite.amber.png") 0 -50px;
+}
+
+#amberTabs li.selected .rtab,
+#amber .amber_tabs li.selected .rtab {
+    background: url("../images/sprite.amber.png") -8px -96px;
+}
+
+#amberTabs li .close {
+    margin-right: 5px;
+    color: #aaa;
+}
+
+#amber {
+       position: fixed;
+       bottom: 0;
+       left: 0;
+       right: 0;
+       height: 350px;
+       z-index: 1000;
+}
+
+#amber, #amber button, #amber input, #amber select {
+       font-family: Lucida Grande, Tahoma, sans-serif;
+       font-size: 11px;
+}
+
+#amber #logo {
+    position: absolute;
+    top: 3px;
+    left: 8px;
+    width: 22px;
+    height: 20px;
+    background: url("../images/tinylogo.amber.png") top left no-repeat;
+}
+
+#amber #amber_toolbar {
+    height: 27px;
+    background: url("../images/sprite.amber.png") 0 0;
+}
+
+#amber #amber_toolbar input {
+    margin-left: 50px;
+    width: 250px;
+    margin-top: 5px;
+}
+
+#amber #amber_toolbar #amber_close {
+    position: absolute;
+    right: 4px;
+    top: 6px;
+    width: 16px;
+    height: 16px;
+    background: url('../images/off.amber.png');
+    cursor: pointer;
+}
+
+#amber #amber_toolbar #amber_close:hover {
+    background: url('../images/offHover.amber.png');
+}
+
+
+#amber .ui-resizable-handle {
+    background-color: transparent;
+    top: 0;
+    cursor: row-resize;
+    height: 5px;
+    left: 0;
+    position: absolute;
+    right: 0;
+    width: auto !important;
+}
+
+.amberTool {
+    width: 100%;
+    color: #333;
+    line-height: 1.3em;
+    padding: 0;
+    margin: 0;
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    top: 49px;
+    z-index: 1000;
+    background: white;
+}
+
+.amberTool .amber_box {
+    width: 100%;
+    margin: 0;
+    position: absolute;
+    top: 0;
+    bottom: 27px;
+}
+
+.amberTool .amber_buttons {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    height: 27px;
+    line-height: 27px;
+    background: url("../images/sprite.amber.png") 0 0 repeat;
+}
+
+.amberTool .amber_buttons .right {
+    float: right;
+}
+
+.amberTool .important {
+    font-weight: bold;
+}
+
+
+.amberTool button {
+    border: 1px solid transparent;
+    background: transparent;
+    padding: 2px 4px;
+    margin-left: 4px;
+    cursor: pointer;
+}
+
+.amberTool button:hover {
+    border-top: 1px solid #fff;
+    border-left: 1px solid #fff;
+    border-right: 1px solid #bbb;
+    border-bottom: 1px solid #bbb;
+}
+
+.amberTool  button:active {
+    border-top: 1px solid #bbb;
+    border-left: 1px solid #bbb;
+    border-right: 1px solid #fff;
+    border-bottom: 1px solid #fff;
+    background: #ddd;
+}
+
+.amberTool select, #amber input {
+    border-top: 1px solid #bbb;
+    border-left: 1px solid #bbb;
+    border-right: 1px solid #fff;
+    border-bottom: 1px solid #fff;
+    background: #fff;
+    display: inline;
+    margin-top: 0;
+    margin-bottom: 0;
+    padding-top: 0;
+    padding-bottom: 0;
+    height: 14px;
+    line-height: normal;
+    box-shadow: none;
+    outline: none;
+    vertical-align:baseline;
+}
+.amberTool select {
+    height:18px;
+    width: auto;
+}
+
+
+
+
+.amberTool li {
+    margin: 0;
+    padding: 0;
+}
+    
+.amberTool .source {
+    height: 100%;
+}
+
+.amberTool textarea,
+.amberTool input {
+    border: 0 none;
+    font-family:  "DejaVu Sans", Helvetica, sans-serif;
+    line-height: 1.3em;
+    font-size: 11px;
+    position: relative;
+    padding: 0;
+}
+
+.amberTool .CodeMirror {
+    border: 0 none;
+    font-family:  "DejaVu Sans", Helvetica, sans-serif;
+    font-size: 11px;
+    line-height: 1.3em;
+    height: 100%;
+    background: white;
+}
+
+.amberTool .CodeMirror-scroll {
+    height: 100%;
+}
+
+.amberTool .CodeMirror-scroll pre {
+    font-family: "DejaVu Sans", Helvetica, sans-serif;
+}
+
+.amberTool .amber_clear {
+    clear: both;
+}
+
+.amberTool .amber_transcript,
+.amberTool .amber_workspace {
+    width: 100%;
+    height: 100%;
+}
+
+.amberTool .amber_packagesButtons {
+    position: absolute;
+    top: 149px;
+    left: 0;
+    z-index: 1;
+}
+
+.amberTool .amber_column {
+    width: 25%;
+    padding: 0;
+    margin: 0;
+    float: left;
+    outline: 1px solid #aaa;
+    border: 0 none;
+    height: 150px;
+    overflow-y: auto;
+    background: #fff;
+    color: #111;
+    position: absolute;
+    top: 0;
+}
+
+.amberTool .amber_column.classes {
+    left: 25%
+}
+
+.amberTool .amber_column.classes ul {
+    margin-left: 0;
+}
+
+.amberTool .amber_column.classes ul li {
+    padding-left: 10px;
+    margin-left: 0;
+}
+
+.amberTool .amber_column.protocols {
+    left: 50%
+}
+
+.amberTool .amber_column.methods {
+    left: 75%
+}
+
+.amberTool .amber_column li {
+    list-style-type: none;
+    padding-left: 5px;
+    cursor: pointer;
+    color: #111;
+    font-weight: bold;
+}
+
+.amberTool .amber_column li.selected {
+	background: #c5c5c5;
+	color: #222;
+}
+
+.amberTool .amber_column li:hover {
+    background: #08c;
+    color: white;
+}
+
+#amber .amberTool .amber_tabs {
+    top: 150px;
+    position: absolute;
+}
+
+#amber .amberTool .amber_tabs.amber_browser {
+    padding-left: 25%;
+}
+
+.amberTool .amber_sourceCode {
+    position: absolute;
+    top: 172px;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.amberTool .amber_sourceCode textarea.source {
+    width: 100%;
+    height: 100%;
+}
+
+/* Debugger & inspector */
+
+.amberTool .amber_box .label {
+	width: 100%;
+	font-weight: bold;
+	text-align: center;
+	position: absolute;
+	line-height: 1.5em;
+	font-size: 16px;
+	color: red;
+	background: url("../images/sprite.amber.png") top left repeat;
+	height: 27px;
+}
+
+.amberTool .amber_box .amber_column.debugger {
+    top: 178px;
+}
+
+.amberTool .amber_box .amber_column.debugger.contexts {
+    top: 27px;
+    width: 100%;
+}
+
+.amberTool .amber_sourceCode.debugger {
+    width: 60%;
+    top: 178px;
+}
+
+.amberTool .amber_box .amber_column.debugger.variables {
+    width: 10%;
+    left: 60%;
+    bottom: 0;
+    position: absolute;
+    height: auto;
+}
+
+.amberTool .amber_box .amber_column.debugger.inspector {
+    width: 30%;
+    left: 70%;
+    bottom: 0;
+    position: absolute;
+    height: auto;
+}
+
+.amberTool .amber_button.debugger.inspect {
+    position: absolute;
+    left: 60%;
+}
+
+.amberTool .amber_column.value {
+    left: 25%;
+    width: 75%;
+}
+
+.amberTool .amber_buttons.inspector {
+    position: absolute;
+    top: 150px;
+}
+
+
+/* ReferencesBrowser */
+
+.amberTool .amber_box .implementors {
+	width: 100%
+}
+
+.amberTool .amber_box .amber_column.implementors,
+.amberTool .amber_box .amber_column.senders,
+.amberTool .amber_box .amber_column.referenced_classes,
+.amberTool .amber_box .amber_column.matches {
+	top: 20px;
+	height: auto;
+	bottom: 0;
+	width: 25%;
+}
+
+.amberTool .amber_box .amber_column.senders {
+	left: 25%
+}
+
+.amberTool .amber_box .amber_column.referenced_classes {
+        left: 50%
+}
+
+.amberTool .amber_box .amber_column.matches {
+        left: 75%
+}
+
+.amberTool .amber_box .amber_column.implementors .column_label, 
+.amberTool .amber_box .amber_column.senders .column_label,
+.amberTool .amber_box .amber_column.referenced_classes .column_label,
+.amberTool .amber_box .amber_column.matches .column_label {
+	background: #dbdbdb
+}
+
+.amberTool .amber_box .amber_column.implementors .column_label:hover,
+.amberTool .amber_box .amber_column.senders .column_label:hover,
+.amberTool .amber_box .amber_column.referenced_classes .column_label:hover,
+.amberTool .amber_box .amber_column.matches .column_label:hover {
+	font-weight: bold;
+	color: #000;
+	cursor: default
+}
+
+
+.amberTool .classes .commented {
+		color: #33337F;
+}
+
+
+/* SUnit TestRunner  */
+
+.amberTool .amber_column.sunit.packages,
+.amberTool .amber_column.sunit.classes {
+	height: 100%
+}
+
+.amberTool .amber_column.sunit.classes li.all,
+.amberTool .amber_column.sunit.categories li.all {
+	background: #e3e3e3;
+	font-weight: bold
+}
+
+.amberTool .amber_column.sunit.classes li.all:hover ,
+.amberTool .amber_column.sunit.categories li.all:hover {
+	background: #0088CC;
+	font-weight: bold
+}
+
+.amberTool .sunit.status {
+	position: absolute;
+	left: 50%;
+	width: 50%;
+	outline: 1px solid #aaa;
+	background: white;
+	height: 40px
+}
+
+
+.amberTool .sunit.status.success {
+	background: #43d443;
+}
+
+
+.amberTool .sunit.status.failure {
+	background: #ecd443;
+}
+
+
+.amberTool .sunit.status.error {
+	background: #e56f3b;
+}
+
+.amberTool .progress_bar {
+	position: absolute;
+	left: 50%;
+	width: 50%;
+	top: 40px;
+	background: white;
+	outline: 1px solid #aaa;
+	min-height: 20px
+}
+
+.amberTool .progress_bar div {
+	background: #0088CC;
+	min-height: 20px;
+}
+
+.amberTool .amber_column.results.sunit {
+	left: 50%;
+	height: auto;
+        width: 50%;
+        top: 62px;
+        bottom: 0;
+}
+
+.amberTool .amber_column.sunit.results .errors {
+    color: red;
+}
+
+/*.amberTool .amber_column.sunit.results ul {padding: 0; margin: 0}*/
+
+/* Code mirror overrides */
+.CodeMirror pre {
+	line-height: 14px;
+}

+ 134 - 0
css/niflheim.css

@@ -0,0 +1,134 @@
+.cm-s-niflheim.CodeMirror {
+	background-color: #444;
+    color:#b8c4cf;
+    padding-left: 8px;
+}
+.cm-s-niflheim .CodeMirror-sizer{
+	padding-bottom: 0px;
+}
+
+.cm-s-niflheim .CodeMirror-scroll{
+	margin-right: 0px;
+	border-color: #202020;
+  padding-bottom: 0px;
+}
+.cm-s-niflheim .CodeMirror-vscrollbar{
+	overflow-y: hidden;
+}
+/*
+.cm-s-niflheim ::-webkit-scrollbar {
+    width: 14px;
+    height: 14px;
+}
+*/
+/*
+.cm-s-niflheim ::-webkit-scrollbar-track {
+    background: transparent;
+}
+.cm-s-niflheim ::-webkit-scrollbar-thumb {
+    background: rgba(255,255,255,.2);
+    border-radius: 5px;
+}
+.cm-s-niflheim ::-webkit-scrollbar-thumb:hover{
+	background: rgba(255,255,255,.3);
+}
+.cm-s-niflheim ::-webkit-scrollbar-thumb:active{
+	background: rgba(255,255,255,.4);
+}
+*/
+
+.cm-s-niflheim.CodeMirror .inline-widget{
+	background: #272727;
+	color: #ccc;
+}
+.cm-s-niflheim.CodeMirror .inline-widget h1,
+.cm-s-niflheim.CodeMirror .inline-widget h2,
+.cm-s-niflheim.CodeMirror .inline-widget h3{
+	color: #ccc;
+}
+.cm-s-niflheim.CodeMirror .inline-widget p,
+.cm-s-niflheim.CodeMirror .inline-widget dt,
+.cm-s-niflheim.CodeMirror .inline-widget li,
+.cm-s-niflheim.CodeMirror .inline-widget code{
+	color: #fff;
+}
+.cm-s-niflheim.CodeMirror .CodeMirror-gutters {
+    border-style: none;
+    background: #202020;
+}
+.cm-s-niflheim.CodeMirror .CodeMirror-linenumbers {
+	background-color: #393939;
+    background-image: linear-gradient(to bottom, #393939 33%, #686868 67%);
+    background-position: right;
+    background-size: 1px 3px;
+    background-repeat: repeat-y;
+}
+.cm-s-niflheim.CodeMirror .CodeMirror-linenumber {
+	color: #80939b;
+	padding-left: 5px;
+}
+.cm-s-niflheim.CodeMirror .CodeMirror-activeline,
+.cm-s-niflheim.CodeMirror.CodeMirror-focused .CodeMirror-activeline .CodeMirror-gutter-elt{
+	background-color: #666;
+}
+.cm-s-niflheim.CodeMirror pre{
+	/*padding between line number & content*/
+	padding: 0 8px;
+}
+
+.cm-s-niflheim.CodeMirror .CodeMirror-cursor {
+	border-left: 2px solid #c7c7c7;
+}
+.cm-s-niflheim.CodeMirror .CodeMirror-selected {
+	background: rgba(255,255,255,.2);
+}
+
+.cm-s-niflheim.CodeMirror .CodeMirror-matchingbracket {
+	border-bottom: 1px solid #33ffff;
+    color: #ccc19b;
+}
+.cm-s-niflheim.CodeMirror .CodeMirror-unmatchingbracket {
+	border-bottom: 1px solid #cb3233;
+    color: #cb3233;
+}
+
+
+.cm-s-niflheim.CodeMirror .cm-comment {
+    color: #929283;
+}
+.cm-s-niflheim.CodeMirror .cm-property {
+    color: #cbaaf5;
+}
+.cm-s-niflheim.CodeMirror .cm-qualifier {
+    color: #aaeeab;
+}
+.cm-s-niflheim.CodeMirror .cm-tag {
+    color: #7ac1ff;
+}
+.cm-s-niflheim.CodeMirror .cm-def {
+    color: #b8c4cf;
+}
+.cm-s-niflheim.CodeMirror .cm-number {
+    color: #ccccab;
+}
+.cm-s-niflheim.CodeMirror .cm-atom {
+    color: #cc9dc7;
+}
+.cm-s-niflheim.CodeMirror .cm-keyword{
+    color: #ff6c6b;
+}
+.cm-s-niflheim.CodeMirror .cm-string{
+    color: #789771;
+}
+.cm-s-niflheim.CodeMirror .cm-string-2{
+    color: #7ad1dd;
+}
+.cm-s-niflheim.CodeMirror .cm-variable {
+    color: #ffcd8e;
+}
+.cm-s-niflheim.CodeMirror .cm-variable-2 {
+    color: #aaccff;
+}
+.cm-s-niflheim.CodeMirror .cm-attribute {
+    color: #83e1b2;
+}


+ 24 - 0
grunt/tasks/grunt-peg.js

@@ -0,0 +1,24 @@
+module.exports = function(grunt) {
+
+	var PEG = require('pegjs');
+
+	/**
+     Full config looks like this:
+     pegjs: {
+     my_parser: {
+     options: {                       // optional
+     cache: true,                   // default: false
+     export_var: 'smalltalk.parser' // default: module.exports
+     },
+   */
+  grunt.registerMultiTask('peg', 'Generate JavaScript parser from PEG.js grammar description', function() {
+    var options = this.options({
+      cache: false,
+      output: 'source',
+      export_var: 'module.exports'
+    });
+    var parser = PEG.buildParser(grunt.file.read(this.data.src), options);
+    var content = 'define("amber_vm/parser", ["./globals", "./nil"], function(globals, nil) {\n'+options.export_var + ' = ' + parser + ';\n});';
+    grunt.file.write(this.data.dest, content);
+  });
+};

BIN
images/amber.png


+ 706 - 0
images/amber.svg

@@ -0,0 +1,706 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   version="1.1"
+   width="570"
+   height="380"
+   id="svg3059"
+   style="display:inline">
+  <metadata
+     id="metadata3065">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs3063">
+    <linearGradient
+       id="linearGradient6277">
+      <stop
+         id="stop6279"
+         style="stop-color:#000000;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop6287"
+         style="stop-color:#1b1100;stop-opacity:0.88194442"
+         offset="0.5" />
+      <stop
+         id="stop6281"
+         style="stop-color:#362300;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3872">
+      <stop
+         id="stop3874"
+         style="stop-color:#ffc70d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3860">
+      <stop
+         id="stop3862"
+         style="stop-color:#8c2c1d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3864"
+         style="stop-color:#000000;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3848">
+      <stop
+         id="stop3850"
+         style="stop-color:#ffc20d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3852"
+         style="stop-color:#ff770d;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="356.73056"
+       y1="169.72968"
+       x2="207.50134"
+       y2="214.72968"
+       id="linearGradient3854"
+       xlink:href="#linearGradient3848"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.92652863,0.37622426,-0.37622426,0.92652863,96.00382,-90.834969)" />
+    <radialGradient
+       cx="274.61594"
+       cy="192.72968"
+       r="147.88539"
+       fx="274.61594"
+       fy="192.72968"
+       id="radialGradient3868"
+       xlink:href="#linearGradient3860"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.9661707,-1.0709423,0.87440388,1.6053409,-430.53163,175.75275)" />
+    <linearGradient
+       x1="283.29999"
+       y1="184.5"
+       x2="379.70001"
+       y2="184.5"
+       id="linearGradient3878"
+       xlink:href="#linearGradient3872"
+       gradientUnits="userSpaceOnUse" />
+    <filter
+       x="-0.18143237"
+       y="-0.12051347"
+       width="1.3628647"
+       height="1.2410269"
+       color-interpolation-filters="sRGB"
+       id="filter3892">
+      <feGaussianBlur
+         id="feGaussianBlur3894"
+         stdDeviation="6.8793103" />
+    </filter>
+    <linearGradient
+       x1="283.29999"
+       y1="184.5"
+       x2="379.70001"
+       y2="184.5"
+       id="linearGradient3878-2"
+       xlink:href="#linearGradient3872-7"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       id="linearGradient3872-7">
+      <stop
+         id="stop3874-5"
+         style="stop-color:#ffc70d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-1"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <filter
+       x="-0.18143237"
+       y="-0.12051347"
+       width="1.3628647"
+       height="1.2410269"
+       color-interpolation-filters="sRGB"
+       id="filter3892-9">
+      <feGaussianBlur
+         id="feGaussianBlur3894-0"
+         stdDeviation="6.8793103" />
+    </filter>
+    <linearGradient
+       x1="283.29999"
+       y1="184.5"
+       x2="379.70001"
+       y2="184.5"
+       id="linearGradient3913"
+       xlink:href="#linearGradient3872-7"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       x1="283.29999"
+       y1="184.5"
+       x2="379.70001"
+       y2="184.5"
+       id="linearGradient3913-2"
+       xlink:href="#linearGradient3872-7-1"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       id="linearGradient3872-7-1">
+      <stop
+         id="stop3874-5-2"
+         style="stop-color:#ffffff;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-1-5"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="356.73056"
+       y1="169.72968"
+       x2="207.50134"
+       y2="214.72968"
+       id="linearGradient3854-0"
+       xlink:href="#linearGradient3848-7"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       id="linearGradient3848-7">
+      <stop
+         id="stop3850-0"
+         style="stop-color:#ffc20d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3852-0"
+         style="stop-color:#ff770d;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <radialGradient
+       cx="274.61594"
+       cy="192.72968"
+       r="147.88539"
+       fx="274.61594"
+       fy="192.72968"
+       id="radialGradient3868-6"
+       xlink:href="#linearGradient3860-7"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.418799,-1.7319798,1.4141284,1.1584223,-387.5534,445.09657)" />
+    <linearGradient
+       id="linearGradient3860-7">
+      <stop
+         id="stop3862-8"
+         style="stop-color:#8c2c1d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3864-4"
+         style="stop-color:#000000;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="356.73056"
+       y1="169.72968"
+       x2="207.50134"
+       y2="214.72968"
+       id="linearGradient3995"
+       xlink:href="#linearGradient3848-7"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(0.384046,-0.72968)" />
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4034">
+      <feGaussianBlur
+         id="feGaussianBlur4036"
+         stdDeviation="9.0933437" />
+    </filter>
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4098">
+      <feGaussianBlur
+         id="feGaussianBlur4100"
+         stdDeviation="0.43347014" />
+    </filter>
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4098-4">
+      <feGaussianBlur
+         id="feGaussianBlur4100-4"
+         stdDeviation="0.43347014" />
+    </filter>
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4098-9">
+      <feGaussianBlur
+         id="feGaussianBlur4100-40"
+         stdDeviation="0.43347014" />
+    </filter>
+    <linearGradient
+       x1="292.53186"
+       y1="240.02106"
+       x2="333.58313"
+       y2="211.89999"
+       id="linearGradient3953-9"
+       xlink:href="#linearGradient3872-7-1-6"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       id="linearGradient3872-7-1-6">
+      <stop
+         id="stop3874-5-2-6"
+         style="stop-color:#ffffff;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-1-5-4"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="292.53186"
+       y1="240.02106"
+       x2="333.58313"
+       y2="211.89999"
+       id="linearGradient4244"
+       xlink:href="#linearGradient3872-7-1-6"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       x1="356.73056"
+       y1="169.72968"
+       x2="207.50134"
+       y2="214.72968"
+       id="linearGradient3995-2"
+       xlink:href="#linearGradient3848-7-5"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(0.384046,-0.72968)" />
+    <linearGradient
+       id="linearGradient3848-7-5">
+      <stop
+         id="stop3850-0-7"
+         style="stop-color:#000000;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3852-0-9"
+         style="stop-color:#ffffff;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="299.73056"
+       y1="314.72968"
+       x2="243.50134"
+       y2="207.72968"
+       id="linearGradient4297"
+       xlink:href="#linearGradient3848-7-5"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.92652863,0.37622426,-0.37622426,0.92652863,96.432028,-88.210742)" />
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4332">
+      <feGaussianBlur
+         id="feGaussianBlur4334"
+         stdDeviation="1.5101221" />
+    </filter>
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4429">
+      <feGaussianBlur
+         id="feGaussianBlur4431"
+         stdDeviation="0.17007137" />
+    </filter>
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4429-1">
+      <feGaussianBlur
+         id="feGaussianBlur4431-7"
+         stdDeviation="0.17007137" />
+    </filter>
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4564">
+      <feGaussianBlur
+         id="feGaussianBlur4566"
+         stdDeviation="0.98404287" />
+    </filter>
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4564-6">
+      <feGaussianBlur
+         id="feGaussianBlur4566-4"
+         stdDeviation="0.98404287" />
+    </filter>
+    <linearGradient
+       id="linearGradient3872-7-1-6-5">
+      <stop
+         id="stop3874-5-2-6-7"
+         style="stop-color:#ffffff;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-1-5-4-1"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3848-7-5-3">
+      <stop
+         id="stop3850-0-7-6"
+         style="stop-color:#000000;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3852-0-9-9"
+         style="stop-color:#ffffff;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3872-7-2">
+      <stop
+         id="stop3874-5-29"
+         style="stop-color:#ffc70d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-1-6"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3872-6">
+      <stop
+         id="stop3874-9"
+         style="stop-color:#ffc70d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-7"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3848-7-8">
+      <stop
+         id="stop3850-0-8"
+         style="stop-color:#ffc20d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3852-0-4"
+         style="stop-color:#ff770d;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="356.73056"
+       y1="169.72968"
+       x2="207.50134"
+       y2="214.72968"
+       id="linearGradient3854-4"
+       xlink:href="#linearGradient3848-3"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(2,-3)" />
+    <linearGradient
+       id="linearGradient3848-3">
+      <stop
+         id="stop3850-08"
+         style="stop-color:#ffc20d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3852-5"
+         style="stop-color:#ff770d;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <radialGradient
+       cx="274.61594"
+       cy="192.72968"
+       r="147.88539"
+       fx="274.61594"
+       fy="192.72968"
+       id="radialGradient3868-67"
+       xlink:href="#linearGradient3860-9"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.418799,-1.7319798,1.4141284,1.1584223,-385.5534,442.09657)" />
+    <linearGradient
+       id="linearGradient3860-9">
+      <stop
+         id="stop3862-3"
+         style="stop-color:#8c2c1d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3864-0"
+         style="stop-color:#000000;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4817">
+      <feGaussianBlur
+         result="result1"
+         stdDeviation="5"
+         id="feGaussianBlur4819" />
+      <feComposite
+         in2="result1"
+         operator="arithmetic"
+         k1="0"
+         k2="2"
+         k3="0"
+         k4="0"
+         in="result1"
+         id="feComposite4821" />
+    </filter>
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter4564-7">
+      <feGaussianBlur
+         id="feGaussianBlur4566-2"
+         stdDeviation="0.98404287" />
+    </filter>
+    <linearGradient
+       id="linearGradient3872-7-1-6-9">
+      <stop
+         id="stop3874-5-2-6-4"
+         style="stop-color:#ffffff;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-1-5-4-9"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3848-7-5-2">
+      <stop
+         id="stop3850-0-7-3"
+         style="stop-color:#000000;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3852-0-9-3"
+         style="stop-color:#ffffff;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3872-7-3">
+      <stop
+         id="stop3874-5-3"
+         style="stop-color:#ffc70d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-1-60"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3872-4">
+      <stop
+         id="stop3874-2"
+         style="stop-color:#ffc70d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-0"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="356.73056"
+       y1="169.72968"
+       x2="207.50134"
+       y2="214.72968"
+       id="linearGradient3854-3"
+       xlink:href="#linearGradient3848-0"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(2,-3)" />
+    <linearGradient
+       id="linearGradient3848-0">
+      <stop
+         id="stop3850-7"
+         style="stop-color:#ffc20d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3852-9"
+         style="stop-color:#ff770d;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <radialGradient
+       cx="274.61594"
+       cy="192.72968"
+       r="147.88539"
+       fx="274.61594"
+       fy="192.72968"
+       id="radialGradient3868-2"
+       xlink:href="#linearGradient3860-8"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.418799,-1.7319798,1.4141284,1.1584223,-385.5534,442.09657)" />
+    <linearGradient
+       id="linearGradient3860-8">
+      <stop
+         id="stop3862-6"
+         style="stop-color:#8c2c1d;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3864-2"
+         style="stop-color:#000000;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <filter
+       x="-0.25"
+       y="-0.25"
+       width="1.5"
+       height="1.5"
+       color-interpolation-filters="sRGB"
+       id="filter5802">
+      <feGaussianBlur
+         result="blur"
+         stdDeviation="4"
+         in="SourceAlpha"
+         id="feGaussianBlur5804" />
+      <feColorMatrix
+         values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.3 0 "
+         type="matrix"
+         result="bluralpha"
+         id="feColorMatrix5806" />
+      <feOffset
+         result="offsetBlur"
+         dy="0"
+         dx="0"
+         in="bluralpha"
+         id="feOffset5808" />
+      <feMerge
+         id="feMerge5810">
+        <feMergeNode
+           in="offsetBlur"
+           id="feMergeNode5812" />
+        <feMergeNode
+           in="SourceGraphic"
+           id="feMergeNode5814" />
+      </feMerge>
+    </filter>
+    <linearGradient
+       x1="292.53186"
+       y1="240.02106"
+       x2="333.58313"
+       y2="211.89999"
+       id="linearGradient4244-4"
+       xlink:href="#linearGradient3872-7-1-6-8"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       id="linearGradient3872-7-1-6-8">
+      <stop
+         id="stop3874-5-2-6-1"
+         style="stop-color:#ffffff;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3876-1-5-4-98"
+         style="stop-color:#fff00d;stop-opacity:0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="292.53186"
+       y1="240.02106"
+       x2="333.58313"
+       y2="211.89999"
+       id="linearGradient5957"
+       xlink:href="#linearGradient3872-7-1-6-8"
+       gradientUnits="userSpaceOnUse" />
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter6129">
+      <feGaussianBlur
+         id="feGaussianBlur6131"
+         stdDeviation="0.99672039" />
+    </filter>
+    <linearGradient
+       x1="465.97537"
+       y1="311.61328"
+       x2="533.15851"
+       y2="311.61328"
+       id="linearGradient6285"
+       xlink:href="#linearGradient6277"
+       gradientUnits="userSpaceOnUse" />
+    <filter
+       color-interpolation-filters="sRGB"
+       id="filter6304">
+      <feGaussianBlur
+         id="feGaussianBlur6306"
+         stdDeviation="1.5206895" />
+    </filter>
+  </defs>
+  <g
+     id="layer1"
+     style="display:inline">
+    <path
+       d="M 346.38009,76.669438 C 298.22084,45.622544 217.47069,44.46503 174.5794,82.459223 131.00337,121.06 123.5803,202.02771 147.68242,255.01807 c 15.70143,34.52082 58.45423,57.51325 96.24671,60.66769 61.77533,5.15623 147.93182,-14.41442 171.58716,-71.71364 23.02628,-55.77546 -18.42003,-134.60741 -69.1362,-167.302682 z"
+       id="path3070"
+       style="fill:url(#linearGradient3854);fill-opacity:1;stroke:url(#radialGradient3868);stroke-width:5.4000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+    <path
+       d="m 295.38405,60.270317 c -56.30151,-10.647156 -131.55433,18.660538 -157,70.000003 -25.85189,52.15907 -2.26755,129.97072 40,170 27.5354,26.07727 75.79741,31.29577 112,20 59.1765,-18.46399 131.64001,-69.0109 132,-131 0.35042,-60.3406 -67.70926,-117.787555 -127,-129.000003 z"
+       transform="matrix(0.92652863,0.37622426,-0.37622426,0.92652863,93.022091,-88.807832)"
+       id="path3070-4"
+       style="fill:url(#linearGradient3995);fill-opacity:1;stroke:#000000;stroke-width:5.4000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;filter:url(#filter4034)" />
+    <path
+       d="m 377,184.5 a 45.5,68.5 0 1 1 -91,0 45.5,68.5 0 1 1 91,0 z"
+       transform="matrix(0.92652863,0.37622426,-0.37622426,0.92652863,120.76182,-66.750921)"
+       id="path3870"
+       style="opacity:0.79385968;fill:url(#linearGradient3878);fill-opacity:1;stroke:none;filter:url(#filter3892)" />
+    <path
+       d="m 377,184.5 a 45.5,68.5 0 1 1 -91,0 45.5,68.5 0 1 1 91,0 z"
+       transform="matrix(0.92652863,0.37622426,-0.37622426,0.92652863,-48.635723,-147.94805)"
+       id="path3870-0"
+       style="opacity:0.79385968;fill:url(#linearGradient3913);fill-opacity:1;stroke:none;filter:url(#filter3892-9)" />
+    <path
+       d="M 346.80829,79.293661 C 298.64905,48.24677 217.8989,47.089253 175.0076,85.083458 131.43158,123.68422 124.00851,204.65194 148.11063,257.64229 c 15.70142,34.52082 58.45423,57.51325 96.24671,60.66769 61.77533,5.15622 147.93181,-14.4144 171.58715,-71.71365 23.02627,-55.77545 -18.42003,-134.6074 -69.1362,-167.302669 z"
+       id="path3070-4-0"
+       style="opacity:0.63596491;fill:url(#linearGradient4297);fill-opacity:1;stroke:none" />
+    <g
+       transform="translate(-235.29588,-113.38091)"
+       id="g6289"
+       style="opacity:0.6;filter:url(#filter6304)">
+      <path
+         d="m 496.16574,268.75161 6.04515,-5.58014 c -6.21955,3.62785 72.87411,-35.34837 61.6141,-51.26759 -13.48644,-19.06689 -68.54052,54.01896 -63.00913,49.29128 l -6.97519,6.85893 z"
+         id="path6077"
+         style="fill:#572500;fill-opacity:0.754717;stroke:#3b1f00;stroke-width:0.76284659px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+      <path
+         d="m 496.3727,269.05863 6.92229,-4.44563 c -6.75503,2.49272 77.90517,-22.1569 69.58057,-39.78954 -9.97062,-21.11912 -76.87953,41.29634 -70.61122,37.60101 l -8.06026,5.5435 z"
+         id="path6077-1"
+         style="fill:#572500;fill-opacity:0.754717;stroke:#3b1f00;stroke-width:0.76284659px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" />
+      <path
+         d="m 483.72666,286.18956 -2.44132,3.7201 -17.43794,43.24612 7.55644,36.03844"
+         id="path6097"
+         style="fill:none;stroke:#000000;stroke-width:2.28853989;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+      <path
+         d="m 466.52121,280.37691 -8.95148,3.60385 -15.92666,34.06213 44.05989,9.88151"
+         id="path6099"
+         style="fill:none;stroke:#000000;stroke-width:2.28853989;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+      <path
+         d="m 499.76958,288.04961 2.09255,5.23138 36.3872,46.73372 0.11625,18.71674"
+         id="path6101"
+         style="fill:none;stroke:#000000;stroke-width:2.28853989;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+      <path
+         d="m 475.23474,276.10147 -4.60338,0.49322 -4.27457,4.60339 1.64407,4.76779 -1.15085,4.76779 5.26101,-1.15085 7.89151,-6.90508 4.76779,3.78136 10.19321,0.32881 2.63051,1.47966 5.75423,-1.31526 12.16609,14.46779 7.72711,44.88299 5.0966,9.8644 4.27458,-13.48134 0.16441,-18.74235 -9.7,-23.67455 -15.94743,-18.57795 0.49321,-1.31525 -2.4661,-3.45254 -2.4661,0 -4.11016,-6.74067 -7.72711,-3.12373 -13.64575,3.78136 -2.95931,1.97288 z"
+         id="path6075"
+         style="fill:url(#linearGradient6285);fill-opacity:1;stroke:#000000;stroke-width:0.76284659px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+      <path
+         d="m 498.60705,288.04961 1.62754,10.46277 40.5723,43.12987 27.78447,39.40978"
+         id="path6103"
+         style="fill:none;stroke:#000000;stroke-width:2.28853989;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+    </g>
+  </g>
+  <g
+     id="layer4"
+     style="display:inline">
+    <path
+       d="m 377,184.5 a 45.5,68.5 0 1 1 -91,0 45.5,68.5 0 1 1 91,0 z"
+       transform="matrix(1.8937838,0.76898585,-0.56021714,1.3796485,-284.02686,-336.59823)"
+       id="path3870-0-8"
+       style="opacity:0.73684208;fill:url(#linearGradient4244);fill-opacity:1;stroke:none" />
+    <path
+       d="m 377,184.5 a 45.5,68.5 0 1 1 -91,0 45.5,68.5 0 1 1 91,0 z"
+       transform="matrix(-0.03488592,1.1390564,1.0570101,0.35846485,135.9429,-307.26846)"
+       id="path3870-0-8-9"
+       style="opacity:0.73684208;fill:url(#linearGradient5957);fill-opacity:1;stroke:none;display:inline" />
+  </g>
+  <g
+     id="layer6"
+     style="display:inline" />
+</svg>

BIN
images/amber_small.png


BIN
images/off.amber.png


BIN
images/offHover.amber.png


BIN
images/sprite.amber.png


BIN
images/tinylogo.amber.png


+ 24 - 0
index.html

@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>Amber Smalltalk</title>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <meta name="author" content="Nicolas Petton"/>
+    <script type='text/javascript' src='support/amber.js'></script>
+    <script type='text/javascript' src='support/requirejs/require.min.js'></script>
+</head>
+
+<body>
+<script type='text/javascript'>
+    require(
+        ["amber/devel"],
+        function (smalltalk) {
+            smalltalk.initialize({'transport.defaultAmdNamespace': "amber_core"});
+
+            smalltalk.globals.Browser._open();
+        }
+    );
+</script>
+</body>
+</html> 

+ 37 - 0
package.json

@@ -0,0 +1,37 @@
+{
+  "name": "amber",
+  "version": "0.13.0-pre",
+  "description": "An implementation of the Smalltalk language that runs on top of the JS runtime.",
+  "homepage": "http://amber-lang.net",
+  "keywords": [
+    "javascript",
+    "smalltalk",
+    "language",
+    "compiler",
+    "web"
+  ],
+  "author": {
+    "name": "Nicolas Petton",
+    "email": "petton.nicolas@gmail.com",
+    "url": "http://www.nicolas-petton.fr"
+  },
+  "license": {
+    "type": "MIT"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/amber-smalltalk/amber.git"
+  },
+  "engines": {
+    "node": ">=0.8.0"
+  },
+  "scripts": {
+    "test": "grunt amberc:test_runner && node test_runner.js && ( rm test_runner.js || del test_runner.js )"
+  },
+  "devDependencies": {
+    "pegjs": "~0.8.0",
+    "grunt": "~0.4.0",
+    "grunt-contrib-jshint": "~0.3.0",
+    "amber-dev": "0.0.2"
+  }
+}

+ 297 - 0
src/Benchfib.js

@@ -0,0 +1,297 @@
+define("amber_core/Benchfib", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Benchfib');
+smalltalk.packages["Benchfib"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('Benchfib', globals.Object, [], 'Benchfib');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "main",
+protocol: 'not yet classified',
+fn: function (){
+var self=this;
+var result;
+return smalltalk.withContext(function($ctx1) { 
+result=(0)._tinyBenchmarks();
+_st(console)._log_("0 tinyBenchmarks => ".__comma(result));
+return self}, function($ctx1) {$ctx1.fill(self,"main",{result:result},globals.Benchfib.klass)})},
+args: [],
+source: "main\x0a\x0a\x09| result |\x0a\x09result := 0 tinyBenchmarks.\x0a\x09console log: '0 tinyBenchmarks => ' , result",
+messageSends: ["tinyBenchmarks", "log:", ","],
+referencedClasses: []
+}),
+globals.Benchfib.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "benchFib",
+protocol: '*Benchfib',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$5,$4,$3,$1;
+$2=self.__lt((2));
+if(smalltalk.assert($2)){
+$1=(1);
+} else {
+$5=self.__minus((1));
+$ctx1.sendIdx["-"]=1;
+$4=_st($5)._benchFib();
+$ctx1.sendIdx["benchFib"]=1;
+$3=_st($4).__plus(_st(self.__minus((2)))._benchFib());
+$1=_st($3).__plus((1));
+$ctx1.sendIdx["+"]=1;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"benchFib",{},globals.Number)})},
+args: [],
+source: "benchFib\x0a\x09\x22Handy send-heavy benchmark\x22\x0a\x09\x22(result // seconds to run) = approx calls per second\x22\x0a\x09\x22\x09| r t |\x0a\x09\x09t := Time millisecondsToRun: [r := 26 benchFib].\x0a\x09\x09(r * 1000) // t\x22\x0a\x09\x22138000 on a Mac 8100/100\x22\x0a\x09^ self < 2\x0a\x09\x09ifTrue: [1]\x0a\x09\x09ifFalse: [(self-1) benchFib + (self-2) benchFib + 1]",
+messageSends: ["ifTrue:ifFalse:", "<", "+", "benchFib", "-"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "benchmark",
+protocol: '*Benchfib',
+fn: function (){
+var self=this;
+var size,flags,prime,k,count;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+size=(8190);
+(1)._to_do_(self,(function(iter){
+return smalltalk.withContext(function($ctx2) {
+count=(0);
+count;
+flags=_st($Array())._new();
+flags;
+_st(size)._timesRepeat_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(flags)._add_(true);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+return (1)._to_do_(size,(function(i){
+return smalltalk.withContext(function($ctx3) {
+$1=_st(flags)._at_(i);
+if(smalltalk.assert($1)){
+prime=_st(i).__plus((1));
+$ctx3.sendIdx["+"]=1;
+prime;
+k=_st(i).__plus(prime);
+$ctx3.sendIdx["+"]=2;
+k;
+_st((function(){
+return smalltalk.withContext(function($ctx4) {
+return _st(k).__lt_eq(size);
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx4) {
+_st(flags)._at_put_(k,false);
+k=_st(k).__plus(prime);
+$ctx4.sendIdx["+"]=3;
+return k;
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
+count=_st(count).__plus((1));
+return count;
+};
+}, function($ctx3) {$ctx3.fillBlock({i:i},$ctx2,3)})}));
+}, function($ctx2) {$ctx2.fillBlock({iter:iter},$ctx1,1)})}));
+$ctx1.sendIdx["to:do:"]=1;
+$2=count;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"benchmark",{size:size,flags:flags,prime:prime,k:k,count:count},globals.Number)})},
+args: [],
+source: "benchmark\x0a\x09\x22Handy bytecode-heavy benchmark\x22\x0a\x09\x22(500000 // time to run) = approx bytecodes per second\x22\x0a\x09\x225000000 // (Time millisecondsToRun: [10 benchmark]) * 1000\x22\x0a\x09\x223059000 on a Mac 8100/100\x22\x0a\x09| size flags prime k count |\x0a\x09size := 8190.\x0a\x091 to: self do:\x0a\x09\x09[:iter |\x0a\x09\x09count := 0.\x0a\x09\x09flags := Array new.\x0a\x09\x09size timesRepeat: [ flags add: true].\x0a\x09\x091 to: size do:\x0a\x09\x09\x09[:i | (flags at: i) ifTrue:\x0a\x09\x09\x09\x09[prime := i+1.\x0a\x09\x09\x09\x09k := i + prime.\x0a\x09\x09\x09\x09[k <= size] whileTrue:\x0a\x09\x09\x09\x09\x09[flags at: k put: false.\x0a\x09\x09\x09\x09\x09k := k + prime].\x0a\x09\x09\x09\x09count := count + 1]]].\x0a\x09^ count",
+messageSends: ["to:do:", "new", "timesRepeat:", "add:", "ifTrue:", "at:", "+", "whileTrue:", "<=", "at:put:"],
+referencedClasses: ["Array"]
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "jsbenchFib",
+protocol: '*Benchfib',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+if (this < 2) {
+return 1;
+} else {
+return (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;};
+return self}, function($ctx1) {$ctx1.fill(self,"jsbenchFib",{},globals.Number)})},
+args: [],
+source: "jsbenchFib\x0a\x0a\x09<if (this < 2) {\x0areturn 1;\x0a} else {\x0areturn (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;}>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "jsbenchmark",
+protocol: '*Benchfib',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+var size = 8190;
+var count;
+for (var z=0;z<this;z++) {
+	count = 0;
+	var flags = new Array();
+	for (var p=0; p<size; p++) {
+	flags[p] = true;
+	}
+	for (var i=1;i<=size;i++) {
+		if (flags[i-1]) {
+			var prime = i+1;
+			var k = i + prime;
+			while (k <= size) {
+				flags[k-1] = false;
+				k = k + prime;
+			}
+			count = count + 1;
+		}
+	}
+}
+return count;
+return self}, function($ctx1) {$ctx1.fill(self,"jsbenchmark",{},globals.Number)})},
+args: [],
+source: "jsbenchmark\x0a\x0a<\x0avar size = 8190;\x0avar count;\x0afor (var z=0;z<this;z++) {\x0a\x09count = 0;\x0a\x09var flags = new Array();\x0a\x09for (var p=0; p<size; p++) {\x0a\x09flags[p] = true;\x0a\x09}\x0a\x09for (var i=1;i<=size;i++) {\x0a\x09\x09if (flags[i-1]) {\x0a\x09\x09\x09var prime = i+1;\x0a\x09\x09\x09var k = i + prime;\x0a\x09\x09\x09while (k <= size) {\x0a\x09\x09\x09\x09flags[k-1] = false;\x0a\x09\x09\x09\x09k = k + prime;\x0a\x09\x09\x09}\x0a\x09\x09\x09count = count + 1;\x0a\x09\x09}\x0a\x09}\x0a}\x0areturn count>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "jstinyBenchmarks",
+protocol: '*Benchfib',
+fn: function (){
+var self=this;
+var t1,t2,r,n1,n2;
+function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
+return smalltalk.withContext(function($ctx1) { 
+var $7,$6,$5,$4,$3,$2,$1;
+n1=(1);
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+t1=_st($Date())._millisecondsToRun_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(n1)._jsbenchmark();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["millisecondsToRun:"]=1;
+t1;
+return _st(t1).__lt((1000));
+$ctx2.sendIdx["<"]=1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+n1=_st(n1).__star((2));
+$ctx2.sendIdx["*"]=1;
+return n1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$ctx1.sendIdx["whileTrue:"]=1;
+n2=(28);
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+t2=_st($Date())._millisecondsToRun_((function(){
+return smalltalk.withContext(function($ctx3) {
+r=_st(n2)._jsbenchFib();
+return r;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
+t2;
+return _st(t2).__lt((1000));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+n2=_st(n2).__plus((1));
+return n2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
+$7=_st(n1).__star((500000));
+$ctx1.sendIdx["*"]=3;
+$6=_st($7).__star((1000));
+$ctx1.sendIdx["*"]=2;
+$5=_st($6).__slash(t1);
+$ctx1.sendIdx["/"]=1;
+$4=_st($5)._printString();
+$ctx1.sendIdx["printString"]=1;
+$3=_st($4).__comma(" bytecodes/sec; ");
+$2=_st($3).__comma(_st(_st(_st(r).__star((1000))).__slash(t2))._printString());
+$ctx1.sendIdx[","]=2;
+$1=_st($2).__comma(" sends/sec");
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"jstinyBenchmarks",{t1:t1,t2:t2,r:r,n1:n1,n2:n2},globals.Number)})},
+args: [],
+source: "jstinyBenchmarks\x0a\x09\x220 jstinyBenchmarks\x22\x0a\x0a\x09| t1 t2 r n1 n2 |\x0a\x09n1 := 1.\x0a\x09[t1 := Date millisecondsToRun: [n1 jsbenchmark].\x0a\x09t1 < 1000] whileTrue:[n1 := n1 * 2]. \x22Note: #benchmark's runtime is about O(n)\x22\x0a\x0a\x09n2 := 28.\x0a\x09[t2 := Date millisecondsToRun: [r := n2 jsbenchFib].\x0a\x09t2 < 1000] whileTrue:[n2 := n2 + 1].\x0a\x09\x22Note: #jsbenchFib's runtime is about O(k^n),\x0a\x09\x09where k is the golden number = (1 + 5 sqrt) / 2 = 1.618....\x22\x0a\x0a\x09^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',\x0a\x09\x09((r * 1000) / t2) printString, ' sends/sec'",
+messageSends: ["whileTrue:", "millisecondsToRun:", "jsbenchmark", "<", "*", "jsbenchFib", "+", ",", "printString", "/"],
+referencedClasses: ["Date"]
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tinyBenchmarks",
+protocol: '*Benchfib',
+fn: function (){
+var self=this;
+var t1,t2,r,n1,n2;
+function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
+return smalltalk.withContext(function($ctx1) { 
+var $7,$6,$5,$4,$3,$2,$1;
+n1=(1);
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+t1=_st($Date())._millisecondsToRun_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(n1)._benchmark();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["millisecondsToRun:"]=1;
+t1;
+return _st(t1).__lt((1000));
+$ctx2.sendIdx["<"]=1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+n1=_st(n1).__star((2));
+$ctx2.sendIdx["*"]=1;
+return n1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$ctx1.sendIdx["whileTrue:"]=1;
+n2=(16);
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+t2=_st($Date())._millisecondsToRun_((function(){
+return smalltalk.withContext(function($ctx3) {
+r=_st(n2)._benchFib();
+return r;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
+t2;
+return _st(t2).__lt((1000));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+n2=_st(n2).__plus((1));
+return n2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
+$7=_st(n1).__star((500000));
+$ctx1.sendIdx["*"]=3;
+$6=_st($7).__star((1000));
+$ctx1.sendIdx["*"]=2;
+$5=_st($6).__slash(t1);
+$ctx1.sendIdx["/"]=1;
+$4=_st($5)._printString();
+$ctx1.sendIdx["printString"]=1;
+$3=_st($4).__comma(" bytecodes/sec; ");
+$2=_st($3).__comma(_st(_st(_st(r).__star((1000))).__slash(t2))._printString());
+$ctx1.sendIdx[","]=2;
+$1=_st($2).__comma(" sends/sec");
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tinyBenchmarks",{t1:t1,t2:t2,r:r,n1:n1,n2:n2},globals.Number)})},
+args: [],
+source: "tinyBenchmarks\x0a\x09\x22Report the results of running the two tiny Squeak benchmarks.\x0a\x09ar 9/10/1999: Adjusted to run at least 1 sec to get more stable results\x22\x0a\x09\x220 tinyBenchmarks\x22\x0a\x09\x22On a 292 MHz G3 Mac: 22727272 bytecodes/sec; 984169 sends/sec\x22\x0a\x09\x22On a 400 MHz PII/Win98: 18028169 bytecodes/sec; 1081272 sends/sec\x22\x0a\x09| t1 t2 r n1 n2 |\x0a\x09n1 := 1.\x0a\x09[t1 := Date millisecondsToRun: [n1 benchmark].\x0a\x09t1 < 1000] whileTrue:[n1 := n1 * 2]. \x22Note: #benchmark's runtime is about O(n)\x22\x0a\x0a\x09n2 := 16.\x0a\x09[t2 := Date millisecondsToRun: [r := n2 benchFib].\x0a\x09t2 < 1000] whileTrue:[n2 := n2 + 1].\x0a\x09\x22Note: #benchFib's runtime is about O(k^n),\x0a\x09\x09where k is the golden number = (1 + 5 sqrt) / 2 = 1.618....\x22\x0a\x0a\x09^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',\x0a\x09\x09((r * 1000) / t2) printString, ' sends/sec'",
+messageSends: ["whileTrue:", "millisecondsToRun:", "benchmark", "<", "*", "benchFib", "+", ",", "printString", "/"],
+referencedClasses: ["Date"]
+}),
+globals.Number);
+
+});

+ 124 - 0
src/Benchfib.st

@@ -0,0 +1,124 @@
+Smalltalk createPackage: 'Benchfib'!
+Object subclass: #Benchfib
+	instanceVariableNames: ''
+	package: 'Benchfib'!
+
+!Benchfib class methodsFor: 'not yet classified'!
+
+main
+
+	| result |
+	result := 0 tinyBenchmarks.
+	console log: '0 tinyBenchmarks => ' , result
+! !
+
+!Number methodsFor: '*Benchfib'!
+
+benchFib
+	"Handy send-heavy benchmark"
+	"(result // seconds to run) = approx calls per second"
+	"	| r t |
+		t := Time millisecondsToRun: [r := 26 benchFib].
+		(r * 1000) // t"
+	"138000 on a Mac 8100/100"
+	^ self < 2
+		ifTrue: [1]
+		ifFalse: [(self-1) benchFib + (self-2) benchFib + 1]
+!
+
+benchmark
+	"Handy bytecode-heavy benchmark"
+	"(500000 // time to run) = approx bytecodes per second"
+	"5000000 // (Time millisecondsToRun: [10 benchmark]) * 1000"
+	"3059000 on a Mac 8100/100"
+	| size flags prime k count |
+	size := 8190.
+	1 to: self do:
+		[:iter |
+		count := 0.
+		flags := Array new.
+		size timesRepeat: [ flags add: true].
+		1 to: size do:
+			[:i | (flags at: i) ifTrue:
+				[prime := i+1.
+				k := i + prime.
+				[k <= size] whileTrue:
+					[flags at: k put: false.
+					k := k + prime].
+				count := count + 1]]].
+	^ count
+!
+
+jsbenchFib
+
+	<if (this < 2) {
+return 1;
+} else {
+return (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;}>
+!
+
+jsbenchmark
+
+<
+var size = 8190;
+var count;
+for (var z=0;z<this;z++) {
+	count = 0;
+	var flags = new Array();
+	for (var p=0; p<size; p++) {
+	flags[p] = true;
+	}
+	for (var i=1;i<=size;i++) {
+		if (flags[i-1]) {
+			var prime = i+1;
+			var k = i + prime;
+			while (k <= size) {
+				flags[k-1] = false;
+				k = k + prime;
+			}
+			count = count + 1;
+		}
+	}
+}
+return count>
+!
+
+jstinyBenchmarks
+	"0 jstinyBenchmarks"
+
+	| t1 t2 r n1 n2 |
+	n1 := 1.
+	[t1 := Date millisecondsToRun: [n1 jsbenchmark].
+	t1 < 1000] whileTrue:[n1 := n1 * 2]. "Note: #benchmark's runtime is about O(n)"
+
+	n2 := 28.
+	[t2 := Date millisecondsToRun: [r := n2 jsbenchFib].
+	t2 < 1000] whileTrue:[n2 := n2 + 1].
+	"Note: #jsbenchFib's runtime is about O(k^n),
+		where k is the golden number = (1 + 5 sqrt) / 2 = 1.618...."
+
+	^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',
+		((r * 1000) / t2) printString, ' sends/sec'
+!
+
+tinyBenchmarks
+	"Report the results of running the two tiny Squeak benchmarks.
+	ar 9/10/1999: Adjusted to run at least 1 sec to get more stable results"
+	"0 tinyBenchmarks"
+	"On a 292 MHz G3 Mac: 22727272 bytecodes/sec; 984169 sends/sec"
+	"On a 400 MHz PII/Win98: 18028169 bytecodes/sec; 1081272 sends/sec"
+	| t1 t2 r n1 n2 |
+	n1 := 1.
+	[t1 := Date millisecondsToRun: [n1 benchmark].
+	t1 < 1000] whileTrue:[n1 := n1 * 2]. "Note: #benchmark's runtime is about O(n)"
+
+	n2 := 16.
+	[t2 := Date millisecondsToRun: [r := n2 benchFib].
+	t2 < 1000] whileTrue:[n2 := n2 + 1].
+	"Note: #benchFib's runtime is about O(k^n),
+		where k is the golden number = (1 + 5 sqrt) / 2 = 1.618...."
+
+	^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',
+		((r * 1000) / t2) printString, ' sends/sec'
+! !
+

+ 2676 - 0
src/Compiler-AST.js

@@ -0,0 +1,2676 @@
+define("amber_core/Compiler-AST", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Compiler-AST');
+smalltalk.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('Node', globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
+globals.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.Node)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addNode:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._nodes())._add_(aNode);
+_st(aNode)._parent_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},globals.Node)})},
+args: ["aNode"],
+source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
+messageSends: ["add:", "nodes", "parent:"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allNodes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var allNodes;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._nodes();
+$ctx1.sendIdx["nodes"]=1;
+allNodes=_st($1)._asSet();
+_st(self._nodes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(allNodes)._addAll_(_st(each)._allNodes());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$2=allNodes;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},globals.Node)})},
+args: [],
+source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes",
+messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inPosition:",
+protocol: 'testing',
+fn: function (aPoint){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._positionStart()).__lt_eq(aPoint))._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._positionEnd()).__gt_eq(aPoint);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},globals.Node)})},
+args: ["aPoint"],
+source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
+messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isAssignmentNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isAssignmentNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBlockNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isBlockNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBlockSequenceNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isBlockSequenceNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isCascadeNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isCascadeNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isImmutable\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isJSStatementNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isJSStatementNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isLastChild",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(self._parent())._nodes())._last()).__eq(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isLastChild",{},globals.Node)})},
+args: [],
+source: "isLastChild\x0a\x09^ self parent nodes last = self",
+messageSends: ["=", "last", "nodes", "parent"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNavigationNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isReferenced",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+$4=self._parent();
+$ctx1.sendIdx["parent"]=1;
+$3=_st($4)._isSequenceNode();
+$2=_st($3)._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._parent())._isAssignmentNode();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$1=_st($2)._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isReferenced",{},globals.Node)})},
+args: [],
+source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not",
+messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isReturnNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isReturnNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSendNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isSendNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSequenceNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isSequenceNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isValueNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isValueNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isVariableNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isVariableNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._parent();
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$2;
+} else {
+var node;
+node=$receiver;
+$1=_st(node)._method();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"method",{},globals.Node)})},
+args: [],
+source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
+messageSends: ["ifNotNil:", "parent", "method"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "navigationNodeAt:ifAbsent:",
+protocol: 'accessing',
+fn: function (aPoint,aBlock){
+var self=this;
+var children;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$4,$3,$2;
+var $early={};
+try {
+children=_st(self._allNodes())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._isNavigationNode())._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(each)._inPosition_(aPoint);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+_st(children)._ifEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aBlock)._value();
+throw $early=[$1];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$2=_st(_st(_st(children)._asArray())._sort_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(a)._positionStart();
+$ctx2.sendIdx["positionStart"]=1;
+$3=_st($4)._dist_(aPoint);
+$ctx2.sendIdx["dist:"]=1;
+return _st($3).__lt_eq(_st(_st(b)._positionStart())._dist_(aPoint));
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)})})))._first();
+return $2;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},globals.Node)})},
+args: ["aPoint", "aBlock"],
+source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allNodes select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first",
+messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextChild",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self._nodes();
+$ctx1.sendIdx["nodes"]=1;
+$2=_st($3)._isEmpty();
+if(smalltalk.assert($2)){
+$1=self;
+} else {
+$1=_st(_st(self._nodes())._first())._nextChild();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"nextChild",{},globals.Node)})},
+args: [],
+source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
+messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextNode",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._parent();
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$2;
+} else {
+var node;
+node=$receiver;
+$1=_st(node)._nextNode_(self);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"nextNode",{},globals.Node)})},
+args: [],
+source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
+messageSends: ["ifNotNil:", "parent", "nextNode:"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextNode:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+var next;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+var $early={};
+try {
+$1=self._nodes();
+$ctx1.sendIdx["nodes"]=1;
+next=_st($1)._at_ifAbsent_(_st(_st(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
+throw $early=[self];
+}));
+$2=_st(next)._nextChild();
+return $2;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},globals.Node)})},
+args: ["aNode"],
+source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
+messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nodes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@nodes"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@nodes"]=_st($Array())._new();
+$1=self["@nodes"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.Node)})},
+args: [],
+source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Array"]
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nodes:",
+protocol: 'building',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@nodes"]=aCollection;
+_st(aCollection)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._parent_(self);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},globals.Node)})},
+args: ["aCollection"],
+source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
+messageSends: ["do:", "parent:"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parent",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@parent"];
+return $1;
+},
+args: [],
+source: "parent\x0a\x09^ parent",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parent:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+self["@parent"]=aNode;
+return self},
+args: ["aNode"],
+source: "parent: aNode\x0a\x09parent := aNode",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "position",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1,$receiver;
+$2=self["@position"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=self._parent();
+if(($receiver = $3) == null || $receiver.isNil){
+$1=$3;
+} else {
+var node;
+node=$receiver;
+$1=_st(node)._position();
+};
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"position",{},globals.Node)})},
+args: [],
+source: "position\x0a\x09\x22answer the line and column of the receiver in the source code\x22\x0a\x09\x0a\x09^ position ifNil: [ \x0a\x09\x09self parent ifNotNil: [ :node | node position ] ]",
+messageSends: ["ifNil:", "ifNotNil:", "parent", "position"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "position:",
+protocol: 'accessing',
+fn: function (aPosition){
+var self=this;
+self["@position"]=aPosition;
+return self},
+args: ["aPosition"],
+source: "position: aPosition\x0a\x09position := aPosition",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "positionEnd",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$7,$6,$5,$4,$3,$1;
+$2=self._positionStart();
+$7=self._source();
+$ctx1.sendIdx["source"]=1;
+$6=_st($7)._lines();
+$ctx1.sendIdx["lines"]=1;
+$5=_st($6)._size();
+$ctx1.sendIdx["size"]=1;
+$4=_st($5).__minus((1));
+$ctx1.sendIdx["-"]=1;
+$3=_st($4).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__minus((1)));
+$1=_st($2).__plus($3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"positionEnd",{},globals.Node)})},
+args: [],
+source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
+messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "positionStart",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._position();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"positionStart",{},globals.Node)})},
+args: [],
+source: "positionStart\x0a\x09^ self position",
+messageSends: ["position"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "postCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.Node.superclass.fn.prototype._postCopy.apply(_st(self), []));
+$ctx1.supercall = false;
+_st(self._nodes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._parent_(self);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},globals.Node)})},
+args: [],
+source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
+messageSends: ["postCopy", "do:", "nodes", "parent:"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "requiresSmalltalkContext",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._nodes())._detect_ifNone_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._requiresSmalltalkContext();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return nil;
+})))._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.Node)})},
+args: [],
+source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
+messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldBeAliased",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@shouldBeAliased"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.Node)})},
+args: [],
+source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldBeAliased:",
+protocol: 'accessing',
+fn: function (aBoolean){
+var self=this;
+self["@shouldBeAliased"]=aBoolean;
+return self},
+args: ["aBoolean"],
+source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldBeInlined",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@shouldBeInlined"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},globals.Node)})},
+args: [],
+source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldBeInlined:",
+protocol: 'accessing',
+fn: function (aBoolean){
+var self=this;
+self["@shouldBeInlined"]=aBoolean;
+return self},
+args: ["aBoolean"],
+source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "size",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._source())._size();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Node)})},
+args: [],
+source: "size\x0a\x09^ self source size",
+messageSends: ["size", "source"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@source"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"source",{},globals.Node)})},
+args: [],
+source: "source\x0a\x09^ source ifNil: [ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@source"]=aString;
+return self},
+args: ["aString"],
+source: "source: aString\x0a\x09source := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stopOnStepping",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "stopOnStepping\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subtreeNeedsAliasing",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._shouldBeAliased())._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._shouldBeInlined();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._nodes())._anySatisfy_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(each)._subtreeNeedsAliasing();
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$ctx1.sendIdx["or:"]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.Node)})},
+args: [],
+source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
+messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"],
+referencedClasses: []
+}),
+globals.Node);
+
+
+
+smalltalk.addClass('AssignmentNode', globals.Node, ['left', 'right'], 'Compiler-AST');
+globals.AssignmentNode.comment="I represent an assignment node.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitAssignmentNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.AssignmentNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
+messageSends: ["visitAssignmentNode:"],
+referencedClasses: []
+}),
+globals.AssignmentNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isAssignmentNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isAssignmentNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AssignmentNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "left",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@left"];
+return $1;
+},
+args: [],
+source: "left\x0a\x09^ left",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AssignmentNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "left:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@left"]=aNode;
+_st(aNode)._parent_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},globals.AssignmentNode)})},
+args: ["aNode"],
+source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
+messageSends: ["parent:"],
+referencedClasses: []
+}),
+globals.AssignmentNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nodes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Array())._with_with_(self._left(),self._right());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.AssignmentNode)})},
+args: [],
+source: "nodes\x0a\x09^ Array with: self left with: self right",
+messageSends: ["with:with:", "left", "right"],
+referencedClasses: ["Array"]
+}),
+globals.AssignmentNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "right",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@right"];
+return $1;
+},
+args: [],
+source: "right\x0a\x09^ right",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AssignmentNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "right:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@right"]=aNode;
+_st(aNode)._parent_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},globals.AssignmentNode)})},
+args: ["aNode"],
+source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
+messageSends: ["parent:"],
+referencedClasses: []
+}),
+globals.AssignmentNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldBeAliased",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=($ctx1.supercall = true, globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st($2)._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._isReferenced();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.AssignmentNode)})},
+args: [],
+source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
+messageSends: ["or:", "shouldBeAliased", "isReferenced"],
+referencedClasses: []
+}),
+globals.AssignmentNode);
+
+
+
+smalltalk.addClass('BlockNode', globals.Node, ['parameters', 'scope'], 'Compiler-AST');
+globals.BlockNode.comment="I represent an block closure node.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitBlockNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
+messageSends: ["visitBlockNode:"],
+referencedClasses: []
+}),
+globals.BlockNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBlockNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isBlockNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextChild",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextNode:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+return self;
+},
+args: ["aNode"],
+source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parameters",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@parameters"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@parameters"]=_st($Array())._new();
+$1=self["@parameters"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"parameters",{},globals.BlockNode)})},
+args: [],
+source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Array"]
+}),
+globals.BlockNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parameters:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@parameters"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "parameters: aCollection\x0a\x09parameters := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@scope"];
+return $1;
+},
+args: [],
+source: "scope\x0a\x09^ scope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope:",
+protocol: 'accessing',
+fn: function (aLexicalScope){
+var self=this;
+self["@scope"]=aLexicalScope;
+return self},
+args: ["aLexicalScope"],
+source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subtreeNeedsAliasing",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._shouldBeAliased())._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._shouldBeInlined();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.BlockNode)})},
+args: [],
+source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
+messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"],
+referencedClasses: []
+}),
+globals.BlockNode);
+
+
+
+smalltalk.addClass('CascadeNode', globals.Node, ['receiver'], 'Compiler-AST');
+globals.CascadeNode.comment="I represent an cascade node.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitCascadeNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.CascadeNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
+messageSends: ["visitCascadeNode:"],
+referencedClasses: []
+}),
+globals.CascadeNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isCascadeNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isCascadeNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.CascadeNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@receiver"];
+return $1;
+},
+args: [],
+source: "receiver\x0a\x09^ receiver",
+messageSends: [],
+referencedClasses: []
+}),
+globals.CascadeNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+self["@receiver"]=aNode;
+return self},
+args: ["aNode"],
+source: "receiver: aNode\x0a\x09receiver := aNode",
+messageSends: [],
+referencedClasses: []
+}),
+globals.CascadeNode);
+
+
+
+smalltalk.addClass('DynamicArrayNode', globals.Node, [], 'Compiler-AST');
+globals.DynamicArrayNode.comment="I represent an dynamic array node.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitDynamicArrayNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicArrayNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
+messageSends: ["visitDynamicArrayNode:"],
+referencedClasses: []
+}),
+globals.DynamicArrayNode);
+
+
+
+smalltalk.addClass('DynamicDictionaryNode', globals.Node, [], 'Compiler-AST');
+globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitDynamicDictionaryNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicDictionaryNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
+messageSends: ["visitDynamicDictionaryNode:"],
+referencedClasses: []
+}),
+globals.DynamicDictionaryNode);
+
+
+
+smalltalk.addClass('JSStatementNode', globals.Node, [], 'Compiler-AST');
+globals.JSStatementNode.comment="I represent an JavaScript statement node.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitJSStatementNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.JSStatementNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
+messageSends: ["visitJSStatementNode:"],
+referencedClasses: []
+}),
+globals.JSStatementNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isJSStatementNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isJSStatementNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSStatementNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "requiresSmalltalkContext",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "requiresSmalltalkContext\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSStatementNode);
+
+
+
+smalltalk.addClass('MethodNode', globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
+globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitMethodNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.MethodNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
+messageSends: ["visitMethodNode:"],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@arguments"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=[];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MethodNode)})},
+args: [],
+source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@arguments"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "arguments: aCollection\x0a\x09arguments := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classReferences",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@classReferences"];
+return $1;
+},
+args: [],
+source: "classReferences\x0a\x09^ classReferences",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classReferences:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@classReferences"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageSends",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._sendIndexes())._keys();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.MethodNode)})},
+args: [],
+source: "messageSends\x0a\x09^ self sendIndexes keys",
+messageSends: ["keys", "sendIndexes"],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "method\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@scope"];
+return $1;
+},
+args: [],
+source: "scope\x0a\x09^ scope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope:",
+protocol: 'accessing',
+fn: function (aMethodScope){
+var self=this;
+self["@scope"]=aMethodScope;
+return self},
+args: ["aMethodScope"],
+source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selector"];
+return $1;
+},
+args: [],
+source: "selector\x0a\x09^ selector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@selector"]=aString;
+return self},
+args: ["aString"],
+source: "selector: aString\x0a\x09selector := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendIndexes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@sendIndexes"];
+return $1;
+},
+args: [],
+source: "sendIndexes\x0a\x09^ sendIndexes",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendIndexes:",
+protocol: 'accessing',
+fn: function (aDictionary){
+var self=this;
+self["@sendIndexes"]=aDictionary;
+return self},
+args: ["aDictionary"],
+source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sequenceNode",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+var $early={};
+try {
+_st(self._nodes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(each)._isSequenceNode();
+if(smalltalk.assert($1)){
+throw $early=[each];
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return nil;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},globals.MethodNode)})},
+args: [],
+source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
+messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@source"];
+return $1;
+},
+args: [],
+source: "source\x0a\x09^ source",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@source"]=aString;
+return self},
+args: ["aString"],
+source: "source: aString\x0a\x09source := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superSends",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@superSends"];
+return $1;
+},
+args: [],
+source: "superSends\x0a\x09^ superSends",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superSends:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@superSends"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "superSends: aCollection\x0a\x09superSends := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodNode);
+
+
+
+smalltalk.addClass('ReturnNode', globals.Node, ['scope'], 'Compiler-AST');
+globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitReturnNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ReturnNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
+messageSends: ["visitReturnNode:"],
+referencedClasses: []
+}),
+globals.ReturnNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isReturnNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isReturnNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ReturnNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nonLocalReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._scope())._isMethodScope())._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},globals.ReturnNode)})},
+args: [],
+source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
+messageSends: ["not", "isMethodScope", "scope"],
+referencedClasses: []
+}),
+globals.ReturnNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@scope"];
+return $1;
+},
+args: [],
+source: "scope\x0a\x09^ scope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ReturnNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope:",
+protocol: 'accessing',
+fn: function (aLexicalScope){
+var self=this;
+self["@scope"]=aLexicalScope;
+return self},
+args: ["aLexicalScope"],
+source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ReturnNode);
+
+
+
+smalltalk.addClass('SendNode', globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
+globals.SendNode.comment="I represent an message send node.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitSendNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SendNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
+messageSends: ["visitSendNode:"],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@arguments"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@arguments"]=[];
+$1=self["@arguments"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.SendNode)})},
+args: [],
+source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@arguments"]=aCollection;
+_st(aCollection)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._parent_(self);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.SendNode)})},
+args: ["aCollection"],
+source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
+messageSends: ["do:", "parent:"],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cascadeNodeWithMessages:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+var first;
+function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
+function $CascadeNode(){return globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$5,$3;
+$1=_st($SendNode())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._selector_(self._selector());
+_st($1)._arguments_(self._arguments());
+$2=_st($1)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+first=$2;
+$4=_st($CascadeNode())._new();
+_st($4)._receiver_(self._receiver());
+_st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
+$5=_st($4)._yourself();
+$3=$5;
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},globals.SendNode)})},
+args: ["aCollection"],
+source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself",
+messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
+referencedClasses: ["SendNode", "CascadeNode", "Array"]
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "index",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@index"];
+return $1;
+},
+args: [],
+source: "index\x0a\x09^ index",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "index:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@index"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "index: anInteger\x0a\x09index := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isCascadeSendNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._parent())._isCascadeNode();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},globals.SendNode)})},
+args: [],
+source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
+messageSends: ["isCascadeNode", "parent"],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNavigationNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isNavigationNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSendNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSendNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "navigationLink",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._selector();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.SendNode)})},
+args: [],
+source: "navigationLink\x0a\x09^ self selector",
+messageSends: ["selector"],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nodes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$5,$6,$4,$receiver;
+$1=self._receiver();
+$ctx1.sendIdx["receiver"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$3=self._arguments();
+$ctx1.sendIdx["arguments"]=1;
+$2=_st($3)._copy();
+return $2;
+} else {
+$1;
+};
+$5=_st($Array())._with_(self._receiver());
+_st($5)._addAll_(self._arguments());
+$6=_st($5)._yourself();
+$4=$6;
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.SendNode)})},
+args: [],
+source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
+messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"],
+referencedClasses: ["Array"]
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@receiver"];
+return $1;
+},
+args: [],
+source: "receiver\x0a\x09^ receiver",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self["@receiver"]=aNode;
+$1=_st(aNode)._isNode();
+if(smalltalk.assert($1)){
+_st(aNode)._parent_(self);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},globals.SendNode)})},
+args: ["aNode"],
+source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
+messageSends: ["ifTrue:", "isNode", "parent:"],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "requiresSmalltalkContext",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "requiresSmalltalkContext\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selector"];
+return $1;
+},
+args: [],
+source: "selector\x0a\x09^ selector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@selector"]=aString;
+return self},
+args: ["aString"],
+source: "selector: aString\x0a\x09selector := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldBeAliased",
+protocol: 'testing',
+fn: function (){
+var self=this;
+var sends;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+sends=_st(_st(_st(self._method())._sendIndexes())._at_(self._selector()))._size();
+$2=($ctx1.supercall = true, globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st($2)._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._isReferenced())._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(_st(sends).__gt((1)))._and_((function(){
+return smalltalk.withContext(function($ctx4) {
+return _st(self._index()).__lt(sends);
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})})))._or_((function(){
+return smalltalk.withContext(function($ctx4) {
+return self._superSend();
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["and:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["or:"]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},globals.SendNode)})},
+args: [],
+source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])",
+messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stopOnStepping",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "stopOnStepping\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superSend",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@superSend"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"superSend",{},globals.SendNode)})},
+args: [],
+source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superSend:",
+protocol: 'accessing',
+fn: function (aBoolean){
+var self=this;
+self["@superSend"]=aBoolean;
+return self},
+args: ["aBoolean"],
+source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valueForReceiver:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$5,$4,$6,$1,$receiver;
+$2=_st($SendNode())._new();
+_st($2)._position_(self._position());
+_st($2)._source_(self._source());
+$3=$2;
+$5=self._receiver();
+$ctx1.sendIdx["receiver"]=1;
+if(($receiver = $5) == null || $receiver.isNil){
+$4=anObject;
+} else {
+$4=_st(self._receiver())._valueForReceiver_(anObject);
+};
+_st($3)._receiver_($4);
+_st($2)._selector_(self._selector());
+_st($2)._arguments_(self._arguments());
+$6=_st($2)._yourself();
+$1=$6;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},globals.SendNode)})},
+args: ["anObject"],
+source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself",
+messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"],
+referencedClasses: ["SendNode"]
+}),
+globals.SendNode);
+
+
+
+smalltalk.addClass('SequenceNode', globals.Node, ['temps', 'scope'], 'Compiler-AST');
+globals.SequenceNode.comment="I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope).";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitSequenceNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SequenceNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
+messageSends: ["visitSequenceNode:"],
+referencedClasses: []
+}),
+globals.SequenceNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asBlockSequenceNode",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $BlockSequenceNode(){return globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($BlockSequenceNode())._new();
+_st($2)._position_(self._position());
+_st($2)._source_(self._source());
+_st($2)._nodes_(self._nodes());
+_st($2)._temps_(self._temps());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},globals.SequenceNode)})},
+args: [],
+source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
+messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"],
+referencedClasses: ["BlockSequenceNode"]
+}),
+globals.SequenceNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSequenceNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSequenceNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@scope"];
+return $1;
+},
+args: [],
+source: "scope\x0a\x09^ scope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope:",
+protocol: 'accessing',
+fn: function (aLexicalScope){
+var self=this;
+self["@scope"]=aLexicalScope;
+return self},
+args: ["aLexicalScope"],
+source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "temps",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@temps"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=[];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"temps",{},globals.SequenceNode)})},
+args: [],
+source: "temps\x0a\x09^ temps ifNil: [ #() ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.SequenceNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "temps:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@temps"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "temps: aCollection\x0a\x09temps := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceNode);
+
+
+
+smalltalk.addClass('BlockSequenceNode', globals.SequenceNode, [], 'Compiler-AST');
+globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitBlockSequenceNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockSequenceNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
+messageSends: ["visitBlockSequenceNode:"],
+referencedClasses: []
+}),
+globals.BlockSequenceNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBlockSequenceNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isBlockSequenceNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockSequenceNode);
+
+
+
+smalltalk.addClass('ValueNode', globals.Node, ['value'], 'Compiler-AST');
+globals.ValueNode.comment="I represent a value node.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitValueNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ValueNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
+messageSends: ["visitValueNode:"],
+referencedClasses: []
+}),
+globals.ValueNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._value())._isImmutable();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.ValueNode)})},
+args: [],
+source: "isImmutable\x0a\x09^ self value isImmutable",
+messageSends: ["isImmutable", "value"],
+referencedClasses: []
+}),
+globals.ValueNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isValueNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isValueNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ValueNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@value"];
+return $1;
+},
+args: [],
+source: "value\x0a\x09^ value",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ValueNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@value"]=anObject;
+return self},
+args: ["anObject"],
+source: "value: anObject\x0a\x09value := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ValueNode);
+
+
+
+smalltalk.addClass('VariableNode', globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
+globals.VariableNode.comment="I represent an variable node.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitVariableNode_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.VariableNode)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
+messageSends: ["visitVariableNode:"],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "alias",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._binding())._alias();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"alias",{},globals.VariableNode)})},
+args: [],
+source: "alias\x0a\x09^ self binding alias",
+messageSends: ["alias", "binding"],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "assigned",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@assigned"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"assigned",{},globals.VariableNode)})},
+args: [],
+source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "assigned:",
+protocol: 'accessing',
+fn: function (aBoolean){
+var self=this;
+self["@assigned"]=aBoolean;
+return self},
+args: ["aBoolean"],
+source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
+messageSends: [],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "beAssigned",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._binding())._validateAssignment();
+self["@assigned"]=true;
+return self}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},globals.VariableNode)})},
+args: [],
+source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
+messageSends: ["validateAssignment", "binding"],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "binding",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@binding"];
+return $1;
+},
+args: [],
+source: "binding\x0a\x09^ binding",
+messageSends: [],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "binding:",
+protocol: 'accessing',
+fn: function (aScopeVar){
+var self=this;
+self["@binding"]=aScopeVar;
+return self},
+args: ["aScopeVar"],
+source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
+messageSends: [],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isArgument",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._binding())._isArgVar();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isArgument",{},globals.VariableNode)})},
+args: [],
+source: "isArgument\x0a\x09^ self binding isArgVar",
+messageSends: ["isArgVar", "binding"],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._binding())._isImmutable();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.VariableNode)})},
+args: [],
+source: "isImmutable\x0a\x09^ self binding isImmutable",
+messageSends: ["isImmutable", "binding"],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNavigationNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isNavigationNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isVariableNode",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isVariableNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "navigationLink",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.VariableNode)})},
+args: [],
+source: "navigationLink\x0a\x09^ self value",
+messageSends: ["value"],
+referencedClasses: []
+}),
+globals.VariableNode);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ast",
+protocol: '*Compiler-AST',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._source();
+$ctx1.sendIdx["source"]=1;
+_st($1)._ifEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._error_("Method source is empty");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$2=_st($Smalltalk())._parse_(self._source());
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"ast",{},globals.CompiledMethod)})},
+args: [],
+source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
+messageSends: ["ifEmpty:", "source", "error:", "parse:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNode",
+protocol: '*Compiler-AST',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+});

+ 842 - 0
src/Compiler-AST.st

@@ -0,0 +1,842 @@
+Smalltalk createPackage: 'Compiler-AST'!
+Object subclass: #Node
+	instanceVariableNames: 'parent position source nodes shouldBeInlined shouldBeAliased'
+	package: 'Compiler-AST'!
+!Node commentStamp!
+I am the abstract root class of the abstract syntax tree.
+
+Concrete classes should implement `#accept:` to allow visiting.
+
+`position` holds a point containing line and column number of the symbol location in the original source file.!
+
+!Node methodsFor: 'accessing'!
+
+addNode: aNode
+	self nodes add: aNode.
+	aNode parent: self
+!
+
+allNodes
+	| allNodes |
+	
+	allNodes := self nodes asSet.
+	self nodes do: [ :each | 
+		allNodes addAll: each allNodes ].
+	
+	^ allNodes
+!
+
+method
+	^ self parent ifNotNil: [ :node | node method ]
+!
+
+navigationNodeAt: aPoint ifAbsent: aBlock
+	"Answer the navigation node in the receiver's tree at aPoint 
+	or nil if no navigation node was found.
+	
+	See `node >> isNaviationNode`"
+	
+	| children |
+	
+	children := self allNodes select: [ :each | 
+		each isNavigationNode and: [ each inPosition: aPoint ] ].
+	
+	children ifEmpty: [ ^ aBlock value ].
+	
+	^ (children asArray sort: [ :a :b | 
+		(a positionStart dist: aPoint) <= 
+		(b positionStart dist: aPoint) ]) first
+!
+
+nextChild
+	"Answer the next node after aNode.
+	Recurse into the possible children of the receiver to answer the next node to be evaluated"
+	
+	^ self nodes isEmpty
+		ifTrue: [ self ]
+		ifFalse: [ self nodes first nextChild ]
+!
+
+nextNode
+	^ self parent ifNotNil: [ :node |
+		node nextNode: self ]
+!
+
+nextNode: aNode
+	"Answer the next node after aNode.
+	Recurse into the possible children of the next node to answer the next node to be evaluated"
+	
+	| next |
+	
+	next := self nodes 
+		at: (self nodes indexOf: aNode) + 1
+		ifAbsent: [ ^ self ].
+	
+	^ next nextChild
+!
+
+nodes
+	^ nodes ifNil: [ nodes := Array new ]
+!
+
+parent
+	^ parent
+!
+
+parent: aNode
+	parent := aNode
+!
+
+position
+	"answer the line and column of the receiver in the source code"
+	
+	^ position ifNil: [ 
+		self parent ifNotNil: [ :node | node position ] ]
+!
+
+position: aPosition
+	position := aPosition
+!
+
+positionEnd
+	^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))
+!
+
+positionStart
+	^ self position
+!
+
+shouldBeAliased
+	^ shouldBeAliased ifNil: [ false ]
+!
+
+shouldBeAliased: aBoolean
+	shouldBeAliased := aBoolean
+!
+
+shouldBeInlined
+	^ shouldBeInlined ifNil: [ false ]
+!
+
+shouldBeInlined: aBoolean
+	shouldBeInlined := aBoolean
+!
+
+size
+	^ self source size
+!
+
+source
+	^ source ifNil: [ '' ]
+!
+
+source: aString
+	source := aString
+! !
+
+!Node methodsFor: 'building'!
+
+nodes: aCollection
+	nodes := aCollection.
+	aCollection do: [ :each | each parent: self ]
+! !
+
+!Node methodsFor: 'copying'!
+
+postCopy
+	super postCopy.
+	self nodes do: [ :each | each parent: self ]
+! !
+
+!Node methodsFor: 'testing'!
+
+inPosition: aPoint
+	^ (self positionStart <= aPoint and: [
+		self positionEnd >= aPoint ])
+!
+
+isAssignmentNode
+	^ false
+!
+
+isBlockNode
+	^ false
+!
+
+isBlockSequenceNode
+	^ false
+!
+
+isCascadeNode
+	^ false
+!
+
+isImmutable
+	^ false
+!
+
+isJSStatementNode
+	^ false
+!
+
+isLastChild
+	^ self parent nodes last = self
+!
+
+isNavigationNode
+	"Answer true if the node can be navigated to"
+	
+	^ false
+!
+
+isNode
+	^ true
+!
+
+isReferenced
+	"Answer true if the receiver is referenced by other nodes.
+	Do not take sequences or assignments into account"
+	
+	^ (self parent isSequenceNode or: [
+		self parent isAssignmentNode ]) not
+!
+
+isReturnNode
+	^ false
+!
+
+isSendNode
+	^ false
+!
+
+isSequenceNode
+	^ false
+!
+
+isValueNode
+	^ false
+!
+
+isVariableNode
+	^ false
+!
+
+requiresSmalltalkContext
+	"Answer true if the receiver requires a smalltalk context.
+	Only send nodes require a context.
+	
+	If no node requires a context, the method will be compiled without one.
+	See `IRJSTranslator` and `JSStream` for context creation"
+	
+	^ (self nodes 
+		detect: [ :each | each requiresSmalltalkContext ]
+		ifNone: [ nil ]) notNil
+!
+
+stopOnStepping
+	^ false
+!
+
+subtreeNeedsAliasing
+	^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [
+		self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]
+! !
+
+!Node methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitNode: self
+! !
+
+Node subclass: #AssignmentNode
+	instanceVariableNames: 'left right'
+	package: 'Compiler-AST'!
+!AssignmentNode commentStamp!
+I represent an assignment node.!
+
+!AssignmentNode methodsFor: 'accessing'!
+
+left
+	^ left
+!
+
+left: aNode
+	left := aNode.
+	aNode parent: self
+!
+
+nodes
+	^ Array with: self left with: self right
+!
+
+right
+	^ right
+!
+
+right: aNode
+	right := aNode.
+	aNode parent: self
+! !
+
+!AssignmentNode methodsFor: 'testing'!
+
+isAssignmentNode
+	^ true
+!
+
+shouldBeAliased
+	^ super shouldBeAliased or: [ self isReferenced ]
+! !
+
+!AssignmentNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitAssignmentNode: self
+! !
+
+Node subclass: #BlockNode
+	instanceVariableNames: 'parameters scope'
+	package: 'Compiler-AST'!
+!BlockNode commentStamp!
+I represent an block closure node.!
+
+!BlockNode methodsFor: 'accessing'!
+
+nextChild
+	"Answer the receiver as we want to avoid eager evaluation"
+	
+	^ self
+!
+
+nextNode: aNode
+	"Answer the receiver as we want to avoid eager evaluation"
+	
+	^ self
+!
+
+parameters
+	^ parameters ifNil: [ parameters := Array new ]
+!
+
+parameters: aCollection
+	parameters := aCollection
+!
+
+scope
+	^ scope
+!
+
+scope: aLexicalScope
+	scope := aLexicalScope
+! !
+
+!BlockNode methodsFor: 'testing'!
+
+isBlockNode
+	^ true
+!
+
+subtreeNeedsAliasing
+	^ self shouldBeAliased or: [ self shouldBeInlined ]
+! !
+
+!BlockNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitBlockNode: self
+! !
+
+Node subclass: #CascadeNode
+	instanceVariableNames: 'receiver'
+	package: 'Compiler-AST'!
+!CascadeNode commentStamp!
+I represent an cascade node.!
+
+!CascadeNode methodsFor: 'accessing'!
+
+receiver
+	^ receiver
+!
+
+receiver: aNode
+	receiver := aNode
+! !
+
+!CascadeNode methodsFor: 'testing'!
+
+isCascadeNode
+	^ true
+! !
+
+!CascadeNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitCascadeNode: self
+! !
+
+Node subclass: #DynamicArrayNode
+	instanceVariableNames: ''
+	package: 'Compiler-AST'!
+!DynamicArrayNode commentStamp!
+I represent an dynamic array node.!
+
+!DynamicArrayNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitDynamicArrayNode: self
+! !
+
+Node subclass: #DynamicDictionaryNode
+	instanceVariableNames: ''
+	package: 'Compiler-AST'!
+!DynamicDictionaryNode commentStamp!
+I represent an dynamic dictionary node.!
+
+!DynamicDictionaryNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitDynamicDictionaryNode: self
+! !
+
+Node subclass: #JSStatementNode
+	instanceVariableNames: ''
+	package: 'Compiler-AST'!
+!JSStatementNode commentStamp!
+I represent an JavaScript statement node.!
+
+!JSStatementNode methodsFor: 'testing'!
+
+isJSStatementNode
+	^ true
+!
+
+requiresSmalltalkContext
+	^ true
+! !
+
+!JSStatementNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitJSStatementNode: self
+! !
+
+Node subclass: #MethodNode
+	instanceVariableNames: 'selector arguments source scope classReferences sendIndexes superSends'
+	package: 'Compiler-AST'!
+!MethodNode commentStamp!
+I represent an method node.
+
+A method node must be the root and only method node of a valid AST.!
+
+!MethodNode methodsFor: 'accessing'!
+
+arguments
+	^ arguments ifNil: [ #() ]
+!
+
+arguments: aCollection
+	arguments := aCollection
+!
+
+classReferences
+	^ classReferences
+!
+
+classReferences: aCollection
+	classReferences := aCollection
+!
+
+messageSends
+	^ self sendIndexes keys
+!
+
+method
+	^ self
+!
+
+scope
+	^ scope
+!
+
+scope: aMethodScope
+	scope := aMethodScope
+!
+
+selector
+	^ selector
+!
+
+selector: aString
+	selector := aString
+!
+
+sendIndexes
+	^ sendIndexes
+!
+
+sendIndexes: aDictionary
+	sendIndexes := aDictionary
+!
+
+sequenceNode
+	self nodes do: [ :each |
+		each isSequenceNode ifTrue: [ ^ each ] ].
+		
+	^ nil
+!
+
+source
+	^ source
+!
+
+source: aString
+	source := aString
+!
+
+superSends
+	^ superSends
+!
+
+superSends: aCollection
+	superSends := aCollection
+! !
+
+!MethodNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitMethodNode: self
+! !
+
+Node subclass: #ReturnNode
+	instanceVariableNames: 'scope'
+	package: 'Compiler-AST'!
+!ReturnNode commentStamp!
+I represent an return node. At the AST level, there is not difference between a local return or non-local return.!
+
+!ReturnNode methodsFor: 'accessing'!
+
+scope
+	^ scope
+!
+
+scope: aLexicalScope
+	scope := aLexicalScope
+! !
+
+!ReturnNode methodsFor: 'testing'!
+
+isReturnNode
+	^ true
+!
+
+nonLocalReturn
+	^ self scope isMethodScope not
+! !
+
+!ReturnNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitReturnNode: self
+! !
+
+Node subclass: #SendNode
+	instanceVariableNames: 'selector arguments receiver superSend index'
+	package: 'Compiler-AST'!
+!SendNode commentStamp!
+I represent an message send node.!
+
+!SendNode methodsFor: 'accessing'!
+
+arguments
+	^ arguments ifNil: [ arguments := #() ]
+!
+
+arguments: aCollection
+	arguments := aCollection.
+	aCollection do: [ :each | each parent: self ]
+!
+
+cascadeNodeWithMessages: aCollection
+	| first |
+	first := SendNode new
+		selector: self selector;
+		arguments: self arguments;
+		yourself.
+	^ CascadeNode new
+		receiver: self receiver;
+		nodes: (Array with: first), aCollection;
+		yourself
+!
+
+index
+	^ index
+!
+
+index: anInteger
+	index := anInteger
+!
+
+navigationLink
+	^ self selector
+!
+
+nodes
+	self receiver ifNil: [ ^ self arguments copy ].
+	
+	^ (Array with: self receiver)
+		addAll: self arguments;
+		yourself
+!
+
+receiver
+	^ receiver
+!
+
+receiver: aNode
+	receiver := aNode.
+	aNode isNode ifTrue: [
+		aNode parent: self ]
+!
+
+selector
+	^ selector
+!
+
+selector: aString
+	selector := aString
+!
+
+superSend
+	^ superSend ifNil: [ false ]
+!
+
+superSend: aBoolean
+	superSend := aBoolean
+!
+
+valueForReceiver: anObject
+	^ SendNode new
+		position: self position;
+		source: self source;
+		receiver: (self receiver
+		ifNil: [ anObject ] 
+		ifNotNil: [ self receiver valueForReceiver: anObject ]);
+		selector: self selector;
+		arguments: self arguments;
+		yourself
+! !
+
+!SendNode methodsFor: 'testing'!
+
+isCascadeSendNode
+	^ self parent isCascadeNode
+!
+
+isNavigationNode
+	^ true
+!
+
+isSendNode
+	^ true
+!
+
+requiresSmalltalkContext
+	^ true
+!
+
+shouldBeAliased
+	"Because we keep track of send indexes, some send nodes need additional care for aliasing. 
+	See IRJSVisitor >> visitIRSend:"
+	
+	| sends |
+	
+	sends := (self method sendIndexes at: self selector) size.
+	
+	^ (super shouldBeAliased or: [
+		self isReferenced and: [
+			(sends > 1 and: [ self index < sends ])
+				or: [ self superSend ] ] ])
+!
+
+stopOnStepping
+	^ true
+! !
+
+!SendNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitSendNode: self
+! !
+
+Node subclass: #SequenceNode
+	instanceVariableNames: 'temps scope'
+	package: 'Compiler-AST'!
+!SequenceNode commentStamp!
+I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope).!
+
+!SequenceNode methodsFor: 'accessing'!
+
+scope
+	^ scope
+!
+
+scope: aLexicalScope
+	scope := aLexicalScope
+!
+
+temps
+	^ temps ifNil: [ #() ]
+!
+
+temps: aCollection
+	temps := aCollection
+! !
+
+!SequenceNode methodsFor: 'converting'!
+
+asBlockSequenceNode
+	^ BlockSequenceNode new
+		position: self position;
+		source: self source;
+		nodes: self nodes;
+		temps: self temps;
+		yourself
+! !
+
+!SequenceNode methodsFor: 'testing'!
+
+isSequenceNode
+	^ true
+! !
+
+!SequenceNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitSequenceNode: self
+! !
+
+SequenceNode subclass: #BlockSequenceNode
+	instanceVariableNames: ''
+	package: 'Compiler-AST'!
+!BlockSequenceNode commentStamp!
+I represent an special sequence node for block scopes.!
+
+!BlockSequenceNode methodsFor: 'testing'!
+
+isBlockSequenceNode
+	^ true
+! !
+
+!BlockSequenceNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitBlockSequenceNode: self
+! !
+
+Node subclass: #ValueNode
+	instanceVariableNames: 'value'
+	package: 'Compiler-AST'!
+!ValueNode commentStamp!
+I represent a value node.!
+
+!ValueNode methodsFor: 'accessing'!
+
+value
+	^ value
+!
+
+value: anObject
+	value := anObject
+! !
+
+!ValueNode methodsFor: 'testing'!
+
+isImmutable
+	^ self value isImmutable
+!
+
+isValueNode
+	^ true
+! !
+
+!ValueNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitValueNode: self
+! !
+
+ValueNode subclass: #VariableNode
+	instanceVariableNames: 'assigned binding'
+	package: 'Compiler-AST'!
+!VariableNode commentStamp!
+I represent an variable node.!
+
+!VariableNode methodsFor: 'accessing'!
+
+alias
+	^ self binding alias
+!
+
+assigned
+	^ assigned ifNil: [ false ]
+!
+
+assigned: aBoolean
+	assigned := aBoolean
+!
+
+beAssigned
+	self binding validateAssignment.
+	assigned := true
+!
+
+binding
+	^ binding
+!
+
+binding: aScopeVar
+	binding := aScopeVar
+!
+
+navigationLink
+	^ self value
+! !
+
+!VariableNode methodsFor: 'testing'!
+
+isArgument
+	^ self binding isArgVar
+!
+
+isImmutable
+	^ self binding isImmutable
+!
+
+isNavigationNode
+	^ true
+!
+
+isVariableNode
+	^ true
+! !
+
+!VariableNode methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitVariableNode: self
+! !
+
+!CompiledMethod methodsFor: '*Compiler-AST'!
+
+ast
+	self source ifEmpty: [ self error: 'Method source is empty' ].
+	
+	^ Smalltalk parse: self source
+! !
+
+!Object methodsFor: '*Compiler-AST'!
+
+isNode
+	^ false
+! !
+

+ 1148 - 0
src/Compiler-Core.js

@@ -0,0 +1,1148 @@
+define("amber_core/Compiler-Core", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Compiler-Core');
+smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('AbstractCodeGenerator', globals.Object, ['currentClass', 'source'], 'Compiler-Core');
+globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classNameFor:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1;
+$2=_st(aClass)._isMetaclass();
+if(smalltalk.assert($2)){
+$3=_st(_st(aClass)._instanceClass())._name();
+$ctx1.sendIdx["name"]=1;
+$1=_st($3).__comma(".klass");
+} else {
+$4=_st(aClass)._isNil();
+if(smalltalk.assert($4)){
+$1="nil";
+} else {
+$1=_st(aClass)._name();
+};
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractCodeGenerator)})},
+args: ["aClass"],
+source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]",
+messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
+referencedClasses: []
+}),
+globals.AbstractCodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileNode:",
+protocol: 'compiling',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},globals.AbstractCodeGenerator)})},
+args: ["aNode"],
+source: "compileNode: aNode\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.AbstractCodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@currentClass"];
+return $1;
+},
+args: [],
+source: "currentClass\x0a\x09^ currentClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AbstractCodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@currentClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "currentClass: aClass\x0a\x09currentClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AbstractCodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pseudoVariables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._pseudoVariableNames();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},globals.AbstractCodeGenerator)})},
+args: [],
+source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
+messageSends: ["pseudoVariableNames"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.AbstractCodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@source"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"source",{},globals.AbstractCodeGenerator)})},
+args: [],
+source: "source\x0a\x09^ source ifNil: [ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.AbstractCodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@source"]=aString;
+return self},
+args: ["aString"],
+source: "source: aString\x0a\x09source := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AbstractCodeGenerator);
+
+
+
+smalltalk.addClass('CodeGenerator', globals.AbstractCodeGenerator, [], 'Compiler-Core');
+globals.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileNode:",
+protocol: 'compiling',
+fn: function (aNode){
+var self=this;
+var ir,stream;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+_st(self._semanticAnalyzer())._visit_(aNode);
+$ctx1.sendIdx["visit:"]=1;
+ir=_st(self._translator())._visit_(aNode);
+$ctx1.sendIdx["visit:"]=2;
+$2=self._irTranslator();
+_st($2)._currentClass_(self._currentClass());
+_st($2)._visit_(ir);
+$3=_st($2)._contents();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.CodeGenerator)})},
+args: ["aNode"],
+source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
+messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"],
+referencedClasses: []
+}),
+globals.CodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "irTranslator",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+function $IRJSTranslator(){return globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($IRJSTranslator())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.CodeGenerator)})},
+args: [],
+source: "irTranslator\x0a\x09^ IRJSTranslator new",
+messageSends: ["new"],
+referencedClasses: ["IRJSTranslator"]
+}),
+globals.CodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "semanticAnalyzer",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($SemanticAnalyzer())._on_(self._currentClass());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},globals.CodeGenerator)})},
+args: [],
+source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
+messageSends: ["on:", "currentClass"],
+referencedClasses: ["SemanticAnalyzer"]
+}),
+globals.CodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "translator",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+function $IRASTTranslator(){return globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($IRASTTranslator())._new();
+_st($2)._source_(self._source());
+_st($2)._theClass_(self._currentClass());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"translator",{},globals.CodeGenerator)})},
+args: [],
+source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
+messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"],
+referencedClasses: ["IRASTTranslator"]
+}),
+globals.CodeGenerator);
+
+
+
+smalltalk.addClass('Compiler', globals.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
+globals.Compiler.comment="I provide the public interface for compiling Amber source code into JavaScript.\x0a\x0aThe code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.\x0aThe default code generator is an instance of `InlinedCodeGenerator`";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "codeGeneratorClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@codeGeneratorClass"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$InliningCodeGenerator();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},globals.Compiler)})},
+args: [],
+source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
+messageSends: ["ifNil:"],
+referencedClasses: ["InliningCodeGenerator"]
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "codeGeneratorClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@codeGeneratorClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compile:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._compileNode_(self._parse_(aString));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Compiler)})},
+args: ["aString"],
+source: "compile: aString\x0a\x09^ self compileNode: (self parse: aString)",
+messageSends: ["compileNode:", "parse:"],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compile:forClass:",
+protocol: 'compiling',
+fn: function (aString,aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._currentClass_(aClass);
+self._source_(aString);
+$1=self._compile_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass},globals.Compiler)})},
+args: ["aString", "aClass"],
+source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^ self compile: aString",
+messageSends: ["currentClass:", "source:", "compile:"],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileExpression:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._currentClass_($DoIt());
+$1=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
+$ctx1.sendIdx[","]=1;
+self._source_($1);
+$2=self._compileNode_(self._parse_(self._source()));
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString},globals.Compiler)})},
+args: ["aString"],
+source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
+messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
+referencedClasses: ["DoIt"]
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileExpression:on:",
+protocol: 'compiling',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._currentClass_(_st(anObject)._class());
+$1=_st("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
+$ctx1.sendIdx[","]=1;
+self._source_($1);
+$2=self._compileNode_(self._parse_(self._source()));
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},globals.Compiler)})},
+args: ["aString", "anObject"],
+source: "compileExpression: aString on: anObject\x0a\x09self currentClass: anObject class.\x0a\x09self source: 'xxxDoIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
+messageSends: ["currentClass:", "class", "source:", ",", "compileNode:", "parse:", "source"],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileNode:",
+protocol: 'compiling',
+fn: function (aNode){
+var self=this;
+var generator,result;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+generator=_st(self._codeGeneratorClass())._new();
+$1=generator;
+_st($1)._source_(self._source());
+$2=_st($1)._currentClass_(self._currentClass());
+result=_st(generator)._compileNode_(aNode);
+self._unknownVariables_([]);
+$3=result;
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},globals.Compiler)})},
+args: ["aNode"],
+source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
+messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@currentClass"];
+return $1;
+},
+args: [],
+source: "currentClass\x0a\x09^ currentClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@currentClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "currentClass: aClass\x0a\x09currentClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "eval:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return eval(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},globals.Compiler)})},
+args: ["aString"],
+source: "eval: aString\x0a\x09<return eval(aString)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluateExpression:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._evaluateExpression_on_(aString,_st($DoIt())._new());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},globals.Compiler)})},
+args: ["aString"],
+source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09^ self evaluateExpression: aString on: DoIt new",
+messageSends: ["evaluateExpression:on:", "new"],
+referencedClasses: ["DoIt"]
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluateExpression:on:",
+protocol: 'compiling',
+fn: function (aString,anObject){
+var self=this;
+var result,method;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+method=self._eval_(self._compileExpression_on_(aString,anObject));
+_st(method)._protocol_("xxxDoIt");
+$1=_st(anObject)._class();
+$ctx1.sendIdx["class"]=1;
+_st($1)._addCompiledMethod_(method);
+result=_st(anObject)._xxxDoIt();
+_st(_st(anObject)._class())._removeCompiledMethod_(method);
+$2=result;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},globals.Compiler)})},
+args: ["aString", "anObject"],
+source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: 'xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
+messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "install:forClass:protocol:",
+protocol: 'compiling',
+fn: function (aString,aBehavior,anotherString){
+var self=this;
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(self._eval_(self._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString},globals.Compiler)})},
+args: ["aString", "aBehavior", "anotherString"],
+source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: (self eval: (self compile: aString forClass: aBehavior))\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
+messageSends: ["installMethod:forClass:protocol:", "new", "eval:", "compile:forClass:"],
+referencedClasses: ["ClassBuilder"]
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parse:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._parse_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.Compiler)})},
+args: ["aString"],
+source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
+messageSends: ["parse:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parseExpression:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
+$ctx1.sendIdx[","]=1;
+$1=self._parse_($2);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},globals.Compiler)})},
+args: ["aString"],
+source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
+messageSends: ["parse:", ","],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "recompile:",
+protocol: 'compiling',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(_st(_st(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._install_forClass_protocol_(_st(each)._source(),aClass,_st(each)._protocol());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Recompiling ".__comma(_st(aClass)._name()));
+$1=_st(aClass)._isMetaclass();
+if(! smalltalk.assert($1)){
+self._recompile_(_st(aClass)._class());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler)})},
+args: ["aClass"],
+source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]",
+messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "recompileAll",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($Smalltalk())._classes())._do_displayingProgress_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._recompile_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Compiling all classes...");
+return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler)})},
+args: [],
+source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
+messageSends: ["do:displayingProgress:", "classes", "recompile:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@source"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"source",{},globals.Compiler)})},
+args: [],
+source: "source\x0a\x09^ source ifNil: [ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@source"]=aString;
+return self},
+args: ["aString"],
+source: "source: aString\x0a\x09source := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unknownVariables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@unknownVariables"];
+return $1;
+},
+args: [],
+source: "unknownVariables\x0a\x09^ unknownVariables",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Compiler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unknownVariables:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@unknownVariables"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Compiler);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "recompile:",
+protocol: 'compiling',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._new())._recompile_(aClass);
+return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler.klass)})},
+args: ["aClass"],
+source: "recompile: aClass\x0a\x09self new recompile: aClass",
+messageSends: ["recompile:", "new"],
+referencedClasses: []
+}),
+globals.Compiler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "recompileAll",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($Smalltalk())._classes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._recompile_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler.klass)})},
+args: [],
+source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
+messageSends: ["do:", "classes", "recompile:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Compiler.klass);
+
+
+smalltalk.addClass('DoIt', globals.Object, [], 'Compiler-Core');
+globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "xxxDoIt",
+protocol: 'xxxDoIt',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($Smalltalk())._packages())._do_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(each)._commit();
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"xxxDoIt",{},globals.DoIt)})},
+args: [],
+source: "xxxDoIt ^ [ Smalltalk packages do: [ :each | each commit ] ] value",
+messageSends: ["value", "do:", "packages", "commit"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.DoIt);
+
+
+
+smalltalk.addClass('Evaluator', globals.InterfacingObject, [], 'Compiler-Core');
+globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:context:",
+protocol: 'evaluating',
+fn: function (aString,aContext){
+var self=this;
+var compiler,ast;
+function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+function $AISemanticAnalyzer(){return globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+var $early={};
+try {
+compiler=_st($Compiler())._new();
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+ast=_st(compiler)._parseExpression_(aString);
+return ast;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
+return smalltalk.withContext(function($ctx2) {
+$1=self._alert_(_st(ex)._messageText());
+throw $early=[$1];
+}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
+$2=_st($AISemanticAnalyzer())._on_(_st(_st(aContext)._receiver())._class());
+_st($2)._context_(aContext);
+$3=_st($2)._visit_(ast);
+$4=_st(aContext)._evaluateNode_(ast);
+return $4;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},globals.Evaluator)})},
+args: ["aString", "aContext"],
+source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast",
+messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"],
+referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"]
+}),
+globals.Evaluator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:for:",
+protocol: 'evaluating',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(anObject)._evaluate_on_(aString,self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Evaluator)})},
+args: ["aString", "anObject"],
+source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
+messageSends: ["evaluate:on:"],
+referencedClasses: []
+}),
+globals.Evaluator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:receiver:",
+protocol: 'evaluating',
+fn: function (aString,anObject){
+var self=this;
+var compiler;
+function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+var $early={};
+try {
+compiler=_st($Compiler())._new();
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(compiler)._parseExpression_(aString);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
+return smalltalk.withContext(function($ctx2) {
+$1=self._alert_(_st(ex)._messageText());
+throw $early=[$1];
+}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
+$2=_st(compiler)._evaluateExpression_on_(aString,anObject);
+return $2;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},globals.Evaluator)})},
+args: ["aString", "anObject"],
+source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
+messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"],
+referencedClasses: ["Compiler", "Error"]
+}),
+globals.Evaluator);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:for:",
+protocol: 'instance creation',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._new())._evaluate_for_(aString,anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Evaluator.klass)})},
+args: ["aString", "anObject"],
+source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
+messageSends: ["evaluate:for:", "new"],
+referencedClasses: []
+}),
+globals.Evaluator.klass);
+
+
+smalltalk.addClass('NodeVisitor', globals.Object, [], 'Compiler-Core');
+globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visit:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aNode)._accept_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visit: aNode\x0a\x09^ aNode accept: self",
+messageSends: ["accept:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitAll:",
+protocol: 'visiting',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aCollection)._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},globals.NodeVisitor)})},
+args: ["aCollection"],
+source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
+messageSends: ["collect:", "visit:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitAssignmentNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitBlockNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitBlockSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitSequenceNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
+messageSends: ["visitSequenceNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitCascadeNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitDynamicArrayNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitDynamicDictionaryNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitJSStatementNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitMethodNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitAll_(_st(aNode)._nodes());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
+messageSends: ["visitAll:", "nodes"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitReturnNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSendNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitValueNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitVariableNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitNode_(aNode);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.NodeVisitor)})},
+args: ["aNode"],
+source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
+messageSends: ["visitNode:"],
+referencedClasses: []
+}),
+globals.NodeVisitor);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asVariableName",
+protocol: '*Compiler-Core',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(_st($Smalltalk())._reservedWords())._includes_(self);
+if(smalltalk.assert($2)){
+$1=self.__comma("_");
+} else {
+$1=self;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asVariableName",{},globals.String)})},
+args: [],
+source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
+messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","],
+referencedClasses: ["Smalltalk"]
+}),
+globals.String);
+
+});

+ 353 - 0
src/Compiler-Core.st

@@ -0,0 +1,353 @@
+Smalltalk createPackage: 'Compiler-Core'!
+Object subclass: #AbstractCodeGenerator
+	instanceVariableNames: 'currentClass source'
+	package: 'Compiler-Core'!
+!AbstractCodeGenerator commentStamp!
+I am the abstract super class of all code generators and provide their common API.!
+
+!AbstractCodeGenerator methodsFor: 'accessing'!
+
+classNameFor: aClass
+	^ aClass isMetaclass
+		ifTrue: [ aClass instanceClass name, '.klass' ]
+		ifFalse: [
+		aClass isNil
+			ifTrue: [ 'nil' ]
+			ifFalse: [ aClass name ]]
+!
+
+currentClass
+	^ currentClass
+!
+
+currentClass: aClass
+	currentClass := aClass
+!
+
+pseudoVariables
+	^ Smalltalk pseudoVariableNames
+!
+
+source
+	^ source ifNil: [ '' ]
+!
+
+source: aString
+	source := aString
+! !
+
+!AbstractCodeGenerator methodsFor: 'compiling'!
+
+compileNode: aNode
+	self subclassResponsibility
+! !
+
+AbstractCodeGenerator subclass: #CodeGenerator
+	instanceVariableNames: ''
+	package: 'Compiler-Core'!
+!CodeGenerator commentStamp!
+I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.
+See `InliningCodeGenerator` for an optimized JavaScript code generation.!
+
+!CodeGenerator methodsFor: 'compiling'!
+
+compileNode: aNode
+	| ir stream |
+	self semanticAnalyzer visit: aNode.
+	ir := self translator visit: aNode.
+	^ self irTranslator
+		currentClass: self currentClass;
+		visit: ir;
+		contents
+!
+
+irTranslator
+	^ IRJSTranslator new
+!
+
+semanticAnalyzer
+	^ SemanticAnalyzer on: self currentClass
+!
+
+translator
+	^ IRASTTranslator new
+		source: self source;
+		theClass: self currentClass;
+		yourself
+! !
+
+Object subclass: #Compiler
+	instanceVariableNames: 'currentClass source unknownVariables codeGeneratorClass'
+	package: 'Compiler-Core'!
+!Compiler commentStamp!
+I provide the public interface for compiling Amber source code into JavaScript.
+
+The code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.
+The default code generator is an instance of `InlinedCodeGenerator`!
+
+!Compiler methodsFor: 'accessing'!
+
+codeGeneratorClass
+	^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]
+!
+
+codeGeneratorClass: aClass
+	codeGeneratorClass := aClass
+!
+
+currentClass
+	^ currentClass
+!
+
+currentClass: aClass
+	currentClass := aClass
+!
+
+source
+	^ source ifNil: [ '' ]
+!
+
+source: aString
+	source := aString
+!
+
+unknownVariables
+	^ unknownVariables
+!
+
+unknownVariables: aCollection
+	unknownVariables := aCollection
+! !
+
+!Compiler methodsFor: 'compiling'!
+
+compile: aString
+	^ self compileNode: (self parse: aString)
+!
+
+compile: aString forClass: aClass
+	self currentClass: aClass.
+	self source: aString.
+	^ self compile: aString
+!
+
+compileExpression: aString
+	self currentClass: DoIt.
+	self source: 'doIt ^ [ ', aString, ' ] value'.
+	^ self compileNode: (self parse: self source)
+!
+
+compileExpression: aString on: anObject
+	self currentClass: anObject class.
+	self source: 'xxxDoIt ^ [ ', aString, ' ] value'.
+	^ self compileNode: (self parse: self source)
+!
+
+compileNode: aNode
+	| generator result |
+	generator := self codeGeneratorClass new.
+	generator
+		source: self source;
+		currentClass: self currentClass.
+	result := generator compileNode: aNode.
+	self unknownVariables: #().
+	^ result
+!
+
+eval: aString
+	<return eval(aString)>
+!
+
+evaluateExpression: aString
+	"Unlike #eval: evaluate a Smalltalk expression and answer the returned object"
+	^ self evaluateExpression: aString on: DoIt new
+!
+
+evaluateExpression: aString on: anObject
+	"Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object"
+	| result method |
+	method := self eval: (self compileExpression: aString on: anObject).
+	method protocol: 'xxxDoIt'.
+	anObject class addCompiledMethod: method.
+	result := anObject xxxDoIt.
+	anObject class removeCompiledMethod: method.
+	^ result
+!
+
+install: aString forClass: aBehavior protocol: anotherString
+	^ ClassBuilder new
+		installMethod: (self eval: (self compile: aString forClass: aBehavior))
+		forClass: aBehavior
+		protocol: anotherString
+!
+
+parse: aString
+	^ Smalltalk parse: aString
+!
+
+parseExpression: aString
+	^ self parse: 'doIt ^ [ ', aString, ' ] value'
+!
+
+recompile: aClass
+	aClass methodDictionary values
+		do: [ :each | 
+			self 
+				install: each source 
+				forClass: aClass 
+				protocol: each protocol ]
+		displayingProgress: 'Recompiling ', aClass name.
+	aClass isMetaclass ifFalse: [ self recompile: aClass class ]
+!
+
+recompileAll
+	Smalltalk classes 
+		do: [ :each | self recompile: each ]
+		displayingProgress: 'Compiling all classes...'
+! !
+
+!Compiler class methodsFor: 'compiling'!
+
+recompile: aClass
+	self new recompile: aClass
+!
+
+recompileAll
+	Smalltalk classes do: [ :each |
+		self recompile: each ]
+! !
+
+Object subclass: #DoIt
+	instanceVariableNames: ''
+	package: 'Compiler-Core'!
+!DoIt commentStamp!
+`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.!
+
+InterfacingObject subclass: #Evaluator
+	instanceVariableNames: ''
+	package: 'Compiler-Core'!
+!Evaluator commentStamp!
+I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.!
+
+!Evaluator methodsFor: 'evaluating'!
+
+evaluate: aString context: aContext
+	"Similar to #evaluate:for:, with the following differences:
+	- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`
+	- instead of evaluating against a receiver, evaluate in the context of `aContext`"
+
+	| compiler ast |
+	
+	compiler := Compiler new.
+	[ ast := compiler parseExpression: aString ] 
+		on: Error 
+		do: [ :ex | ^ self alert: ex messageText ].
+		
+	(AISemanticAnalyzer on: aContext receiver class)
+		context: aContext;
+		visit: ast.
+
+	^ aContext evaluateNode: ast
+!
+
+evaluate: aString for: anObject
+	^ anObject evaluate: aString on: self
+!
+
+evaluate: aString receiver: anObject
+	| compiler |
+	
+	compiler := Compiler new.
+	[ compiler parseExpression: aString ] 
+		on: Error 
+		do: [ :ex | ^ self alert: ex messageText ].
+
+	^ compiler evaluateExpression: aString on: anObject
+! !
+
+!Evaluator class methodsFor: 'instance creation'!
+
+evaluate: aString for: anObject
+	^ self new evaluate: aString for: anObject
+! !
+
+Object subclass: #NodeVisitor
+	instanceVariableNames: ''
+	package: 'Compiler-Core'!
+!NodeVisitor commentStamp!
+I am the abstract super class of all AST node visitors.!
+
+!NodeVisitor methodsFor: 'visiting'!
+
+visit: aNode
+	^ aNode accept: self
+!
+
+visitAll: aCollection
+	^ aCollection collect: [ :each | self visit: each ]
+!
+
+visitAssignmentNode: aNode
+	^ self visitNode: aNode
+!
+
+visitBlockNode: aNode
+	^ self visitNode: aNode
+!
+
+visitBlockSequenceNode: aNode
+	^ self visitSequenceNode: aNode
+!
+
+visitCascadeNode: aNode
+	^ self visitNode: aNode
+!
+
+visitDynamicArrayNode: aNode
+	^ self visitNode: aNode
+!
+
+visitDynamicDictionaryNode: aNode
+	^ self visitNode: aNode
+!
+
+visitJSStatementNode: aNode
+	^ self visitNode: aNode
+!
+
+visitMethodNode: aNode
+	^ self visitNode: aNode
+!
+
+visitNode: aNode
+	^ self visitAll: aNode nodes
+!
+
+visitReturnNode: aNode
+	^ self visitNode: aNode
+!
+
+visitSendNode: aNode
+	^ self visitNode: aNode
+!
+
+visitSequenceNode: aNode
+	^ self visitNode: aNode
+!
+
+visitValueNode: aNode
+	^ self visitNode: aNode
+!
+
+visitVariableNode: aNode
+	^ self visitNode: aNode
+! !
+
+!String methodsFor: '*Compiler-Core'!
+
+asVariableName
+	^ (Smalltalk reservedWords includes: self)
+		ifTrue: [ self, '_' ]
+		ifFalse: [ self ]
+! !
+

+ 220 - 0
src/Compiler-Exceptions.js

@@ -0,0 +1,220 @@
+define("amber_core/Compiler-Exceptions", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Compiler-Exceptions');
+smalltalk.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('CompilerError', globals.Error, [], 'Compiler-Exceptions');
+globals.CompilerError.comment="I am the common superclass of all compiling errors.";
+
+
+smalltalk.addClass('ParseError', globals.CompilerError, [], 'Compiler-Exceptions');
+globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
+
+
+smalltalk.addClass('SemanticError', globals.CompilerError, [], 'Compiler-Exceptions');
+globals.SemanticError.comment="I represent an abstract semantic error thrown by the SemanticAnalyzer.\x0aSemantic errors can be unknown variable errors, etc.\x0aSee my subclasses for concrete errors.\x0a\x0aThe IDE should catch instances of Semantic error to deal with them when compiling";
+
+
+smalltalk.addClass('InliningError', globals.SemanticError, [], 'Compiler-Exceptions');
+globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
+
+
+smalltalk.addClass('InvalidAssignmentError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
+globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=" Invalid assignment to variable: ".__comma(self._variableName());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.InvalidAssignmentError)})},
+args: [],
+source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
+messageSends: [",", "variableName"],
+referencedClasses: []
+}),
+globals.InvalidAssignmentError);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableName",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@variableName"];
+return $1;
+},
+args: [],
+source: "variableName\x0a\x09^ variableName",
+messageSends: [],
+referencedClasses: []
+}),
+globals.InvalidAssignmentError);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableName:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@variableName"]=aString;
+return self},
+args: ["aString"],
+source: "variableName: aString\x0a\x09variableName := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.InvalidAssignmentError);
+
+
+
+smalltalk.addClass('ShadowingVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
+globals.ShadowingVariableError.comment="I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.ShadowingVariableError)})},
+args: [],
+source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
+messageSends: [",", "variableName"],
+referencedClasses: []
+}),
+globals.ShadowingVariableError);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableName",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@variableName"];
+return $1;
+},
+args: [],
+source: "variableName\x0a\x09^ variableName",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ShadowingVariableError);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableName:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@variableName"]=aString;
+return self},
+args: ["aString"],
+source: "variableName: aString\x0a\x09variableName := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ShadowingVariableError);
+
+
+
+smalltalk.addClass('UnknownVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
+globals.UnknownVariableError.comment="I get signaled when a variable is not defined.\x0aThe default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.UnknownVariableError)})},
+args: [],
+source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
+messageSends: [",", "variableName"],
+referencedClasses: []
+}),
+globals.UnknownVariableError);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableName",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@variableName"];
+return $1;
+},
+args: [],
+source: "variableName\x0a\x09^ variableName",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UnknownVariableError);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableName:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@variableName"]=aString;
+return self},
+args: ["aString"],
+source: "variableName: aString\x0a\x09variableName := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UnknownVariableError);
+
+
+
+smalltalk.addClass('RethrowErrorHandler', globals.Object, [], 'Compiler-Exceptions');
+globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicSignal:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+throw anError;
+return self}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},globals.RethrowErrorHandler)})},
+args: ["anError"],
+source: "basicSignal: anError\x0a        <throw anError>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.RethrowErrorHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._basicSignal_(anError);
+return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.RethrowErrorHandler)})},
+args: ["anError"],
+source: "handleError: anError\x0a        self basicSignal: anError",
+messageSends: ["basicSignal:"],
+referencedClasses: []
+}),
+globals.RethrowErrorHandler);
+
+
+});

+ 109 - 0
src/Compiler-Exceptions.st

@@ -0,0 +1,109 @@
+Smalltalk createPackage: 'Compiler-Exceptions'!
+Error subclass: #CompilerError
+	instanceVariableNames: ''
+	package: 'Compiler-Exceptions'!
+!CompilerError commentStamp!
+I am the common superclass of all compiling errors.!
+
+CompilerError subclass: #ParseError
+	instanceVariableNames: ''
+	package: 'Compiler-Exceptions'!
+!ParseError commentStamp!
+Instance of ParseError are signaled on any parsing error.
+See `Smalltalk >> #parse:`!
+
+CompilerError subclass: #SemanticError
+	instanceVariableNames: ''
+	package: 'Compiler-Exceptions'!
+!SemanticError commentStamp!
+I represent an abstract semantic error thrown by the SemanticAnalyzer.
+Semantic errors can be unknown variable errors, etc.
+See my subclasses for concrete errors.
+
+The IDE should catch instances of Semantic error to deal with them when compiling!
+
+SemanticError subclass: #InliningError
+	instanceVariableNames: ''
+	package: 'Compiler-Exceptions'!
+!InliningError commentStamp!
+Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.!
+
+SemanticError subclass: #InvalidAssignmentError
+	instanceVariableNames: 'variableName'
+	package: 'Compiler-Exceptions'!
+!InvalidAssignmentError commentStamp!
+I get signaled when a pseudo variable gets assigned.!
+
+!InvalidAssignmentError methodsFor: 'accessing'!
+
+messageText
+	^ ' Invalid assignment to variable: ', self variableName
+!
+
+variableName
+	^ variableName
+!
+
+variableName: aString
+	variableName := aString
+! !
+
+SemanticError subclass: #ShadowingVariableError
+	instanceVariableNames: 'variableName'
+	package: 'Compiler-Exceptions'!
+!ShadowingVariableError commentStamp!
+I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.!
+
+!ShadowingVariableError methodsFor: 'accessing'!
+
+messageText
+	^ 'Variable shadowing error: ', self variableName, ' is already defined'
+!
+
+variableName
+	^ variableName
+!
+
+variableName: aString
+	variableName := aString
+! !
+
+SemanticError subclass: #UnknownVariableError
+	instanceVariableNames: 'variableName'
+	package: 'Compiler-Exceptions'!
+!UnknownVariableError commentStamp!
+I get signaled when a variable is not defined.
+The default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.!
+
+!UnknownVariableError methodsFor: 'accessing'!
+
+messageText
+	^ 'Unknown Variable error: ', self variableName, ' is not defined'
+!
+
+variableName
+	^ variableName
+!
+
+variableName: aString
+	variableName := aString
+! !
+
+Object subclass: #RethrowErrorHandler
+	instanceVariableNames: ''
+	package: 'Compiler-Exceptions'!
+!RethrowErrorHandler commentStamp!
+This class is used in the commandline version of the compiler.
+It uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.
+As a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.!
+
+!RethrowErrorHandler methodsFor: 'error handling'!
+
+basicSignal: anError
+        <throw anError>
+!
+
+handleError: anError
+        self basicSignal: anError
+! !
+

+ 4109 - 0
src/Compiler-IR.js

@@ -0,0 +1,4109 @@
+define("amber_core/Compiler-IR", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Compiler-IR');
+smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('IRASTTranslator', globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
+globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "alias:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var variable;
+function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
+function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
+function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
+$1=_st(aNode)._isImmutable();
+if(smalltalk.assert($1)){
+$2=self._visit_(aNode);
+$ctx1.sendIdx["visit:"]=1;
+return $2;
+};
+$3=_st($IRVariable())._new();
+$ctx1.sendIdx["new"]=1;
+$4=$3;
+$6=_st($AliasVar())._new();
+$ctx1.sendIdx["new"]=2;
+$5=_st($6)._name_("$".__comma(self._nextAlias()));
+_st($4)._variable_($5);
+$7=_st($3)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+variable=$7;
+$8=self._sequence();
+$10=_st($IRAssignment())._new();
+_st($10)._add_(variable);
+$ctx1.sendIdx["add:"]=2;
+_st($10)._add_(self._visit_(aNode));
+$ctx1.sendIdx["add:"]=3;
+$11=_st($10)._yourself();
+$9=$11;
+_st($8)._add_($9);
+$ctx1.sendIdx["add:"]=1;
+_st(_st(self._method())._internalVariables())._add_(variable);
+$12=variable;
+return $12;
+}, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
+messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"],
+referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aliasTemporally:",
+protocol: 'visiting',
+fn: function (aCollection){
+var self=this;
+var threshold,result;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3,$5;
+threshold=(0);
+_st(aCollection)._withIndexDo_((function(each,i){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(each)._subtreeNeedsAliasing();
+if(smalltalk.assert($1)){
+threshold=i;
+return threshold;
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
+$ctx1.sendIdx["withIndexDo:"]=1;
+result=_st($OrderedCollection())._new();
+_st(aCollection)._withIndexDo_((function(each,i){
+return smalltalk.withContext(function($ctx2) {
+$2=result;
+$4=_st(i).__lt_eq(threshold);
+if(smalltalk.assert($4)){
+$3=self._alias_(each);
+} else {
+$3=self._visit_(each);
+};
+return _st($2)._add_($3);
+}, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
+$5=result;
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},globals.IRASTTranslator)})},
+args: ["aCollection"],
+source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result",
+messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@method"];
+return $1;
+},
+args: [],
+source: "method\x0a\x09^ method",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method:",
+protocol: 'accessing',
+fn: function (anIRMethod){
+var self=this;
+self["@method"]=anIRMethod;
+return self},
+args: ["anIRMethod"],
+source: "method: anIRMethod\x0a\x09method := anIRMethod",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextAlias",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=self["@nextAlias"];
+if(($receiver = $1) == null || $receiver.isNil){
+self["@nextAlias"]=(0);
+self["@nextAlias"];
+} else {
+$1;
+};
+self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
+$2=_st(self["@nextAlias"])._asString();
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"nextAlias",{},globals.IRASTTranslator)})},
+args: [],
+source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
+messageSends: ["ifNil:", "+", "asString"],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sequence",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@sequence"];
+return $1;
+},
+args: [],
+source: "sequence\x0a\x09^ sequence",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sequence:",
+protocol: 'accessing',
+fn: function (anIRSequence){
+var self=this;
+self["@sequence"]=anIRSequence;
+return self},
+args: ["anIRSequence"],
+source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@source"];
+return $1;
+},
+args: [],
+source: "source\x0a\x09^ source",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@source"]=aString;
+return self},
+args: ["aString"],
+source: "source: aString\x0a\x09source := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@theClass"];
+return $1;
+},
+args: [],
+source: "theClass\x0a\x09^ theClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@theClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitAssignmentNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var left,right,assignment;
+function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2,$5;
+right=self._visit_(_st(aNode)._right());
+$ctx1.sendIdx["visit:"]=1;
+left=self._visit_(_st(aNode)._left());
+$1=self._sequence();
+$3=_st($IRAssignment())._new();
+_st($3)._add_(left);
+$ctx1.sendIdx["add:"]=2;
+_st($3)._add_(right);
+$4=_st($3)._yourself();
+$2=$4;
+_st($1)._add_($2);
+$ctx1.sendIdx["add:"]=1;
+$5=left;
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
+messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"],
+referencedClasses: ["IRAssignment"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitBlockNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var closure;
+function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
+function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$6,$5,$7,$8,$9;
+$1=_st($IRClosure())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._arguments_(_st(aNode)._parameters());
+_st($1)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
+$2=$1;
+$3=_st(aNode)._scope();
+$ctx1.sendIdx["scope"]=1;
+_st($2)._scope_($3);
+$ctx1.sendIdx["scope:"]=1;
+$4=_st($1)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+closure=$4;
+$6=_st(aNode)._scope();
+$ctx1.sendIdx["scope"]=2;
+$5=_st($6)._temps();
+_st($5)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$7=_st($IRTempDeclaration())._new();
+_st($7)._name_(_st(each)._name());
+_st($7)._scope_(_st(aNode)._scope());
+$8=_st($7)._yourself();
+return _st(closure)._add_($8);
+$ctx2.sendIdx["add:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["do:"]=1;
+_st(_st(aNode)._nodes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(closure)._add_(self._visit_(each));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+$9=closure;
+return $9;
+}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
+messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
+referencedClasses: ["IRClosure", "IRTempDeclaration"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitBlockSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
+function $IRBlockReturn(){return globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
+$2=_st($IRBlockSequence())._new();
+$ctx1.sendIdx["new"]=1;
+$1=self._withSequence_do_($2,(function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(aNode)._nodes();
+$ctx2.sendIdx["nodes"]=1;
+return _st($3)._ifNotEmpty_((function(){
+return smalltalk.withContext(function($ctx3) {
+$5=_st(aNode)._nodes();
+$ctx3.sendIdx["nodes"]=2;
+$4=_st($5)._allButLast();
+_st($4)._do_((function(each){
+return smalltalk.withContext(function($ctx4) {
+$6=self._sequence();
+$ctx4.sendIdx["sequence"]=1;
+$7=self._visitOrAlias_(each);
+$ctx4.sendIdx["visitOrAlias:"]=1;
+return _st($6)._add_($7);
+$ctx4.sendIdx["add:"]=1;
+}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})}));
+$10=_st(aNode)._nodes();
+$ctx3.sendIdx["nodes"]=3;
+$9=_st($10)._last();
+$ctx3.sendIdx["last"]=1;
+$8=_st($9)._isReturnNode();
+if(smalltalk.assert($8)){
+return _st(self._sequence())._add_(self._visitOrAlias_(_st(_st(aNode)._nodes())._last()));
+} else {
+$11=self._sequence();
+$ctx3.sendIdx["sequence"]=2;
+$13=_st($IRBlockReturn())._new();
+$14=$13;
+$17=_st(aNode)._nodes();
+$ctx3.sendIdx["nodes"]=4;
+$16=_st($17)._last();
+$ctx3.sendIdx["last"]=2;
+$15=self._visitOrAlias_($16);
+$ctx3.sendIdx["visitOrAlias:"]=2;
+_st($14)._add_($15);
+$ctx3.sendIdx["add:"]=3;
+$18=_st($13)._yourself();
+$12=$18;
+return _st($11)._add_($12);
+$ctx3.sendIdx["add:"]=2;
+};
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]",
+messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"],
+referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitCascadeNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var alias,receiver;
+function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$5,$4,$6;
+$2=_st(aNode)._receiver();
+$ctx1.sendIdx["receiver"]=1;
+$1=_st($2)._isImmutable();
+if(smalltalk.assert($1)){
+receiver=_st(aNode)._receiver();
+$ctx1.sendIdx["receiver"]=2;
+receiver;
+} else {
+alias=self._alias_(_st(aNode)._receiver());
+$ctx1.sendIdx["alias:"]=1;
+alias;
+receiver=_st(_st($VariableNode())._new())._binding_(_st(alias)._variable());
+receiver;
+};
+$3=_st(aNode)._nodes();
+$ctx1.sendIdx["nodes"]=1;
+_st($3)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._receiver_(receiver);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
+$ctx1.sendIdx["do:"]=1;
+$5=_st(aNode)._nodes();
+$ctx1.sendIdx["nodes"]=2;
+$4=_st($5)._allButLast();
+_st($4)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._sequence())._add_(self._visit_(each));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
+$6=self._alias_(_st(_st(aNode)._nodes())._last());
+return $6;
+}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
+messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"],
+referencedClasses: ["VariableNode"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitDynamicArrayNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var array;
+function $IRDynamicArray(){return globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+array=_st($IRDynamicArray())._new();
+_st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(array)._add_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=array;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
+messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
+referencedClasses: ["IRDynamicArray"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitDynamicDictionaryNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var dictionary;
+function $IRDynamicDictionary(){return globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+dictionary=_st($IRDynamicDictionary())._new();
+_st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(dictionary)._add_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=dictionary;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
+messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
+referencedClasses: ["IRDynamicDictionary"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitJSStatementNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+function $IRVerbatim(){return globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($IRVerbatim())._new();
+_st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
+messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"],
+referencedClasses: ["IRVerbatim"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitMethodNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+function $IRMethod(){return globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
+function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
+function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
+function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$18,$19,$17,$20,$21,$22;
+$2=_st($IRMethod())._new();
+$ctx1.sendIdx["new"]=1;
+_st($2)._source_(_st(self._source())._crlfSanitized());
+_st($2)._theClass_(self._theClass());
+_st($2)._arguments_(_st(aNode)._arguments());
+_st($2)._selector_(_st(aNode)._selector());
+_st($2)._sendIndexes_(_st(aNode)._sendIndexes());
+_st($2)._superSends_(_st(aNode)._superSends());
+_st($2)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
+_st($2)._classReferences_(_st(aNode)._classReferences());
+$3=$2;
+$4=_st(aNode)._scope();
+$ctx1.sendIdx["scope"]=1;
+_st($3)._scope_($4);
+$ctx1.sendIdx["scope:"]=1;
+$5=_st($2)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+$1=$5;
+self._method_($1);
+$7=_st(aNode)._scope();
+$ctx1.sendIdx["scope"]=2;
+$6=_st($7)._temps();
+_st($6)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$8=self._method();
+$ctx2.sendIdx["method"]=1;
+$10=_st($IRTempDeclaration())._new();
+$ctx2.sendIdx["new"]=2;
+_st($10)._name_(_st(each)._name());
+$11=$10;
+$12=_st(aNode)._scope();
+$ctx2.sendIdx["scope"]=3;
+_st($11)._scope_($12);
+$13=_st($10)._yourself();
+$ctx2.sendIdx["yourself"]=2;
+$9=$13;
+return _st($8)._add_($9);
+$ctx2.sendIdx["add:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["do:"]=1;
+_st(_st(aNode)._nodes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$14=self._method();
+$ctx2.sendIdx["method"]=2;
+return _st($14)._add_(self._visit_(each));
+$ctx2.sendIdx["add:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+$16=_st(aNode)._scope();
+$ctx1.sendIdx["scope"]=4;
+$15=_st($16)._hasLocalReturn();
+if(! smalltalk.assert($15)){
+$18=self._method();
+$ctx1.sendIdx["method"]=3;
+$19=_st($IRReturn())._new();
+$ctx1.sendIdx["new"]=3;
+$17=_st($18)._add_($19);
+$20=_st($IRVariable())._new();
+_st($20)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
+$21=_st($20)._yourself();
+_st($17)._add_($21);
+$ctx1.sendIdx["add:"]=3;
+};
+$22=self._method();
+return $22;
+}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [\x0a\x09\x09(self method add: IRReturn new) add: (IRVariable new\x0a\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09^ self method",
+messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"],
+referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitOrAlias:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(aNode)._shouldBeAliased();
+if(smalltalk.assert($2)){
+$1=self._alias_(aNode);
+} else {
+$1=self._visit_(aNode);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
+messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitReturnNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var return_;
+function $IRNonLocalReturn(){return globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
+function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(aNode)._nonLocalReturn();
+if(smalltalk.assert($1)){
+return_=_st($IRNonLocalReturn())._new();
+$ctx1.sendIdx["new"]=1;
+} else {
+return_=_st($IRReturn())._new();
+};
+_st(return_)._scope_(_st(aNode)._scope());
+_st(_st(aNode)._nodes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(return_)._add_(self._alias_(each));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
+$2=return_;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self alias: each) ].\x0a\x09^ return",
+messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"],
+referencedClasses: ["IRNonLocalReturn", "IRReturn"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSendNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var send,all,receiver,arguments;
+function $IRSend(){return globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+send=_st($IRSend())._new();
+$1=send;
+_st($1)._selector_(_st(aNode)._selector());
+$2=_st($1)._index_(_st(aNode)._index());
+$3=_st(aNode)._superSend();
+if(smalltalk.assert($3)){
+_st(send)._classSend_(_st(self._theClass())._superclass());
+};
+all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
+receiver=_st(all)._first();
+arguments=_st(all)._allButFirst();
+_st(send)._add_(receiver);
+$ctx1.sendIdx["add:"]=1;
+_st(arguments)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(send)._add_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+$4=send;
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
+messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"],
+referencedClasses: ["IRSend"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+function $IRSequence(){return globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(aNode)._nodes())._do_((function(each){
+var instruction;
+return smalltalk.withContext(function($ctx3) {
+instruction=self._visitOrAlias_(each);
+instruction;
+$2=_st(instruction)._isVariable();
+if(! smalltalk.assert($2)){
+return _st(self._sequence())._add_(instruction);
+};
+}, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
+messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"],
+referencedClasses: ["IRSequence"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitValueNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+function $IRValue(){return globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($IRValue())._new();
+_st($2)._value_(_st(aNode)._value());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
+messageSends: ["value:", "new", "value", "yourself"],
+referencedClasses: ["IRValue"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitVariableNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($IRVariable())._new();
+_st($2)._variable_(_st(aNode)._binding());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.IRASTTranslator)})},
+args: ["aNode"],
+source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
+messageSends: ["variable:", "new", "binding", "yourself"],
+referencedClasses: ["IRVariable"]
+}),
+globals.IRASTTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withSequence:do:",
+protocol: 'accessing',
+fn: function (aSequence,aBlock){
+var self=this;
+var outerSequence;
+return smalltalk.withContext(function($ctx1) { 
+outerSequence=self._sequence();
+self._sequence_(aSequence);
+$ctx1.sendIdx["sequence:"]=1;
+_st(aBlock)._value();
+self._sequence_(outerSequence);
+return aSequence;
+}, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},globals.IRASTTranslator)})},
+args: ["aSequence", "aBlock"],
+source: "withSequence: aSequence do: aBlock\x0a\x09| outerSequence |\x0a\x09outerSequence := self sequence.\x0a\x09self sequence: aSequence.\x0a\x09aBlock value.\x0a\x09self sequence: outerSequence.\x0a\x09^ aSequence",
+messageSends: ["sequence", "sequence:", "value"],
+referencedClasses: []
+}),
+globals.IRASTTranslator);
+
+
+
+smalltalk.addClass('IRInstruction', globals.Object, ['parent', 'instructions'], 'Compiler-IR');
+globals.IRInstruction.comment="I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.\x0aThe IR graph is used to emit JavaScript code using a JSStream.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRInstruction_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInstruction)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "add:",
+protocol: 'building',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(anObject)._parent_(self);
+$1=_st(self._instructions())._add_(anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.IRInstruction)})},
+args: ["anObject"],
+source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
+messageSends: ["parent:", "add:", "instructions"],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeAssigned",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canBeAssigned\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instructions",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@instructions"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@instructions"]=_st($OrderedCollection())._new();
+$1=self["@instructions"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"instructions",{},globals.IRInstruction)})},
+args: [],
+source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isClosure",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isClosure\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInlined",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isInlined\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isLocalReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isLocalReturn\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isMethod",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isMethod\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isReturn\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSend",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isSend\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSequence",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isSequence\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isTempDeclaration",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isTempDeclaration\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isVariable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isVariable\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._parent())._method();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"method",{},globals.IRInstruction)})},
+args: [],
+source: "method\x0a\x09^ self parent method",
+messageSends: ["method", "parent"],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "needsBoxingAsReceiver",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "needsBoxingAsReceiver\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parent",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@parent"];
+return $1;
+},
+args: [],
+source: "parent\x0a\x09^ parent",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parent:",
+protocol: 'accessing',
+fn: function (anIRInstruction){
+var self=this;
+self["@parent"]=anIRInstruction;
+return self},
+args: ["anIRInstruction"],
+source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove",
+protocol: 'building',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._parent())._remove_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.IRInstruction)})},
+args: [],
+source: "remove\x0a\x09self parent remove: self",
+messageSends: ["remove:", "parent"],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove:",
+protocol: 'building',
+fn: function (anIRInstruction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._instructions())._remove_(anIRInstruction);
+return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},globals.IRInstruction)})},
+args: ["anIRInstruction"],
+source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
+messageSends: ["remove:", "instructions"],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "replace:with:",
+protocol: 'building',
+fn: function (anIRInstruction,anotherIRInstruction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(anotherIRInstruction)._parent_(self);
+$1=self._instructions();
+$ctx1.sendIdx["instructions"]=1;
+_st($1)._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
+return self}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRInstruction)})},
+args: ["anIRInstruction", "anotherIRInstruction"],
+source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
+messageSends: ["parent:", "at:put:", "instructions", "indexOf:"],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "replaceWith:",
+protocol: 'building',
+fn: function (anIRInstruction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._parent())._replace_with_(self,anIRInstruction);
+return self}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},globals.IRInstruction)})},
+args: ["anIRInstruction"],
+source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
+messageSends: ["replace:with:", "parent"],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._parent();
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$2;
+} else {
+var node;
+node=$receiver;
+$1=_st(node)._scope();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRInstruction)})},
+args: [],
+source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
+messageSends: ["ifNotNil:", "parent", "scope"],
+referencedClasses: []
+}),
+globals.IRInstruction);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aBuilder){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._builder_(aBuilder);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},globals.IRInstruction.klass)})},
+args: ["aBuilder"],
+source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
+messageSends: ["builder:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.IRInstruction.klass);
+
+
+smalltalk.addClass('IRAssignment', globals.IRInstruction, [], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRAssignment_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRAssignment)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
+messageSends: ["visitIRAssignment:"],
+referencedClasses: []
+}),
+globals.IRAssignment);
+
+
+
+smalltalk.addClass('IRDynamicArray', globals.IRInstruction, [], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRDynamicArray_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicArray)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
+messageSends: ["visitIRDynamicArray:"],
+referencedClasses: []
+}),
+globals.IRDynamicArray);
+
+
+
+smalltalk.addClass('IRDynamicDictionary', globals.IRInstruction, [], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRDynamicDictionary_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicDictionary)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
+messageSends: ["visitIRDynamicDictionary:"],
+referencedClasses: []
+}),
+globals.IRDynamicDictionary);
+
+
+
+smalltalk.addClass('IRScopedInstruction', globals.IRInstruction, ['scope'], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@scope"];
+return $1;
+},
+args: [],
+source: "scope\x0a\x09^ scope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRScopedInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope:",
+protocol: 'accessing',
+fn: function (aScope){
+var self=this;
+self["@scope"]=aScope;
+return self},
+args: ["aScope"],
+source: "scope: aScope\x0a\x09scope := aScope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRScopedInstruction);
+
+
+
+smalltalk.addClass('IRClosureInstruction', globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@arguments"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=[];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.IRClosureInstruction)})},
+args: [],
+source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.IRClosureInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@arguments"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "arguments: aCollection\x0a\x09arguments := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRClosureInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "locals",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st(self._arguments())._copy();
+_st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._name();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"locals",{},globals.IRClosureInstruction)})},
+args: [],
+source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
+messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"],
+referencedClasses: []
+}),
+globals.IRClosureInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "requiresSmalltalkContext",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@requiresSmalltalkContext"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.IRClosureInstruction)})},
+args: [],
+source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.IRClosureInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "requiresSmalltalkContext:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@requiresSmalltalkContext"]=anObject;
+return self},
+args: ["anObject"],
+source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRClosureInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope:",
+protocol: 'accessing',
+fn: function (aScope){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply(_st(self), [aScope]));
+$ctx1.supercall = false;
+_st(aScope)._instruction_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},globals.IRClosureInstruction)})},
+args: ["aScope"],
+source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
+messageSends: ["scope:", "instruction:"],
+referencedClasses: []
+}),
+globals.IRClosureInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tempDeclarations",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._instructions())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._isTempDeclaration();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},globals.IRClosureInstruction)})},
+args: [],
+source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
+messageSends: ["select:", "instructions", "isTempDeclaration"],
+referencedClasses: []
+}),
+globals.IRClosureInstruction);
+
+
+
+smalltalk.addClass('IRClosure', globals.IRClosureInstruction, [], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRClosure_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRClosure)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
+messageSends: ["visitIRClosure:"],
+referencedClasses: []
+}),
+globals.IRClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isClosure",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isClosure\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sequence",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._instructions())._last();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sequence",{},globals.IRClosure)})},
+args: [],
+source: "sequence\x0a\x09^ self instructions last",
+messageSends: ["last", "instructions"],
+referencedClasses: []
+}),
+globals.IRClosure);
+
+
+
+smalltalk.addClass('IRMethod', globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
+globals.IRMethod.comment="I am a method instruction";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRMethod_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRMethod)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
+messageSends: ["visitIRMethod:"],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classReferences",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@classReferences"];
+return $1;
+},
+args: [],
+source: "classReferences\x0a\x09^ classReferences",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classReferences:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@classReferences"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "internalVariables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@internalVariables"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@internalVariables"]=_st($Set())._new();
+$1=self["@internalVariables"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRMethod)})},
+args: [],
+source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Set"]
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isMethod",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isMethod\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageSends",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._sendIndexes())._keys();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.IRMethod)})},
+args: [],
+source: "messageSends\x0a\x09^ self sendIndexes keys",
+messageSends: ["keys", "sendIndexes"],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "method\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selector"];
+return $1;
+},
+args: [],
+source: "selector\x0a\x09^ selector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@selector"]=aString;
+return self},
+args: ["aString"],
+source: "selector: aString\x0a\x09selector := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendIndexes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@sendIndexes"];
+return $1;
+},
+args: [],
+source: "sendIndexes\x0a\x09^ sendIndexes",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendIndexes:",
+protocol: 'accessing',
+fn: function (aDictionary){
+var self=this;
+self["@sendIndexes"]=aDictionary;
+return self},
+args: ["aDictionary"],
+source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@source"];
+return $1;
+},
+args: [],
+source: "source\x0a\x09^ source",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@source"]=aString;
+return self},
+args: ["aString"],
+source: "source: aString\x0a\x09source := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superSends",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@superSends"];
+return $1;
+},
+args: [],
+source: "superSends\x0a\x09^ superSends",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superSends:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@superSends"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "superSends: aCollection\x0a\x09superSends := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@theClass"];
+return $1;
+},
+args: [],
+source: "theClass\x0a\x09^ theClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@theClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRMethod);
+
+
+
+smalltalk.addClass('IRReturn', globals.IRScopedInstruction, [], 'Compiler-IR');
+globals.IRReturn.comment="I am a local return instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRReturn_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRReturn)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
+messageSends: ["visitIRReturn:"],
+referencedClasses: []
+}),
+globals.IRReturn);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeAssigned",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "canBeAssigned\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRReturn);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBlockReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isBlockReturn\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRReturn);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isLocalReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isLocalReturn\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRReturn);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNonLocalReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._isLocalReturn())._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},globals.IRReturn)})},
+args: [],
+source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
+messageSends: ["not", "isLocalReturn"],
+referencedClasses: []
+}),
+globals.IRReturn);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isReturn\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRReturn);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@scope"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=_st(self._parent())._scope();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRReturn)})},
+args: [],
+source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
+messageSends: ["ifNil:", "scope", "parent"],
+referencedClasses: []
+}),
+globals.IRReturn);
+
+
+
+smalltalk.addClass('IRBlockReturn', globals.IRReturn, [], 'Compiler-IR');
+globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRBlockReturn_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockReturn)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
+messageSends: ["visitIRBlockReturn:"],
+referencedClasses: []
+}),
+globals.IRBlockReturn);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBlockReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isBlockReturn\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRBlockReturn);
+
+
+
+smalltalk.addClass('IRNonLocalReturn', globals.IRReturn, [], 'Compiler-IR');
+globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRNonLocalReturn_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRNonLocalReturn)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
+messageSends: ["visitIRNonLocalReturn:"],
+referencedClasses: []
+}),
+globals.IRNonLocalReturn);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isLocalReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isLocalReturn\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRNonLocalReturn);
+
+
+
+smalltalk.addClass('IRTempDeclaration', globals.IRScopedInstruction, ['name'], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRTempDeclaration_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRTempDeclaration)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
+messageSends: ["visitIRTempDeclaration:"],
+referencedClasses: []
+}),
+globals.IRTempDeclaration);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isTempDeclaration",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isTempDeclaration\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRTempDeclaration);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@name"];
+return $1;
+},
+args: [],
+source: "name\x0a\x09^ name",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRTempDeclaration);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@name"]=aString;
+return self},
+args: ["aString"],
+source: "name: aString\x0a\x09name := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRTempDeclaration);
+
+
+
+smalltalk.addClass('IRSend', globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
+globals.IRSend.comment="I am a message send instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRSend_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSend)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
+messageSends: ["visitIRSend:"],
+referencedClasses: []
+}),
+globals.IRSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classSend",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@classSend"];
+return $1;
+},
+args: [],
+source: "classSend\x0a\x09^ classSend",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classSend:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@classSend"]=aClass;
+return self},
+args: ["aClass"],
+source: "classSend: aClass\x0a\x09classSend := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "index",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@index"];
+return $1;
+},
+args: [],
+source: "index\x0a\x09^ index",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "index:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@index"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "index: anInteger\x0a\x09index := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSend",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSend\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selector"];
+return $1;
+},
+args: [],
+source: "selector\x0a\x09^ selector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@selector"]=aString;
+return self},
+args: ["aString"],
+source: "selector: aString\x0a\x09selector := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSend);
+
+
+
+smalltalk.addClass('IRSequence', globals.IRInstruction, [], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRSequence_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSequence)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
+messageSends: ["visitIRSequence:"],
+referencedClasses: []
+}),
+globals.IRSequence);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSequence",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSequence\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSequence);
+
+
+
+smalltalk.addClass('IRBlockSequence', globals.IRSequence, [], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRBlockSequence_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockSequence)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
+messageSends: ["visitIRBlockSequence:"],
+referencedClasses: []
+}),
+globals.IRBlockSequence);
+
+
+
+smalltalk.addClass('IRValue', globals.IRInstruction, ['value'], 'Compiler-IR');
+globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRValue_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRValue)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
+messageSends: ["visitIRValue:"],
+referencedClasses: []
+}),
+globals.IRValue);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "needsBoxingAsReceiver",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "needsBoxingAsReceiver\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRValue);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@value"];
+return $1;
+},
+args: [],
+source: "value\x0a\x09^ value",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRValue);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@value"]=aString;
+return self},
+args: ["aString"],
+source: "value: aString\x0a\x09value := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRValue);
+
+
+
+smalltalk.addClass('IRVariable', globals.IRInstruction, ['variable'], 'Compiler-IR');
+globals.IRVariable.comment="I am a variable instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRVariable_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVariable)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
+messageSends: ["visitIRVariable:"],
+referencedClasses: []
+}),
+globals.IRVariable);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isVariable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isVariable\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRVariable);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "needsBoxingAsReceiver",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._variable())._isPseudoVar())._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},globals.IRVariable)})},
+args: [],
+source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
+messageSends: ["not", "isPseudoVar", "variable"],
+referencedClasses: []
+}),
+globals.IRVariable);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variable",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@variable"];
+return $1;
+},
+args: [],
+source: "variable\x0a\x09^ variable",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRVariable);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variable:",
+protocol: 'accessing',
+fn: function (aScopeVariable){
+var self=this;
+self["@variable"]=aScopeVariable;
+return self},
+args: ["aScopeVariable"],
+source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRVariable);
+
+
+
+smalltalk.addClass('IRVerbatim', globals.IRInstruction, ['source'], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRVerbatim_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVerbatim)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
+messageSends: ["visitIRVerbatim:"],
+referencedClasses: []
+}),
+globals.IRVerbatim);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@source"];
+return $1;
+},
+args: [],
+source: "source\x0a\x09^ source",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRVerbatim);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@source"]=aString;
+return self},
+args: ["aString"],
+source: "source: aString\x0a\x09source := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRVerbatim);
+
+
+
+smalltalk.addClass('IRVisitor', globals.Object, [], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visit:",
+protocol: 'visiting',
+fn: function (anIRInstruction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(anIRInstruction)._accept_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},globals.IRVisitor)})},
+args: ["anIRInstruction"],
+source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
+messageSends: ["accept:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRAssignment:",
+protocol: 'visiting',
+fn: function (anIRAssignment){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRAssignment);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRVisitor)})},
+args: ["anIRAssignment"],
+source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRBlockReturn:",
+protocol: 'visiting',
+fn: function (anIRBlockReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRReturn_(anIRBlockReturn);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},globals.IRVisitor)})},
+args: ["anIRBlockReturn"],
+source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
+messageSends: ["visitIRReturn:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRBlockSequence:",
+protocol: 'visiting',
+fn: function (anIRBlockSequence){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRSequence_(anIRBlockSequence);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},globals.IRVisitor)})},
+args: ["anIRBlockSequence"],
+source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
+messageSends: ["visitIRSequence:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRClosure:",
+protocol: 'visiting',
+fn: function (anIRClosure){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRClosure);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRVisitor)})},
+args: ["anIRClosure"],
+source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRDynamicArray:",
+protocol: 'visiting',
+fn: function (anIRDynamicArray){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRDynamicArray);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRVisitor)})},
+args: ["anIRDynamicArray"],
+source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRDynamicDictionary:",
+protocol: 'visiting',
+fn: function (anIRDynamicDictionary){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRDynamicDictionary);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRVisitor)})},
+args: ["anIRDynamicDictionary"],
+source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedClosure:",
+protocol: 'visiting',
+fn: function (anIRInlinedClosure){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRClosure_(anIRInlinedClosure);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRVisitor)})},
+args: ["anIRInlinedClosure"],
+source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
+messageSends: ["visitIRClosure:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedSequence:",
+protocol: 'visiting',
+fn: function (anIRInlinedSequence){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRSequence_(anIRInlinedSequence);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRVisitor)})},
+args: ["anIRInlinedSequence"],
+source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
+messageSends: ["visitIRSequence:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInstruction:",
+protocol: 'visiting',
+fn: function (anIRInstruction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(anIRInstruction)._instructions())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return anIRInstruction;
+}, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},globals.IRVisitor)})},
+args: ["anIRInstruction"],
+source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
+messageSends: ["do:", "instructions", "visit:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRMethod:",
+protocol: 'visiting',
+fn: function (anIRMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRMethod);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRVisitor)})},
+args: ["anIRMethod"],
+source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRNonLocalReturn:",
+protocol: 'visiting',
+fn: function (anIRNonLocalReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRNonLocalReturn);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRVisitor)})},
+args: ["anIRNonLocalReturn"],
+source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRNonLocalReturnHandling:",
+protocol: 'visiting',
+fn: function (anIRNonLocalReturnHandling){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},globals.IRVisitor)})},
+args: ["anIRNonLocalReturnHandling"],
+source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRReturn:",
+protocol: 'visiting',
+fn: function (anIRReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRReturn);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRVisitor)})},
+args: ["anIRReturn"],
+source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRSend:",
+protocol: 'visiting',
+fn: function (anIRSend){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRSend);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRVisitor)})},
+args: ["anIRSend"],
+source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRSequence:",
+protocol: 'visiting',
+fn: function (anIRSequence){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRSequence);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRVisitor)})},
+args: ["anIRSequence"],
+source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRTempDeclaration:",
+protocol: 'visiting',
+fn: function (anIRTempDeclaration){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRTempDeclaration);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},globals.IRVisitor)})},
+args: ["anIRTempDeclaration"],
+source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRValue:",
+protocol: 'visiting',
+fn: function (anIRValue){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRValue);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRVisitor)})},
+args: ["anIRValue"],
+source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRVariable:",
+protocol: 'visiting',
+fn: function (anIRVariable){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRVariable);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRVisitor)})},
+args: ["anIRVariable"],
+source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRVerbatim:",
+protocol: 'visiting',
+fn: function (anIRVerbatim){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._visitIRInstruction_(anIRVerbatim);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRVisitor)})},
+args: ["anIRVerbatim"],
+source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
+messageSends: ["visitIRInstruction:"],
+referencedClasses: []
+}),
+globals.IRVisitor);
+
+
+
+smalltalk.addClass('IRJSTranslator', globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contents",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._stream())._contents();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"contents",{},globals.IRJSTranslator)})},
+args: [],
+source: "contents\x0a\x09^ self stream contents",
+messageSends: ["contents", "stream"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@currentClass"];
+return $1;
+},
+args: [],
+source: "currentClass\x0a\x09^ currentClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@currentClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "currentClass: aClass\x0a\x09currentClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $JSStream(){return globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@stream"]=_st($JSStream())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.IRJSTranslator)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
+messageSends: ["initialize", "new"],
+referencedClasses: ["JSStream"]
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stream",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@stream"];
+return $1;
+},
+args: [],
+source: "stream\x0a\x09^ stream",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stream:",
+protocol: 'accessing',
+fn: function (aStream){
+var self=this;
+self["@stream"]=aStream;
+return self},
+args: ["aStream"],
+source: "stream: aStream\x0a\x09stream := aStream",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRAssignment:",
+protocol: 'visiting',
+fn: function (anIRAssignment){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(anIRAssignment)._instructions();
+$ctx1.sendIdx["instructions"]=1;
+$1=_st($2)._first();
+self._visit_($1);
+$ctx1.sendIdx["visit:"]=1;
+_st(self._stream())._nextPutAssignment();
+self._visit_(_st(_st(anIRAssignment)._instructions())._last());
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRJSTranslator)})},
+args: ["anIRAssignment"],
+source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
+messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRClosure:",
+protocol: 'visiting',
+fn: function (anIRClosure){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutClosureWith_arguments_((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._stream();
+$ctx2.sendIdx["stream"]=2;
+_st($2)._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(each)._name())._asVariableName();
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})})));
+return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
+return smalltalk.withContext(function($ctx3) {
+return ($ctx3.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]));
+$ctx3.supercall = false;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),_st(anIRClosure)._arguments());
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRJSTranslator)})},
+args: ["anIRClosure"],
+source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments",
+messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRDynamicArray:",
+protocol: 'visiting',
+fn: function (anIRDynamicArray){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutAll_("[");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._stream())._nextPutAll_(",");
+$ctx2.sendIdx["nextPutAll:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(self["@stream"])._nextPutAll_("]");
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRJSTranslator)})},
+args: ["anIRDynamicArray"],
+source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'",
+messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRDynamicDictionary:",
+protocol: 'visiting',
+fn: function (anIRDynamicDictionary){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutAll_("globals.HashedCollection._newFromPairs_([");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._stream();
+$ctx2.sendIdx["stream"]=2;
+return _st($2)._nextPutAll_(",");
+$ctx2.sendIdx["nextPutAll:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(self._stream())._nextPutAll_("])");
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRJSTranslator)})},
+args: ["anIRDynamicDictionary"],
+source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
+messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRMethod:",
+protocol: 'visiting',
+fn: function (anIRMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._stream();
+$ctx2.sendIdx["stream"]=2;
+return _st($2)._nextPutFunctionWith_arguments_((function(){
+return smalltalk.withContext(function($ctx3) {
+$3=self._stream();
+$ctx3.sendIdx["stream"]=3;
+$4=_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
+return smalltalk.withContext(function($ctx4) {
+return _st(_st(each)._name())._asVariableName();
+}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})}));
+$ctx3.sendIdx["collect:"]=1;
+_st($3)._nextPutVars_($4);
+$ctx3.sendIdx["nextPutVars:"]=1;
+_st(_st(anIRMethod)._classReferences())._do_((function(each){
+return smalltalk.withContext(function($ctx4) {
+$5=self._stream();
+$ctx4.sendIdx["stream"]=4;
+return _st($5)._nextPutClassRefFunction_(each);
+}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)})}));
+$6=self._stream();
+$ctx3.sendIdx["stream"]=5;
+return _st($6)._nextPutContextFor_during_(anIRMethod,(function(){
+return smalltalk.withContext(function($ctx4) {
+$8=_st(anIRMethod)._internalVariables();
+$ctx4.sendIdx["internalVariables"]=1;
+$7=_st($8)._notEmpty();
+if(smalltalk.assert($7)){
+$9=self._stream();
+$ctx4.sendIdx["stream"]=6;
+_st($9)._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
+return smalltalk.withContext(function($ctx5) {
+return _st(_st(each)._variable())._alias();
+}, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)})})));
+};
+$10=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
+if(smalltalk.assert($10)){
+return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
+return smalltalk.withContext(function($ctx5) {
+return ($ctx5.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
+$ctx5.supercall = false;
+$ctx5.sendIdx["visitIRMethod:"]=1;
+}, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
+} else {
+return ($ctx4.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
+$ctx4.supercall = false;
+};
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)})}));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),_st(anIRMethod)._arguments());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRJSTranslator)})},
+args: ["anIRMethod"],
+source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
+messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRNonLocalReturn:",
+protocol: 'visiting',
+fn: function (anIRNonLocalReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._stream())._nextPutNonLocalReturnWith_((function(){
+return smalltalk.withContext(function($ctx2) {
+return ($ctx2.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
+$ctx2.supercall = false;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRJSTranslator)})},
+args: ["anIRNonLocalReturn"],
+source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
+messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRReturn:",
+protocol: 'visiting',
+fn: function (anIRReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._stream())._nextPutReturnWith_((function(){
+return smalltalk.withContext(function($ctx2) {
+return ($ctx2.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
+$ctx2.supercall = false;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRJSTranslator)})},
+args: ["anIRReturn"],
+source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
+messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRSend:",
+protocol: 'visiting',
+fn: function (anIRSend){
+var self=this;
+var sends;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+sends=_st(_st(_st(_st(anIRSend)._method())._sendIndexes())._at_(_st(anIRSend)._selector()))._size();
+$1=_st(anIRSend)._classSend();
+if(($receiver = $1) == null || $receiver.isNil){
+self._visitSend_(anIRSend);
+} else {
+self._visitSuperSend_(anIRSend);
+};
+$2=_st(_st(sends).__gt((1)))._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(anIRSend)._index()).__lt(sends);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+if(smalltalk.assert($2)){
+_st(self._stream())._nextPutSendIndexFor_(anIRSend);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},globals.IRJSTranslator)})},
+args: ["anIRSend"],
+source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
+messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRSequence:",
+protocol: 'visiting',
+fn: function (anIRSequence){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutSequenceWith_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(anIRSequence)._instructions())._do_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRJSTranslator)})},
+args: ["anIRSequence"],
+source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
+messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRTempDeclaration:",
+protocol: 'visiting',
+fn: function (anIRTempDeclaration){
+var self=this;
+return self},
+args: ["anIRTempDeclaration"],
+source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRValue:",
+protocol: 'visiting',
+fn: function (anIRValue){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRJSTranslator)})},
+args: ["anIRValue"],
+source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
+messageSends: ["nextPutAll:", "stream", "asJavascript", "value"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRVariable:",
+protocol: 'visiting',
+fn: function (anIRVariable){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$4;
+$3=_st(anIRVariable)._variable();
+$ctx1.sendIdx["variable"]=1;
+$2=_st($3)._name();
+$1=_st($2).__eq("thisContext");
+if(smalltalk.assert($1)){
+$4=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($4)._nextPutAll_("smalltalk.getThisContext()");
+$ctx1.sendIdx["nextPutAll:"]=1;
+} else {
+_st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRJSTranslator)})},
+args: ["anIRVariable"],
+source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
+messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRVerbatim:",
+protocol: 'visiting',
+fn: function (anIRVerbatim){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutStatementWith_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRJSTranslator)})},
+args: ["anIRVerbatim"],
+source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
+messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitReceiver:",
+protocol: 'visiting',
+fn: function (anIRInstruction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=_st(anIRInstruction)._needsBoxingAsReceiver();
+if(! smalltalk.assert($1)){
+$2=self._visit_(anIRInstruction);
+$ctx1.sendIdx["visit:"]=1;
+return $2;
+};
+$3=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($3)._nextPutAll_("_st(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+self._visit_(anIRInstruction);
+_st(self._stream())._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},globals.IRJSTranslator)})},
+args: ["anIRInstruction"],
+source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '_st('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
+messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSend:",
+protocol: 'visiting',
+fn: function (anIRSend){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$4,$5;
+$2=_st(anIRSend)._instructions();
+$ctx1.sendIdx["instructions"]=1;
+$1=_st($2)._first();
+self._visitReceiver_($1);
+$3=self._stream();
+$ctx1.sendIdx["stream"]=1;
+$4=_st(".".__comma(_st(_st(anIRSend)._selector())._asSelector())).__comma("(");
+$ctx1.sendIdx[","]=1;
+_st($3)._nextPutAll_($4);
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+$5=self._stream();
+$ctx2.sendIdx["stream"]=2;
+return _st($5)._nextPutAll_(",");
+$ctx2.sendIdx["nextPutAll:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(self._stream())._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},globals.IRJSTranslator)})},
+args: ["anIRSend"],
+source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asSelector, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
+messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "visit:"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSuperSend:",
+protocol: 'visiting',
+fn: function (anIRSend){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$6,$5,$4,$3,$7,$8,$9,$11,$10,$12,$13,$14,$15;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+$2=$1;
+$6=_st(anIRSend)._scope();
+$ctx1.sendIdx["scope"]=1;
+$5=_st($6)._alias();
+$ctx1.sendIdx["alias"]=1;
+$4="(".__comma($5);
+$ctx1.sendIdx[","]=2;
+$3=_st($4).__comma(".supercall = true, ");
+$ctx1.sendIdx[","]=1;
+_st($2)._nextPutAll_($3);
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st($1)._nextPutAll_(_st(self._currentClass())._asJavascript());
+$ctx1.sendIdx["nextPutAll:"]=2;
+_st($1)._nextPutAll_(".superclass.fn.prototype.");
+$ctx1.sendIdx["nextPutAll:"]=3;
+$7=$1;
+$8=_st(_st(_st(anIRSend)._selector())._asSelector()).__comma(".apply(");
+$ctx1.sendIdx[","]=3;
+_st($7)._nextPutAll_($8);
+$ctx1.sendIdx["nextPutAll:"]=4;
+$9=_st($1)._nextPutAll_("_st(");
+$ctx1.sendIdx["nextPutAll:"]=5;
+$11=_st(anIRSend)._instructions();
+$ctx1.sendIdx["instructions"]=1;
+$10=_st($11)._first();
+self._visit_($10);
+$ctx1.sendIdx["visit:"]=1;
+$12=self._stream();
+$ctx1.sendIdx["stream"]=2;
+_st($12)._nextPutAll_("), [");
+$ctx1.sendIdx["nextPutAll:"]=6;
+_st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+$13=self._stream();
+$ctx2.sendIdx["stream"]=3;
+return _st($13)._nextPutAll_(",");
+$ctx2.sendIdx["nextPutAll:"]=7;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$14=self._stream();
+_st($14)._nextPutAll_("]));");
+$ctx1.sendIdx["nextPutAll:"]=8;
+_st($14)._lf();
+$15=_st($14)._nextPutAll_(_st(_st(_st(anIRSend)._scope())._alias()).__comma(".supercall = false"));
+return self}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},globals.IRJSTranslator)})},
+args: ["anIRSend"],
+source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '(', anIRSend scope alias, '.supercall = true, ';\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asSelector, '.apply(';\x0a\x09\x09nextPutAll: '_st('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream \x0a\x09\x09nextPutAll: ']));'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false'",
+messageSends: ["nextPutAll:", "stream", ",", "alias", "scope", "asJavascript", "currentClass", "asSelector", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst", "lf"],
+referencedClasses: []
+}),
+globals.IRJSTranslator);
+
+
+
+smalltalk.addClass('JSStream', globals.Object, ['stream'], 'Compiler-IR');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contents",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@stream"])._contents();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"contents",{},globals.JSStream)})},
+args: [],
+source: "contents\x0a\x09^ stream contents",
+messageSends: ["contents"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.JSStream.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@stream"]=""._writeStream();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.JSStream)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
+messageSends: ["initialize", "writeStream"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lf",
+protocol: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@stream"])._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.JSStream)})},
+args: [],
+source: "lf\x0a\x09stream lf",
+messageSends: ["lf"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPut:",
+protocol: 'streaming',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@stream"])._nextPut_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.JSStream)})},
+args: ["aString"],
+source: "nextPut: aString\x0a\x09stream nextPut: aString",
+messageSends: ["nextPut:"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutAll:",
+protocol: 'streaming',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@stream"])._nextPutAll_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},globals.JSStream)})},
+args: ["aString"],
+source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
+messageSends: ["nextPutAll:"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutAssignment",
+protocol: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@stream"])._nextPutAll_("=");
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},globals.JSStream)})},
+args: [],
+source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
+messageSends: ["nextPutAll:"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutBlockContextFor:during:",
+protocol: 'streaming',
+fn: function (anIRClosure,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$24,$23,$22,$21,$20,$19,$18;
+$1=_st(anIRClosure)._requiresSmalltalkContext();
+if(! smalltalk.assert($1)){
+$2=_st(aBlock)._value();
+$ctx1.sendIdx["value"]=1;
+return $2;
+};
+$6=_st(anIRClosure)._scope();
+$ctx1.sendIdx["scope"]=1;
+$5=_st($6)._alias();
+$ctx1.sendIdx["alias"]=1;
+$4="return smalltalk.withContext(function(".__comma($5);
+$ctx1.sendIdx[","]=2;
+$3=_st($4).__comma(") {");
+$ctx1.sendIdx[","]=1;
+self._nextPutAll_($3);
+$ctx1.sendIdx["nextPutAll:"]=1;
+$7=self._lf();
+_st(aBlock)._value();
+$11=_st(anIRClosure)._scope();
+$ctx1.sendIdx["scope"]=2;
+$10=_st($11)._alias();
+$ctx1.sendIdx["alias"]=2;
+$9="}, function(".__comma($10);
+$ctx1.sendIdx[","]=4;
+$8=_st($9).__comma(") {");
+$ctx1.sendIdx[","]=3;
+self._nextPutAll_($8);
+$ctx1.sendIdx["nextPutAll:"]=2;
+$15=_st(anIRClosure)._scope();
+$ctx1.sendIdx["scope"]=3;
+$14=_st($15)._alias();
+$ctx1.sendIdx["alias"]=3;
+$13=_st($14).__comma(".fillBlock({");
+$ctx1.sendIdx[","]=5;
+$12=self._nextPutAll_($13);
+$ctx1.sendIdx["nextPutAll:"]=3;
+_st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$16=_st(each)._asVariableName();
+$ctx2.sendIdx["asVariableName"]=1;
+self._nextPutAll_($16);
+$ctx2.sendIdx["nextPutAll:"]=4;
+self._nextPutAll_(":");
+$ctx2.sendIdx["nextPutAll:"]=5;
+$17=self._nextPutAll_(_st(each)._asVariableName());
+$ctx2.sendIdx["nextPutAll:"]=6;
+return $17;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._nextPutAll_(",");
+$ctx2.sendIdx["nextPutAll:"]=7;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+self._nextPutAll_("},");
+$ctx1.sendIdx["nextPutAll:"]=8;
+$24=_st(anIRClosure)._scope();
+$ctx1.sendIdx["scope"]=4;
+$23=_st($24)._outerScope();
+$22=_st($23)._alias();
+$21=_st($22).__comma(",");
+$20=_st($21).__comma(_st(_st(_st(anIRClosure)._scope())._blockIndex())._asString());
+$ctx1.sendIdx[","]=7;
+$19=_st($20).__comma(")})");
+$ctx1.sendIdx[","]=6;
+$18=self._nextPutAll_($19);
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},globals.JSStream)})},
+args: ["anIRClosure", "aBlock"],
+source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')})'",
+messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutClassRefFunction:",
+protocol: 'streaming',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self["@stream"];
+_st($1)._nextPutAll_("function $");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st($1)._nextPutAll_(aString);
+$ctx1.sendIdx["nextPutAll:"]=2;
+_st($1)._nextPutAll_("(){return globals.");
+$ctx1.sendIdx["nextPutAll:"]=3;
+_st($1)._nextPutAll_(aString);
+$ctx1.sendIdx["nextPutAll:"]=4;
+_st($1)._nextPutAll_("||(typeof ");
+$ctx1.sendIdx["nextPutAll:"]=5;
+_st($1)._nextPutAll_(aString);
+$ctx1.sendIdx["nextPutAll:"]=6;
+_st($1)._nextPutAll_("==\x22undefined\x22?nil:");
+$ctx1.sendIdx["nextPutAll:"]=7;
+_st($1)._nextPutAll_(aString);
+$ctx1.sendIdx["nextPutAll:"]=8;
+_st($1)._nextPutAll_(")}");
+$2=_st($1)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},globals.JSStream)})},
+args: ["aString"],
+source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", "lf"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutClosureWith:arguments:",
+protocol: 'streaming',
+fn: function (aBlock,anArray){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st(self["@stream"])._nextPutAll_("(function(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(anArray)._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
+$ctx2.sendIdx["nextPutAll:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@stream"])._nextPut_(",");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$1=self["@stream"];
+_st($1)._nextPutAll_("){");
+$ctx1.sendIdx["nextPutAll:"]=3;
+$2=_st($1)._lf();
+_st(aBlock)._value();
+_st(self["@stream"])._nextPutAll_("})");
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)})},
+args: ["aBlock", "anArray"],
+source: "nextPutClosureWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '})'",
+messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutContextFor:during:",
+protocol: 'streaming',
+fn: function (aMethod,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
+$1=_st(aMethod)._requiresSmalltalkContext();
+if(! smalltalk.assert($1)){
+$2=_st(aBlock)._value();
+$ctx1.sendIdx["value"]=1;
+return $2;
+};
+$6=_st(aMethod)._scope();
+$ctx1.sendIdx["scope"]=1;
+$5=_st($6)._alias();
+$ctx1.sendIdx["alias"]=1;
+$4="return smalltalk.withContext(function(".__comma($5);
+$ctx1.sendIdx[","]=2;
+$3=_st($4).__comma(") { ");
+$ctx1.sendIdx[","]=1;
+self._nextPutAll_($3);
+$ctx1.sendIdx["nextPutAll:"]=1;
+$7=self._lf();
+_st(aBlock)._value();
+$12=_st(aMethod)._scope();
+$ctx1.sendIdx["scope"]=2;
+$11=_st($12)._alias();
+$ctx1.sendIdx["alias"]=2;
+$10="}, function(".__comma($11);
+$ctx1.sendIdx[","]=5;
+$9=_st($10).__comma(") {");
+$ctx1.sendIdx[","]=4;
+$8=_st($9).__comma(_st(_st(aMethod)._scope())._alias());
+$ctx1.sendIdx[","]=3;
+self._nextPutAll_($8);
+$ctx1.sendIdx["nextPutAll:"]=2;
+$16=_st(_st(aMethod)._selector())._asJavascript();
+$ctx1.sendIdx["asJavascript"]=1;
+$15=".fill(self,".__comma($16);
+$14=_st($15).__comma(",{");
+$ctx1.sendIdx[","]=6;
+$13=self._nextPutAll_($14);
+$ctx1.sendIdx["nextPutAll:"]=3;
+_st(_st(aMethod)._locals())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$17=_st(each)._asVariableName();
+$ctx2.sendIdx["asVariableName"]=1;
+self._nextPutAll_($17);
+$ctx2.sendIdx["nextPutAll:"]=4;
+self._nextPutAll_(":");
+$ctx2.sendIdx["nextPutAll:"]=5;
+$18=self._nextPutAll_(_st(each)._asVariableName());
+$ctx2.sendIdx["nextPutAll:"]=6;
+return $18;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._nextPutAll_(",");
+$ctx2.sendIdx["nextPutAll:"]=7;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+self._nextPutAll_("},");
+$ctx1.sendIdx["nextPutAll:"]=8;
+self._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
+$ctx1.sendIdx["nextPutAll:"]=9;
+$19=self._nextPutAll_(")})");
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)})},
+args: ["aMethod", "aBlock"],
+source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { '; lf.\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')})'",
+messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutFunctionWith:arguments:",
+protocol: 'streaming',
+fn: function (aBlock,anArray){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+_st(self["@stream"])._nextPutAll_("fn: function(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(anArray)._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
+$ctx2.sendIdx["nextPutAll:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@stream"])._nextPut_(",");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$1=self["@stream"];
+_st($1)._nextPutAll_("){");
+$ctx1.sendIdx["nextPutAll:"]=3;
+$2=_st($1)._lf();
+$ctx1.sendIdx["lf"]=1;
+$3=self["@stream"];
+_st($3)._nextPutAll_("var self=this;");
+$ctx1.sendIdx["nextPutAll:"]=4;
+$4=_st($3)._lf();
+_st(aBlock)._value();
+_st(self["@stream"])._nextPutAll_("}");
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)})},
+args: ["aBlock", "anArray"],
+source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '}'",
+messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutIf:with:",
+protocol: 'streaming',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st(self["@stream"])._nextPutAll_("if(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aBlock)._value();
+$ctx1.sendIdx["value"]=1;
+$1=self["@stream"];
+_st($1)._nextPutAll_("){");
+$ctx1.sendIdx["nextPutAll:"]=2;
+$2=_st($1)._lf();
+_st(anotherBlock)._value();
+_st(self["@stream"])._nextPutAll_("}");
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.JSStream)})},
+args: ["aBlock", "anotherBlock"],
+source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
+messageSends: ["nextPutAll:", "value", "lf"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutIfElse:with:with:",
+protocol: 'streaming',
+fn: function (aBlock,ifBlock,elseBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+_st(self["@stream"])._nextPutAll_("if(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aBlock)._value();
+$ctx1.sendIdx["value"]=1;
+$1=self["@stream"];
+_st($1)._nextPutAll_("){");
+$ctx1.sendIdx["nextPutAll:"]=2;
+$2=_st($1)._lf();
+$ctx1.sendIdx["lf"]=1;
+_st(ifBlock)._value();
+$ctx1.sendIdx["value"]=2;
+$3=self["@stream"];
+_st($3)._nextPutAll_("} else {");
+$ctx1.sendIdx["nextPutAll:"]=3;
+$4=_st($3)._lf();
+_st(elseBlock)._value();
+_st(self["@stream"])._nextPutAll_("}");
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},globals.JSStream)})},
+args: ["aBlock", "ifBlock", "elseBlock"],
+source: "nextPutIfElse: aBlock with: ifBlock with: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'",
+messageSends: ["nextPutAll:", "value", "lf"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutMethodDeclaration:with:",
+protocol: 'streaming',
+fn: function (aMethod,aBlock){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26;
+$1=self["@stream"];
+_st($1)._nextPutAll_("smalltalk.method({");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st($1)._lf();
+$ctx1.sendIdx["lf"]=1;
+$2=$1;
+$5=_st(_st(aMethod)._selector())._asJavascript();
+$ctx1.sendIdx["asJavascript"]=1;
+$4="selector: ".__comma($5);
+$ctx1.sendIdx[","]=2;
+$3=_st($4).__comma(",");
+$ctx1.sendIdx[","]=1;
+_st($2)._nextPutAll_($3);
+$ctx1.sendIdx["nextPutAll:"]=2;
+_st($1)._lf();
+$ctx1.sendIdx["lf"]=2;
+$6=$1;
+$9=_st(_st(aMethod)._source())._asJavascript();
+$ctx1.sendIdx["asJavascript"]=2;
+$8="source: ".__comma($9);
+$ctx1.sendIdx[","]=4;
+$7=_st($8).__comma(",");
+$ctx1.sendIdx[","]=3;
+_st($6)._nextPutAll_($7);
+$ctx1.sendIdx["nextPutAll:"]=3;
+$10=_st($1)._lf();
+$ctx1.sendIdx["lf"]=3;
+_st(aBlock)._value();
+$ctx1.sendIdx["value"]=1;
+$11=self["@stream"];
+$12=$11;
+$15=_st($String())._lf();
+$ctx1.sendIdx["lf"]=4;
+$14=",".__comma($15);
+$ctx1.sendIdx[","]=6;
+$13=_st($14).__comma("messageSends: ");
+$ctx1.sendIdx[","]=5;
+_st($12)._nextPutAll_($13);
+$ctx1.sendIdx["nextPutAll:"]=4;
+$16=$11;
+$19=_st(_st(aMethod)._messageSends())._asArray();
+$ctx1.sendIdx["asArray"]=1;
+$18=_st($19)._asJavascript();
+$ctx1.sendIdx["asJavascript"]=3;
+$17=_st($18).__comma(",");
+$ctx1.sendIdx[","]=7;
+_st($16)._nextPutAll_($17);
+$ctx1.sendIdx["nextPutAll:"]=5;
+_st($11)._lf();
+$ctx1.sendIdx["lf"]=5;
+$20=$11;
+$23=_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._value();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asArray())._asJavascript();
+$ctx1.sendIdx["asJavascript"]=4;
+$22="args: ".__comma($23);
+$21=_st($22).__comma(",");
+$ctx1.sendIdx[","]=8;
+_st($20)._nextPutAll_($21);
+$ctx1.sendIdx["nextPutAll:"]=6;
+_st($11)._lf();
+$24=_st($11)._nextPutAll_("referencedClasses: [");
+$ctx1.sendIdx["nextPutAll:"]=7;
+_st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
+$ctx2.sendIdx["nextPutAll:"]=8;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@stream"])._nextPutAll_(",");
+$ctx2.sendIdx["nextPutAll:"]=9;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$25=self["@stream"];
+_st($25)._nextPutAll_("]");
+$ctx1.sendIdx["nextPutAll:"]=10;
+$26=_st($25)._nextPutAll_("})");
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)})},
+args: ["aMethod", "aBlock"],
+source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
+messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
+referencedClasses: ["String"]
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutNonLocalReturnHandlingWith:",
+protocol: 'streaming',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+$1=self["@stream"];
+_st($1)._nextPutAll_("var $early={};");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st($1)._lf();
+$ctx1.sendIdx["lf"]=1;
+_st($1)._nextPutAll_("try {");
+$ctx1.sendIdx["nextPutAll:"]=2;
+$2=_st($1)._lf();
+$ctx1.sendIdx["lf"]=2;
+_st(aBlock)._value();
+$3=self["@stream"];
+_st($3)._nextPutAll_("}");
+$ctx1.sendIdx["nextPutAll:"]=3;
+_st($3)._lf();
+$ctx1.sendIdx["lf"]=3;
+_st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
+$4=_st($3)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},globals.JSStream)})},
+args: ["aBlock"],
+source: "nextPutNonLocalReturnHandlingWith: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'var $early={};'; lf;\x0a\x09\x09nextPutAll: 'try {'; lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: '}'; lf;\x0a\x09\x09nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf",
+messageSends: ["nextPutAll:", "lf", "value"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutNonLocalReturnWith:",
+protocol: 'streaming',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@stream"])._nextPutAll_("throw $early=[");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aBlock)._value();
+_st(self["@stream"])._nextPutAll_("]");
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},globals.JSStream)})},
+args: ["aBlock"],
+source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
+messageSends: ["nextPutAll:", "value"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutReturn",
+protocol: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@stream"])._nextPutAll_("return ");
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},globals.JSStream)})},
+args: [],
+source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
+messageSends: ["nextPutAll:"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutReturnWith:",
+protocol: 'streaming',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._nextPutReturn();
+_st(aBlock)._value();
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},globals.JSStream)})},
+args: ["aBlock"],
+source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
+messageSends: ["nextPutReturn", "value"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutSendIndexFor:",
+protocol: 'streaming',
+fn: function (anIRSend){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._nextPutAll_(";");
+$ctx1.sendIdx["nextPutAll:"]=1;
+self._lf();
+self._nextPutAll_(_st(_st(anIRSend)._scope())._alias());
+$ctx1.sendIdx["nextPutAll:"]=2;
+self._nextPutAll_(".sendIdx[");
+$ctx1.sendIdx["nextPutAll:"]=3;
+self._nextPutAll_(_st(_st(anIRSend)._selector())._asJavascript());
+$ctx1.sendIdx["nextPutAll:"]=4;
+self._nextPutAll_("]=");
+$ctx1.sendIdx["nextPutAll:"]=5;
+$1=self._nextPutAll_(_st(_st(anIRSend)._index())._asString());
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},globals.JSStream)})},
+args: ["anIRSend"],
+source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString",
+messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutSequenceWith:",
+protocol: 'streaming',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aBlock)._value();
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},globals.JSStream)})},
+args: ["aBlock"],
+source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch(smalltalk.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22",
+messageSends: ["value"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutStatementWith:",
+protocol: 'streaming',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st(aBlock)._value();
+$1=self["@stream"];
+_st($1)._nextPutAll_(";");
+$2=_st($1)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},globals.JSStream)})},
+args: ["aBlock"],
+source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
+messageSends: ["value", "nextPutAll:", "lf"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutVars:",
+protocol: 'streaming',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+var $early={};
+try {
+_st(aCollection)._ifEmpty_((function(){
+throw $early=[self];
+}));
+_st(self["@stream"])._nextPutAll_("var ");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aCollection)._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@stream"])._nextPutAll_(each);
+$ctx2.sendIdx["nextPutAll:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@stream"])._nextPutAll_(",");
+$ctx2.sendIdx["nextPutAll:"]=3;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$1=self["@stream"];
+_st($1)._nextPutAll_(";");
+$2=_st($1)._lf();
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},globals.JSStream)})},
+args: ["aCollection"],
+source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
+messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"],
+referencedClasses: []
+}),
+globals.JSStream);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "appendToInstruction:",
+protocol: '*Compiler-IR',
+fn: function (anIRInstruction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(anIRInstruction)._appendBlock_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},globals.BlockClosure)})},
+args: ["anIRInstruction"],
+source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
+messageSends: ["appendBlock:"],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+});

+ 1299 - 0
src/Compiler-IR.st

@@ -0,0 +1,1299 @@
+Smalltalk createPackage: 'Compiler-IR'!
+NodeVisitor subclass: #IRASTTranslator
+	instanceVariableNames: 'source theClass method sequence nextAlias'
+	package: 'Compiler-IR'!
+!IRASTTranslator commentStamp!
+I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.!
+
+!IRASTTranslator methodsFor: 'accessing'!
+
+method
+	^ method
+!
+
+method: anIRMethod
+	method := anIRMethod
+!
+
+nextAlias
+	nextAlias ifNil: [ nextAlias := 0 ].
+	nextAlias := nextAlias + 1.
+	^ nextAlias asString
+!
+
+sequence
+	^ sequence
+!
+
+sequence: anIRSequence
+	sequence := anIRSequence
+!
+
+source
+	^ source
+!
+
+source: aString
+	source := aString
+!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
+!
+
+withSequence: aSequence do: aBlock
+	| outerSequence |
+	outerSequence := self sequence.
+	self sequence: aSequence.
+	aBlock value.
+	self sequence: outerSequence.
+	^ aSequence
+! !
+
+!IRASTTranslator methodsFor: 'visiting'!
+
+alias: aNode
+	| variable |
+
+	aNode isImmutable ifTrue: [ ^ self visit: aNode ].
+
+	variable := IRVariable new
+		variable: (AliasVar new name: '$', self nextAlias);
+		yourself.
+
+	self sequence add: (IRAssignment new
+		add: variable;
+		add: (self visit: aNode);
+		yourself).
+
+	self method internalVariables add: variable.
+
+	^ variable
+!
+
+aliasTemporally: aCollection
+	"https://github.com/NicolasPetton/amber/issues/296
+	
+	If a node is aliased, all preceding ones are aliased as well.
+	The tree is iterated twice. First we get the aliasing dependency,
+	then the aliasing itself is done"
+
+	| threshold result |
+	threshold := 0.
+	
+	aCollection withIndexDo: [ :each :i |
+		each subtreeNeedsAliasing
+			ifTrue: [ threshold := i ] ].
+
+	result := OrderedCollection new.
+	aCollection withIndexDo: [ :each :i |
+		result add: (i <= threshold
+			ifTrue: [ self alias: each ]
+			ifFalse: [ self visit: each ]) ].
+
+	^ result
+!
+
+visitAssignmentNode: aNode
+	| left right assignment |
+	right := self visit: aNode right.
+	left := self visit: aNode left.
+	self sequence add: (IRAssignment new
+		add: left;
+		add: right;
+		yourself).
+	^ left
+!
+
+visitBlockNode: aNode
+	| closure |
+	closure := IRClosure new
+		arguments: aNode parameters;
+		requiresSmalltalkContext: aNode requiresSmalltalkContext;
+		scope: aNode scope;
+		yourself.
+	aNode scope temps do: [ :each |
+		closure add: (IRTempDeclaration new
+			name: each name;
+			scope: aNode scope;
+			yourself) ].
+	aNode nodes do: [ :each | closure add: (self visit: each) ].
+	^ closure
+!
+
+visitBlockSequenceNode: aNode
+	^ self
+		withSequence: IRBlockSequence new
+		do: [
+			aNode nodes ifNotEmpty: [
+				aNode nodes allButLast do: [ :each |
+					self sequence add: (self visitOrAlias: each) ].
+				aNode nodes last isReturnNode
+					ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]
+					ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]
+!
+
+visitCascadeNode: aNode
+	| alias receiver |
+
+	aNode receiver isImmutable 
+		ifTrue: [ receiver := aNode receiver ]
+		ifFalse: [
+			alias := self alias: aNode receiver.
+			receiver := VariableNode new binding: alias variable ].
+	
+	aNode nodes do: [ :each |
+			each receiver: receiver ].
+
+	aNode nodes allButLast do: [ :each |
+		self sequence add: (self visit: each) ].
+
+	^ self alias: aNode nodes last
+!
+
+visitDynamicArrayNode: aNode
+	| array |
+	array := IRDynamicArray new.
+	(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].
+	^ array
+!
+
+visitDynamicDictionaryNode: aNode
+	| dictionary |
+	dictionary := IRDynamicDictionary new.
+	(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].
+	^ dictionary
+!
+
+visitJSStatementNode: aNode
+	^ IRVerbatim new
+		source: aNode source crlfSanitized;
+		yourself
+!
+
+visitMethodNode: aNode
+
+	self method: (IRMethod new
+		source: self source crlfSanitized;
+		theClass: self theClass;
+		arguments: aNode arguments;
+		selector: aNode selector;
+		sendIndexes: aNode sendIndexes;
+		superSends: aNode superSends;
+		requiresSmalltalkContext: aNode requiresSmalltalkContext;
+		classReferences: aNode classReferences;
+		scope: aNode scope;
+		yourself).
+
+	aNode scope temps do: [ :each |
+		self method add: (IRTempDeclaration new
+			name: each name;
+			scope: aNode scope;
+			yourself) ].
+
+	aNode nodes do: [ :each | self method add: (self visit: each) ].
+
+	aNode scope hasLocalReturn ifFalse: [
+		(self method add: IRReturn new) add: (IRVariable new
+			variable: (aNode scope pseudoVars at: 'self');
+			yourself) ].
+
+	^ self method
+!
+
+visitOrAlias: aNode
+	^ aNode shouldBeAliased
+		ifTrue: [ self alias: aNode ]
+		ifFalse: [ self visit: aNode ]
+!
+
+visitReturnNode: aNode
+	| return |
+	return := aNode nonLocalReturn
+		ifTrue: [ IRNonLocalReturn new ]
+		ifFalse: [ IRReturn new ].
+	return scope: aNode scope.
+	aNode nodes do: [ :each |
+		return add: (self alias: each) ].
+	^ return
+!
+
+visitSendNode: aNode
+	| send all receiver arguments |
+	send := IRSend new.
+	send
+		selector: aNode selector;
+		index: aNode index.
+	aNode superSend ifTrue: [ send classSend: self theClass superclass ].
+	
+	all := self aliasTemporally: { aNode receiver }, aNode arguments.
+	receiver := all first.
+	arguments := all allButFirst.
+
+	send add: receiver.
+	arguments do: [ :each | send add: each ].
+
+	^ send
+!
+
+visitSequenceNode: aNode
+	^ self
+		withSequence: IRSequence new
+		do: [
+			aNode nodes do: [ :each | | instruction |
+				instruction := self visitOrAlias: each.
+				instruction isVariable ifFalse: [
+					self sequence add: instruction ] ]]
+!
+
+visitValueNode: aNode
+	^ IRValue new
+		value: aNode value;
+		yourself
+!
+
+visitVariableNode: aNode
+	^ IRVariable new
+		variable: aNode binding;
+		yourself
+! !
+
+Object subclass: #IRInstruction
+	instanceVariableNames: 'parent instructions'
+	package: 'Compiler-IR'!
+!IRInstruction commentStamp!
+I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.
+The IR graph is used to emit JavaScript code using a JSStream.!
+
+!IRInstruction methodsFor: 'accessing'!
+
+instructions
+	^ instructions ifNil: [ instructions := OrderedCollection new ]
+!
+
+method
+	^ self parent method
+!
+
+parent
+	^ parent
+!
+
+parent: anIRInstruction
+	parent := anIRInstruction
+!
+
+scope
+	^ self parent ifNotNil: [ :node | 
+		node scope ]
+! !
+
+!IRInstruction methodsFor: 'building'!
+
+add: anObject
+	anObject parent: self.
+	^ self instructions add: anObject
+!
+
+remove
+	self parent remove: self
+!
+
+remove: anIRInstruction
+	self instructions remove: anIRInstruction
+!
+
+replace: anIRInstruction with: anotherIRInstruction
+	anotherIRInstruction parent: self.
+	self instructions
+		at: (self instructions indexOf: anIRInstruction)
+		put: anotherIRInstruction
+!
+
+replaceWith: anIRInstruction
+	self parent replace: self with: anIRInstruction
+! !
+
+!IRInstruction methodsFor: 'testing'!
+
+canBeAssigned
+	^ true
+!
+
+isClosure
+	^ false
+!
+
+isInlined
+	^ false
+!
+
+isLocalReturn
+	^ false
+!
+
+isMethod
+	^ false
+!
+
+isReturn
+	^ false
+!
+
+isSend
+	^ false
+!
+
+isSequence
+	^ false
+!
+
+isTempDeclaration
+	^ false
+!
+
+isVariable
+	^ false
+!
+
+needsBoxingAsReceiver
+	^ true
+! !
+
+!IRInstruction methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRInstruction: self
+! !
+
+!IRInstruction class methodsFor: 'instance creation'!
+
+on: aBuilder
+	^ self new
+		builder: aBuilder;
+		yourself
+! !
+
+IRInstruction subclass: #IRAssignment
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+
+!IRAssignment methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRAssignment: self
+! !
+
+IRInstruction subclass: #IRDynamicArray
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+
+!IRDynamicArray methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRDynamicArray: self
+! !
+
+IRInstruction subclass: #IRDynamicDictionary
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+
+!IRDynamicDictionary methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRDynamicDictionary: self
+! !
+
+IRInstruction subclass: #IRScopedInstruction
+	instanceVariableNames: 'scope'
+	package: 'Compiler-IR'!
+
+!IRScopedInstruction methodsFor: 'accessing'!
+
+scope
+	^ scope
+!
+
+scope: aScope
+	scope := aScope
+! !
+
+IRScopedInstruction subclass: #IRClosureInstruction
+	instanceVariableNames: 'arguments requiresSmalltalkContext'
+	package: 'Compiler-IR'!
+
+!IRClosureInstruction methodsFor: 'accessing'!
+
+arguments
+	^ arguments ifNil: [ #() ]
+!
+
+arguments: aCollection
+	arguments := aCollection
+!
+
+locals
+	^ self arguments copy
+		addAll: (self tempDeclarations collect: [ :each | each name ]);
+		yourself
+!
+
+requiresSmalltalkContext
+	^ requiresSmalltalkContext ifNil: [ false ]
+!
+
+requiresSmalltalkContext: anObject
+	requiresSmalltalkContext := anObject
+!
+
+scope: aScope
+	super scope: aScope.
+	aScope instruction: self
+!
+
+tempDeclarations
+	^ self instructions select: [ :each |
+		each isTempDeclaration ]
+! !
+
+IRClosureInstruction subclass: #IRClosure
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+
+!IRClosure methodsFor: 'accessing'!
+
+sequence
+	^ self instructions last
+! !
+
+!IRClosure methodsFor: 'testing'!
+
+isClosure
+	^ true
+! !
+
+!IRClosure methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRClosure: self
+! !
+
+IRClosureInstruction subclass: #IRMethod
+	instanceVariableNames: 'theClass source selector classReferences sendIndexes superSends requiresSmalltalkContext internalVariables'
+	package: 'Compiler-IR'!
+!IRMethod commentStamp!
+I am a method instruction!
+
+!IRMethod methodsFor: 'accessing'!
+
+classReferences
+	^ classReferences
+!
+
+classReferences: aCollection
+	classReferences := aCollection
+!
+
+internalVariables
+	^ internalVariables ifNil: [ internalVariables := Set new ]
+!
+
+isMethod
+	^ true
+!
+
+messageSends
+	^ self sendIndexes keys
+!
+
+method
+	^ self
+!
+
+selector
+	^ selector
+!
+
+selector: aString
+	selector := aString
+!
+
+sendIndexes
+	^ sendIndexes
+!
+
+sendIndexes: aDictionary
+	sendIndexes := aDictionary
+!
+
+source
+	^ source
+!
+
+source: aString
+	source := aString
+!
+
+superSends
+	^ superSends
+!
+
+superSends: aCollection
+	superSends := aCollection
+!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
+! !
+
+!IRMethod methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRMethod: self
+! !
+
+IRScopedInstruction subclass: #IRReturn
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+!IRReturn commentStamp!
+I am a local return instruction.!
+
+!IRReturn methodsFor: 'accessing'!
+
+scope
+	^ scope ifNil: [ self parent scope ]
+! !
+
+!IRReturn methodsFor: 'testing'!
+
+canBeAssigned
+	^ false
+!
+
+isBlockReturn
+	^ false
+!
+
+isLocalReturn
+	^ true
+!
+
+isNonLocalReturn
+	^ self isLocalReturn not
+!
+
+isReturn
+	^ true
+! !
+
+!IRReturn methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRReturn: self
+! !
+
+IRReturn subclass: #IRBlockReturn
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+!IRBlockReturn commentStamp!
+Smalltalk blocks return their last statement. I am a implicit block return instruction.!
+
+!IRBlockReturn methodsFor: 'testing'!
+
+isBlockReturn
+	^ true
+! !
+
+!IRBlockReturn methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRBlockReturn: self
+! !
+
+IRReturn subclass: #IRNonLocalReturn
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+!IRNonLocalReturn commentStamp!
+I am a non local return instruction.
+Non local returns are handled using a try/catch JavaScript statement.
+
+See `IRNonLocalReturnHandling` class.!
+
+!IRNonLocalReturn methodsFor: 'testing'!
+
+isLocalReturn
+	^ false
+! !
+
+!IRNonLocalReturn methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRNonLocalReturn: self
+! !
+
+IRScopedInstruction subclass: #IRTempDeclaration
+	instanceVariableNames: 'name'
+	package: 'Compiler-IR'!
+
+!IRTempDeclaration methodsFor: 'accessing'!
+
+name
+	^ name
+!
+
+name: aString
+	name := aString
+! !
+
+!IRTempDeclaration methodsFor: 'testing'!
+
+isTempDeclaration
+	^ true
+! !
+
+!IRTempDeclaration methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRTempDeclaration: self
+! !
+
+IRInstruction subclass: #IRSend
+	instanceVariableNames: 'selector classSend index'
+	package: 'Compiler-IR'!
+!IRSend commentStamp!
+I am a message send instruction.!
+
+!IRSend methodsFor: 'accessing'!
+
+classSend
+	^ classSend
+!
+
+classSend: aClass
+	classSend := aClass
+!
+
+index
+	^ index
+!
+
+index: anInteger
+	index := anInteger
+!
+
+selector
+	^ selector
+!
+
+selector: aString
+	selector := aString
+! !
+
+!IRSend methodsFor: 'testing'!
+
+isSend
+	^ true
+! !
+
+!IRSend methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRSend: self
+! !
+
+IRInstruction subclass: #IRSequence
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+
+!IRSequence methodsFor: 'testing'!
+
+isSequence
+	^ true
+! !
+
+!IRSequence methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRSequence: self
+! !
+
+IRSequence subclass: #IRBlockSequence
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+
+!IRBlockSequence methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRBlockSequence: self
+! !
+
+IRInstruction subclass: #IRValue
+	instanceVariableNames: 'value'
+	package: 'Compiler-IR'!
+!IRValue commentStamp!
+I am the simplest possible instruction. I represent a value.!
+
+!IRValue methodsFor: 'accessing'!
+
+value
+	^ value
+!
+
+value: aString
+	value := aString
+! !
+
+!IRValue methodsFor: 'testing'!
+
+needsBoxingAsReceiver
+	^ false
+! !
+
+!IRValue methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRValue: self
+! !
+
+IRInstruction subclass: #IRVariable
+	instanceVariableNames: 'variable'
+	package: 'Compiler-IR'!
+!IRVariable commentStamp!
+I am a variable instruction.!
+
+!IRVariable methodsFor: 'accessing'!
+
+variable
+	^ variable
+!
+
+variable: aScopeVariable
+	variable := aScopeVariable
+! !
+
+!IRVariable methodsFor: 'testing'!
+
+isVariable
+	^ true
+!
+
+needsBoxingAsReceiver
+	^ self variable isPseudoVar not
+! !
+
+!IRVariable methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRVariable: self
+! !
+
+IRInstruction subclass: #IRVerbatim
+	instanceVariableNames: 'source'
+	package: 'Compiler-IR'!
+
+!IRVerbatim methodsFor: 'accessing'!
+
+source
+	^ source
+!
+
+source: aString
+	source := aString
+! !
+
+!IRVerbatim methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRVerbatim: self
+! !
+
+Object subclass: #IRVisitor
+	instanceVariableNames: ''
+	package: 'Compiler-IR'!
+
+!IRVisitor methodsFor: 'visiting'!
+
+visit: anIRInstruction
+	^ anIRInstruction accept: self
+!
+
+visitIRAssignment: anIRAssignment
+	^ self visitIRInstruction: anIRAssignment
+!
+
+visitIRBlockReturn: anIRBlockReturn
+	^ self visitIRReturn: anIRBlockReturn
+!
+
+visitIRBlockSequence: anIRBlockSequence
+	^ self visitIRSequence: anIRBlockSequence
+!
+
+visitIRClosure: anIRClosure
+	^ self visitIRInstruction: anIRClosure
+!
+
+visitIRDynamicArray: anIRDynamicArray
+	^ self visitIRInstruction: anIRDynamicArray
+!
+
+visitIRDynamicDictionary: anIRDynamicDictionary
+	^ self visitIRInstruction: anIRDynamicDictionary
+!
+
+visitIRInlinedClosure: anIRInlinedClosure
+	^ self visitIRClosure: anIRInlinedClosure
+!
+
+visitIRInlinedSequence: anIRInlinedSequence
+	^ self visitIRSequence: anIRInlinedSequence
+!
+
+visitIRInstruction: anIRInstruction
+	anIRInstruction instructions do: [ :each | self visit: each ].
+	^ anIRInstruction
+!
+
+visitIRMethod: anIRMethod
+	^ self visitIRInstruction: anIRMethod
+!
+
+visitIRNonLocalReturn: anIRNonLocalReturn
+	^ self visitIRInstruction: anIRNonLocalReturn
+!
+
+visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling
+	^ self visitIRInstruction: anIRNonLocalReturnHandling
+!
+
+visitIRReturn: anIRReturn
+	^ self visitIRInstruction: anIRReturn
+!
+
+visitIRSend: anIRSend
+	^ self visitIRInstruction: anIRSend
+!
+
+visitIRSequence: anIRSequence
+	^ self visitIRInstruction: anIRSequence
+!
+
+visitIRTempDeclaration: anIRTempDeclaration
+	^ self visitIRInstruction: anIRTempDeclaration
+!
+
+visitIRValue: anIRValue
+	^ self visitIRInstruction: anIRValue
+!
+
+visitIRVariable: anIRVariable
+	^ self visitIRInstruction: anIRVariable
+!
+
+visitIRVerbatim: anIRVerbatim
+	^ self visitIRInstruction: anIRVerbatim
+! !
+
+IRVisitor subclass: #IRJSTranslator
+	instanceVariableNames: 'stream currentClass'
+	package: 'Compiler-IR'!
+
+!IRJSTranslator methodsFor: 'accessing'!
+
+contents
+	^ self stream contents
+!
+
+currentClass
+	^ currentClass
+!
+
+currentClass: aClass
+	currentClass := aClass
+!
+
+stream
+	^ stream
+!
+
+stream: aStream
+	stream := aStream
+! !
+
+!IRJSTranslator methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	stream := JSStream new.
+! !
+
+!IRJSTranslator methodsFor: 'visiting'!
+
+visitIRAssignment: anIRAssignment
+	self visit: anIRAssignment instructions first.
+	self stream nextPutAssignment.
+	self visit: anIRAssignment instructions last.
+!
+
+visitIRClosure: anIRClosure
+	self stream
+		nextPutClosureWith: [
+			self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |
+					each name asVariableName ]).
+			self stream
+				nextPutBlockContextFor: anIRClosure
+				during: [ super visitIRClosure: anIRClosure ] ]
+		arguments: anIRClosure arguments
+!
+
+visitIRDynamicArray: anIRDynamicArray
+	self stream nextPutAll: '['.
+	anIRDynamicArray instructions
+		do: [ :each | self visit: each ]
+		separatedBy: [ self stream nextPutAll: ',' ].
+	stream nextPutAll: ']'
+!
+
+visitIRDynamicDictionary: anIRDynamicDictionary
+	self stream nextPutAll: 'globals.HashedCollection._newFromPairs_(['.
+		anIRDynamicDictionary instructions
+			do: [ :each | self visit: each ]
+			separatedBy: [ self stream nextPutAll: ',' ].
+	self stream nextPutAll: '])'
+!
+
+visitIRMethod: anIRMethod
+
+	self stream
+		nextPutMethodDeclaration: anIRMethod
+		with: [ self stream
+			nextPutFunctionWith: [
+				self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |
+					each name asVariableName ]).
+				anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].
+				self stream nextPutContextFor: anIRMethod during: [
+				anIRMethod internalVariables notEmpty ifTrue: [
+					self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |
+						each variable alias ]) ].
+				anIRMethod scope hasNonLocalReturn
+					ifTrue: [
+						self stream nextPutNonLocalReturnHandlingWith: [
+							super visitIRMethod: anIRMethod ] ]
+					ifFalse: [ super visitIRMethod: anIRMethod ] ]]
+			arguments: anIRMethod arguments ]
+!
+
+visitIRNonLocalReturn: anIRNonLocalReturn
+	self stream nextPutNonLocalReturnWith: [
+		super visitIRNonLocalReturn: anIRNonLocalReturn ]
+!
+
+visitIRReturn: anIRReturn
+	self stream nextPutReturnWith: [
+		super visitIRReturn: anIRReturn ]
+!
+
+visitIRSend: anIRSend
+	| sends |
+	sends := (anIRSend method sendIndexes at: anIRSend selector) size.
+	
+	anIRSend classSend
+		ifNil: [ self visitSend: anIRSend ]
+		ifNotNil: [ self visitSuperSend: anIRSend ].
+		
+	(sends > 1 and: [ anIRSend index < sends ])
+		ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]
+!
+
+visitIRSequence: anIRSequence
+	self stream nextPutSequenceWith: [
+		anIRSequence instructions do: [ :each |
+			self stream nextPutStatementWith: (self visit: each) ] ]
+!
+
+visitIRTempDeclaration: anIRTempDeclaration
+	"self stream
+		nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';
+		lf"
+!
+
+visitIRValue: anIRValue
+	self stream nextPutAll: anIRValue value asJavascript
+!
+
+visitIRVariable: anIRVariable
+	anIRVariable variable name = 'thisContext'
+		ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]
+		ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]
+!
+
+visitIRVerbatim: anIRVerbatim
+	self stream nextPutStatementWith: [
+		self stream nextPutAll: anIRVerbatim source ]
+!
+
+visitReceiver: anIRInstruction
+	anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].
+	
+	self stream nextPutAll: '_st('.
+	self visit: anIRInstruction.
+	self stream nextPutAll: ')'
+!
+
+visitSend: anIRSend
+	self visitReceiver: anIRSend instructions first.
+	self stream nextPutAll: '.', anIRSend selector asSelector, '('.
+	anIRSend instructions allButFirst
+		do: [ :each | self visit: each ]
+		separatedBy: [ self stream nextPutAll: ',' ].
+	self stream nextPutAll: ')'
+!
+
+visitSuperSend: anIRSend
+	self stream
+		nextPutAll: '(', anIRSend scope alias, '.supercall = true, ';
+		nextPutAll: self currentClass asJavascript;
+		nextPutAll: '.superclass.fn.prototype.';
+		nextPutAll: anIRSend selector asSelector, '.apply(';
+		nextPutAll: '_st('.
+	self visit: anIRSend instructions first.
+	self stream nextPutAll: '), ['.
+	anIRSend instructions allButFirst
+		do: [ :each | self visit: each ]
+		separatedBy: [ self stream nextPutAll: ',' ].
+	self stream 
+		nextPutAll: ']));'; lf;
+		nextPutAll: anIRSend scope alias, '.supercall = false'
+! !
+
+Object subclass: #JSStream
+	instanceVariableNames: 'stream'
+	package: 'Compiler-IR'!
+
+!JSStream methodsFor: 'accessing'!
+
+contents
+	^ stream contents
+! !
+
+!JSStream methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	stream := '' writeStream.
+! !
+
+!JSStream methodsFor: 'streaming'!
+
+lf
+	stream lf
+!
+
+nextPut: aString
+	stream nextPut: aString
+!
+
+nextPutAll: aString
+	stream nextPutAll: aString
+!
+
+nextPutAssignment
+	stream nextPutAll: '='
+!
+
+nextPutBlockContextFor: anIRClosure during: aBlock
+	anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].
+	self
+		nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; lf.
+	
+	aBlock value.
+	
+	self
+		nextPutAll: '}, function(', anIRClosure scope alias, ') {';
+		nextPutAll: anIRClosure scope alias, '.fillBlock({'.
+	
+	anIRClosure locals
+		do: [ :each |
+			self
+				nextPutAll: each asVariableName;
+				nextPutAll: ':';
+				nextPutAll: each asVariableName ]
+		separatedBy: [ self nextPutAll: ',' ].
+	
+	self
+		nextPutAll: '},';
+		nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')})'
+!
+
+nextPutClassRefFunction: aString
+	"Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.
+	This ensures that undefined global access will answer `nil`"
+	
+	stream
+		nextPutAll: 'function $';
+		nextPutAll: aString;
+		nextPutAll: '(){return globals.';
+		nextPutAll: aString;
+		nextPutAll: '||(typeof ';
+		nextPutAll: aString;
+		nextPutAll: '=="undefined"?nil:';
+		nextPutAll: aString;
+		nextPutAll: ')}';
+		lf
+!
+
+nextPutClosureWith: aBlock arguments: anArray
+	stream nextPutAll: '(function('.
+	anArray
+		do: [ :each | stream nextPutAll: each asVariableName ]
+		separatedBy: [ stream nextPut: ',' ].
+	stream nextPutAll: '){'; lf.
+	aBlock value.
+	stream nextPutAll: '})'
+!
+
+nextPutContextFor: aMethod during: aBlock
+	aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].
+	
+	self
+		nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { '; lf.
+	aBlock value.
+	
+	self
+		nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;
+		nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.
+
+	aMethod locals
+		do: [ :each |
+			self
+				nextPutAll: each asVariableName;
+				nextPutAll: ':';
+				nextPutAll: each asVariableName ]
+		separatedBy: [ self nextPutAll: ',' ].
+	
+	self
+		nextPutAll: '},';
+		nextPutAll: aMethod theClass asJavascript;
+		nextPutAll: ')})'
+!
+
+nextPutFunctionWith: aBlock arguments: anArray
+	stream nextPutAll: 'fn: function('.
+	anArray
+		do: [ :each | stream nextPutAll: each asVariableName ]
+		separatedBy: [ stream nextPut: ',' ].
+	stream nextPutAll: '){'; lf.
+	stream nextPutAll: 'var self=this;'; lf.
+	aBlock value.
+	stream nextPutAll: '}'
+!
+
+nextPutIf: aBlock with: anotherBlock
+	stream nextPutAll: 'if('.
+	aBlock value.
+	stream nextPutAll: '){'; lf.
+	anotherBlock value.
+	stream nextPutAll: '}'
+!
+
+nextPutIfElse: aBlock with: ifBlock with: elseBlock
+	stream nextPutAll: 'if('.
+	aBlock value.
+	stream nextPutAll: '){'; lf.
+	ifBlock value.
+	stream nextPutAll: '} else {'; lf.
+	elseBlock value.
+	stream nextPutAll: '}'
+!
+
+nextPutMethodDeclaration: aMethod with: aBlock
+	stream
+		nextPutAll: 'smalltalk.method({'; lf;
+		nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;
+		nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.
+	aBlock value.
+	stream
+		nextPutAll: ',', String lf, 'messageSends: ';
+		nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;
+		nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;
+		nextPutAll: 'referencedClasses: ['.
+	aMethod classReferences
+		do: [ :each | stream nextPutAll: each asJavascript ]
+		separatedBy: [ stream nextPutAll: ',' ].
+	stream
+		nextPutAll: ']';
+		nextPutAll: '})'
+!
+
+nextPutNonLocalReturnHandlingWith: aBlock
+	stream
+		nextPutAll: 'var $early={};'; lf;
+		nextPutAll: 'try {'; lf.
+	aBlock value.
+	stream
+		nextPutAll: '}'; lf;
+		nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf
+!
+
+nextPutNonLocalReturnWith: aBlock
+	stream nextPutAll: 'throw $early=['.
+	aBlock value.
+	stream nextPutAll: ']'
+!
+
+nextPutReturn
+	stream nextPutAll: 'return '
+!
+
+nextPutReturnWith: aBlock
+	self nextPutReturn.
+	aBlock value
+!
+
+nextPutSendIndexFor: anIRSend
+	self 
+		nextPutAll: ';'; lf;
+		nextPutAll: anIRSend scope alias;
+		nextPutAll: '.sendIdx[';
+		nextPutAll: anIRSend selector asJavascript;
+		nextPutAll: ']=';
+		nextPutAll: anIRSend index asString
+!
+
+nextPutSequenceWith: aBlock
+	"stream
+		nextPutAll: 'switch(smalltalk.thisContext.pc){'; lf."
+	aBlock value.
+	"stream
+		nextPutAll: '};'; lf"
+!
+
+nextPutStatementWith: aBlock
+	aBlock value.
+	stream nextPutAll: ';'; lf
+!
+
+nextPutVars: aCollection
+	aCollection ifEmpty: [ ^ self ].
+	
+	stream nextPutAll: 'var '.
+	aCollection
+		do: [ :each | stream nextPutAll: each ]
+		separatedBy: [ stream nextPutAll: ',' ].
+	stream nextPutAll: ';'; lf
+! !
+
+!BlockClosure methodsFor: '*Compiler-IR'!
+
+appendToInstruction: anIRInstruction
+	anIRInstruction appendBlock: self
+! !
+

+ 1746 - 0
src/Compiler-Inlining.js

@@ -0,0 +1,1746 @@
+define("amber_core/Compiler-Inlining", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Compiler-Inlining');
+smalltalk.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('IRInlinedAssignment', globals.IRAssignment, [], 'Compiler-Inlining');
+globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRInlinedAssignment_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedAssignment)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
+messageSends: ["visitIRInlinedAssignment:"],
+referencedClasses: []
+}),
+globals.IRInlinedAssignment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInlined",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInlined\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInlinedAssignment);
+
+
+
+smalltalk.addClass('IRInlinedClosure', globals.IRClosure, [], 'Compiler-Inlining');
+globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aVisitor)._visitIRInlinedClosure_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedClosure)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
+messageSends: ["visitIRInlinedClosure:"],
+referencedClasses: []
+}),
+globals.IRInlinedClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInlined",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInlined\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInlinedClosure);
+
+
+
+smalltalk.addClass('IRInlinedReturn', globals.IRReturn, [], 'Compiler-Inlining');
+globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aVisitor)._visitIRInlinedReturn_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedReturn)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
+messageSends: ["visitIRInlinedReturn:"],
+referencedClasses: []
+}),
+globals.IRInlinedReturn);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInlined",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInlined\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInlinedReturn);
+
+
+
+smalltalk.addClass('IRInlinedSend', globals.IRSend, [], 'Compiler-Inlining');
+globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aVisitor)._visitInlinedSend_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSend)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
+messageSends: ["visitInlinedSend:"],
+referencedClasses: []
+}),
+globals.IRInlinedSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "internalVariables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=[];
+return $1;
+},
+args: [],
+source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInlinedSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInlined",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInlined\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInlinedSend);
+
+
+
+smalltalk.addClass('IRInlinedIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
+globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aVisitor)._visitIRInlinedIfFalse_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfFalse)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
+messageSends: ["visitIRInlinedIfFalse:"],
+referencedClasses: []
+}),
+globals.IRInlinedIfFalse);
+
+
+
+smalltalk.addClass('IRInlinedIfNilIfNotNil', globals.IRInlinedSend, [], 'Compiler-Inlining');
+globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfNilIfNotNil)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
+messageSends: ["visitIRInlinedIfNilIfNotNil:"],
+referencedClasses: []
+}),
+globals.IRInlinedIfNilIfNotNil);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "internalVariables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Array())._with_(self._receiverInternalVariable());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRInlinedIfNilIfNotNil)})},
+args: [],
+source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
+messageSends: ["with:", "receiverInternalVariable"],
+referencedClasses: ["Array"]
+}),
+globals.IRInlinedIfNilIfNotNil);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiverInternalVariable",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
+function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($IRVariable())._new();
+$ctx1.sendIdx["new"]=1;
+_st($2)._variable_(_st(_st($AliasVar())._new())._name_(self._receiverInternalVariableName()));
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},globals.IRInlinedIfNilIfNotNil)})},
+args: [],
+source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
+messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"],
+referencedClasses: ["IRVariable", "AliasVar"]
+}),
+globals.IRInlinedIfNilIfNotNil);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiverInternalVariableName",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "$receiver";
+},
+args: [],
+source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInlinedIfNilIfNotNil);
+
+
+
+smalltalk.addClass('IRInlinedIfTrue', globals.IRInlinedSend, [], 'Compiler-Inlining');
+globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aVisitor)._visitIRInlinedIfTrue_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrue)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
+messageSends: ["visitIRInlinedIfTrue:"],
+referencedClasses: []
+}),
+globals.IRInlinedIfTrue);
+
+
+
+smalltalk.addClass('IRInlinedIfTrueIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
+globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrueIfFalse)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
+messageSends: ["visitIRInlinedIfTrueIfFalse:"],
+referencedClasses: []
+}),
+globals.IRInlinedIfTrueIfFalse);
+
+
+
+smalltalk.addClass('IRInlinedSequence', globals.IRBlockSequence, [], 'Compiler-Inlining');
+globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accept:",
+protocol: 'visiting',
+fn: function (aVisitor){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aVisitor)._visitIRInlinedSequence_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSequence)})},
+args: ["aVisitor"],
+source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
+messageSends: ["visitIRInlinedSequence:"],
+referencedClasses: []
+}),
+globals.IRInlinedSequence);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInlined",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInlined\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRInlinedSequence);
+
+
+
+smalltalk.addClass('IRInliner', globals.IRVisitor, [], 'Compiler-Inlining');
+globals.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "assignmentInliner",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $IRAssignmentInliner(){return globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($IRAssignmentInliner())._new();
+_st($2)._translator_(self);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},globals.IRInliner)})},
+args: [],
+source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
+messageSends: ["translator:", "new", "yourself"],
+referencedClasses: ["IRAssignmentInliner"]
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "returnInliner",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $IRReturnInliner(){return globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($IRReturnInliner())._new();
+_st($2)._translator_(self);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"returnInliner",{},globals.IRInliner)})},
+args: [],
+source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
+messageSends: ["translator:", "new", "yourself"],
+referencedClasses: ["IRReturnInliner"]
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendInliner",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($IRSendInliner())._new();
+_st($2)._translator_(self);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sendInliner",{},globals.IRInliner)})},
+args: [],
+source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
+messageSends: ["translator:", "new", "yourself"],
+referencedClasses: ["IRSendInliner"]
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldInlineAssignment:",
+protocol: 'testing',
+fn: function (anIRAssignment){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+$1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(anIRAssignment)._instructions();
+$ctx2.sendIdx["instructions"]=1;
+$3=_st($4)._last();
+$ctx2.sendIdx["last"]=1;
+$2=_st($3)._isSend();
+return _st($2)._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["and:"]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)})},
+args: ["anIRAssignment"],
+source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
+messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"],
+referencedClasses: []
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldInlineReturn:",
+protocol: 'testing',
+fn: function (anIRReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+$1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(anIRReturn)._instructions();
+$ctx2.sendIdx["instructions"]=1;
+$3=_st($4)._first();
+$ctx2.sendIdx["first"]=1;
+$2=_st($3)._isSend();
+return _st($2)._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["and:"]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},globals.IRInliner)})},
+args: ["anIRReturn"],
+source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
+messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"],
+referencedClasses: []
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldInlineSend:",
+protocol: 'testing',
+fn: function (anIRSend){
+var self=this;
+function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st($IRSendInliner())._shouldInline_(anIRSend);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},globals.IRInliner)})},
+args: ["anIRSend"],
+source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
+messageSends: ["and:", "not", "isInlined", "shouldInline:"],
+referencedClasses: ["IRSendInliner"]
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transformNonLocalReturn:",
+protocol: 'visiting',
+fn: function (anIRNonLocalReturn){
+var self=this;
+var localReturn;
+function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$4,$3,$5,$6,$7,$8,$9;
+$2=_st(anIRNonLocalReturn)._scope();
+$ctx1.sendIdx["scope"]=1;
+$1=_st($2)._canInlineNonLocalReturns();
+if(smalltalk.assert($1)){
+$4=_st(anIRNonLocalReturn)._scope();
+$ctx1.sendIdx["scope"]=2;
+$3=_st($4)._methodScope();
+$5=_st(anIRNonLocalReturn)._scope();
+$ctx1.sendIdx["scope"]=3;
+_st($3)._removeNonLocalReturn_($5);
+$6=_st($IRReturn())._new();
+_st($6)._scope_(_st(anIRNonLocalReturn)._scope());
+$7=_st($6)._yourself();
+localReturn=$7;
+localReturn;
+_st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(localReturn)._add_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+_st(anIRNonLocalReturn)._replaceWith_(localReturn);
+$8=localReturn;
+return $8;
+};
+$9=($ctx1.supercall = true, globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
+$ctx1.supercall = false;
+return $9;
+}, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},globals.IRInliner)})},
+args: ["anIRNonLocalReturn"],
+source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
+messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"],
+referencedClasses: ["IRReturn"]
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRAssignment:",
+protocol: 'visiting',
+fn: function (anIRAssignment){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._shouldInlineAssignment_(anIRAssignment);
+if(smalltalk.assert($2)){
+$1=_st(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
+} else {
+$1=($ctx1.supercall = true, globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]));
+$ctx1.supercall = false;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)})},
+args: ["anIRAssignment"],
+source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
+messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"],
+referencedClasses: []
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRNonLocalReturn:",
+protocol: 'visiting',
+fn: function (anIRNonLocalReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._transformNonLocalReturn_(anIRNonLocalReturn);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRInliner)})},
+args: ["anIRNonLocalReturn"],
+source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
+messageSends: ["transformNonLocalReturn:"],
+referencedClasses: []
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRReturn:",
+protocol: 'visiting',
+fn: function (anIRReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._shouldInlineReturn_(anIRReturn);
+if(smalltalk.assert($2)){
+$1=_st(self._returnInliner())._inlineReturn_(anIRReturn);
+} else {
+$1=($ctx1.supercall = true, globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
+$ctx1.supercall = false;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRInliner)})},
+args: ["anIRReturn"],
+source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
+messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"],
+referencedClasses: []
+}),
+globals.IRInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRSend:",
+protocol: 'visiting',
+fn: function (anIRSend){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._shouldInlineSend_(anIRSend);
+if(smalltalk.assert($2)){
+$1=_st(self._sendInliner())._inlineSend_(anIRSend);
+} else {
+$1=($ctx1.supercall = true, globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]));
+$ctx1.supercall = false;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRInliner)})},
+args: ["anIRSend"],
+source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
+messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"],
+referencedClasses: []
+}),
+globals.IRInliner);
+
+
+
+smalltalk.addClass('IRInliningJSTranslator', globals.IRJSTranslator, [], 'Compiler-Inlining');
+globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedAssignment:",
+protocol: 'visiting',
+fn: function (anIRInlinedAssignment){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},globals.IRInliningJSTranslator)})},
+args: ["anIRInlinedAssignment"],
+source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
+messageSends: ["visit:", "last", "instructions"],
+referencedClasses: []
+}),
+globals.IRInliningJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedClosure:",
+protocol: 'visiting',
+fn: function (anIRInlinedClosure){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._stream())._nextPutVars_(_st(_st(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._name())._asVariableName();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
+_st(_st(anIRInlinedClosure)._instructions())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRInliningJSTranslator)})},
+args: ["anIRInlinedClosure"],
+source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
+messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"],
+referencedClasses: []
+}),
+globals.IRInliningJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedIfFalse:",
+protocol: 'visiting',
+fn: function (anIRInlinedIfFalse){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutIf_with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._stream();
+$ctx2.sendIdx["stream"]=2;
+_st($2)._nextPutAll_("! smalltalk.assert(");
+$ctx2.sendIdx["nextPutAll:"]=1;
+$4=_st(anIRInlinedIfFalse)._instructions();
+$ctx2.sendIdx["instructions"]=1;
+$3=_st($4)._first();
+self._visit_($3);
+$ctx2.sendIdx["visit:"]=1;
+return _st(self._stream())._nextPutAll_(")");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},globals.IRInliningJSTranslator)})},
+args: ["anIRInlinedIfFalse"],
+source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '! smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
+messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
+referencedClasses: []
+}),
+globals.IRInliningJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedIfNilIfNotNil:",
+protocol: 'visiting',
+fn: function (anIRInlinedIfNilIfNotNil){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$5,$4,$7,$6;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutIfElse_with_with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._stream();
+$ctx2.sendIdx["stream"]=2;
+$3=_st("(".__comma(_st(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
+$ctx2.sendIdx[","]=1;
+_st($2)._nextPutAll_($3);
+$ctx2.sendIdx["nextPutAll:"]=1;
+$5=_st(anIRInlinedIfNilIfNotNil)._instructions();
+$ctx2.sendIdx["instructions"]=1;
+$4=_st($5)._first();
+self._visit_($4);
+$ctx2.sendIdx["visit:"]=1;
+return _st(self._stream())._nextPutAll_(") == null || $receiver.isNil");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+$7=_st(anIRInlinedIfNilIfNotNil)._instructions();
+$ctx2.sendIdx["instructions"]=2;
+$6=_st($7)._second();
+return self._visit_($6);
+$ctx2.sendIdx["visit:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},globals.IRInliningJSTranslator)})},
+args: ["anIRInlinedIfNilIfNotNil"],
+source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || $receiver.isNil' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
+messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"],
+referencedClasses: []
+}),
+globals.IRInliningJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedIfTrue:",
+protocol: 'visiting',
+fn: function (anIRInlinedIfTrue){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutIf_with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._stream();
+$ctx2.sendIdx["stream"]=2;
+_st($2)._nextPutAll_("smalltalk.assert(");
+$ctx2.sendIdx["nextPutAll:"]=1;
+$4=_st(anIRInlinedIfTrue)._instructions();
+$ctx2.sendIdx["instructions"]=1;
+$3=_st($4)._first();
+self._visit_($3);
+$ctx2.sendIdx["visit:"]=1;
+return _st(self._stream())._nextPutAll_(")");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},globals.IRInliningJSTranslator)})},
+args: ["anIRInlinedIfTrue"],
+source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
+messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
+referencedClasses: []
+}),
+globals.IRInliningJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedIfTrueIfFalse:",
+protocol: 'visiting',
+fn: function (anIRInlinedIfTrueIfFalse){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3,$6,$5;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutIfElse_with_with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._stream();
+$ctx2.sendIdx["stream"]=2;
+_st($2)._nextPutAll_("smalltalk.assert(");
+$ctx2.sendIdx["nextPutAll:"]=1;
+$4=_st(anIRInlinedIfTrueIfFalse)._instructions();
+$ctx2.sendIdx["instructions"]=1;
+$3=_st($4)._first();
+self._visit_($3);
+$ctx2.sendIdx["visit:"]=1;
+return _st(self._stream())._nextPutAll_(")");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+$6=_st(anIRInlinedIfTrueIfFalse)._instructions();
+$ctx2.sendIdx["instructions"]=2;
+$5=_st($6)._second();
+return self._visit_($5);
+$ctx2.sendIdx["visit:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},globals.IRInliningJSTranslator)})},
+args: ["anIRInlinedIfTrueIfFalse"],
+source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
+messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"],
+referencedClasses: []
+}),
+globals.IRInliningJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedNonLocalReturn:",
+protocol: 'visiting',
+fn: function (anIRInlinedReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._stream();
+$ctx1.sendIdx["stream"]=1;
+_st($1)._nextPutStatementWith_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+_st(self._stream())._nextPutNonLocalReturnWith_((function(){
+}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)})},
+args: ["anIRInlinedReturn"],
+source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
+messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"],
+referencedClasses: []
+}),
+globals.IRInliningJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedReturn:",
+protocol: 'visiting',
+fn: function (anIRInlinedReturn){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)})},
+args: ["anIRInlinedReturn"],
+source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
+messageSends: ["visit:", "last", "instructions"],
+referencedClasses: []
+}),
+globals.IRInliningJSTranslator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitIRInlinedSequence:",
+protocol: 'visiting',
+fn: function (anIRInlinedSequence){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._stream())._nextPutStatementWith_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._visit_(each);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRInliningJSTranslator)})},
+args: ["anIRInlinedSequence"],
+source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
+messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"],
+referencedClasses: []
+}),
+globals.IRInliningJSTranslator);
+
+
+
+smalltalk.addClass('IRSendInliner', globals.Object, ['send', 'translator'], 'Compiler-Inlining');
+globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifFalse:",
+protocol: 'inlining',
+fn: function (anIRInstruction){
+var self=this;
+function $IRInlinedIfFalse(){return globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._inlinedSend_with_(_st($IRInlinedIfFalse())._new(),anIRInstruction);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
+args: ["anIRInstruction"],
+source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
+messageSends: ["inlinedSend:with:", "new"],
+referencedClasses: ["IRInlinedIfFalse"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifFalse:ifTrue:",
+protocol: 'inlining',
+fn: function (anIRInstruction,anotherIRInstruction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
+args: ["anIRInstruction", "anotherIRInstruction"],
+source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
+messageSends: ["perform:withArguments:"],
+referencedClasses: []
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNil:",
+protocol: 'inlining',
+fn: function (anIRInstruction){
+var self=this;
+function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
+function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
+function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$4,$5,$7,$8,$6,$9,$3,$1;
+$2=_st($IRInlinedIfNilIfNotNil())._new();
+$ctx1.sendIdx["new"]=1;
+$4=_st($IRClosure())._new();
+$ctx1.sendIdx["new"]=2;
+_st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
+$5=$4;
+$7=_st($IRBlockSequence())._new();
+_st($7)._add_(_st(_st(self._send())._instructions())._first());
+$8=_st($7)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+$6=$8;
+_st($5)._add_($6);
+$ctx1.sendIdx["add:"]=1;
+$9=_st($4)._yourself();
+$3=$9;
+$1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
+args: ["anIRInstruction"],
+source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
+messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
+referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNil:ifNotNil:",
+protocol: 'inlining',
+fn: function (anIRInstruction,anotherIRInstruction){
+var self=this;
+function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
+args: ["anIRInstruction", "anotherIRInstruction"],
+source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
+messageSends: ["inlinedSend:with:with:", "new"],
+referencedClasses: ["IRInlinedIfNilIfNotNil"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNotNil:",
+protocol: 'inlining',
+fn: function (anIRInstruction){
+var self=this;
+function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
+function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
+function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$4,$5,$7,$8,$6,$9,$3,$1;
+$2=_st($IRInlinedIfNilIfNotNil())._new();
+$ctx1.sendIdx["new"]=1;
+$4=_st($IRClosure())._new();
+$ctx1.sendIdx["new"]=2;
+_st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
+$5=$4;
+$7=_st($IRBlockSequence())._new();
+_st($7)._add_(_st(_st(self._send())._instructions())._first());
+$8=_st($7)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+$6=$8;
+_st($5)._add_($6);
+$ctx1.sendIdx["add:"]=1;
+$9=_st($4)._yourself();
+$3=$9;
+$1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
+args: ["anIRInstruction"],
+source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09with: anIRInstruction",
+messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
+referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNotNil:ifNil:",
+protocol: 'inlining',
+fn: function (anIRInstruction,anotherIRInstruction){
+var self=this;
+function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
+args: ["anIRInstruction", "anotherIRInstruction"],
+source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
+messageSends: ["inlinedSend:with:with:", "new"],
+referencedClasses: ["IRInlinedIfNilIfNotNil"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifTrue:",
+protocol: 'inlining',
+fn: function (anIRInstruction){
+var self=this;
+function $IRInlinedIfTrue(){return globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._inlinedSend_with_(_st($IRInlinedIfTrue())._new(),anIRInstruction);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
+args: ["anIRInstruction"],
+source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
+messageSends: ["inlinedSend:with:", "new"],
+referencedClasses: ["IRInlinedIfTrue"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifTrue:ifFalse:",
+protocol: 'inlining',
+fn: function (anIRInstruction,anotherIRInstruction){
+var self=this;
+function $IRInlinedIfTrueIfFalse(){return globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._inlinedSend_with_with_(_st($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
+args: ["anIRInstruction", "anotherIRInstruction"],
+source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
+messageSends: ["inlinedSend:with:with:", "new"],
+referencedClasses: ["IRInlinedIfTrueIfFalse"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlineClosure:",
+protocol: 'inlining',
+fn: function (anIRClosure){
+var self=this;
+var inlinedClosure,sequence,statements;
+function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
+function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
+function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
+function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$7,$8,$6,$9,$11,$12,$14,$16,$17,$18,$19,$15,$13,$20,$22,$24,$25,$23,$21,$26,$10,$28,$27,$31,$30,$32,$29,$33,$36,$35,$34,$37;
+inlinedClosure=self._inlinedClosure();
+$1=inlinedClosure;
+$2=$1;
+$3=_st(anIRClosure)._scope();
+$ctx1.sendIdx["scope"]=1;
+_st($2)._scope_($3);
+$ctx1.sendIdx["scope:"]=1;
+$4=_st($1)._parent_(_st(anIRClosure)._parent());
+_st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(inlinedClosure)._add_(each);
+$ctx2.sendIdx["add:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["do:"]=1;
+sequence=self._inlinedSequence();
+_st(_st(anIRClosure)._arguments())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$5=inlinedClosure;
+$7=_st($IRTempDeclaration())._new();
+$ctx2.sendIdx["new"]=1;
+_st($7)._name_(each);
+$ctx2.sendIdx["name:"]=1;
+$8=_st($7)._yourself();
+$ctx2.sendIdx["yourself"]=1;
+$6=$8;
+_st($5)._add_($6);
+$ctx2.sendIdx["add:"]=2;
+$9=sequence;
+$11=_st($IRAssignment())._new();
+$ctx2.sendIdx["new"]=2;
+$12=$11;
+$14=_st($IRVariable())._new();
+$ctx2.sendIdx["new"]=3;
+$16=_st($AliasVar())._new();
+$ctx2.sendIdx["new"]=4;
+$17=$16;
+$18=_st(inlinedClosure)._scope();
+$ctx2.sendIdx["scope"]=2;
+_st($17)._scope_($18);
+$ctx2.sendIdx["scope:"]=2;
+_st($16)._name_(each);
+$ctx2.sendIdx["name:"]=2;
+$19=_st($16)._yourself();
+$ctx2.sendIdx["yourself"]=2;
+$15=$19;
+$13=_st($14)._variable_($15);
+$ctx2.sendIdx["variable:"]=1;
+_st($12)._add_($13);
+$ctx2.sendIdx["add:"]=4;
+$20=$11;
+$22=_st($IRVariable())._new();
+$ctx2.sendIdx["new"]=5;
+$24=_st($AliasVar())._new();
+_st($24)._scope_(_st(inlinedClosure)._scope());
+_st($24)._name_("$receiver");
+$25=_st($24)._yourself();
+$ctx2.sendIdx["yourself"]=3;
+$23=$25;
+$21=_st($22)._variable_($23);
+_st($20)._add_($21);
+$ctx2.sendIdx["add:"]=5;
+$26=_st($11)._yourself();
+$10=$26;
+return _st($9)._add_($10);
+$ctx2.sendIdx["add:"]=3;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+$ctx1.sendIdx["do:"]=2;
+_st(inlinedClosure)._add_(sequence);
+$ctx1.sendIdx["add:"]=6;
+$28=_st(anIRClosure)._instructions();
+$ctx1.sendIdx["instructions"]=2;
+$27=_st($28)._last();
+$ctx1.sendIdx["last"]=1;
+statements=_st($27)._instructions();
+$ctx1.sendIdx["instructions"]=1;
+_st(statements)._ifNotEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(_st(statements)._allButLast())._do_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(sequence)._add_(each);
+$ctx3.sendIdx["add:"]=7;
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)})}));
+$31=_st(statements)._last();
+$ctx2.sendIdx["last"]=2;
+$30=_st($31)._isReturn();
+$29=_st($30)._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+$32=_st(statements)._last();
+$ctx3.sendIdx["last"]=3;
+return _st($32)._isBlockReturn();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
+if(smalltalk.assert($29)){
+$33=sequence;
+$36=_st(statements)._last();
+$ctx2.sendIdx["last"]=4;
+$35=_st($36)._instructions();
+$34=_st($35)._first();
+return _st($33)._add_($34);
+$ctx2.sendIdx["add:"]=8;
+} else {
+return _st(sequence)._add_(_st(statements)._last());
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$37=inlinedClosure;
+return $37;
+}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},globals.IRSendInliner)})},
+args: ["anIRClosure"],
+source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
+messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"],
+referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlineSend:",
+protocol: 'inlining',
+fn: function (anIRSend){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+self._send_(anIRSend);
+$3=self._send();
+$ctx1.sendIdx["send"]=1;
+$2=_st($3)._selector();
+$1=self._perform_withArguments_($2,_st(_st(self._send())._instructions())._allButFirst());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},globals.IRSendInliner)})},
+args: ["anIRSend"],
+source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
+messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
+referencedClasses: []
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlinedClosure",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $IRInlinedClosure(){return globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($IRInlinedClosure())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},globals.IRSendInliner)})},
+args: [],
+source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
+messageSends: ["new"],
+referencedClasses: ["IRInlinedClosure"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlinedSend:with:",
+protocol: 'inlining',
+fn: function (inlinedSend,anIRInstruction){
+var self=this;
+var inlinedClosure;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$5,$4,$3,$6,$7;
+$1=_st(anIRInstruction)._isClosure();
+if(! smalltalk.assert($1)){
+self._inliningError_("Message argument should be a block");
+$ctx1.sendIdx["inliningError:"]=1;
+};
+$2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
+if(! smalltalk.assert($2)){
+self._inliningError_("Inlined block should have zero argument");
+};
+inlinedClosure=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
+$5=self._send();
+$ctx1.sendIdx["send"]=1;
+$4=_st($5)._instructions();
+$3=_st($4)._first();
+_st(inlinedSend)._add_($3);
+$ctx1.sendIdx["add:"]=1;
+$6=_st(inlinedSend)._add_(inlinedClosure);
+_st(self._send())._replaceWith_(inlinedSend);
+$7=_st(_st(inlinedSend)._method())._internalVariables();
+$ctx1.sendIdx["internalVariables"]=1;
+_st($7)._addAll_(_st(inlinedSend)._internalVariables());
+return inlinedSend;
+}, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},globals.IRSendInliner)})},
+args: ["inlinedSend", "anIRInstruction"],
+source: "inlinedSend: inlinedSend with: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
+messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"],
+referencedClasses: []
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlinedSend:with:with:",
+protocol: 'inlining',
+fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
+var self=this;
+var inlinedClosure1,inlinedClosure2;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$7,$6,$5,$8,$9;
+$1=_st(anIRInstruction)._isClosure();
+$ctx1.sendIdx["isClosure"]=1;
+if(! smalltalk.assert($1)){
+self._inliningError_("Message argument should be a block");
+$ctx1.sendIdx["inliningError:"]=1;
+};
+$2=_st(anotherIRInstruction)._isClosure();
+if(! smalltalk.assert($2)){
+self._inliningError_("Message argument should be a block");
+};
+$3=self._translator();
+$ctx1.sendIdx["translator"]=1;
+$4=self._inlineClosure_(anIRInstruction);
+$ctx1.sendIdx["inlineClosure:"]=1;
+inlinedClosure1=_st($3)._visit_($4);
+$ctx1.sendIdx["visit:"]=1;
+inlinedClosure2=_st(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
+$7=self._send();
+$ctx1.sendIdx["send"]=1;
+$6=_st($7)._instructions();
+$5=_st($6)._first();
+_st(inlinedSend)._add_($5);
+$ctx1.sendIdx["add:"]=1;
+_st(inlinedSend)._add_(inlinedClosure1);
+$ctx1.sendIdx["add:"]=2;
+$8=_st(inlinedSend)._add_(inlinedClosure2);
+_st(self._send())._replaceWith_(inlinedSend);
+$9=_st(_st(inlinedSend)._method())._internalVariables();
+$ctx1.sendIdx["internalVariables"]=1;
+_st($9)._addAll_(_st(inlinedSend)._internalVariables());
+return inlinedSend;
+}, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},globals.IRSendInliner)})},
+args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
+source: "inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
+messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"],
+referencedClasses: []
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlinedSequence",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $IRInlinedSequence(){return globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($IRInlinedSequence())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},globals.IRSendInliner)})},
+args: [],
+source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
+messageSends: ["new"],
+referencedClasses: ["IRInlinedSequence"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inliningError:",
+protocol: 'error handling',
+fn: function (aString){
+var self=this;
+function $InliningError(){return globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
+return smalltalk.withContext(function($ctx1) { 
+_st($InliningError())._signal_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},globals.IRSendInliner)})},
+args: ["aString"],
+source: "inliningError: aString\x0a\x09InliningError signal: aString",
+messageSends: ["signal:"],
+referencedClasses: ["InliningError"]
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "send",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@send"];
+return $1;
+},
+args: [],
+source: "send\x0a\x09^ send",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "send:",
+protocol: 'accessing',
+fn: function (anIRSend){
+var self=this;
+self["@send"]=anIRSend;
+return self},
+args: ["anIRSend"],
+source: "send: anIRSend\x0a\x09send := anIRSend",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "translator",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@translator"];
+return $1;
+},
+args: [],
+source: "translator\x0a\x09^ translator",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSendInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "translator:",
+protocol: 'accessing',
+fn: function (anASTTranslator){
+var self=this;
+self["@translator"]=anASTTranslator;
+return self},
+args: ["anASTTranslator"],
+source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSendInliner);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlinedSelectors",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
+return $1;
+},
+args: [],
+source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRSendInliner.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldInline:",
+protocol: 'accessing',
+fn: function (anIRInstruction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+var $early={};
+try {
+$1=_st(self._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
+if(! smalltalk.assert($1)){
+return false;
+};
+_st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(each)._isClosure();
+if(! smalltalk.assert($2)){
+throw $early=[false];
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return true;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},globals.IRSendInliner.klass)})},
+args: ["anIRInstruction"],
+source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true",
+messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"],
+referencedClasses: []
+}),
+globals.IRSendInliner.klass);
+
+
+smalltalk.addClass('IRAssignmentInliner', globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
+globals.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions.\x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if(smalltalk.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "assignment",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@assignment"];
+return $1;
+},
+args: [],
+source: "assignment\x0a\x09^ assignment",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRAssignmentInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "assignment:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+self["@assignment"]=aNode;
+return self},
+args: ["aNode"],
+source: "assignment: aNode\x0a\x09assignment := aNode",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRAssignmentInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlineAssignment:",
+protocol: 'inlining',
+fn: function (anIRAssignment){
+var self=this;
+var inlinedAssignment;
+function $IRInlinedAssignment(){return globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._assignment_(anIRAssignment);
+inlinedAssignment=_st($IRInlinedAssignment())._new();
+$1=_st(anIRAssignment)._instructions();
+$ctx1.sendIdx["instructions"]=1;
+_st($1)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(inlinedAssignment)._add_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+_st(anIRAssignment)._replaceWith_(inlinedAssignment);
+self._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
+$2=inlinedAssignment;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},globals.IRAssignmentInliner)})},
+args: ["anIRAssignment"],
+source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment",
+messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
+referencedClasses: ["IRInlinedAssignment"]
+}),
+globals.IRAssignmentInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlineClosure:",
+protocol: 'inlining',
+fn: function (anIRClosure){
+var self=this;
+var inlinedClosure,statements;
+function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$4,$3,$5,$7,$8,$6,$9;
+inlinedClosure=($ctx1.supercall = true, globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]));
+$ctx1.supercall = false;
+$2=_st(inlinedClosure)._instructions();
+$ctx1.sendIdx["instructions"]=2;
+$1=_st($2)._last();
+$ctx1.sendIdx["last"]=1;
+statements=_st($1)._instructions();
+$ctx1.sendIdx["instructions"]=1;
+_st(statements)._ifNotEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(statements)._last();
+$ctx2.sendIdx["last"]=2;
+$3=_st($4)._canBeAssigned();
+if(smalltalk.assert($3)){
+$5=_st(statements)._last();
+$ctx2.sendIdx["last"]=3;
+$7=_st($IRAssignment())._new();
+_st($7)._add_(_st(_st(self._assignment())._instructions())._first());
+$ctx2.sendIdx["add:"]=1;
+_st($7)._add_(_st(_st(statements)._last())._copy());
+$8=_st($7)._yourself();
+$6=$8;
+return _st($5)._replaceWith_($6);
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$9=inlinedClosure;
+return $9;
+}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},globals.IRAssignmentInliner)})},
+args: ["anIRClosure"],
+source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
+messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"],
+referencedClasses: ["IRAssignment"]
+}),
+globals.IRAssignmentInliner);
+
+
+
+smalltalk.addClass('IRReturnInliner', globals.IRSendInliner, [], 'Compiler-Inlining');
+globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlineClosure:",
+protocol: 'inlining',
+fn: function (anIRClosure){
+var self=this;
+var closure,statements;
+function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4,$5,$6,$7;
+closure=($ctx1.supercall = true, globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]));
+$ctx1.supercall = false;
+$1=_st(_st(closure)._instructions())._last();
+$ctx1.sendIdx["last"]=1;
+statements=_st($1)._instructions();
+$ctx1.sendIdx["instructions"]=1;
+_st(statements)._ifNotEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(statements)._last();
+$ctx2.sendIdx["last"]=2;
+$2=_st($3)._isReturn();
+if(! smalltalk.assert($2)){
+$4=_st(statements)._last();
+$ctx2.sendIdx["last"]=3;
+$5=_st($IRReturn())._new();
+_st($5)._add_(_st(_st(statements)._last())._copy());
+$6=_st($5)._yourself();
+return _st($4)._replaceWith_($6);
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$7=closure;
+return $7;
+}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},globals.IRReturnInliner)})},
+args: ["anIRClosure"],
+source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
+messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"],
+referencedClasses: ["IRReturn"]
+}),
+globals.IRReturnInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlineReturn:",
+protocol: 'inlining',
+fn: function (anIRReturn){
+var self=this;
+var return_;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+return_=self._inlinedReturn();
+$1=_st(anIRReturn)._instructions();
+$ctx1.sendIdx["instructions"]=1;
+_st($1)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(return_)._add_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+_st(anIRReturn)._replaceWith_(return_);
+self._inlineSend_(_st(_st(return_)._instructions())._last());
+$2=return_;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},globals.IRReturnInliner)})},
+args: ["anIRReturn"],
+source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return",
+messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
+referencedClasses: []
+}),
+globals.IRReturnInliner);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inlinedReturn",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $IRInlinedReturn(){return globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($IRInlinedReturn())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},globals.IRReturnInliner)})},
+args: [],
+source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
+messageSends: ["new"],
+referencedClasses: ["IRInlinedReturn"]
+}),
+globals.IRReturnInliner);
+
+
+
+smalltalk.addClass('InliningCodeGenerator', globals.CodeGenerator, [], 'Compiler-Inlining');
+globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileNode:",
+protocol: 'compiling',
+fn: function (aNode){
+var self=this;
+var ir,stream;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+_st(self._semanticAnalyzer())._visit_(aNode);
+$ctx1.sendIdx["visit:"]=1;
+ir=_st(self._translator())._visit_(aNode);
+$ctx1.sendIdx["visit:"]=2;
+_st(self._inliner())._visit_(ir);
+$ctx1.sendIdx["visit:"]=3;
+$2=self._irTranslator();
+_st($2)._currentClass_(self._currentClass());
+_st($2)._visit_(ir);
+$3=_st($2)._contents();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.InliningCodeGenerator)})},
+args: ["aNode"],
+source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
+messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"],
+referencedClasses: []
+}),
+globals.InliningCodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inliner",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+function $IRInliner(){return globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($IRInliner())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inliner",{},globals.InliningCodeGenerator)})},
+args: [],
+source: "inliner\x0a\x09^ IRInliner new",
+messageSends: ["new"],
+referencedClasses: ["IRInliner"]
+}),
+globals.InliningCodeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "irTranslator",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+function $IRInliningJSTranslator(){return globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($IRInliningJSTranslator())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.InliningCodeGenerator)})},
+args: [],
+source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
+messageSends: ["new"],
+referencedClasses: ["IRInliningJSTranslator"]
+}),
+globals.InliningCodeGenerator);
+
+
+});

+ 636 - 0
src/Compiler-Inlining.st

@@ -0,0 +1,636 @@
+Smalltalk createPackage: 'Compiler-Inlining'!
+IRAssignment subclass: #IRInlinedAssignment
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInlinedAssignment commentStamp!
+I represent an inlined assignment instruction.!
+
+!IRInlinedAssignment methodsFor: 'testing'!
+
+isInlined
+	^ true
+! !
+
+!IRInlinedAssignment methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRInlinedAssignment: self
+! !
+
+IRClosure subclass: #IRInlinedClosure
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInlinedClosure commentStamp!
+I represent an inlined closure instruction.!
+
+!IRInlinedClosure methodsFor: 'testing'!
+
+isInlined
+	^ true
+! !
+
+!IRInlinedClosure methodsFor: 'visiting'!
+
+accept: aVisitor
+	aVisitor visitIRInlinedClosure: self
+! !
+
+IRReturn subclass: #IRInlinedReturn
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInlinedReturn commentStamp!
+I represent an inlined local return instruction.!
+
+!IRInlinedReturn methodsFor: 'testing'!
+
+isInlined
+	^ true
+! !
+
+!IRInlinedReturn methodsFor: 'visiting'!
+
+accept: aVisitor
+	^ aVisitor visitIRInlinedReturn: self
+! !
+
+IRSend subclass: #IRInlinedSend
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInlinedSend commentStamp!
+I am the abstract super class of inlined message send instructions.!
+
+!IRInlinedSend methodsFor: 'accessing'!
+
+internalVariables
+	"Answer a collection of internal variables required 
+	to perform the inlining"
+	
+	^ #()
+! !
+
+!IRInlinedSend methodsFor: 'testing'!
+
+isInlined
+	^ true
+! !
+
+!IRInlinedSend methodsFor: 'visiting'!
+
+accept: aVisitor
+	aVisitor visitInlinedSend: self
+! !
+
+IRInlinedSend subclass: #IRInlinedIfFalse
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInlinedIfFalse commentStamp!
+I represent an inlined `#ifFalse:` message send instruction.!
+
+!IRInlinedIfFalse methodsFor: 'visiting'!
+
+accept: aVisitor
+	aVisitor visitIRInlinedIfFalse: self
+! !
+
+IRInlinedSend subclass: #IRInlinedIfNilIfNotNil
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInlinedIfNilIfNotNil commentStamp!
+I represent an inlined `#ifNil:ifNotNil:` message send instruction.!
+
+!IRInlinedIfNilIfNotNil methodsFor: 'accessing'!
+
+internalVariables
+	^ Array with: self receiverInternalVariable
+!
+
+receiverInternalVariable
+	^ IRVariable new
+		variable: (AliasVar new name: self receiverInternalVariableName);
+		yourself.
+!
+
+receiverInternalVariableName
+	^ '$receiver'
+! !
+
+!IRInlinedIfNilIfNotNil methodsFor: 'visiting'!
+
+accept: aVisitor
+	aVisitor visitIRInlinedIfNilIfNotNil: self
+! !
+
+IRInlinedSend subclass: #IRInlinedIfTrue
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInlinedIfTrue commentStamp!
+I represent an inlined `#ifTrue:` message send instruction.!
+
+!IRInlinedIfTrue methodsFor: 'visiting'!
+
+accept: aVisitor
+	aVisitor visitIRInlinedIfTrue: self
+! !
+
+IRInlinedSend subclass: #IRInlinedIfTrueIfFalse
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInlinedIfTrueIfFalse commentStamp!
+I represent an inlined `#ifTrue:ifFalse:` message send instruction.!
+
+!IRInlinedIfTrueIfFalse methodsFor: 'visiting'!
+
+accept: aVisitor
+	aVisitor visitIRInlinedIfTrueIfFalse: self
+! !
+
+IRBlockSequence subclass: #IRInlinedSequence
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInlinedSequence commentStamp!
+I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).!
+
+!IRInlinedSequence methodsFor: 'testing'!
+
+isInlined
+	^ true
+! !
+
+!IRInlinedSequence methodsFor: 'visiting'!
+
+accept: aVisitor
+	aVisitor visitIRInlinedSequence: self
+! !
+
+IRVisitor subclass: #IRInliner
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInliner commentStamp!
+I visit an IR tree, inlining message sends and block closures.
+
+Message selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`!
+
+!IRInliner methodsFor: 'factory'!
+
+assignmentInliner
+	^ IRAssignmentInliner new
+		translator: self;
+		yourself
+!
+
+returnInliner
+	^ IRReturnInliner new
+		translator: self;
+		yourself
+!
+
+sendInliner
+	^ IRSendInliner new
+		translator: self;
+		yourself
+! !
+
+!IRInliner methodsFor: 'testing'!
+
+shouldInlineAssignment: anIRAssignment
+	^ anIRAssignment isInlined not and: [
+		anIRAssignment instructions last isSend and: [
+			self shouldInlineSend: (anIRAssignment instructions last) ]]
+!
+
+shouldInlineReturn: anIRReturn
+	^ anIRReturn isInlined not and: [
+		anIRReturn instructions first isSend and: [
+			self shouldInlineSend: (anIRReturn instructions first) ]]
+!
+
+shouldInlineSend: anIRSend
+	^ anIRSend isInlined not and: [
+		IRSendInliner shouldInline: anIRSend ]
+! !
+
+!IRInliner methodsFor: 'visiting'!
+
+transformNonLocalReturn: anIRNonLocalReturn
+	"Replace a non local return into a local return"
+
+	| localReturn |
+	anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [
+		anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.
+		localReturn := IRReturn new
+			scope: anIRNonLocalReturn scope;
+			yourself.
+		anIRNonLocalReturn instructions do: [ :each |
+			localReturn add: each ].
+		anIRNonLocalReturn replaceWith: localReturn.
+		^ localReturn ].
+	^ super visitIRNonLocalReturn: anIRNonLocalReturn
+!
+
+visitIRAssignment: anIRAssignment
+	^ (self shouldInlineAssignment: anIRAssignment)
+		ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]
+		ifFalse: [ super visitIRAssignment: anIRAssignment ]
+!
+
+visitIRNonLocalReturn: anIRNonLocalReturn
+	^ self transformNonLocalReturn: anIRNonLocalReturn
+!
+
+visitIRReturn: anIRReturn
+	^ (self shouldInlineReturn: anIRReturn)
+		ifTrue: [ self returnInliner inlineReturn: anIRReturn ]
+		ifFalse: [ super visitIRReturn: anIRReturn ]
+!
+
+visitIRSend: anIRSend
+	^ (self shouldInlineSend: anIRSend)
+		ifTrue: [ self sendInliner inlineSend: anIRSend ]
+		ifFalse: [ super visitIRSend: anIRSend ]
+! !
+
+IRJSTranslator subclass: #IRInliningJSTranslator
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRInliningJSTranslator commentStamp!
+I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).!
+
+!IRInliningJSTranslator methodsFor: 'visiting'!
+
+visitIRInlinedAssignment: anIRInlinedAssignment
+	self visit: anIRInlinedAssignment instructions last
+!
+
+visitIRInlinedClosure: anIRInlinedClosure
+	self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |
+		each name asVariableName ]).
+	anIRInlinedClosure instructions do: [ :each |
+		self visit: each ]
+!
+
+visitIRInlinedIfFalse: anIRInlinedIfFalse
+	self stream nextPutIf: [
+		self stream nextPutAll: '!! smalltalk.assert('.
+		self visit: anIRInlinedIfFalse instructions first.
+		self stream nextPutAll: ')' ]
+		with: [ self visit: anIRInlinedIfFalse instructions last ]
+!
+
+visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil
+	self stream
+		nextPutIfElse: [
+			self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.
+			self visit: anIRInlinedIfNilIfNotNil instructions first.
+			self stream nextPutAll: ') == null || $receiver.isNil' ]
+		with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]
+		with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]
+!
+
+visitIRInlinedIfTrue: anIRInlinedIfTrue
+	self stream nextPutIf: [
+		self stream nextPutAll: 'smalltalk.assert('.
+		self visit: anIRInlinedIfTrue instructions first.
+		self stream nextPutAll: ')' ]
+		with: [ self visit: anIRInlinedIfTrue instructions last ]
+!
+
+visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse
+	self stream
+		nextPutIfElse: [
+			self stream nextPutAll: 'smalltalk.assert('.
+			self visit: anIRInlinedIfTrueIfFalse instructions first.
+			self stream nextPutAll: ')' ]
+		with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]
+		with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]
+!
+
+visitIRInlinedNonLocalReturn: anIRInlinedReturn
+	self stream nextPutStatementWith: [
+		self visit: anIRInlinedReturn instructions last ].
+	self stream nextPutNonLocalReturnWith: [ ]
+!
+
+visitIRInlinedReturn: anIRInlinedReturn
+	self visit: anIRInlinedReturn instructions last
+!
+
+visitIRInlinedSequence: anIRInlinedSequence
+	anIRInlinedSequence instructions do: [ :each |
+		self stream nextPutStatementWith: [ self visit: each ]]
+! !
+
+Object subclass: #IRSendInliner
+	instanceVariableNames: 'send translator'
+	package: 'Compiler-Inlining'!
+!IRSendInliner commentStamp!
+I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.!
+
+!IRSendInliner methodsFor: 'accessing'!
+
+send
+	^ send
+!
+
+send: anIRSend
+	send := anIRSend
+!
+
+translator
+	^ translator
+!
+
+translator: anASTTranslator
+	translator := anASTTranslator
+! !
+
+!IRSendInliner methodsFor: 'error handling'!
+
+inliningError: aString
+	InliningError signal: aString
+! !
+
+!IRSendInliner methodsFor: 'factory'!
+
+inlinedClosure
+	^ IRInlinedClosure new
+!
+
+inlinedSequence
+	^ IRInlinedSequence new
+! !
+
+!IRSendInliner methodsFor: 'inlining'!
+
+ifFalse: anIRInstruction
+	^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction
+!
+
+ifFalse: anIRInstruction ifTrue: anotherIRInstruction
+	^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }
+!
+
+ifNil: anIRInstruction
+	^ self
+		inlinedSend: IRInlinedIfNilIfNotNil new
+		with: anIRInstruction
+		with: (IRClosure new
+			scope: anIRInstruction scope copy;
+			add: (IRBlockSequence new
+				add: self send instructions first;
+				yourself);
+			yourself)
+!
+
+ifNil: anIRInstruction ifNotNil: anotherIRInstruction
+	^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction
+!
+
+ifNotNil: anIRInstruction
+	^ self
+		inlinedSend: IRInlinedIfNilIfNotNil new
+		with: (IRClosure new
+			scope: anIRInstruction scope copy;
+			add: (IRBlockSequence new
+				add: self send instructions first;
+				yourself);
+			yourself)
+		with: anIRInstruction
+!
+
+ifNotNil: anIRInstruction ifNil: anotherIRInstruction
+	^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction
+!
+
+ifTrue: anIRInstruction
+	^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction
+!
+
+ifTrue: anIRInstruction ifFalse: anotherIRInstruction
+	^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction
+!
+
+inlineClosure: anIRClosure
+	| inlinedClosure sequence statements |
+
+	inlinedClosure := self inlinedClosure.
+	inlinedClosure 
+		scope: anIRClosure scope;
+		parent: anIRClosure parent.
+
+	"Add the possible temp declarations"
+	anIRClosure tempDeclarations do: [ :each |
+			inlinedClosure add: each ].
+
+	"Add a block sequence"
+	sequence := self inlinedSequence.
+
+	"Map the closure arguments to the receiver of the message send"
+	anIRClosure arguments do: [ :each |
+		inlinedClosure add: (IRTempDeclaration new name: each; yourself).
+		sequence add: (IRAssignment new
+			add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));
+			add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));
+			yourself) ].
+			
+	"To ensure the correct order of the closure instructions: first the temps then the sequence"
+	inlinedClosure add: sequence.
+
+	"Get all the statements"
+	statements := anIRClosure instructions last instructions.
+	
+	statements ifNotEmpty: [
+		statements allButLast do: [ :each | sequence add: each ].
+
+		"Inlined closures don't have implicit local returns"
+		(statements last isReturn and: [ statements last isBlockReturn ])
+			ifTrue: [ sequence add: statements last instructions first ]
+			ifFalse: [ sequence add: statements last ] ].
+
+	^ inlinedClosure
+!
+
+inlineSend: anIRSend
+	self send: anIRSend.
+	^ self
+		perform: self send selector
+		withArguments: self send instructions allButFirst
+!
+
+inlinedSend: inlinedSend with: anIRInstruction
+	| inlinedClosure |
+
+	anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].
+	anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].
+
+	inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).
+
+	inlinedSend
+		add: self send instructions first;
+		add: inlinedClosure.
+
+	self send replaceWith: inlinedSend.
+	inlinedSend method internalVariables 
+		addAll: inlinedSend internalVariables.
+
+	^ inlinedSend
+!
+
+inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction
+	| inlinedClosure1 inlinedClosure2 |
+
+	anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].
+	anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].
+
+	inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).
+	inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).
+
+	inlinedSend
+		add: self send instructions first;
+		add: inlinedClosure1;
+		add: inlinedClosure2.
+
+	self send replaceWith: inlinedSend.
+	inlinedSend method internalVariables 
+		addAll: inlinedSend internalVariables.
+		
+	^ inlinedSend
+! !
+
+!IRSendInliner class methodsFor: 'accessing'!
+
+inlinedSelectors
+	^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')
+!
+
+shouldInline: anIRInstruction
+	(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].
+	anIRInstruction instructions allButFirst do: [ :each |
+		each isClosure ifFalse: [ ^ false ]].
+	^ true
+! !
+
+IRSendInliner subclass: #IRAssignmentInliner
+	instanceVariableNames: 'assignment'
+	package: 'Compiler-Inlining'!
+!IRAssignmentInliner commentStamp!
+I inline message sends together with assignments by moving them around into the inline closure instructions.
+
+##Example
+
+	foo
+		| a |
+		a := true ifTrue: [ 1 ]
+
+Will produce:
+
+	if(smalltalk.assert(true) {
+		a = 1;
+	};!
+
+!IRAssignmentInliner methodsFor: 'accessing'!
+
+assignment
+	^ assignment
+!
+
+assignment: aNode
+	assignment := aNode
+! !
+
+!IRAssignmentInliner methodsFor: 'inlining'!
+
+inlineAssignment: anIRAssignment
+	| inlinedAssignment |
+	self assignment: anIRAssignment.
+	inlinedAssignment := IRInlinedAssignment new.
+	anIRAssignment instructions do: [ :each |
+		inlinedAssignment add: each ].
+	anIRAssignment replaceWith: inlinedAssignment.
+	self inlineSend: inlinedAssignment instructions last.
+	^ inlinedAssignment
+!
+
+inlineClosure: anIRClosure
+	| inlinedClosure statements |
+
+	inlinedClosure := super inlineClosure: anIRClosure.
+	statements := inlinedClosure instructions last instructions.
+	
+	statements ifNotEmpty: [
+		statements last canBeAssigned ifTrue: [
+			statements last replaceWith: (IRAssignment new
+				add: self assignment instructions first;
+				add: statements last copy;
+				yourself) ] ].
+
+	^ inlinedClosure
+! !
+
+IRSendInliner subclass: #IRReturnInliner
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!IRReturnInliner commentStamp!
+I inline message sends with inlined closure together with a return instruction.!
+
+!IRReturnInliner methodsFor: 'factory'!
+
+inlinedReturn
+	^ IRInlinedReturn new
+! !
+
+!IRReturnInliner methodsFor: 'inlining'!
+
+inlineClosure: anIRClosure
+	| closure statements |
+
+	closure := super inlineClosure: anIRClosure.
+	statements := closure instructions last instructions.
+	
+	statements ifNotEmpty: [
+		statements last isReturn
+			ifFalse: [ statements last replaceWith: (IRReturn new
+				add: statements last copy;
+				yourself)] ].
+
+	^ closure
+!
+
+inlineReturn: anIRReturn
+	| return |
+	return := self inlinedReturn.
+	anIRReturn instructions do: [ :each |
+		return add: each ].
+	anIRReturn replaceWith: return.
+	self inlineSend: return instructions last.
+	^ return
+! !
+
+CodeGenerator subclass: #InliningCodeGenerator
+	instanceVariableNames: ''
+	package: 'Compiler-Inlining'!
+!InliningCodeGenerator commentStamp!
+I am a specialized code generator that uses inlining to produce more optimized JavaScript output!
+
+!InliningCodeGenerator methodsFor: 'compiling'!
+
+compileNode: aNode
+	| ir stream |
+
+	self semanticAnalyzer visit: aNode.
+	ir := self translator visit: aNode.
+	self inliner visit: ir.
+
+	^ self irTranslator
+		currentClass: self currentClass;
+		visit: ir;
+		contents
+!
+
+inliner
+	^ IRInliner new
+!
+
+irTranslator
+	^ IRInliningJSTranslator new
+! !
+

+ 2738 - 0
src/Compiler-Interpreter.js

@@ -0,0 +1,2738 @@
+define("amber_core/Compiler-Interpreter", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Compiler-Interpreter');
+smalltalk.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('AIBlockClosure', globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
+globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "applyTo:arguments:",
+protocol: 'evaluating',
+fn: function (anObject,aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._interpreterError();
+return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.AIBlockClosure)})},
+args: ["anObject", "aCollection"],
+source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
+messageSends: ["interpreterError"],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compiledSource",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "[ AST Block closure ]";
+},
+args: [],
+source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currySelf",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._interpreterError();
+return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.AIBlockClosure)})},
+args: [],
+source: "currySelf\x0a\x09self interpreterError",
+messageSends: ["interpreterError"],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeWithContext:node:",
+protocol: 'initialization',
+fn: function (aContext,aNode){
+var self=this;
+self["@node"]=aNode;
+self["@outerContext"]=aContext;
+return self},
+args: ["aContext", "aNode"],
+source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "interpreterError",
+protocol: 'error handling',
+fn: function (){
+var self=this;
+function $ASTInterpreterError(){return globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
+return smalltalk.withContext(function($ctx1) { 
+_st($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
+return self}, function($ctx1) {$ctx1.fill(self,"interpreterError",{},globals.AIBlockClosure)})},
+args: [],
+source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
+messageSends: ["signal:"],
+referencedClasses: ["ASTInterpreterError"]
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "numArgs",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self["@node"])._temps())._size();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.AIBlockClosure)})},
+args: [],
+source: "numArgs\x0a\x09^ node temps size",
+messageSends: ["size", "temps"],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'evaluating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._valueWithPossibleArguments_([]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value",{},globals.AIBlockClosure)})},
+args: [],
+source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
+messageSends: ["valueWithPossibleArguments:"],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'evaluating',
+fn: function (anArgument){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._valueWithPossibleArguments_([anArgument]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},globals.AIBlockClosure)})},
+args: ["anArgument"],
+source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
+messageSends: ["valueWithPossibleArguments:"],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:",
+protocol: 'evaluating',
+fn: function (firstArgument,secondArgument){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.AIBlockClosure)})},
+args: ["firstArgument", "secondArgument"],
+source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
+messageSends: ["valueWithPossibleArguments:"],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:value:",
+protocol: 'evaluating',
+fn: function (firstArgument,secondArgument,thirdArgument){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.AIBlockClosure)})},
+args: ["firstArgument", "secondArgument", "thirdArgument"],
+source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
+messageSends: ["valueWithPossibleArguments:"],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valueWithPossibleArguments:",
+protocol: 'evaluating',
+fn: function (aCollection){
+var self=this;
+var context,sequenceNode;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$6;
+context=_st(self["@outerContext"])._newInnerContext();
+$1=_st(_st(_st(self["@node"])._nodes())._first())._copy();
+_st($1)._parent_(nil);
+$2=_st($1)._yourself();
+sequenceNode=$2;
+_st(_st(sequenceNode)._temps())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(context)._defineLocal_(each);
+$ctx2.sendIdx["defineLocal:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+_st(_st(self["@node"])._parameters())._withIndexDo_((function(each,index){
+return smalltalk.withContext(function($ctx2) {
+_st(context)._defineLocal_(each);
+return _st(context)._localAt_put_(each,_st(aCollection)._at_ifAbsent_(index,(function(){
+return nil;
+})));
+}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)})}));
+$3=_st(context)._interpreter();
+$ctx1.sendIdx["interpreter"]=1;
+_st($3)._node_(_st(sequenceNode)._nextChild());
+$4=_st($3)._proceed();
+$5=_st(self["@outerContext"])._interpreter();
+$ctx1.sendIdx["interpreter"]=2;
+_st($5)._setNonLocalReturnFromContext_(context);
+$6=_st(_st(context)._interpreter())._pop();
+return $6;
+}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},globals.AIBlockClosure)})},
+args: ["aCollection"],
+source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
+messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"],
+referencedClasses: []
+}),
+globals.AIBlockClosure);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forContext:node:",
+protocol: 'instance creation',
+fn: function (aContext,aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._initializeWithContext_node_(aContext,aNode);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},globals.AIBlockClosure.klass)})},
+args: ["aContext", "aNode"],
+source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
+messageSends: ["initializeWithContext:node:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.AIBlockClosure.klass);
+
+
+smalltalk.addClass('AIContext', globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
+globals.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._ast())._arguments())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._localAt_ifAbsent_(each,(function(){
+return smalltalk.withContext(function($ctx3) {
+return self._error_("Argument not in context");
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.AIContext)})},
+args: [],
+source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
+messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ast",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4,$5,$receiver;
+$1=self._isBlockContext();
+if(smalltalk.assert($1)){
+$3=self._outerContext();
+if(($receiver = $3) == null || $receiver.isNil){
+$2=$3;
+} else {
+var context;
+context=$receiver;
+$2=_st(context)._ast();
+};
+return $2;
+};
+$4=self["@ast"];
+if(($receiver = $4) == null || $receiver.isNil){
+self._initializeAST();
+} else {
+$4;
+};
+$5=self["@ast"];
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"ast",{},globals.AIContext)})},
+args: [],
+source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
+messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicLocalAt:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._locals())._at_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},globals.AIContext)})},
+args: ["aString"],
+source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
+messageSends: ["at:", "locals"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicLocalAt:put:",
+protocol: 'private',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._locals())._at_put_(aString,anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},globals.AIContext)})},
+args: ["aString", "anObject"],
+source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
+messageSends: ["at:put:", "locals"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicReceiver",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._localAt_("self");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},globals.AIContext)})},
+args: [],
+source: "basicReceiver\x0a\x09^ self localAt: 'self'",
+messageSends: ["localAt:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defineLocal:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._locals())._at_put_(aString,nil);
+return self}, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},globals.AIContext)})},
+args: ["aString"],
+source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
+messageSends: ["at:put:", "locals"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:on:",
+protocol: 'evaluating',
+fn: function (aString,anEvaluator){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(anEvaluator)._evaluate_context_(aString,self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},globals.AIContext)})},
+args: ["aString", "anEvaluator"],
+source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
+messageSends: ["evaluate:context:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluateNode:",
+protocol: 'evaluating',
+fn: function (aNode){
+var self=this;
+function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($ASTInterpreter())._new();
+_st($2)._context_(self);
+_st($2)._node_(_st(aNode)._nextChild());
+_st($2)._proceed();
+$3=_st($2)._result();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},globals.AIContext)})},
+args: ["aNode"],
+source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
+messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"],
+referencedClasses: ["ASTInterpreter"]
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluatedSelector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@evaluatedSelector"];
+return $1;
+},
+args: [],
+source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluatedSelector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@evaluatedSelector"]=aString;
+return self},
+args: ["aString"],
+source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "index",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@index"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=(0);
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"index",{},globals.AIContext)})},
+args: [],
+source: "index\x0a\x09^ index ifNil: [ 0 ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "index:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@index"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "index: anInteger\x0a\x09index := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeAST",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._method();
+$ctx1.sendIdx["method"]=1;
+self["@ast"]=_st($1)._ast();
+_st(_st($SemanticAnalyzer())._on_(_st(self._method())._methodClass()))._visit_(self["@ast"]);
+return self}, function($ctx1) {$ctx1.fill(self,"initializeAST",{},globals.AIContext)})},
+args: [],
+source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
+messageSends: ["ast", "method", "visit:", "on:", "methodClass"],
+referencedClasses: ["SemanticAnalyzer"]
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeFromMethodContext:",
+protocol: 'initialization',
+fn: function (aMethodContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$receiver;
+self._evaluatedSelector_(_st(aMethodContext)._evaluatedSelector());
+self._index_(_st(aMethodContext)._index());
+self._sendIndexes_(_st(aMethodContext)._sendIndexes());
+self._receiver_(_st(aMethodContext)._receiver());
+self._supercall_(_st(aMethodContext)._supercall());
+$1=self._selector_(_st(aMethodContext)._selector());
+$2=_st(aMethodContext)._outerContext();
+$ctx1.sendIdx["outerContext"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+$2;
+} else {
+var outer;
+outer=$receiver;
+$3=_st(outer)._methodContext();
+if(($receiver = $3) == null || $receiver.isNil){
+$3;
+} else {
+self._outerContext_(_st(self._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
+};
+$4=_st(aMethodContext)._locals();
+$ctx1.sendIdx["locals"]=1;
+_st($4)._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._locals())._at_put_(key,value);
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
+};
+return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext)})},
+args: ["aMethodContext"],
+source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
+messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeInterpreter",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+$1=_st($ASTInterpreter())._new();
+_st($1)._context_(self);
+$2=_st($1)._yourself();
+self["@interpreter"]=$2;
+$3=self._innerContext();
+if(($receiver = $3) == null || $receiver.isNil){
+$3;
+} else {
+self._setupInterpreter_(self["@interpreter"]);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},globals.AIContext)})},
+args: [],
+source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
+messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"],
+referencedClasses: ["ASTInterpreter"]
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeLocals",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+self["@locals"]=_st($Dictionary())._new();
+_st(self["@locals"])._at_put_("thisContext",self);
+return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},globals.AIContext)})},
+args: [],
+source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
+messageSends: ["new", "at:put:"],
+referencedClasses: ["Dictionary"]
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "innerContext",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@innerContext"];
+return $1;
+},
+args: [],
+source: "innerContext\x0a\x09^ innerContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "innerContext:",
+protocol: 'accessing',
+fn: function (anAIContext){
+var self=this;
+self["@innerContext"]=anAIContext;
+return self},
+args: ["anAIContext"],
+source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "interpreter",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=self["@interpreter"];
+if(($receiver = $1) == null || $receiver.isNil){
+self._initializeInterpreter();
+} else {
+$1;
+};
+$2=self["@interpreter"];
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.AIContext)})},
+args: [],
+source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
+messageSends: ["ifNil:", "initializeInterpreter"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "interpreter:",
+protocol: 'interpreting',
+fn: function (anInterpreter){
+var self=this;
+self["@interpreter"]=anInterpreter;
+return self},
+args: ["anInterpreter"],
+source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isTopContext",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._innerContext())._isNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isTopContext",{},globals.AIContext)})},
+args: [],
+source: "isTopContext\x0a\x09^ self innerContext isNil",
+messageSends: ["isNil", "innerContext"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "localAt:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+var context;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+context=self._lookupContextForLocal_(aString);
+$1=_st(context)._basicLocalAt_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},globals.AIContext)})},
+args: ["aString"],
+source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09^ context basicLocalAt: aString",
+messageSends: ["lookupContextForLocal:", "basicLocalAt:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "localAt:ifAbsent:",
+protocol: 'accessing',
+fn: function (aString,aBlock){
+var self=this;
+var context;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+var $early={};
+try {
+context=self._lookupContextForLocal_ifNone_(aString,(function(){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aBlock)._value();
+throw $early=[$1];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$2=_st(context)._basicLocalAt_(aString);
+return $2;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},globals.AIContext)})},
+args: ["aString", "aBlock"],
+source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self \x09\x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ ^ aBlock value ].\x0a\x09\x0a\x09^ context basicLocalAt: aString",
+messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "localAt:put:",
+protocol: 'accessing',
+fn: function (aString,anObject){
+var self=this;
+var context;
+return smalltalk.withContext(function($ctx1) { 
+context=self._lookupContextForLocal_(aString);
+_st(context)._basicLocalAt_put_(aString,anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},globals.AIContext)})},
+args: ["aString", "anObject"],
+source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
+messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "locals",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=self["@locals"];
+if(($receiver = $1) == null || $receiver.isNil){
+self._initializeLocals();
+} else {
+$1;
+};
+$2=self["@locals"];
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"locals",{},globals.AIContext)})},
+args: [],
+source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
+messageSends: ["ifNil:", "initializeLocals"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lookupContextForLocal:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._lookupContextForLocal_ifNone_(aString,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._variableNotFound();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},globals.AIContext)})},
+args: ["aString"],
+source: "lookupContextForLocal: aString\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self \x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ self variableNotFound ]",
+messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lookupContextForLocal:ifNone:",
+protocol: 'private',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
+return self;
+}),(function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._outerContext();
+return _st($2)._ifNil_ifNotNil_(aBlock,(function(context){
+return smalltalk.withContext(function($ctx3) {
+return _st(context)._lookupContextForLocal_(aString);
+}, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},globals.AIContext)})},
+args: ["aString", "aBlock"],
+source: "lookupContextForLocal: aString ifNone: aBlock\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self locals \x0a\x09\x09at: aString\x0a\x09\x09ifPresent: [ self ]\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09self outerContext \x0a\x09\x09\x09\x09ifNil: aBlock\x0a\x09\x09\x09\x09ifNotNil: [ :context | \x0a\x09\x09\x09\x09\x09context lookupContextForLocal: aString ] ]",
+messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newInnerContext",
+protocol: 'factory',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st(self._class())._new();
+_st($2)._outerContext_(self);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},globals.AIContext)})},
+args: [],
+source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
+messageSends: ["outerContext:", "new", "class", "yourself"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "outerContext",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@outerContext"];
+return $1;
+},
+args: [],
+source: "outerContext\x0a\x09^ outerContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "outerContext:",
+protocol: 'accessing',
+fn: function (anAIContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+self["@outerContext"]=anAIContext;
+$1=self["@outerContext"];
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+var context;
+context=$receiver;
+_st(context)._innerContext_(self);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},globals.AIContext)})},
+args: ["anAIContext"],
+source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
+messageSends: ["ifNotNil:", "innerContext:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+protocol: 'interpreting',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._locals())._at_put_("self",anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},globals.AIContext)})},
+args: ["anObject"],
+source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
+messageSends: ["at:put:", "locals"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selector"];
+return $1;
+},
+args: [],
+source: "selector\x0a\x09^ selector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@selector"]=aString;
+return self},
+args: ["aString"],
+source: "selector: aString\x0a\x09selector := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendIndexAt:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._sendIndexes())._at_ifAbsent_(aString,(function(){
+return (0);
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},globals.AIContext)})},
+args: ["aString"],
+source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
+messageSends: ["at:ifAbsent:", "sendIndexes"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendIndexes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@sendIndexes"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=_st($Dictionary())._new();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.AIContext)})},
+args: [],
+source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Dictionary"]
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendIndexes:",
+protocol: 'accessing',
+fn: function (aDictionary){
+var self=this;
+self["@sendIndexes"]=aDictionary;
+return self},
+args: ["aDictionary"],
+source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupInterpreter:",
+protocol: 'interpreting',
+fn: function (anInterpreter){
+var self=this;
+var currentNode;
+function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
+$1=_st($ASTPCNodeVisitor())._new();
+_st($1)._selector_(self._evaluatedSelector());
+_st($1)._context_(self);
+$2=$1;
+$3=self._ast();
+$ctx1.sendIdx["ast"]=1;
+_st($2)._visit_($3);
+$4=_st($1)._currentNode();
+currentNode=$4;
+$5=_st(self._ast())._sequenceNode();
+if(($receiver = $5) == null || $receiver.isNil){
+$5;
+} else {
+var sequence;
+sequence=$receiver;
+_st(_st(sequence)._temps())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._defineLocal_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+$ctx1.sendIdx["do:"]=1;
+};
+_st(anInterpreter)._node_(currentNode);
+$8=self._innerContext();
+$ctx1.sendIdx["innerContext"]=1;
+$7=_st($8)._arguments();
+$6=_st($7)._reversed();
+_st($6)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(anInterpreter)._push_(each);
+$ctx2.sendIdx["push:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
+_st(anInterpreter)._push_(_st(self._innerContext())._receiver());
+return self}, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},globals.AIContext)})},
+args: ["anInterpreter"],
+source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
+messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"],
+referencedClasses: ["ASTPCNodeVisitor"]
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "supercall",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@supercall"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"supercall",{},globals.AIContext)})},
+args: [],
+source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "supercall:",
+protocol: 'interpreting',
+fn: function (aBoolean){
+var self=this;
+self["@supercall"]=aBoolean;
+return self},
+args: ["aBoolean"],
+source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AIContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableNotFound",
+protocol: 'error handling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._error_("Variable missing");
+return self}, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},globals.AIContext)})},
+args: [],
+source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
+messageSends: ["error:"],
+referencedClasses: []
+}),
+globals.AIContext);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromMethodContext:",
+protocol: 'instance creation',
+fn: function (aMethodContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._initializeFromMethodContext_(aMethodContext);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext.klass)})},
+args: ["aMethodContext"],
+source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
+messageSends: ["initializeFromMethodContext:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.AIContext.klass);
+
+
+smalltalk.addClass('AISemanticAnalyzer', globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
+globals.AISemanticAnalyzer.comment="I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@context"];
+return $1;
+},
+args: [],
+source: "context\x0a\x09^ context",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AISemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context:",
+protocol: 'accessing',
+fn: function (anAIContext){
+var self=this;
+self["@context"]=anAIContext;
+return self},
+args: ["anAIContext"],
+source: "context: anAIContext\x0a\x09context := anAIContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AISemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitVariableNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+function $ASTContextVar(){return globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+var $early={};
+try {
+_st(self._context())._localAt_ifAbsent_(_st(aNode)._value(),(function(){
+return smalltalk.withContext(function($ctx2) {
+$1=($ctx2.supercall = true, globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply(_st(self), [aNode]));
+$ctx2.supercall = false;
+throw $early=[$1];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+_st(aNode)._binding_(_st($ASTContextVar())._new());
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.AISemanticAnalyzer)})},
+args: ["aNode"],
+source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
+messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"],
+referencedClasses: ["ASTContextVar"]
+}),
+globals.AISemanticAnalyzer);
+
+
+
+smalltalk.addClass('ASTContextVar', globals.ScopeVar, ['context'], 'Compiler-Interpreter');
+globals.ASTContextVar.comment="I am a variable defined in a `context`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@context"];
+return $1;
+},
+args: [],
+source: "context\x0a\x09^ context",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTContextVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@context"]=anObject;
+return self},
+args: ["anObject"],
+source: "context: anObject\x0a\x09context := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTContextVar);
+
+
+
+smalltalk.addClass('ASTDebugger', globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
+globals.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "atEnd",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=self._context();
+$ctx1.sendIdx["context"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return true;
+} else {
+$1;
+};
+$2=_st(_st(self._interpreter())._atEnd())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._context())._isTopContext();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTDebugger)})},
+args: [],
+source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
+messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@context"];
+return $1;
+},
+args: [],
+source: "context\x0a\x09^ context",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context:",
+protocol: 'accessing',
+fn: function (aContext){
+var self=this;
+self["@context"]=aContext;
+return self},
+args: ["aContext"],
+source: "context: aContext\x0a\x09context := aContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "flushInnerContexts",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self._context();
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+var cxt;
+cxt=$receiver;
+_st(cxt)._innerContext_(nil);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},globals.ASTDebugger)})},
+args: [],
+source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self context ifNotNil: [ :cxt | \x0a\x09\x09cxt innerContext: nil ]",
+messageSends: ["ifNotNil:", "context", "innerContext:"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "interpreter",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._context();
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$2;
+} else {
+var ctx;
+ctx=$receiver;
+$1=_st(ctx)._interpreter();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.ASTDebugger)})},
+args: [],
+source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
+messageSends: ["ifNotNil:", "context", "interpreter"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._context())._method();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"method",{},globals.ASTDebugger)})},
+args: [],
+source: "method\x0a\x09^ self context method",
+messageSends: ["method", "context"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "node",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._interpreter();
+$ctx1.sendIdx["interpreter"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$2;
+} else {
+$1=_st(self._interpreter())._node();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"node",{},globals.ASTDebugger)})},
+args: [],
+source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
+messageSends: ["ifNotNil:", "interpreter", "node"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onStep",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4,$6,$5,$receiver;
+$1=self._interpreter();
+$ctx1.sendIdx["interpreter"]=1;
+self["@result"]=_st($1)._result();
+$3=self._interpreter();
+$ctx1.sendIdx["interpreter"]=2;
+$2=_st($3)._atEnd();
+$ctx1.sendIdx["atEnd"]=1;
+if(smalltalk.assert($2)){
+$4=_st(self._context())._outerContext();
+if(($receiver = $4) == null || $receiver.isNil){
+$4;
+} else {
+var outerContext;
+outerContext=$receiver;
+self._context_(outerContext);
+};
+$6=self._interpreter();
+$ctx1.sendIdx["interpreter"]=3;
+$5=_st($6)._atEnd();
+if(! smalltalk.assert($5)){
+_st(self._interpreter())._skip();
+};
+};
+self._flushInnerContexts();
+return self}, function($ctx1) {$ctx1.fill(self,"onStep",{},globals.ASTDebugger)})},
+args: [],
+source: "onStep\x0a\x09\x22After each step, check if the interpreter is at the end,\x0a\x09and if it is move to its outer context if any, skipping its \x0a\x09current node (which was just evaluated by the current \x0a\x09interpreter).\x0a\x09\x0a\x09After each step we also flush inner contexts.\x22\x0a\x09\x0a\x09result := self interpreter result.\x0a\x09\x0a\x09self interpreter atEnd ifTrue: [\x0a\x09\x09self context outerContext ifNotNil: [ :outerContext | \x0a\x09\x09\x09self context: outerContext ].\x0a\x09\x09self interpreter atEnd ifFalse: [ self interpreter skip ] ].\x0a\x09\x09\x0a\x09self flushInnerContexts",
+messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "proceed",
+protocol: 'stepping',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._atEnd();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._stepOver();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTDebugger)})},
+args: [],
+source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
+messageSends: ["whileFalse:", "atEnd", "stepOver"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "restart",
+protocol: 'stepping',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._interpreter())._restart();
+self._flushInnerContexts();
+return self}, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTDebugger)})},
+args: [],
+source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
+messageSends: ["restart", "interpreter", "flushInnerContexts"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "result",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@result"];
+return $1;
+},
+args: [],
+source: "result\x0a\x09^ result",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stepInto",
+protocol: 'stepping',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._shouldBeImplemented();
+return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},globals.ASTDebugger)})},
+args: [],
+source: "stepInto\x0a\x09self shouldBeImplemented",
+messageSends: ["shouldBeImplemented"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stepOver",
+protocol: 'stepping',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._context())._isTopContext();
+if(smalltalk.assert($1)){
+_st(self._interpreter())._stepOver();
+} else {
+$2=self._interpreter();
+$ctx1.sendIdx["interpreter"]=1;
+_st($2)._skip();
+};
+self._onStep();
+return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTDebugger)})},
+args: [],
+source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
+messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"],
+referencedClasses: []
+}),
+globals.ASTDebugger);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context:",
+protocol: 'instance creation',
+fn: function (aContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._context_(aContext);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},globals.ASTDebugger.klass)})},
+args: ["aContext"],
+source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
+messageSends: ["context:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.ASTDebugger.klass);
+
+
+smalltalk.addClass('ASTInterpreter', globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
+globals.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "assign:to:",
+protocol: 'private',
+fn: function (aNode,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4;
+$1=_st(_st(aNode)._binding())._isInstanceVar();
+if(smalltalk.assert($1)){
+$3=self._context();
+$ctx1.sendIdx["context"]=1;
+$2=_st($3)._receiver();
+$4=_st(aNode)._value();
+$ctx1.sendIdx["value"]=1;
+_st($2)._instVarAt_put_($4,anObject);
+} else {
+_st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},globals.ASTInterpreter)})},
+args: ["aNode", "anObject"],
+source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
+messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "atEnd",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self["@forceAtEnd"];
+if(smalltalk.assert($1)){
+return true;
+};
+$2=_st(self._hasReturned())._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._node())._isNil();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTInterpreter)})},
+args: [],
+source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
+messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@context"];
+return $1;
+},
+args: [],
+source: "context\x0a\x09^ context",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context:",
+protocol: 'accessing',
+fn: function (aContext){
+var self=this;
+self["@context"]=aContext;
+return self},
+args: ["aContext"],
+source: "context: aContext\x0a\x09context := aContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "eval:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+var source,function_;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$4,$5;
+source=_st($String())._streamContents_((function(str){
+return smalltalk.withContext(function($ctx2) {
+_st(str)._nextPutAll_("(function(");
+$ctx2.sendIdx["nextPutAll:"]=1;
+$3=self._context();
+$ctx2.sendIdx["context"]=1;
+$2=_st($3)._locals();
+$ctx2.sendIdx["locals"]=1;
+$1=_st($2)._keys();
+_st($1)._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(str)._nextPutAll_(each);
+$ctx3.sendIdx["nextPutAll:"]=2;
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(str)._nextPutAll_(",");
+$ctx3.sendIdx["nextPutAll:"]=3;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+_st(str)._nextPutAll_("){ return (function() {");
+$ctx2.sendIdx["nextPutAll:"]=4;
+_st(str)._nextPutAll_(aString);
+$ctx2.sendIdx["nextPutAll:"]=5;
+$4=_st(str)._nextPutAll_("})() })");
+return $4;
+}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
+function_=_st(_st($Compiler())._new())._eval_(source);
+$5=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},globals.ASTInterpreter)})},
+args: ["aString"],
+source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})() })' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
+messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
+referencedClasses: ["String", "Compiler"]
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hasReturned",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@returned"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"hasReturned",{},globals.ASTInterpreter)})},
+args: [],
+source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.ASTInterpreter.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@forceAtEnd"]=false;
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ASTInterpreter)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
+messageSends: ["initialize"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "interpret",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._visit_(self._node());
+return self}, function($ctx1) {$ctx1.fill(self,"interpret",{},globals.ASTInterpreter)})},
+args: [],
+source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
+messageSends: ["visit:", "node"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "interpret:",
+protocol: 'interpreting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._node_(aNode);
+self._interpret();
+return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
+messageSends: ["node:", "interpret"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageFromSendNode:arguments:",
+protocol: 'private',
+fn: function (aSendNode,aCollection){
+var self=this;
+function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($Message())._new();
+_st($2)._selector_(_st(aSendNode)._selector());
+_st($2)._arguments_(aCollection);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},globals.ASTInterpreter)})},
+args: ["aSendNode", "aCollection"],
+source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
+messageSends: ["selector:", "new", "selector", "arguments:", "yourself"],
+referencedClasses: ["Message"]
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageNotUnderstood:receiver:",
+protocol: 'private',
+fn: function (aMessage,anObject){
+var self=this;
+function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($MessageNotUnderstood())._new();
+_st($1)._meesage_(aMessage);
+_st($1)._receiver_(anObject);
+$2=_st($1)._signal();
+return self}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},globals.ASTInterpreter)})},
+args: ["aMessage", "anObject"],
+source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
+messageSends: ["meesage:", "new", "receiver:", "signal"],
+referencedClasses: ["MessageNotUnderstood"]
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._node_(_st(self._node())._nextNode());
+return self}, function($ctx1) {$ctx1.fill(self,"next",{},globals.ASTInterpreter)})},
+args: [],
+source: "next\x0a\x09self node: self node nextNode",
+messageSends: ["node:", "nextNode", "node"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "node",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@node"];
+return $1;
+},
+args: [],
+source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "node:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+self["@node"]=aNode;
+return self},
+args: ["aNode"],
+source: "node: aNode\x0a\x09node := aNode",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "peek",
+protocol: 'stack',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+var $early={};
+try {
+$1=self._stack();
+$ctx1.sendIdx["stack"]=1;
+_st($1)._ifEmpty_((function(){
+throw $early=[nil];
+}));
+$2=_st(self._stack())._last();
+return $2;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"peek",{},globals.ASTInterpreter)})},
+args: [],
+source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last",
+messageSends: ["ifEmpty:", "stack", "last"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pop",
+protocol: 'stack',
+fn: function (){
+var self=this;
+var peekedValue;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+peekedValue=self._peek();
+_st(self._stack())._removeLast();
+$1=peekedValue;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},globals.ASTInterpreter)})},
+args: [],
+source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue",
+messageSends: ["peek", "removeLast", "stack"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "proceed",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._atEnd();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._step();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTInterpreter)})},
+args: [],
+source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
+messageSends: ["whileFalse:", "atEnd", "step"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "push:",
+protocol: 'stack',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._stack())._add_(anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},globals.ASTInterpreter)})},
+args: ["anObject"],
+source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
+messageSends: ["add:", "stack"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "restart",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._node_(_st(_st(self._context())._ast())._nextChild());
+return self}, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTInterpreter)})},
+args: [],
+source: "restart\x0a\x09self node: self context ast nextChild",
+messageSends: ["node:", "nextChild", "ast", "context"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "result",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._hasReturned();
+if(smalltalk.assert($2)){
+$1=self._returnValue();
+} else {
+$1=_st(self._context())._receiver();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"result",{},globals.ASTInterpreter)})},
+args: [],
+source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
+messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "returnValue",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@returnValue"];
+return $1;
+},
+args: [],
+source: "returnValue\x0a\x09^ returnValue",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "returnValue:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@returnValue"]=anObject;
+return self},
+args: ["anObject"],
+source: "returnValue: anObject\x0a\x09returnValue := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendMessage:to:superSend:",
+protocol: 'private',
+fn: function (aMessage,anObject,aBoolean){
+var self=this;
+var method;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4,$5,$6,$receiver;
+var $early={};
+try {
+if(! smalltalk.assert(aBoolean)){
+$1=_st(aMessage)._sendTo_(anObject);
+return $1;
+};
+$3=_st(anObject)._class();
+$ctx1.sendIdx["class"]=1;
+$2=_st($3)._superclass();
+$ctx1.sendIdx["superclass"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+$4=self._messageNotUnderstood_receiver_(aMessage,anObject);
+$ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
+return $4;
+} else {
+$2;
+};
+method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
+return smalltalk.withContext(function($ctx2) {
+$5=self._messageNotUnderstood_receiver_(aMessage,anObject);
+throw $early=[$5];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$6=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
+return $6;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},globals.ASTInterpreter)})},
+args: ["aMessage", "anObject", "aBoolean"],
+source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
+messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setNonLocalReturnFromContext:",
+protocol: 'interpreting',
+fn: function (aContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(aContext)._interpreter();
+$ctx1.sendIdx["interpreter"]=1;
+$1=_st($2)._hasReturned();
+if(smalltalk.assert($1)){
+self["@returned"]=true;
+self["@returned"];
+self._returnValue_(_st(_st(aContext)._interpreter())._returnValue());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},globals.ASTInterpreter)})},
+args: ["aContext"],
+source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
+messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "skip",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._next();
+return self}, function($ctx1) {$ctx1.fill(self,"skip",{},globals.ASTInterpreter)})},
+args: [],
+source: "skip\x0a\x09self next",
+messageSends: ["next"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stack",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@stack"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@stack"]=_st($OrderedCollection())._new();
+$1=self["@stack"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"stack",{},globals.ASTInterpreter)})},
+args: [],
+source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "step",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._interpret();
+$1=self._next();
+return self}, function($ctx1) {$ctx1.fill(self,"step",{},globals.ASTInterpreter)})},
+args: [],
+source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
+messageSends: ["interpret", "next"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stepOver",
+protocol: 'interpreting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+self._step();
+$ctx1.sendIdx["step"]=1;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._node();
+$ctx2.sendIdx["node"]=1;
+$1=_st($2)._isNil();
+return _st($1)._or_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._node())._isSteppingNode();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._step();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTInterpreter)})},
+args: [],
+source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
+messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visit:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._hasReturned();
+if(! smalltalk.assert($1)){
+($ctx1.supercall = true, globals.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
+messageSends: ["ifFalse:", "hasReturned", "visit:"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitAssignmentNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var poppedValue;
+return smalltalk.withContext(function($ctx1) { 
+poppedValue=self._pop();
+$ctx1.sendIdx["pop"]=1;
+self._pop();
+self._push_(poppedValue);
+self._assign_to_(_st(aNode)._left(),poppedValue);
+return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue",
+messageSends: ["pop", "push:", "assign:to:", "left"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitBlockNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var block;
+function $AIBlockClosure(){return globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
+return smalltalk.withContext(function($ctx1) { 
+block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
+self._push_(block);
+return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block",
+messageSends: ["forContext:node:", "context", "push:"],
+referencedClasses: ["AIBlockClosure"]
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitBlockSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+self["@forceAtEnd"]=true;
+return self}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitBlockSequenceNode: aNode\x0a\x09\x22If the receiver is actually visiting a BlockSequenceNode,\x0a\x09it means the the context is a block context. Evaluation should \x0a\x09stop right after evaluating the block sequence and the outer\x0a\x09context's interpreter should take over. \x0a\x09Therefore we force #atEnd.\x22\x0a\x09\x0a\x09super visitBlockSequenceNode: aNode.\x0a\x09forceAtEnd := true",
+messageSends: ["visitBlockSequenceNode:"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitDynamicArrayNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var array;
+return smalltalk.withContext(function($ctx1) { 
+array=[];
+_st(_st(aNode)._nodes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(array)._addFirst_(self._pop());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+self._push_(array);
+return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
+messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitDynamicDictionaryNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var keyValueList;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+keyValueList=_st($OrderedCollection())._new();
+_st(_st(aNode)._nodes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(keyValueList)._add_(self._pop());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+self._push_(_st($HashedCollection())._newFromPairs_(_st(keyValueList)._reversed()));
+return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
+messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"],
+referencedClasses: ["OrderedCollection", "HashedCollection"]
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitJSStatementNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@returned"]=true;
+self._returnValue_(self._eval_(_st(aNode)._source()));
+return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
+messageSends: ["returnValue:", "eval:", "source"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return self},
+args: ["aNode"],
+source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitReturnNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@returned"]=true;
+self._returnValue_(self._pop());
+return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
+messageSends: ["returnValue:", "pop"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSendNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var receiver,args,message,result;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+args=_st(_st(aNode)._arguments())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._pop();
+$ctx2.sendIdx["pop"]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+receiver=self._pop();
+message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
+result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
+$1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(aNode)._isLastChild())._not();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+if(smalltalk.assert($1)){
+self._push_(receiver);
+$ctx1.sendIdx["push:"]=1;
+} else {
+self._push_(result);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]",
+messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(aNode)._temps())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._context())._defineLocal_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
+messageSends: ["do:", "temps", "defineLocal:", "context"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitValueNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._push_(_st(aNode)._value());
+return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitValueNode: aNode\x0a\x09self push: aNode value",
+messageSends: ["push:", "value"],
+referencedClasses: []
+}),
+globals.ASTInterpreter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitVariableNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
+$2=_st(aNode)._binding();
+$ctx1.sendIdx["binding"]=1;
+$1=_st($2)._isUnknownVar();
+if(smalltalk.assert($1)){
+$5=_st($PlatformInterface())._globals();
+$ctx1.sendIdx["globals"]=1;
+$6=_st(aNode)._value();
+$ctx1.sendIdx["value"]=1;
+$4=_st($5)._at_ifAbsent_($6,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._error_("Unknown variable");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$ctx1.sendIdx["at:ifAbsent:"]=1;
+$3=self._push_($4);
+$ctx1.sendIdx["push:"]=1;
+return $3;
+};
+$8=_st(_st(aNode)._binding())._isInstanceVar();
+if(smalltalk.assert($8)){
+$10=self._context();
+$ctx1.sendIdx["context"]=1;
+$9=_st($10)._receiver();
+$11=_st(aNode)._value();
+$ctx1.sendIdx["value"]=2;
+$7=_st($9)._instVarAt_($11);
+} else {
+$12=self._context();
+$13=_st(aNode)._value();
+$ctx1.sendIdx["value"]=3;
+$7=_st($12)._localAt_ifAbsent_($13,(function(){
+return smalltalk.withContext(function($ctx2) {
+$15=_st(aNode)._value();
+$ctx2.sendIdx["value"]=4;
+$14=_st($15)._isCapitalized();
+if(smalltalk.assert($14)){
+$16=_st($Smalltalk())._globals();
+$ctx2.sendIdx["globals"]=2;
+$17=_st(aNode)._value();
+$ctx2.sendIdx["value"]=5;
+return _st($16)._at_ifAbsent_($17,(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st($PlatformInterface())._globals())._at_(_st(aNode)._value());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)})}));
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
+};
+self._push_($7);
+return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.ASTInterpreter)})},
+args: ["aNode"],
+source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (PlatformInterface globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ PlatformInterface globals at: aNode value ] ] ] ])",
+messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"],
+referencedClasses: ["PlatformInterface", "Smalltalk"]
+}),
+globals.ASTInterpreter);
+
+
+
+smalltalk.addClass('ASTInterpreterError', globals.Error, [], 'Compiler-Interpreter');
+globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
+
+
+smalltalk.addClass('ASTPCNodeVisitor', globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
+globals.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node is answered by `#currentNode`";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@context"];
+return $1;
+},
+args: [],
+source: "context\x0a\x09^ context",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTPCNodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context:",
+protocol: 'accessing',
+fn: function (aContext){
+var self=this;
+self["@context"]=aContext;
+return self},
+args: ["aContext"],
+source: "context: aContext\x0a\x09context := aContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTPCNodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentNode",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@currentNode"];
+return $1;
+},
+args: [],
+source: "currentNode\x0a\x09^ currentNode",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTPCNodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "increaseIndex",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@index"]=_st(self._index()).__plus((1));
+return self}, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},globals.ASTPCNodeVisitor)})},
+args: [],
+source: "increaseIndex\x0a\x09index := self index + 1",
+messageSends: ["+", "index"],
+referencedClasses: []
+}),
+globals.ASTPCNodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "index",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@index"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@index"]=(0);
+$1=self["@index"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"index",{},globals.ASTPCNodeVisitor)})},
+args: [],
+source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.ASTPCNodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selector"];
+return $1;
+},
+args: [],
+source: "selector\x0a\x09^ selector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTPCNodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@selector"]=aString;
+return self},
+args: ["aString"],
+source: "selector: aString\x0a\x09selector := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTPCNodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitJSStatementNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+self["@currentNode"]=aNode;
+return self},
+args: ["aNode"],
+source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ASTPCNodeVisitor);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSendNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var sendIndex;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3,$5;
+$1=self._context();
+$2=self._selector();
+$ctx1.sendIdx["selector"]=1;
+sendIndex=_st($1)._sendIndexAt_($2);
+($ctx1.supercall = true, globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+$4=self._selector();
+$ctx1.sendIdx["selector"]=2;
+$3=_st($4).__eq(_st(aNode)._selector());
+$ctx1.sendIdx["="]=1;
+if(smalltalk.assert($3)){
+$5=_st(self._index()).__eq(sendIndex);
+if(smalltalk.assert($5)){
+self["@currentNode"]=aNode;
+self["@currentNode"];
+};
+self._increaseIndex();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},globals.ASTPCNodeVisitor)})},
+args: ["aNode"],
+source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index = sendIndex ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseIndex ]",
+messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"],
+referencedClasses: []
+}),
+globals.ASTPCNodeVisitor);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSteppingNode",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSteppingNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AssignmentNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSteppingNode",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSteppingNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSteppingNode",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSteppingNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.DynamicArrayNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSteppingNode",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSteppingNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.DynamicDictionaryNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSteppingNode",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSteppingNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSStatementNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSteppingNode",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isSteppingNode\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Node);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSteppingNode",
+protocol: '*Compiler-Interpreter',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isSteppingNode\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SendNode);
+
+});

+ 975 - 0
src/Compiler-Interpreter.st

@@ -0,0 +1,975 @@
+Smalltalk createPackage: 'Compiler-Interpreter'!
+BlockClosure subclass: #AIBlockClosure
+	instanceVariableNames: 'node outerContext'
+	package: 'Compiler-Interpreter'!
+!AIBlockClosure commentStamp!
+I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.
+
+While I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.
+
+Evaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).!
+
+!AIBlockClosure methodsFor: 'accessing'!
+
+compiledSource
+	"Unlike blocks, the receiver doesn't represent a JS function"
+	
+	^ '[ AST Block closure ]'
+!
+
+numArgs
+	^ node temps size
+! !
+
+!AIBlockClosure methodsFor: 'converting'!
+
+currySelf
+	self interpreterError
+! !
+
+!AIBlockClosure methodsFor: 'error handling'!
+
+interpreterError
+	ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'
+! !
+
+!AIBlockClosure methodsFor: 'evaluating'!
+
+applyTo: anObject arguments: aCollection
+	self interpreterError
+!
+
+value
+	^ self valueWithPossibleArguments: #()
+!
+
+value: anArgument
+	^ self valueWithPossibleArguments: {anArgument}
+!
+
+value: firstArgument value: secondArgument
+	^ self valueWithPossibleArguments: {firstArgument . secondArgument}
+!
+
+value: firstArgument value: secondArgument value: thirdArgument
+	^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}
+!
+
+valueWithPossibleArguments: aCollection
+	| context sequenceNode |
+	context := outerContext newInnerContext.
+
+	"Interpret a copy of the sequence node to avoid creating a new AIBlockClosure"
+	sequenceNode := node nodes first copy
+		parent: nil;
+		yourself.
+		
+	"Define locals in the context"
+	sequenceNode temps do: [ :each |
+		context defineLocal: each ].
+		
+	"Populate the arguments into the context locals"	
+	node parameters withIndexDo: [ :each :index |
+		context defineLocal: each.
+		context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].
+
+	"Interpret the first node of the BlockSequenceNode"
+	context interpreter
+		node: sequenceNode nextChild;
+		proceed.
+		
+	outerContext interpreter
+		setNonLocalReturnFromContext: context.
+		
+	^ context interpreter pop
+! !
+
+!AIBlockClosure methodsFor: 'initialization'!
+
+initializeWithContext: aContext node: aNode
+	node := aNode.
+	outerContext := aContext
+! !
+
+!AIBlockClosure class methodsFor: 'instance creation'!
+
+forContext: aContext node: aNode
+	^ self new
+		initializeWithContext: aContext node: aNode;
+		yourself
+! !
+
+MethodContext subclass: #AIContext
+	instanceVariableNames: 'outerContext innerContext pc locals selector index sendIndexes evaluatedSelector ast interpreter supercall'
+	package: 'Compiler-Interpreter'!
+!AIContext commentStamp!
+I am like a `MethodContext`, used by the `ASTInterpreter`.
+Unlike a `MethodContext`, my instances are not read-only.
+
+When debugging, my instances are created by copying the current `MethodContext` (thisContext)!
+
+!AIContext methodsFor: 'accessing'!
+
+defineLocal: aString
+	self locals at: aString put: nil
+!
+
+evaluatedSelector
+	^ evaluatedSelector
+!
+
+evaluatedSelector: aString
+	evaluatedSelector := aString
+!
+
+index
+	^ index ifNil: [ 0 ]
+!
+
+index: anInteger
+	index := anInteger
+!
+
+innerContext
+	^ innerContext
+!
+
+innerContext: anAIContext
+	innerContext := anAIContext
+!
+
+localAt: aString
+	"Lookup the local value up to the method context"
+
+	| context |
+	
+	context := self lookupContextForLocal: aString.
+	^ context basicLocalAt: aString
+!
+
+localAt: aString ifAbsent: aBlock
+	"Lookup the local value up to the method context"
+
+	| context |
+	
+	context := self 	
+		lookupContextForLocal: aString 
+		ifNone: [ ^ aBlock value ].
+	
+	^ context basicLocalAt: aString
+!
+
+localAt: aString put: anObject
+	| context |
+	
+	context := self lookupContextForLocal: aString.
+	context basicLocalAt: aString put: anObject
+!
+
+locals
+	locals ifNil: [ self initializeLocals ].
+	
+	^ locals
+!
+
+outerContext
+	^ outerContext
+!
+
+outerContext: anAIContext
+	outerContext := anAIContext.
+	outerContext ifNotNil: [ :context | 
+		context innerContext: self ]
+!
+
+selector
+	^ selector
+!
+
+selector: aString
+	selector := aString
+!
+
+sendIndexAt: aString
+	^ self sendIndexes at: aString ifAbsent: [ 0 ]
+!
+
+sendIndexes
+	^ sendIndexes ifNil: [ Dictionary new ]
+!
+
+sendIndexes: aDictionary
+	sendIndexes := aDictionary
+! !
+
+!AIContext methodsFor: 'error handling'!
+
+variableNotFound
+	"Error thrown whenever a variable lookup fails"
+	
+	self error: 'Variable missing'
+! !
+
+!AIContext methodsFor: 'evaluating'!
+
+evaluate: aString on: anEvaluator
+	^ anEvaluator evaluate: aString context: self
+!
+
+evaluateNode: aNode
+	^ ASTInterpreter new
+		context: self;
+		node: aNode nextChild;
+		proceed;
+		result
+! !
+
+!AIContext methodsFor: 'factory'!
+
+newInnerContext
+	^ self class new
+		outerContext: self;
+		yourself
+! !
+
+!AIContext methodsFor: 'initialization'!
+
+initializeAST
+	ast := self method ast.
+	(SemanticAnalyzer on: self method methodClass)
+		visit: ast
+!
+
+initializeFromMethodContext: aMethodContext
+
+	self
+		evaluatedSelector: aMethodContext evaluatedSelector;
+		index: aMethodContext index;
+		sendIndexes: aMethodContext sendIndexes;
+		receiver: aMethodContext receiver;
+		supercall: aMethodContext supercall;
+		selector: aMethodContext selector.
+		
+	aMethodContext outerContext ifNotNil: [ :outer |
+		"If the method context is nil, the block was defined in JS, so ignore it"
+		outer methodContext ifNotNil: [
+			self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].
+			aMethodContext locals keysAndValuesDo: [ :key :value |
+				self locals at: key put: value ] ]
+!
+
+initializeInterpreter
+	interpreter := ASTInterpreter new
+		context: self;
+		yourself.
+	
+	self innerContext ifNotNil: [
+		self setupInterpreter: interpreter ]
+!
+
+initializeLocals
+	locals := Dictionary new.
+	locals at: 'thisContext' put: self.
+! !
+
+!AIContext methodsFor: 'interpreting'!
+
+arguments
+	^ self ast arguments collect: [ :each |
+		self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]
+!
+
+ast
+	self isBlockContext ifTrue: [ 
+		^ self outerContext ifNotNil: [ :context | context ast ] ].
+
+	ast ifNil: [ self initializeAST ].
+	^ ast
+!
+
+basicReceiver
+	^ self localAt: 'self'
+!
+
+interpreter
+	interpreter ifNil: [ self initializeInterpreter ].
+	^ interpreter
+!
+
+interpreter: anInterpreter
+	interpreter := anInterpreter
+!
+
+receiver: anObject
+	self locals at: 'self' put: anObject
+!
+
+setupInterpreter: anInterpreter
+	| currentNode |
+	
+	"Retrieve the current node"
+	currentNode := ASTPCNodeVisitor new
+			selector: self evaluatedSelector;
+			context: self;
+			visit: self ast;
+			currentNode.
+	
+	"Define locals for the context"
+	self ast sequenceNode ifNotNil: [ :sequence |
+		sequence temps do: [ :each |
+			self defineLocal: each ] ].
+	
+	anInterpreter node: currentNode.
+
+	"Push the send args and receiver to the interpreter stack"	
+	self innerContext arguments reversed do: [ :each | 
+		anInterpreter push: each ].
+		
+	anInterpreter push: (self innerContext receiver)
+!
+
+supercall
+	^ supercall ifNil: [ false ]
+!
+
+supercall: aBoolean
+	supercall := aBoolean
+! !
+
+!AIContext methodsFor: 'private'!
+
+basicLocalAt: aString
+	^ self locals at: aString
+!
+
+basicLocalAt: aString put: anObject
+	self locals at: aString put: anObject
+!
+
+lookupContextForLocal: aString
+	"Lookup the context defining the local named `aString` 
+	up to the method context"
+
+	^ self 
+		lookupContextForLocal: aString 
+		ifNone: [ self variableNotFound ]
+!
+
+lookupContextForLocal: aString ifNone: aBlock
+	"Lookup the context defining the local named `aString` 
+	up to the method context"
+
+	^ self locals 
+		at: aString
+		ifPresent: [ self ]
+		ifAbsent: [ 
+			self outerContext 
+				ifNil: aBlock
+				ifNotNil: [ :context | 
+					context lookupContextForLocal: aString ] ]
+! !
+
+!AIContext methodsFor: 'testing'!
+
+isTopContext
+	^ self innerContext isNil
+! !
+
+!AIContext class methodsFor: 'instance creation'!
+
+fromMethodContext: aMethodContext
+	^ self new
+		initializeFromMethodContext: aMethodContext;
+		yourself
+! !
+
+SemanticAnalyzer subclass: #AISemanticAnalyzer
+	instanceVariableNames: 'context'
+	package: 'Compiler-Interpreter'!
+!AISemanticAnalyzer commentStamp!
+I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables.!
+
+!AISemanticAnalyzer methodsFor: 'accessing'!
+
+context
+	^ context
+!
+
+context: anAIContext
+	context := anAIContext
+! !
+
+!AISemanticAnalyzer methodsFor: 'visiting'!
+
+visitVariableNode: aNode
+	self context 
+		localAt: aNode value 
+		ifAbsent: [ ^ super visitVariableNode: aNode ].
+
+	aNode binding: ASTContextVar new
+! !
+
+ScopeVar subclass: #ASTContextVar
+	instanceVariableNames: 'context'
+	package: 'Compiler-Interpreter'!
+!ASTContextVar commentStamp!
+I am a variable defined in a `context`.!
+
+!ASTContextVar methodsFor: 'accessing'!
+
+context
+	^ context
+!
+
+context: anObject
+	context := anObject
+! !
+
+Object subclass: #ASTDebugger
+	instanceVariableNames: 'interpreter context result'
+	package: 'Compiler-Interpreter'!
+!ASTDebugger commentStamp!
+I am a stepping debugger interface for Amber code.
+I internally use an instance of `ASTInterpreter` to actually step through node and interpret them.
+
+My instances are created from an `AIContext` with `ASTDebugger class >> context:`.
+They hold an `AIContext` instance internally, recursive copy of the `MethodContext`.
+
+## API
+
+Use the methods of the `'stepping'` protocol to do stepping.!
+
+!ASTDebugger methodsFor: 'accessing'!
+
+context
+	^ context
+!
+
+context: aContext
+	context := aContext
+!
+
+interpreter
+	^ self context ifNotNil: [ :ctx | 
+		ctx interpreter ]
+!
+
+method
+	^ self context method
+!
+
+node
+	^ self interpreter ifNotNil: [
+		self interpreter node ]
+!
+
+result
+	^ result
+! !
+
+!ASTDebugger methodsFor: 'actions'!
+
+flushInnerContexts
+	"When stepping, the inner contexts are not relevent anymore,
+	and can be flushed"
+	
+	self context ifNotNil: [ :cxt | 
+		cxt innerContext: nil ]
+! !
+
+!ASTDebugger methodsFor: 'private'!
+
+onStep
+	"After each step, check if the interpreter is at the end,
+	and if it is move to its outer context if any, skipping its 
+	current node (which was just evaluated by the current 
+	interpreter).
+	
+	After each step we also flush inner contexts."
+	
+	result := self interpreter result.
+	
+	self interpreter atEnd ifTrue: [
+		self context outerContext ifNotNil: [ :outerContext | 
+			self context: outerContext ].
+		self interpreter atEnd ifFalse: [ self interpreter skip ] ].
+		
+	self flushInnerContexts
+! !
+
+!ASTDebugger methodsFor: 'stepping'!
+
+proceed
+	[ self atEnd ] whileFalse: [ self stepOver ]
+!
+
+restart
+	self interpreter restart.
+	self flushInnerContexts
+!
+
+stepInto
+	self shouldBeImplemented
+!
+
+stepOver
+	self context isTopContext 
+		ifFalse: [ self interpreter skip ]
+		ifTrue: [ self interpreter stepOver ].
+	self onStep
+! !
+
+!ASTDebugger methodsFor: 'testing'!
+
+atEnd	
+	self context ifNil: [ ^ true ].
+	
+	^ self interpreter atEnd and: [ 
+		self context isTopContext ]
+! !
+
+!ASTDebugger class methodsFor: 'instance creation'!
+
+context: aContext
+	^ self new
+		context: aContext;
+		yourself
+! !
+
+NodeVisitor subclass: #ASTInterpreter
+	instanceVariableNames: 'node context stack returnValue returned forceAtEnd'
+	package: 'Compiler-Interpreter'!
+!ASTInterpreter commentStamp!
+I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.
+
+## API
+
+While my instances should be used from within an `ASTDebugger`, which provides a more high level interface,
+you can use methods from the `interpreting` protocol:
+
+- `#step` evaluates the current `node` only
+- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)
+- `#proceed` evaluates eagerly the AST
+- `#restart` select the first node of the AST
+- `#skip` skips the current node, moving to the next one if any!
+
+!ASTInterpreter methodsFor: 'accessing'!
+
+context
+	^ context
+!
+
+context: aContext
+	context := aContext
+!
+
+node
+	"Answer the next node, ie the node to be evaluated in the next step"
+	
+	^ node
+!
+
+node: aNode
+	node := aNode
+!
+
+result
+	^ self hasReturned 
+		ifTrue: [ self returnValue ] 
+		ifFalse: [ self context receiver ]
+!
+
+returnValue
+	^ returnValue
+!
+
+returnValue: anObject
+	returnValue := anObject
+!
+
+stack
+	^ stack ifNil: [ stack := OrderedCollection new ]
+! !
+
+!ASTInterpreter methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+
+	forceAtEnd := false
+! !
+
+!ASTInterpreter methodsFor: 'interpreting'!
+
+interpret
+	"Interpret the next node to be evaluated"
+	
+	self visit: self node
+!
+
+interpret: aNode
+	self node: aNode.
+	self interpret
+!
+
+next
+	self node: self node nextNode
+!
+
+proceed
+	"Eagerly evaluate the ast"
+	
+	[ self atEnd ] 
+		whileFalse: [ self step ]
+!
+
+restart
+	self node: self context ast nextChild
+!
+
+setNonLocalReturnFromContext: aContext
+	aContext interpreter hasReturned ifTrue: [
+		returned := true.
+		self returnValue: aContext interpreter returnValue ]
+!
+
+skip
+	self next
+!
+
+step
+	self 
+		interpret; 
+		next
+!
+
+stepOver
+	self step.
+	
+	[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ 
+		self step ]
+! !
+
+!ASTInterpreter methodsFor: 'private'!
+
+assign: aNode to: anObject
+	aNode binding isInstanceVar
+		ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]
+		ifFalse: [ self context localAt: aNode value put: anObject ]
+!
+
+eval: aString
+	"Evaluate aString as JS source inside an JS function.
+	aString is not sandboxed."
+	
+	| source function |
+	
+	source := String streamContents: [ :str |
+		str nextPutAll: '(function('.
+		self context locals keys
+			do: [ :each | str nextPutAll: each ]
+			separatedBy: [ str nextPutAll: ',' ].
+		str
+			nextPutAll: '){ return (function() {';
+			nextPutAll: aString;
+			nextPutAll: '})() })' ].
+			
+	function := Compiler new eval: source.
+	
+	^ function valueWithPossibleArguments: self context locals values
+!
+
+messageFromSendNode: aSendNode arguments: aCollection
+	^ Message new
+		selector: aSendNode selector;
+		arguments: aCollection;
+		yourself
+!
+
+messageNotUnderstood: aMessage receiver: anObject
+	MessageNotUnderstood new
+		meesage: aMessage;
+		receiver: anObject;
+		signal
+!
+
+sendMessage: aMessage to: anObject superSend: aBoolean
+	| method |
+	
+	aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].
+	anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].
+	
+	method := anObject class superclass methodDictionary
+		at: aMessage selector
+		ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].
+		
+	^ method sendTo: anObject arguments: aMessage arguments
+! !
+
+!ASTInterpreter methodsFor: 'stack'!
+
+peek
+	"Peek the top object of the context stack"
+	
+	self stack ifEmpty: [ ^ nil ].
+	
+	^ self stack last
+!
+
+pop
+	"Pop an object from the context stack"
+	
+	| peekedValue |
+	
+	peekedValue := self peek.
+	self stack removeLast.
+	^ peekedValue
+!
+
+push: anObject
+	"Push an object to the context stack"
+	
+	^ self stack add: anObject
+! !
+
+!ASTInterpreter methodsFor: 'testing'!
+
+atEnd
+	forceAtEnd ifTrue: [ ^ true ].
+	
+	^ self hasReturned or: [ self node isNil ]
+!
+
+hasReturned
+	^ returned ifNil: [ false ]
+! !
+
+!ASTInterpreter methodsFor: 'visiting'!
+
+visit: aNode
+	self hasReturned ifFalse: [ super visit: aNode ]
+!
+
+visitAssignmentNode: aNode
+	| poppedValue |
+	
+	poppedValue := self pop.
+	
+	"Pop the left side of the assignment.
+	It already has been visited, and we don't need its value."
+	self pop.
+	
+	self push: poppedValue.
+	self assign: aNode left to: poppedValue
+!
+
+visitBlockNode: aNode
+	"Do not evaluate the block node.
+	Instead, put all instructions into a block that we push to the stack for later evaluation"
+	
+	| block |
+	
+	block := AIBlockClosure forContext: self context node: aNode.
+	
+	self push: block
+!
+
+visitBlockSequenceNode: aNode
+	"If the receiver is actually visiting a BlockSequenceNode,
+	it means the the context is a block context. Evaluation should 
+	stop right after evaluating the block sequence and the outer
+	context's interpreter should take over. 
+	Therefore we force #atEnd."
+	
+	super visitBlockSequenceNode: aNode.
+	forceAtEnd := true
+!
+
+visitDynamicArrayNode: aNode
+	| array |
+	
+	array := #().
+	aNode nodes do: [ :each |
+		array addFirst: self pop ].
+	
+	self push: array
+!
+
+visitDynamicDictionaryNode: aNode
+	| keyValueList |
+	
+	keyValueList := OrderedCollection new.
+	
+	aNode nodes do: [ :each | 
+		keyValueList add: self pop ].
+	
+	self push: (HashedCollection newFromPairs: keyValueList reversed)
+!
+
+visitJSStatementNode: aNode
+	returned := true.
+	self returnValue: (self eval: aNode source)
+!
+
+visitNode: aNode
+	"Do nothing by default. Especially, do not visit children recursively."
+!
+
+visitReturnNode: aNode
+	returned := true.
+	self returnValue: self pop
+!
+
+visitSendNode: aNode
+	| receiver args message result |
+	
+	args := aNode arguments collect: [ :each | self pop ].
+	receiver := self pop.
+	
+	message := self
+		messageFromSendNode: aNode
+		arguments: args reversed.
+	
+	result := self sendMessage: message to: receiver superSend: aNode superSend.
+	
+	"For cascade sends, push the reciever if the send is not the last one"
+	(aNode isCascadeSendNode and: [ aNode isLastChild not ])
+		ifTrue: [ self push: receiver ]
+		ifFalse: [ self push: result ]
+!
+
+visitSequenceNode: aNode
+	aNode temps do: [ :each |
+		self context defineLocal: each ]
+!
+
+visitValueNode: aNode
+	self push: aNode value
+!
+
+visitVariableNode: aNode
+	aNode binding isUnknownVar ifTrue: [
+		^ self push: (PlatformInterface globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].
+		
+	self push: (aNode binding isInstanceVar
+		ifTrue: [ self context receiver instVarAt: aNode value ]
+		ifFalse: [ self context 
+			localAt: aNode value
+			ifAbsent: [
+				aNode value isCapitalized
+					ifTrue: [
+						Smalltalk globals 
+							at: aNode value 
+							ifAbsent: [ PlatformInterface globals at: aNode value ] ] ] ])
+! !
+
+Error subclass: #ASTInterpreterError
+	instanceVariableNames: ''
+	package: 'Compiler-Interpreter'!
+!ASTInterpreterError commentStamp!
+I get signaled when an AST interpreter is unable to interpret a node.!
+
+NodeVisitor subclass: #ASTPCNodeVisitor
+	instanceVariableNames: 'context index selector currentNode'
+	package: 'Compiler-Interpreter'!
+!ASTPCNodeVisitor commentStamp!
+I visit an AST until I get to the current node for the `context` and answer it.
+
+## API
+
+My instances must be filled with a context object using `#context:`.
+
+After visiting the AST the current node is answered by `#currentNode`!
+
+!ASTPCNodeVisitor methodsFor: 'accessing'!
+
+context
+	^ context
+!
+
+context: aContext
+	context := aContext
+!
+
+currentNode
+	^ currentNode
+!
+
+increaseIndex
+	index := self index + 1
+!
+
+index
+	^ index ifNil: [ index := 0 ]
+!
+
+selector
+	^ selector
+!
+
+selector: aString
+	selector := aString
+! !
+
+!ASTPCNodeVisitor methodsFor: 'visiting'!
+
+visitJSStatementNode: aNode
+	"If a JSStatementNode is encountered, it always is the current node.
+	Stop visiting the AST there"
+	
+	currentNode := aNode
+!
+
+visitSendNode: aNode
+	| sendIndex |
+	sendIndex := self context sendIndexAt: self selector.
+	
+	super visitSendNode: aNode.
+	
+	self selector = aNode selector ifTrue: [
+		self index = sendIndex ifTrue: [ currentNode := aNode ].
+		self increaseIndex ]
+! !
+
+!AssignmentNode methodsFor: '*Compiler-Interpreter'!
+
+isSteppingNode
+	^ true
+! !
+
+!BlockNode methodsFor: '*Compiler-Interpreter'!
+
+isSteppingNode
+	^ true
+! !
+
+!DynamicArrayNode methodsFor: '*Compiler-Interpreter'!
+
+isSteppingNode
+	^ true
+! !
+
+!DynamicDictionaryNode methodsFor: '*Compiler-Interpreter'!
+
+isSteppingNode
+	^ true
+! !
+
+!JSStatementNode methodsFor: '*Compiler-Interpreter'!
+
+isSteppingNode
+	^ true
+! !
+
+!Node methodsFor: '*Compiler-Interpreter'!
+
+isSteppingNode
+	^ false
+! !
+
+!SendNode methodsFor: '*Compiler-Interpreter'!
+
+isSteppingNode
+	^ true
+! !
+

+ 1953 - 0
src/Compiler-Semantic.js

@@ -0,0 +1,1953 @@
+define("amber_core/Compiler-Semantic", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Compiler-Semantic');
+smalltalk.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('LexicalScope', globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
+globals.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addArg:",
+protocol: 'adding',
+fn: function (aString){
+var self=this;
+function $ArgVar(){return globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._args();
+$ctx1.sendIdx["args"]=1;
+_st($1)._at_put_(aString,_st($ArgVar())._on_(aString));
+_st(_st(self._args())._at_(aString))._scope_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},globals.LexicalScope)})},
+args: ["aString"],
+source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
+messageSends: ["at:put:", "args", "on:", "scope:", "at:"],
+referencedClasses: ["ArgVar"]
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addTemp:",
+protocol: 'adding',
+fn: function (aString){
+var self=this;
+function $TempVar(){return globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._temps();
+$ctx1.sendIdx["temps"]=1;
+_st($1)._at_put_(aString,_st($TempVar())._on_(aString));
+_st(_st(self._temps())._at_(aString))._scope_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},globals.LexicalScope)})},
+args: ["aString"],
+source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
+messageSends: ["at:put:", "temps", "on:", "scope:", "at:"],
+referencedClasses: ["TempVar"]
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "alias",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1="$ctx".__comma(_st(self._scopeLevel())._asString());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"alias",{},globals.LexicalScope)})},
+args: [],
+source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
+messageSends: [",", "asString", "scopeLevel"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allVariableNames",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(self._args())._keys();
+$ctx1.sendIdx["keys"]=1;
+$1=_st($2).__comma(_st(self._temps())._keys());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.LexicalScope)})},
+args: [],
+source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
+messageSends: [",", "keys", "args", "temps"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "args",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@args"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@args"]=_st($Dictionary())._new();
+$1=self["@args"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"args",{},globals.LexicalScope)})},
+args: [],
+source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Dictionary"]
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "bindingFor:",
+protocol: 'accessing',
+fn: function (aStringOrNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$5,$1;
+$2=self._pseudoVars();
+$3=_st(aStringOrNode)._value();
+$ctx1.sendIdx["value"]=1;
+$1=_st($2)._at_ifAbsent_($3,(function(){
+return smalltalk.withContext(function($ctx2) {
+$4=self._args();
+$5=_st(aStringOrNode)._value();
+$ctx2.sendIdx["value"]=2;
+return _st($4)._at_ifAbsent_($5,(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
+return nil;
+}));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["at:ifAbsent:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["at:ifAbsent:"]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},globals.LexicalScope)})},
+args: ["aStringOrNode"],
+source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [\x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]",
+messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "blockIndex",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@blockIndex"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=(0);
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"blockIndex",{},globals.LexicalScope)})},
+args: [],
+source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "blockIndex:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@blockIndex"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canInlineNonLocalReturns",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._isInlined())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._outerScope())._canInlineNonLocalReturns();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},globals.LexicalScope)})},
+args: [],
+source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
+messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instruction",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@instruction"];
+return $1;
+},
+args: [],
+source: "instruction\x0a\x09^ instruction",
+messageSends: [],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instruction:",
+protocol: 'accessing',
+fn: function (anIRInstruction){
+var self=this;
+self["@instruction"]=anIRInstruction;
+return self},
+args: ["anIRInstruction"],
+source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
+messageSends: [],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBlockScope",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._isMethodScope())._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},globals.LexicalScope)})},
+args: [],
+source: "isBlockScope\x0a\x09^ self isMethodScope not",
+messageSends: ["not", "isMethodScope"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInlined",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self._instruction();
+$ctx1.sendIdx["instruction"]=1;
+$2=_st($3)._notNil();
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._instruction())._isInlined();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isInlined",{},globals.LexicalScope)})},
+args: [],
+source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
+messageSends: ["and:", "notNil", "instruction", "isInlined"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isMethodScope",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isMethodScope\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lookupVariable:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+var lookup;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+lookup=self._bindingFor_(aNode);
+$1=lookup;
+if(($receiver = $1) == null || $receiver.isNil){
+$2=self._outerScope();
+$ctx1.sendIdx["outerScope"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+lookup=$2;
+} else {
+lookup=_st(self._outerScope())._lookupVariable_(aNode);
+};
+lookup;
+} else {
+$1;
+};
+$3=lookup;
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},globals.LexicalScope)})},
+args: ["aNode"],
+source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup",
+messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodScope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._outerScope();
+$ctx1.sendIdx["outerScope"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$2;
+} else {
+$1=_st(self._outerScope())._methodScope();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodScope",{},globals.LexicalScope)})},
+args: [],
+source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
+messageSends: ["ifNotNil:", "outerScope", "methodScope"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "node",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@node"];
+return $1;
+},
+args: [],
+source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
+messageSends: [],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "node:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+self["@node"]=aNode;
+return self},
+args: ["aNode"],
+source: "node: aNode\x0a\x09node := aNode",
+messageSends: [],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "outerScope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@outerScope"];
+return $1;
+},
+args: [],
+source: "outerScope\x0a\x09^ outerScope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "outerScope:",
+protocol: 'accessing',
+fn: function (aLexicalScope){
+var self=this;
+self["@outerScope"]=aLexicalScope;
+return self},
+args: ["aLexicalScope"],
+source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pseudoVars",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._methodScope())._pseudoVars();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.LexicalScope)})},
+args: [],
+source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
+messageSends: ["pseudoVars", "methodScope"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scopeLevel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3,$5,$receiver;
+$1=self._outerScope();
+$ctx1.sendIdx["outerScope"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return (1);
+} else {
+$1;
+};
+$2=self._isInlined();
+if(smalltalk.assert($2)){
+$4=self._outerScope();
+$ctx1.sendIdx["outerScope"]=2;
+$3=_st($4)._scopeLevel();
+$ctx1.sendIdx["scopeLevel"]=1;
+return $3;
+};
+$5=_st(_st(self._outerScope())._scopeLevel()).__plus((1));
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},globals.LexicalScope)})},
+args: [],
+source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
+messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"],
+referencedClasses: []
+}),
+globals.LexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "temps",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@temps"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@temps"]=_st($Dictionary())._new();
+$1=self["@temps"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"temps",{},globals.LexicalScope)})},
+args: [],
+source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Dictionary"]
+}),
+globals.LexicalScope);
+
+
+
+smalltalk.addClass('MethodLexicalScope', globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
+globals.MethodLexicalScope.comment="I represent a method scope.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addIVar:",
+protocol: 'adding',
+fn: function (aString){
+var self=this;
+function $InstanceVar(){return globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._iVars();
+$ctx1.sendIdx["iVars"]=1;
+_st($1)._at_put_(aString,_st($InstanceVar())._on_(aString));
+_st(_st(self._iVars())._at_(aString))._scope_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},globals.MethodLexicalScope)})},
+args: ["aString"],
+source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
+messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"],
+referencedClasses: ["InstanceVar"]
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addNonLocalReturn:",
+protocol: 'adding',
+fn: function (aScope){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._nonLocalReturns())._add_(aScope);
+return self}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)})},
+args: ["aScope"],
+source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
+messageSends: ["add:", "nonLocalReturns"],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allVariableNames",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=($ctx1.supercall = true, globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st($2).__comma(_st(self._iVars())._keys());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.MethodLexicalScope)})},
+args: [],
+source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
+messageSends: [",", "allVariableNames", "keys", "iVars"],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "bindingFor:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=($ctx1.supercall = true, globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+if(($receiver = $2) == null || $receiver.isNil){
+$1=_st(self._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
+return nil;
+}));
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},globals.MethodLexicalScope)})},
+args: ["aNode"],
+source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
+messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canInlineNonLocalReturns",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canInlineNonLocalReturns\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hasLocalReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._localReturn();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},globals.MethodLexicalScope)})},
+args: [],
+source: "hasLocalReturn\x0a\x09^ self localReturn",
+messageSends: ["localReturn"],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hasNonLocalReturn",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._nonLocalReturns())._notEmpty();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},globals.MethodLexicalScope)})},
+args: [],
+source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
+messageSends: ["notEmpty", "nonLocalReturns"],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "iVars",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@iVars"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@iVars"]=_st($Dictionary())._new();
+$1=self["@iVars"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"iVars",{},globals.MethodLexicalScope)})},
+args: [],
+source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Dictionary"]
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isMethodScope",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isMethodScope\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "localReturn",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@localReturn"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"localReturn",{},globals.MethodLexicalScope)})},
+args: [],
+source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "localReturn:",
+protocol: 'accessing',
+fn: function (aBoolean){
+var self=this;
+self["@localReturn"]=aBoolean;
+return self},
+args: ["aBoolean"],
+source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodScope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "methodScope\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nonLocalReturns",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@nonLocalReturns"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@nonLocalReturns"]=_st($OrderedCollection())._new();
+$1=self["@nonLocalReturns"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},globals.MethodLexicalScope)})},
+args: [],
+source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pseudoVars",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $PseudoVar(){return globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$receiver;
+$1=self["@pseudoVars"];
+if(($receiver = $1) == null || $receiver.isNil){
+self["@pseudoVars"]=_st($Dictionary())._new();
+self["@pseudoVars"];
+_st(_st($Smalltalk())._pseudoVariableNames())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$2=_st($PseudoVar())._on_(each);
+_st($2)._scope_(self._methodScope());
+$3=_st($2)._yourself();
+return _st(self["@pseudoVars"])._at_put_(each,$3);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+} else {
+$1;
+};
+$4=self["@pseudoVars"];
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.MethodLexicalScope)})},
+args: [],
+source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
+messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"],
+referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"]
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeNonLocalReturn:",
+protocol: 'adding',
+fn: function (aScope){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
+}));
+return self}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)})},
+args: ["aScope"],
+source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
+messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
+referencedClasses: []
+}),
+globals.MethodLexicalScope);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unknownVariables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@unknownVariables"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@unknownVariables"]=_st($OrderedCollection())._new();
+$1=self["@unknownVariables"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},globals.MethodLexicalScope)})},
+args: [],
+source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.MethodLexicalScope);
+
+
+
+smalltalk.addClass('ScopeVar', globals.Object, ['scope', 'name'], 'Compiler-Semantic');
+globals.ScopeVar.comment="I am an entry in a LexicalScope that gets associated with variable nodes of the same name.\x0aThere are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "alias",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._name())._asVariableName();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ScopeVar)})},
+args: [],
+source: "alias\x0a\x09^ self name asVariableName",
+messageSends: ["asVariableName", "name"],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isArgVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isArgVar\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isClassRefVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isClassRefVar\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isImmutable\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInstanceVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isInstanceVar\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isPseudoVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isPseudoVar\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isTempVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isTempVar\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isUnknownVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isUnknownVar\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@name"];
+return $1;
+},
+args: [],
+source: "name\x0a\x09^ name",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@name"]=aString;
+return self},
+args: ["aString"],
+source: "name: aString\x0a\x09name := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@scope"];
+return $1;
+},
+args: [],
+source: "scope\x0a\x09^ scope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scope:",
+protocol: 'accessing',
+fn: function (aScope){
+var self=this;
+self["@scope"]=aScope;
+return self},
+args: ["aScope"],
+source: "scope: aScope\x0a\x09scope := aScope",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ScopeVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "validateAssignment",
+protocol: 'testing',
+fn: function (){
+var self=this;
+function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=_st(self._isArgVar())._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._isPseudoVar();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(smalltalk.assert($1)){
+$2=_st($InvalidAssignmentError())._new();
+_st($2)._variableName_(self._name());
+$3=_st($2)._signal();
+$3;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},globals.ScopeVar)})},
+args: [],
+source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
+messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"],
+referencedClasses: ["InvalidAssignmentError"]
+}),
+globals.ScopeVar);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._name_(aString);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},globals.ScopeVar.klass)})},
+args: ["aString"],
+source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
+messageSends: ["name:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.ScopeVar.klass);
+
+
+smalltalk.addClass('AliasVar', globals.ScopeVar, ['node'], 'Compiler-Semantic');
+globals.AliasVar.comment="I am an internally defined variable by the compiler";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "node",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@node"];
+return $1;
+},
+args: [],
+source: "node\x0a\x09^ node",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AliasVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "node:",
+protocol: 'accessing',
+fn: function (aNode){
+var self=this;
+self["@node"]=aNode;
+return self},
+args: ["aNode"],
+source: "node: aNode\x0a\x09node := aNode",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AliasVar);
+
+
+
+smalltalk.addClass('ArgVar', globals.ScopeVar, [], 'Compiler-Semantic');
+globals.ArgVar.comment="I am an argument of a method or block.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isArgVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isArgVar\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ArgVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isImmutable\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ArgVar);
+
+
+
+smalltalk.addClass('ClassRefVar', globals.ScopeVar, [], 'Compiler-Semantic');
+globals.ClassRefVar.comment="I am an class reference variable";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "alias",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st("$".__comma(self._name())).__comma("()");
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ClassRefVar)})},
+args: [],
+source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$', self name, '()'",
+messageSends: [",", "name"],
+referencedClasses: []
+}),
+globals.ClassRefVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isClassRefVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isClassRefVar\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassRefVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isImmutable\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassRefVar);
+
+
+
+smalltalk.addClass('InstanceVar', globals.ScopeVar, [], 'Compiler-Semantic');
+globals.InstanceVar.comment="I am an instance variable of a method or block.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "alias",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st("self[\x22@".__comma(self._name())).__comma("\x22]");
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"alias",{},globals.InstanceVar)})},
+args: [],
+source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
+messageSends: [",", "name"],
+referencedClasses: []
+}),
+globals.InstanceVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInstanceVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInstanceVar\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.InstanceVar);
+
+
+
+smalltalk.addClass('PseudoVar', globals.ScopeVar, [], 'Compiler-Semantic');
+globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "alias",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._name();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"alias",{},globals.PseudoVar)})},
+args: [],
+source: "alias\x0a\x09^ self name",
+messageSends: ["name"],
+referencedClasses: []
+}),
+globals.PseudoVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isImmutable\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PseudoVar);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isPseudoVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isPseudoVar\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PseudoVar);
+
+
+
+smalltalk.addClass('TempVar', globals.ScopeVar, [], 'Compiler-Semantic');
+globals.TempVar.comment="I am an temporary variable of a method or block.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isTempVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isTempVar\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.TempVar);
+
+
+
+smalltalk.addClass('UnknownVar', globals.ScopeVar, [], 'Compiler-Semantic');
+globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isUnknownVar",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isUnknownVar\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UnknownVar);
+
+
+
+smalltalk.addClass('SemanticAnalyzer', globals.NodeVisitor, ['currentScope', 'blockIndex', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
+globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classReferences",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@classReferences"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@classReferences"]=_st($Set())._new();
+$1=self["@classReferences"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classReferences",{},globals.SemanticAnalyzer)})},
+args: [],
+source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Set"]
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "errorShadowingVariable:",
+protocol: 'error handling',
+fn: function (aString){
+var self=this;
+function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($ShadowingVariableError())._new();
+_st($1)._variableName_(aString);
+$2=_st($1)._signal();
+return self}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},globals.SemanticAnalyzer)})},
+args: ["aString"],
+source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
+messageSends: ["variableName:", "new", "signal"],
+referencedClasses: ["ShadowingVariableError"]
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "errorUnknownVariable:",
+protocol: 'error handling',
+fn: function (aNode){
+var self=this;
+var identifier;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5;
+identifier=_st(aNode)._value();
+$ctx1.sendIdx["value"]=1;
+$1=_st(_st(_st(_st($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._isVariableGloballyUndefined_(identifier);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(smalltalk.assert($1)){
+$2=_st($UnknownVariableError())._new();
+$3=$2;
+$4=_st(aNode)._value();
+$ctx1.sendIdx["value"]=2;
+_st($3)._variableName_($4);
+$5=_st($2)._signal();
+$5;
+} else {
+_st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},globals.SemanticAnalyzer)})},
+args: ["aNode"],
+source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `jQuery`, `window`, `document`,  `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableGloballyUndefined: identifier ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
+messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"],
+referencedClasses: ["Smalltalk", "UnknownVariableError"]
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isVariableGloballyUndefined:",
+protocol: 'testing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return eval('typeof ' + aString + ' == "undefined"');
+return self}, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},globals.SemanticAnalyzer)})},
+args: ["aString"],
+source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageSends",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@messageSends"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@messageSends"]=_st($Dictionary())._new();
+$1=self["@messageSends"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.SemanticAnalyzer)})},
+args: [],
+source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Dictionary"]
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newBlockScope",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $LexicalScope(){return globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._newScopeOfClass_($LexicalScope());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},globals.SemanticAnalyzer)})},
+args: [],
+source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
+messageSends: ["newScopeOfClass:"],
+referencedClasses: ["LexicalScope"]
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newMethodScope",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._newScopeOfClass_($MethodLexicalScope());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},globals.SemanticAnalyzer)})},
+args: [],
+source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
+messageSends: ["newScopeOfClass:"],
+referencedClasses: ["MethodLexicalScope"]
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newScopeOfClass:",
+protocol: 'factory',
+fn: function (aLexicalScopeClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st(aLexicalScopeClass)._new();
+_st($2)._outerScope_(self["@currentScope"]);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},globals.SemanticAnalyzer)})},
+args: ["aLexicalScopeClass"],
+source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
+messageSends: ["outerScope:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextBlockIndex",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=self["@blockIndex"];
+if(($receiver = $1) == null || $receiver.isNil){
+self["@blockIndex"]=(0);
+self["@blockIndex"];
+} else {
+$1;
+};
+self["@blockIndex"]=_st(self["@blockIndex"]).__plus((1));
+$2=self["@blockIndex"];
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},globals.SemanticAnalyzer)})},
+args: [],
+source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
+messageSends: ["ifNil:", "+"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "popScope",
+protocol: 'scope',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self["@currentScope"];
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+self["@currentScope"]=_st(self["@currentScope"])._outerScope();
+self["@currentScope"];
+};
+return self}, function($ctx1) {$ctx1.fill(self,"popScope",{},globals.SemanticAnalyzer)})},
+args: [],
+source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
+messageSends: ["ifNotNil:", "outerScope"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pushScope:",
+protocol: 'scope',
+fn: function (aScope){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aScope)._outerScope_(self["@currentScope"]);
+self["@currentScope"]=aScope;
+return self}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},globals.SemanticAnalyzer)})},
+args: ["aScope"],
+source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
+messageSends: ["outerScope:"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superSends",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@superSends"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@superSends"]=_st($Dictionary())._new();
+$1=self["@superSends"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"superSends",{},globals.SemanticAnalyzer)})},
+args: [],
+source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Dictionary"]
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@theClass"];
+return $1;
+},
+args: [],
+source: "theClass\x0a\x09^ theClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@theClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "validateVariableScope:",
+protocol: 'scope',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(self["@currentScope"])._lookupVariable_(aString);
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+self._errorShadowingVariable_(aString);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},globals.SemanticAnalyzer)})},
+args: ["aString"],
+source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]",
+messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitAssignmentNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+_st(_st(aNode)._left())._beAssigned();
+return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
+args: ["aNode"],
+source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
+messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitBlockNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._pushScope_(self._newBlockScope());
+_st(aNode)._scope_(self["@currentScope"]);
+_st(self["@currentScope"])._node_(aNode);
+_st(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
+_st(_st(aNode)._parameters())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+self._validateVariableScope_(each);
+return _st(self["@currentScope"])._addArg_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+self._popScope();
+return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
+args: ["aNode"],
+source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
+messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitCascadeNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+$3=_st(aNode)._nodes();
+$ctx1.sendIdx["nodes"]=1;
+$2=_st($3)._first();
+$1=_st($2)._superSend();
+if(smalltalk.assert($1)){
+_st(_st(aNode)._nodes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._superSend_(true);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+};
+return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
+args: ["aNode"],
+source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
+messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitMethodNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._pushScope_(self._newMethodScope());
+_st(aNode)._scope_(self["@currentScope"]);
+_st(self["@currentScope"])._node_(aNode);
+_st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@currentScope"])._addIVar_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["do:"]=1;
+_st(_st(aNode)._arguments())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+self._validateVariableScope_(each);
+return _st(self["@currentScope"])._addArg_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+_st(aNode)._classReferences_(self._classReferences());
+_st(aNode)._sendIndexes_(self._messageSends());
+$1=_st(aNode)._superSends_(_st(self._superSends())._keys());
+self._popScope();
+return self}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
+args: ["aNode"],
+source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
+messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitReturnNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aNode)._scope_(self["@currentScope"]);
+$1=_st(self["@currentScope"])._isMethodScope();
+if(smalltalk.assert($1)){
+_st(self["@currentScope"])._localReturn_(true);
+} else {
+_st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
+};
+($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
+args: ["aNode"],
+source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
+messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSendNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
+function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
+$3=_st(aNode)._receiver();
+$ctx1.sendIdx["receiver"]=1;
+$2=_st($3)._value();
+$1=_st($2).__eq("super");
+if(smalltalk.assert($1)){
+_st(aNode)._superSend_(true);
+$4=_st(aNode)._receiver();
+$ctx1.sendIdx["receiver"]=2;
+_st($4)._value_("self");
+$5=self._superSends();
+$ctx1.sendIdx["superSends"]=1;
+$6=_st(aNode)._selector();
+$ctx1.sendIdx["selector"]=1;
+_st($5)._at_ifAbsentPut_($6,(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st($Set())._new();
+$ctx2.sendIdx["new"]=1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$ctx1.sendIdx["at:ifAbsentPut:"]=1;
+$8=self._superSends();
+$9=_st(aNode)._selector();
+$ctx1.sendIdx["selector"]=2;
+$7=_st($8)._at_($9);
+$ctx1.sendIdx["at:"]=1;
+_st($7)._add_(aNode);
+$ctx1.sendIdx["add:"]=1;
+} else {
+$11=_st($IRSendInliner())._inlinedSelectors();
+$12=_st(aNode)._selector();
+$ctx1.sendIdx["selector"]=3;
+$10=_st($11)._includes_($12);
+if(smalltalk.assert($10)){
+_st(aNode)._shouldBeInlined_(true);
+$13=_st(aNode)._receiver();
+if(($receiver = $13) == null || $receiver.isNil){
+$13;
+} else {
+var receiver;
+receiver=$receiver;
+_st(receiver)._shouldBeAliased_(true);
+};
+};
+};
+$14=self._messageSends();
+$ctx1.sendIdx["messageSends"]=1;
+$15=_st(aNode)._selector();
+$ctx1.sendIdx["selector"]=4;
+_st($14)._at_ifAbsentPut_($15,(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st($Set())._new();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
+$17=self._messageSends();
+$ctx1.sendIdx["messageSends"]=2;
+$18=_st(aNode)._selector();
+$ctx1.sendIdx["selector"]=5;
+$16=_st($17)._at_($18);
+$ctx1.sendIdx["at:"]=2;
+_st($16)._add_(aNode);
+_st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
+($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
+args: ["aNode"],
+source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
+messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"],
+referencedClasses: ["Set", "IRSendInliner"]
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(aNode)._temps())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+self._validateVariableScope_(each);
+return _st(self["@currentScope"])._addTemp_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
+args: ["aNode"],
+source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
+messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "visitVariableNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+var binding;
+function $ClassRefVar(){return globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
+function $UnknownVar(){return globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
+binding=_st(self["@currentScope"])._lookupVariable_(aNode);
+$1=binding;
+if(($receiver = $1) == null || $receiver.isNil){
+$3=_st(aNode)._value();
+$ctx1.sendIdx["value"]=1;
+$2=_st($3)._isCapitalized();
+if(smalltalk.assert($2)){
+$4=_st($ClassRefVar())._new();
+$ctx1.sendIdx["new"]=1;
+$5=$4;
+$6=_st(aNode)._value();
+$ctx1.sendIdx["value"]=2;
+_st($5)._name_($6);
+$ctx1.sendIdx["name:"]=1;
+$7=_st($4)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+binding=$7;
+binding;
+$8=self._classReferences();
+$9=_st(aNode)._value();
+$ctx1.sendIdx["value"]=3;
+_st($8)._add_($9);
+} else {
+self._errorUnknownVariable_(aNode);
+$10=_st($UnknownVar())._new();
+_st($10)._name_(_st(aNode)._value());
+$11=_st($10)._yourself();
+binding=$11;
+binding;
+};
+} else {
+$1;
+};
+_st(aNode)._binding_(binding);
+return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},globals.SemanticAnalyzer)})},
+args: ["aNode"],
+source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.",
+messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"],
+referencedClasses: ["ClassRefVar", "UnknownVar"]
+}),
+globals.SemanticAnalyzer);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._theClass_(aClass);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},globals.SemanticAnalyzer.klass)})},
+args: ["aClass"],
+source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
+messageSends: ["theClass:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.SemanticAnalyzer.klass);
+
+});

+ 625 - 0
src/Compiler-Semantic.st

@@ -0,0 +1,625 @@
+Smalltalk createPackage: 'Compiler-Semantic'!
+Object subclass: #LexicalScope
+	instanceVariableNames: 'node instruction temps args outerScope blockIndex'
+	package: 'Compiler-Semantic'!
+!LexicalScope commentStamp!
+I represent a lexical scope where variable names are associated with ScopeVars
+Instances are used for block scopes. Method scopes are instances of MethodLexicalScope.
+
+I am attached to a ScopeVar and method/block nodes.
+Each context (method/closure) get a fresh scope that inherits from its outer scope.!
+
+!LexicalScope methodsFor: 'accessing'!
+
+alias
+	^ '$ctx', self scopeLevel asString
+!
+
+allVariableNames
+	^ self args keys, self temps keys
+!
+
+args
+	^ args ifNil: [ args := Dictionary new ]
+!
+
+bindingFor: aStringOrNode
+	^ self pseudoVars at: aStringOrNode value ifAbsent: [
+		self args at: aStringOrNode value ifAbsent: [
+			self temps at: aStringOrNode value ifAbsent: [ nil ]]]
+!
+
+blockIndex
+	^ blockIndex ifNil: [ 0 ]
+!
+
+blockIndex: anInteger 
+	blockIndex := anInteger
+!
+
+instruction
+	^ instruction
+!
+
+instruction: anIRInstruction
+	instruction := anIRInstruction
+!
+
+lookupVariable: aNode
+	| lookup |
+	lookup := (self bindingFor: aNode).
+	lookup ifNil: [
+		lookup := self outerScope ifNotNil: [
+			(self outerScope lookupVariable: aNode) ]].
+	^ lookup
+!
+
+methodScope
+	^ self outerScope ifNotNil: [
+		self outerScope methodScope ]
+!
+
+node
+	"Answer the node in which I am defined"
+	
+	^ node
+!
+
+node: aNode
+	node := aNode
+!
+
+outerScope
+	^ outerScope
+!
+
+outerScope: aLexicalScope
+	outerScope := aLexicalScope
+!
+
+pseudoVars
+	^ self methodScope pseudoVars
+!
+
+scopeLevel
+	self outerScope ifNil: [ ^ 1 ].
+	self isInlined ifTrue: [ ^ self outerScope scopeLevel ].
+	
+	^ self outerScope scopeLevel + 1
+!
+
+temps
+	^ temps ifNil: [ temps := Dictionary new ]
+! !
+
+!LexicalScope methodsFor: 'adding'!
+
+addArg: aString
+	self args at: aString put: (ArgVar on: aString).
+	(self args at: aString) scope: self
+!
+
+addTemp: aString
+	self temps at: aString put: (TempVar on: aString).
+	(self temps at: aString) scope: self
+! !
+
+!LexicalScope methodsFor: 'testing'!
+
+canInlineNonLocalReturns
+	^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]
+!
+
+isBlockScope
+	^ self isMethodScope not
+!
+
+isInlined
+	^ self instruction notNil and: [
+		self instruction isInlined ]
+!
+
+isMethodScope
+	^ false
+! !
+
+LexicalScope subclass: #MethodLexicalScope
+	instanceVariableNames: 'iVars pseudoVars unknownVariables localReturn nonLocalReturns'
+	package: 'Compiler-Semantic'!
+!MethodLexicalScope commentStamp!
+I represent a method scope.!
+
+!MethodLexicalScope methodsFor: 'accessing'!
+
+allVariableNames
+	^ super allVariableNames, self iVars keys
+!
+
+bindingFor: aNode
+	^ (super bindingFor: aNode) ifNil: [
+		self iVars at: aNode value ifAbsent: [ nil ]]
+!
+
+iVars
+	^ iVars ifNil: [ iVars := Dictionary new ]
+!
+
+localReturn
+	^ localReturn ifNil: [ false ]
+!
+
+localReturn: aBoolean
+	localReturn := aBoolean
+!
+
+methodScope
+	^ self
+!
+
+nonLocalReturns
+	^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]
+!
+
+pseudoVars
+	pseudoVars ifNil: [
+		pseudoVars := Dictionary new.
+		Smalltalk pseudoVariableNames do: [ :each |
+			pseudoVars at: each put: ((PseudoVar on: each)
+				scope: self methodScope;
+				yourself) ]].
+	^ pseudoVars
+!
+
+unknownVariables
+	^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]
+! !
+
+!MethodLexicalScope methodsFor: 'adding'!
+
+addIVar: aString
+	self iVars at: aString put: (InstanceVar on: aString).
+	(self iVars at: aString) scope: self
+!
+
+addNonLocalReturn: aScope
+	self nonLocalReturns add: aScope
+!
+
+removeNonLocalReturn: aScope
+	self nonLocalReturns remove: aScope ifAbsent: []
+! !
+
+!MethodLexicalScope methodsFor: 'testing'!
+
+canInlineNonLocalReturns
+	^ true
+!
+
+hasLocalReturn
+	^ self localReturn
+!
+
+hasNonLocalReturn
+	^ self nonLocalReturns notEmpty
+!
+
+isMethodScope
+	^ true
+! !
+
+Object subclass: #ScopeVar
+	instanceVariableNames: 'scope name'
+	package: 'Compiler-Semantic'!
+!ScopeVar commentStamp!
+I am an entry in a LexicalScope that gets associated with variable nodes of the same name.
+There are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars.!
+
+!ScopeVar methodsFor: 'accessing'!
+
+alias
+	^ self name asVariableName
+!
+
+name
+	^ name
+!
+
+name: aString
+	name := aString
+!
+
+scope
+	^ scope
+!
+
+scope: aScope
+	scope := aScope
+! !
+
+!ScopeVar methodsFor: 'testing'!
+
+isArgVar
+	^ false
+!
+
+isClassRefVar
+	^ false
+!
+
+isImmutable
+	^ false
+!
+
+isInstanceVar
+	^ false
+!
+
+isPseudoVar
+	^ false
+!
+
+isTempVar
+	^ false
+!
+
+isUnknownVar
+	^ false
+!
+
+validateAssignment
+	(self isArgVar or: [ self isPseudoVar ]) ifTrue: [
+		InvalidAssignmentError new
+			variableName: self name;
+			signal]
+! !
+
+!ScopeVar class methodsFor: 'instance creation'!
+
+on: aString
+	^ self new
+		name: aString;
+		yourself
+! !
+
+ScopeVar subclass: #AliasVar
+	instanceVariableNames: 'node'
+	package: 'Compiler-Semantic'!
+!AliasVar commentStamp!
+I am an internally defined variable by the compiler!
+
+!AliasVar methodsFor: 'accessing'!
+
+node
+	^ node
+!
+
+node: aNode
+	node := aNode
+! !
+
+ScopeVar subclass: #ArgVar
+	instanceVariableNames: ''
+	package: 'Compiler-Semantic'!
+!ArgVar commentStamp!
+I am an argument of a method or block.!
+
+!ArgVar methodsFor: 'testing'!
+
+isArgVar
+	^ true
+!
+
+isImmutable
+	^ true
+! !
+
+ScopeVar subclass: #ClassRefVar
+	instanceVariableNames: ''
+	package: 'Compiler-Semantic'!
+!ClassRefVar commentStamp!
+I am an class reference variable!
+
+!ClassRefVar methodsFor: 'accessing'!
+
+alias
+	"Fixes issue #190.
+	A function is created in the method definition, answering the class or nil.
+	See JSStream >> #nextPutClassRefFunction:"
+	
+	^ '$', self name, '()'
+! !
+
+!ClassRefVar methodsFor: 'testing'!
+
+isClassRefVar
+	^ true
+!
+
+isImmutable
+	^ true
+! !
+
+ScopeVar subclass: #InstanceVar
+	instanceVariableNames: ''
+	package: 'Compiler-Semantic'!
+!InstanceVar commentStamp!
+I am an instance variable of a method or block.!
+
+!InstanceVar methodsFor: 'testing'!
+
+alias
+	^ 'self["@', self name, '"]'
+!
+
+isInstanceVar
+	^ true
+! !
+
+ScopeVar subclass: #PseudoVar
+	instanceVariableNames: ''
+	package: 'Compiler-Semantic'!
+!PseudoVar commentStamp!
+I am an pseudo variable.
+
+The five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'!
+
+!PseudoVar methodsFor: 'accessing'!
+
+alias
+	^ self name
+! !
+
+!PseudoVar methodsFor: 'testing'!
+
+isImmutable
+	^ true
+!
+
+isPseudoVar
+	^ true
+! !
+
+ScopeVar subclass: #TempVar
+	instanceVariableNames: ''
+	package: 'Compiler-Semantic'!
+!TempVar commentStamp!
+I am an temporary variable of a method or block.!
+
+!TempVar methodsFor: 'testing'!
+
+isTempVar
+	^ true
+! !
+
+ScopeVar subclass: #UnknownVar
+	instanceVariableNames: ''
+	package: 'Compiler-Semantic'!
+!UnknownVar commentStamp!
+I am an unknown variable. Amber uses unknown variables as JavaScript globals!
+
+!UnknownVar methodsFor: 'testing'!
+
+isUnknownVar
+	^ true
+! !
+
+NodeVisitor subclass: #SemanticAnalyzer
+	instanceVariableNames: 'currentScope blockIndex theClass classReferences messageSends superSends'
+	package: 'Compiler-Semantic'!
+!SemanticAnalyzer commentStamp!
+I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.!
+
+!SemanticAnalyzer methodsFor: 'accessing'!
+
+classReferences
+	^ classReferences ifNil: [ classReferences := Set new ]
+!
+
+messageSends
+	^ messageSends ifNil: [ messageSends := Dictionary new ]
+!
+
+superSends
+	^ superSends ifNil: [ superSends := Dictionary new ]
+!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
+! !
+
+!SemanticAnalyzer methodsFor: 'error handling'!
+
+errorShadowingVariable: aString
+	ShadowingVariableError new
+		variableName: aString;
+		signal
+!
+
+errorUnknownVariable: aNode
+	"Throw an error if the variable is undeclared in the global JS scope (i.e. window).
+	We allow all variables listed by Smalltalk>>#globalJsVariables.
+	This list includes: `jQuery`, `window`, `document`,  `process` and `global`
+	for nodejs and browser environments.
+	
+	This is only to make sure compilation works on both browser-based and nodejs environments.
+	The ideal solution would be to use a pragma instead"
+
+	| identifier |
+	identifier := aNode value.
+	
+	((Smalltalk globalJsVariables includes: identifier) not
+		and: [ self isVariableGloballyUndefined: identifier ])
+			ifTrue: [
+				UnknownVariableError new
+					variableName: aNode value;
+					signal ]
+			ifFalse: [
+				currentScope methodScope unknownVariables add: aNode value ]
+! !
+
+!SemanticAnalyzer methodsFor: 'factory'!
+
+newBlockScope
+	^ self newScopeOfClass: LexicalScope
+!
+
+newMethodScope
+	^ self newScopeOfClass: MethodLexicalScope
+!
+
+newScopeOfClass: aLexicalScopeClass
+	^ aLexicalScopeClass new
+		outerScope: currentScope;
+		yourself
+! !
+
+!SemanticAnalyzer methodsFor: 'private'!
+
+nextBlockIndex
+	blockIndex ifNil: [ blockIndex := 0 ].
+	
+	blockIndex := blockIndex + 1.
+	^ blockIndex
+! !
+
+!SemanticAnalyzer methodsFor: 'scope'!
+
+popScope
+	currentScope ifNotNil: [
+		currentScope := currentScope outerScope ]
+!
+
+pushScope: aScope
+	aScope outerScope: currentScope.
+	currentScope := aScope
+!
+
+validateVariableScope: aString
+	"Validate the variable scope in by doing a recursive lookup, up to the method scope"
+
+	(currentScope lookupVariable: aString) ifNotNil: [
+		self errorShadowingVariable: aString ]
+! !
+
+!SemanticAnalyzer methodsFor: 'testing'!
+
+isVariableGloballyUndefined: aString
+	<return eval('typeof ' + aString + ' == "undefined"')>
+! !
+
+!SemanticAnalyzer methodsFor: 'visiting'!
+
+visitAssignmentNode: aNode
+	super visitAssignmentNode: aNode.
+	aNode left beAssigned
+!
+
+visitBlockNode: aNode
+	self pushScope: self newBlockScope.
+	aNode scope: currentScope.
+	currentScope node: aNode.
+	currentScope blockIndex: self nextBlockIndex.
+
+	aNode parameters do: [ :each |
+		self validateVariableScope: each.
+		currentScope addArg: each ].
+
+	super visitBlockNode: aNode.
+	self popScope
+!
+
+visitCascadeNode: aNode
+	super visitCascadeNode: aNode.
+	aNode nodes first superSend ifTrue: [
+		aNode nodes do: [ :each | each superSend: true ] ]
+!
+
+visitMethodNode: aNode
+	self pushScope: self newMethodScope.
+	aNode scope: currentScope.
+	currentScope node: aNode.
+
+	self theClass allInstanceVariableNames do: [ :each |
+		currentScope addIVar: each ].
+	aNode arguments do: [ :each |
+		self validateVariableScope: each.
+		currentScope addArg: each ].
+
+	super visitMethodNode: aNode.
+
+	aNode
+		classReferences: self classReferences;
+		sendIndexes: self messageSends;
+		superSends: self superSends keys.
+	self popScope
+!
+
+visitReturnNode: aNode
+	aNode scope: currentScope.
+	currentScope isMethodScope
+		ifTrue: [ currentScope localReturn: true ]
+		ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].
+	super visitReturnNode: aNode
+!
+
+visitSendNode: aNode
+
+	aNode receiver value = 'super'
+		ifTrue: [
+			aNode superSend: true.
+			aNode receiver value: 'self'.
+			self superSends at: aNode selector ifAbsentPut: [ Set new ].
+			(self superSends at: aNode selector) add: aNode ]
+		
+		ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [
+			aNode shouldBeInlined: true.
+			aNode receiver ifNotNil: [ :receiver |
+				receiver shouldBeAliased: true ] ] ].
+
+	self messageSends at: aNode selector ifAbsentPut: [ Set new ].
+	(self messageSends at: aNode selector) add: aNode.
+
+	aNode index: (self messageSends at: aNode selector) size.
+
+	super visitSendNode: aNode
+!
+
+visitSequenceNode: aNode
+	aNode temps do: [ :each |
+		self validateVariableScope: each.
+		currentScope addTemp: each ].
+
+	super visitSequenceNode: aNode
+!
+
+visitVariableNode: aNode
+	"Bind a ScopeVar to aNode by doing a lookup in the current scope.
+	If no ScopeVar is found, bind a UnknowVar and throw an error."
+
+	| binding |
+	binding := currentScope lookupVariable: aNode.
+	
+	binding ifNil: [
+		aNode value isCapitalized
+			ifTrue: [ "Capital letter variables might be globals."
+				binding := ClassRefVar new name: aNode value; yourself.
+				self classReferences add: aNode value]
+			ifFalse: [
+				self errorUnknownVariable: aNode.
+				binding := UnknownVar new name: aNode value; yourself ] ].
+		
+	aNode binding: binding.
+! !
+
+!SemanticAnalyzer class methodsFor: 'instance creation'!
+
+on: aClass
+	^ self new
+		theClass: aClass;
+		yourself
+! !
+

+ 2003 - 0
src/Compiler-Tests.js

@@ -0,0 +1,2003 @@
+define("amber_core/Compiler-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/SUnit"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Compiler-Tests');
+smalltalk.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('ASTParsingTest', globals.TestCase, [], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "analyze:forClass:",
+protocol: 'convenience',
+fn: function (aNode,aClass){
+var self=this;
+function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
+return aNode;
+}, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.ASTParsingTest)})},
+args: ["aNode", "aClass"],
+source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
+messageSends: ["visit:", "on:"],
+referencedClasses: ["SemanticAnalyzer"]
+}),
+globals.ASTParsingTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parse:",
+protocol: 'parsing',
+fn: function (aString){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._parse_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.ASTParsingTest)})},
+args: ["aString"],
+source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
+messageSends: ["parse:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.ASTParsingTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parse:forClass:",
+protocol: 'parsing',
+fn: function (aString,aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._analyze_forClass_(self._parse_(aString),aClass);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.ASTParsingTest)})},
+args: ["aString", "aClass"],
+source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
+messageSends: ["analyze:forClass:", "parse:"],
+referencedClasses: []
+}),
+globals.ASTParsingTest);
+
+
+
+smalltalk.addClass('ASTPCNodeVisitorTest', globals.ASTParsingTest, [], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "astPCNodeVisitor",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
+function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$5,$1;
+$2=_st($ASTPCNodeVisitor())._new();
+$ctx1.sendIdx["new"]=1;
+$3=$2;
+$4=_st(_st($AIContext())._new())._yourself();
+$ctx1.sendIdx["yourself"]=1;
+_st($3)._context_($4);
+$5=_st($2)._yourself();
+$1=$5;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},globals.ASTPCNodeVisitorTest)})},
+args: [],
+source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
+messageSends: ["context:", "new", "yourself"],
+referencedClasses: ["ASTPCNodeVisitor", "AIContext"]
+}),
+globals.ASTPCNodeVisitorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "astPCNodeVisitorForSelector:",
+protocol: 'factory',
+fn: function (aString){
+var self=this;
+function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
+function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$5,$1;
+$2=_st($ASTPCNodeVisitor())._new();
+$ctx1.sendIdx["new"]=1;
+_st($2)._selector_(aString);
+$3=$2;
+$4=_st(_st($AIContext())._new())._yourself();
+$ctx1.sendIdx["yourself"]=1;
+_st($3)._context_($4);
+$5=_st($2)._yourself();
+$1=$5;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},globals.ASTPCNodeVisitorTest)})},
+args: ["aString"],
+source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
+messageSends: ["selector:", "new", "context:", "yourself"],
+referencedClasses: ["ASTPCNodeVisitor", "AIContext"]
+}),
+globals.ASTPCNodeVisitorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testJSStatementNode",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var ast,visitor;
+function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
+$1=self._astPCNodeVisitor();
+_st($1)._visit_(ast);
+$2=_st($1)._currentNode();
+self._assert_(_st($2)._isJSStatementNode());
+return self}, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)})},
+args: [],
+source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
+messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"],
+referencedClasses: ["Object"]
+}),
+globals.ASTPCNodeVisitorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testMessageSend",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var ast;
+function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
+$1=self._astPCNodeVisitorForSelector_("yourself");
+_st($1)._visit_(ast);
+$2=_st($1)._currentNode();
+self._assert_equals_(_st($2)._selector(),"yourself");
+return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)})},
+args: [],
+source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
+messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"],
+referencedClasses: ["Object"]
+}),
+globals.ASTPCNodeVisitorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testMessageSendWithBlocks",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var ast;
+function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value.  ]. ^ self asBoolean",$Object());
+$1=self._astPCNodeVisitorForSelector_("yourself");
+_st($1)._visit_(ast);
+$2=_st($1)._currentNode();
+self._assert_equals_(_st($2)._selector(),"yourself");
+return self}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},globals.ASTPCNodeVisitorTest)})},
+args: [],
+source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value.  ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
+messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"],
+referencedClasses: ["Object"]
+}),
+globals.ASTPCNodeVisitorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testMessageSendWithInlining",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var ast;
+function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$4,$2,$1,$5,$6;
+ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
+$ctx1.sendIdx["parse:forClass:"]=1;
+$3=self._astPCNodeVisitorForSelector_("yourself");
+$ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
+_st($3)._visit_(ast);
+$ctx1.sendIdx["visit:"]=1;
+$4=_st($3)._currentNode();
+$ctx1.sendIdx["currentNode"]=1;
+$2=$4;
+$1=_st($2)._selector();
+$ctx1.sendIdx["selector"]=1;
+self._assert_equals_($1,"yourself");
+$ctx1.sendIdx["assert:equals:"]=1;
+ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
+$5=self._astPCNodeVisitorForSelector_("asBoolean");
+_st($5)._visit_(ast);
+$6=_st($5)._currentNode();
+self._assert_equals_(_st($6)._selector(),"asBoolean");
+return self}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},globals.ASTPCNodeVisitorTest)})},
+args: [],
+source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
+messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"],
+referencedClasses: ["Object"]
+}),
+globals.ASTPCNodeVisitorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testNoMessageSend",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var ast;
+function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+ast=self._parse_forClass_("foo ^ self",$Object());
+$1=self._astPCNodeVisitor();
+_st($1)._visit_(ast);
+$2=_st($1)._currentNode();
+self._assert_(_st($2)._isNil());
+return self}, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)})},
+args: [],
+source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil",
+messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"],
+referencedClasses: ["Object"]
+}),
+globals.ASTPCNodeVisitorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testPC",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var ast,visitor;
+function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+ast=self._parse_forClass_("foo <console.log(1)>",$Object());
+$1=self._astPCNodeVisitor();
+_st($1)._visit_(ast);
+$2=_st($1)._currentNode();
+self._assert_(_st($2)._isJSStatementNode());
+return self}, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)})},
+args: [],
+source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <console.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
+messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"],
+referencedClasses: ["Object"]
+}),
+globals.ASTPCNodeVisitorTest);
+
+
+
+smalltalk.addClass('ASTPositionTest', globals.ASTParsingTest, [], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testNodeAtPosition",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var node;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$4,$2,$1,$7,$8,$6,$5;
+node=self._parse_("yourself\x0a\x09^ self");
+$ctx1.sendIdx["parse:"]=1;
+$3=node;
+$4=(2).__at((4));
+$ctx1.sendIdx["@"]=1;
+$2=_st($3)._navigationNodeAt_ifAbsent_($4,(function(){
+return nil;
+}));
+$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
+$1=_st($2)._source();
+self._assert_equals_($1,"self");
+$ctx1.sendIdx["assert:equals:"]=1;
+node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
+$ctx1.sendIdx["parse:"]=2;
+$7=node;
+$8=(2).__at((7));
+$ctx1.sendIdx["@"]=2;
+$6=_st($7)._navigationNodeAt_ifAbsent_($8,(function(){
+return nil;
+}));
+$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
+$5=_st($6)._selector();
+$ctx1.sendIdx["selector"]=1;
+self._assert_equals_($5,"ifTrue:");
+$ctx1.sendIdx["assert:equals:"]=2;
+node=self._parse_("foo\x0a\x09self foo; bar; baz");
+self._assert_equals_(_st(_st(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
+return nil;
+})))._selector(),"foo");
+return self}, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},globals.ASTPositionTest)})},
+args: [],
+source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
+messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"],
+referencedClasses: []
+}),
+globals.ASTPositionTest);
+
+
+
+smalltalk.addClass('CodeGeneratorTest', globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "codeGeneratorClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
+return $CodeGenerator();
+},
+args: [],
+source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
+messageSends: [],
+referencedClasses: ["CodeGenerator"]
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compiler",
+protocol: 'factory',
+fn: function (){
+var self=this;
+function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($Compiler())._new();
+_st($2)._codeGeneratorClass_(self._codeGeneratorClass());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
+messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
+referencedClasses: ["Compiler"]
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setUp",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
+return smalltalk.withContext(function($ctx1) { 
+self["@receiver"]=_st($DoIt())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "setUp\x0a\x09receiver := DoIt new",
+messageSends: ["new"],
+referencedClasses: ["DoIt"]
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "should:receiver:return:",
+protocol: 'testing',
+fn: function (aString,anObject,aResult){
+var self=this;
+var method,result;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self["@receiver"]=anObject;
+$1=self._compiler();
+$2=_st(anObject)._class();
+$ctx1.sendIdx["class"]=1;
+method=_st($1)._install_forClass_protocol_(aString,$2,"tests");
+result=_st(self["@receiver"])._perform_(_st(method)._selector());
+_st(_st(anObject)._class())._removeCompiledMethod_(method);
+self._assert_equals_(aResult,result);
+return self}, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},globals.CodeGeneratorTest)})},
+args: ["aString", "anObject", "aResult"],
+source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
+messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "should:return:",
+protocol: 'testing',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._should_receiver_return_(aString,self["@receiver"],anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.CodeGeneratorTest)})},
+args: ["aString", "anObject"],
+source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
+messageSends: ["should:receiver:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tearDown",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "tearDown\x0a\x09\x22receiver := nil\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testAssignment",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
+return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testBackslashSelectors",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("\x5c arg ^ 4",(4));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("\x5c\x5c arg ^ 42",(42));
+return self}, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testBlockReturn",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
+return self}, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testCascades",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
+return self}, function($ctx1) {$ctx1.fill(self,"testCascades",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testCascadesWithInlining",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
+return self}, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testDynamicArrayElementsOrdered",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
+return self}, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testDynamicDictionaryElementsOrdered",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
+return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testDynamicDictionaryWithMoreArrows",
+protocol: 'tests',
+fn: function (){
+var self=this;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st((1).__minus_gt((2))).__minus_gt((3));
+$ctx1.sendIdx["->"]=1;
+$1=_st($HashedCollection())._with_($2);
+self._should_return_("foo ^ #{1->2->3}",$1);
+return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
+messageSends: ["should:return:", "with:", "->"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testGlobalVar",
+protocol: 'tests',
+fn: function (){
+var self=this;
+function $BlockClosure(){return globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ eval class",$BlockClosure());
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ Math cos: 0",(1));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ^ NonExistingVar",nil);
+return self}, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil",
+messageSends: ["should:return:"],
+referencedClasses: ["BlockClosure"]
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testInnerTemporalDependentElementsOrdered",
+protocol: 'tests',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
+$2="foo".__minus_gt($Array());
+$ctx1.sendIdx["->"]=1;
+$3="bar".__minus_gt((2));
+$ctx1.sendIdx["->"]=2;
+$1=[$2,$3];
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
+$ctx1.sendIdx["should:return:"]=1;
+$5="foo".__minus_gt($Array());
+$ctx1.sendIdx["->"]=3;
+$6="bar".__minus_gt((2));
+$ctx1.sendIdx["->"]=4;
+$4=[$5,$6];
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
+$ctx1.sendIdx["should:return:"]=2;
+$8="foo".__minus_gt((1));
+$ctx1.sendIdx["->"]=5;
+$9="bar".__minus_gt((2));
+$ctx1.sendIdx["->"]=6;
+$7=[$8,$9];
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
+$ctx1.sendIdx["should:return:"]=3;
+$11="foo".__minus_gt((1));
+$ctx1.sendIdx["->"]=7;
+$10=[$11,"bar".__minus_gt((2))];
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
+$ctx1.sendIdx["should:return:"]=4;
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
+return self}, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
+messageSends: ["should:return:", "->"],
+referencedClasses: ["Array"]
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testJSStatement",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo <return 2+3>",(5));
+return self}, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testLexicalScope",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
+return self}, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testLiterals",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ 1",(1));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ 'hello'","hello");
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
+$ctx1.sendIdx["should:return:"]=4;
+self._should_return_("foo ^ true",true);
+$ctx1.sendIdx["should:return:"]=5;
+self._should_return_("foo ^ false",false);
+$ctx1.sendIdx["should:return:"]=6;
+self._should_return_("foo ^ #{1->2. 3->4}",globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
+$ctx1.sendIdx["should:return:"]=7;
+self._should_return_("foo ^ #hello","hello");
+$ctx1.sendIdx["should:return:"]=8;
+self._should_return_("foo ^ $h","h");
+$ctx1.sendIdx["should:return:"]=9;
+self._should_return_("foo ^ -123.456",(-123.456));
+$ctx1.sendIdx["should:return:"]=10;
+self._should_return_("foo ^ -2.5e4",(-25000));
+return self}, function($ctx1) {$ctx1.fill(self,"testLiterals",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ $h' return: 'h'.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testLocalReturn",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ 1",(1));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ 1 + 1",(2));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ",self["@receiver"]);
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo self asString",self["@receiver"]);
+$ctx1.sendIdx["should:return:"]=4;
+self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
+return self}, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testMessageSends",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ 1 asString","1");
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ 1 + 1",(2));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ^ 1 + 2 * 3",(9));
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
+$ctx1.sendIdx["should:return:"]=4;
+self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
+return self}, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testMultipleSequences",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
+return self}, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testMutableLiterals",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
+return self}, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://github.com/amber-smalltalk/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testNestedIfTrue",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
+return self}, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testNestedSends",
+protocol: 'tests',
+fn: function (){
+var self=this;
+function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",_st(_st($Point())._x_y_((2).__at((3)),(4)))._asString());
+return self}, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
+messageSends: ["should:return:", "asString", "x:y:", "@"],
+referencedClasses: ["Point"]
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testNonLocalReturn",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo [ ^ 1 ] value",(1));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo [ ^ 1 + 1 ] value",(2));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
+return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testPascalCaseGlobal",
+protocol: 'tests',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^Object",_st(_st($Smalltalk())._globals())._at_("Object"));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^NonExistent",nil);
+return self}, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
+messageSends: ["should:return:", "at:", "globals"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testSendReceiverAndArgumentsOrdered",
+protocol: 'tests',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
+return self}, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.",
+messageSends: ["should:return:"],
+referencedClasses: ["Array"]
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testSuperSend",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_receiver_return_("foo ^ super isBoolean",true,false);
+return self}, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
+messageSends: ["should:receiver:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testTempVariables",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo | a | ^ a",nil);
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo | AVariable | ^ AVariable",nil);
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo | a b c | ^ c",nil);
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo | a | [ | d | ^ d ] value",nil);
+$ctx1.sendIdx["should:return:"]=4;
+self._should_return_("foo | a | a:= 1. ^ a",(1));
+$ctx1.sendIdx["should:return:"]=5;
+self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
+return self}, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testThisContext",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
+return self}, function($ctx1) {$ctx1.fill(self,"testThisContext",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testifFalse",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
+return self}, function($ctx1) {$ctx1.fill(self,"testifFalse",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testifFalseIfTrue",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
+return self}, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testifNil",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
+return self}, function($ctx1) {$ctx1.fill(self,"testifNil",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testifNilIfNotNil",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
+return self}, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testifNotNil",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
+return self}, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testifNotNilWithArgument",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
+$ctx1.sendIdx["should:return:"]=4;
+self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
+$ctx1.sendIdx["should:return:"]=5;
+self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
+return self}, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testifTrue",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
+return self}, function($ctx1) {$ctx1.fill(self,"testifTrue",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testifTrueIfFalse",
+protocol: 'tests',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
+$ctx1.sendIdx["should:return:"]=1;
+self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
+$ctx1.sendIdx["should:return:"]=2;
+self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
+$ctx1.sendIdx["should:return:"]=3;
+self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
+return self}, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
+messageSends: ["should:return:"],
+referencedClasses: []
+}),
+globals.CodeGeneratorTest);
+
+
+
+smalltalk.addClass('ASTInterpreterTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "analyze:forClass:",
+protocol: 'parsing',
+fn: function (aNode,aClass){
+var self=this;
+function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
+return aNode;
+}, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.ASTInterpreterTest)})},
+args: ["aNode", "aClass"],
+source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
+messageSends: ["visit:", "on:"],
+referencedClasses: ["SemanticAnalyzer"]
+}),
+globals.ASTInterpreterTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "interpret:receiver:withArguments:",
+protocol: 'private',
+fn: function (aString,anObject,aDictionary){
+var self=this;
+var ctx,ast,interpreter;
+function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
+function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$5,$6,$4,$receiver;
+interpreter=_st($ASTInterpreter())._new();
+$ctx1.sendIdx["new"]=1;
+ast=self._parse_forClass_(aString,_st(anObject)._class());
+$1=_st($AIContext())._new();
+_st($1)._receiver_(anObject);
+_st($1)._interpreter_(interpreter);
+$2=_st($1)._yourself();
+ctx=$2;
+$3=_st(ast)._sequenceNode();
+if(($receiver = $3) == null || $receiver.isNil){
+$3;
+} else {
+var sequence;
+sequence=$receiver;
+_st(_st(sequence)._temps())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(ctx)._defineLocal_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+};
+_st(aDictionary)._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+return _st(ctx)._localAt_put_(key,value);
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
+$5=interpreter;
+_st($5)._context_(ctx);
+_st($5)._interpret_(_st(ast)._nextChild());
+_st($5)._proceed();
+$6=_st($5)._result();
+$4=$6;
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},globals.ASTInterpreterTest)})},
+args: ["aString", "anObject", "aDictionary"],
+source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09interpret: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
+messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"],
+referencedClasses: ["ASTInterpreter", "AIContext"]
+}),
+globals.ASTInterpreterTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parse:",
+protocol: 'parsing',
+fn: function (aString){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._parse_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.ASTInterpreterTest)})},
+args: ["aString"],
+source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
+messageSends: ["parse:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.ASTInterpreterTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parse:forClass:",
+protocol: 'parsing',
+fn: function (aString,aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._analyze_forClass_(self._parse_(aString),aClass);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.ASTInterpreterTest)})},
+args: ["aString", "aClass"],
+source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
+messageSends: ["analyze:forClass:", "parse:"],
+referencedClasses: []
+}),
+globals.ASTInterpreterTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "should:receiver:return:",
+protocol: 'testing',
+fn: function (aString,anObject,aResult){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self["@receiver"]=anObject;
+$1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],globals.HashedCollection._newFromPairs_([])),aResult);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},globals.ASTInterpreterTest)})},
+args: ["aString", "anObject", "aResult"],
+source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult",
+messageSends: ["assert:equals:", "interpret:receiver:withArguments:"],
+referencedClasses: []
+}),
+globals.ASTInterpreterTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "should:return:",
+protocol: 'testing',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._should_receiver_return_(aString,self["@receiver"],anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.ASTInterpreterTest)})},
+args: ["aString", "anObject"],
+source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
+messageSends: ["should:receiver:return:"],
+referencedClasses: []
+}),
+globals.ASTInterpreterTest);
+
+
+
+smalltalk.addClass('ASTDebuggerTest', globals.ASTInterpreterTest, [], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "interpret:receiver:withArguments:",
+protocol: 'private',
+fn: function (aString,anObject,aDictionary){
+var self=this;
+var ctx,ast,debugger_;
+function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
+function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
+function $ASTDebugger(){return globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$6,$7,$5,$receiver;
+$1=_st($AIContext())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._receiver_(anObject);
+_st($1)._interpreter_(_st($ASTInterpreter())._new());
+$2=_st($1)._yourself();
+ctx=$2;
+ast=self._parse_forClass_(aString,_st(anObject)._class());
+$3=_st(ast)._sequenceNode();
+if(($receiver = $3) == null || $receiver.isNil){
+$3;
+} else {
+var sequence;
+sequence=$receiver;
+_st(_st(sequence)._temps())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(ctx)._defineLocal_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+};
+_st(aDictionary)._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+return _st(ctx)._localAt_put_(key,value);
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
+$4=_st(ctx)._interpreter();
+$ctx1.sendIdx["interpreter"]=1;
+_st($4)._context_(ctx);
+$ctx1.sendIdx["context:"]=1;
+_st(_st(ctx)._interpreter())._node_(_st(ast)._nextChild());
+debugger_=_st($ASTDebugger())._context_(ctx);
+$6=debugger_;
+_st($6)._proceed();
+$7=_st($6)._result();
+$5=$7;
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},globals.ASTDebuggerTest)})},
+args: ["aString", "anObject", "aDictionary"],
+source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast nextChild.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
+messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"],
+referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"]
+}),
+globals.ASTDebuggerTest);
+
+
+
+smalltalk.addClass('InliningCodeGeneratorTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "codeGeneratorClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
+return $InliningCodeGenerator();
+},
+args: [],
+source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
+messageSends: [],
+referencedClasses: ["InliningCodeGenerator"]
+}),
+globals.InliningCodeGeneratorTest);
+
+
+
+smalltalk.addClass('ScopeVarTest', globals.TestCase, [], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testClassRefVar",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var node;
+function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
+function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
+function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+$1=_st($VariableNode())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._value_("Object");
+$2=_st($1)._yourself();
+node=$2;
+$3=_st($SemanticAnalyzer())._new();
+$ctx1.sendIdx["new"]=2;
+_st($3)._pushScope_(_st($MethodLexicalScope())._new());
+$4=_st($3)._visit_(node);
+self._assert_(_st(_st(node)._binding())._isClassRefVar());
+return self}, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},globals.ScopeVarTest)})},
+args: [],
+source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar",
+messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"],
+referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"]
+}),
+globals.ScopeVarTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testInstanceVar",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var node,scope;
+function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
+function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($VariableNode())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._value_("bzzz");
+$2=_st($1)._yourself();
+node=$2;
+scope=_st($MethodLexicalScope())._new();
+_st(scope)._addIVar_("bzzz");
+self._assert_(_st(_st(scope)._bindingFor_(node))._isInstanceVar());
+return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},globals.ScopeVarTest)})},
+args: [],
+source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
+messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"],
+referencedClasses: ["VariableNode", "MethodLexicalScope"]
+}),
+globals.ScopeVarTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testPseudoVar",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var node,pseudoVars;
+function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
+function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+pseudoVars=["self", "super", "true", "false", "nil"];
+_st(pseudoVars)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st($VariableNode())._new();
+$ctx2.sendIdx["new"]=1;
+_st($1)._value_(each);
+$2=_st($1)._yourself();
+node=$2;
+node;
+return self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},globals.ScopeVarTest)})},
+args: [],
+source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar ]",
+messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"],
+referencedClasses: ["VariableNode", "MethodLexicalScope"]
+}),
+globals.ScopeVarTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testTempVar",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var node,scope;
+function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
+function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($VariableNode())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._value_("bzzz");
+$2=_st($1)._yourself();
+node=$2;
+scope=_st($MethodLexicalScope())._new();
+_st(scope)._addTemp_("bzzz");
+self._assert_(_st(_st(scope)._bindingFor_(node))._isTempVar());
+return self}, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},globals.ScopeVarTest)})},
+args: [],
+source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
+messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"],
+referencedClasses: ["VariableNode", "MethodLexicalScope"]
+}),
+globals.ScopeVarTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testUnknownVar",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var node;
+function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
+function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($VariableNode())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._value_("bzzz");
+$2=_st($1)._yourself();
+node=$2;
+self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
+return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},globals.ScopeVarTest)})},
+args: [],
+source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
+messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"],
+referencedClasses: ["VariableNode", "MethodLexicalScope"]
+}),
+globals.ScopeVarTest);
+
+
+
+smalltalk.addClass('SemanticAnalyzerTest', globals.TestCase, ['analyzer'], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setUp",
+protocol: 'running',
+fn: function (){
+var self=this;
+function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
+function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+self["@analyzer"]=_st($SemanticAnalyzer())._on_($Object());
+return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
+messageSends: ["on:"],
+referencedClasses: ["SemanticAnalyzer", "Object"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testAssignment",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo self := 1";
+ast=_st($Smalltalk())._parse_(src);
+self._should_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@analyzer"])._visit_(ast);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$InvalidAssignmentError());
+return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
+messageSends: ["parse:", "should:raise:", "visit:"],
+referencedClasses: ["Smalltalk", "InvalidAssignmentError"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testNonLocalReturn",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a | a + 1. ^ a";
+ast=_st($Smalltalk())._parse_(src);
+_st(self["@analyzer"])._visit_(ast);
+self._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
+return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
+messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testNonLocalReturn2",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a | a + 1. [ [ ^ a] ]";
+ast=_st($Smalltalk())._parse_(src);
+_st(self["@analyzer"])._visit_(ast);
+self._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
+return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
+messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testScope",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+src="foo | a | a + 1. [ | b | b := a ]";
+ast=_st($Smalltalk())._parse_(src);
+_st(self["@analyzer"])._visit_(ast);
+$4=_st(_st(_st(ast)._nodes())._first())._nodes();
+$ctx1.sendIdx["nodes"]=1;
+$3=_st($4)._last();
+$2=_st($3)._scope();
+$ctx1.sendIdx["scope"]=1;
+$1=_st($2).__eq_eq(_st(ast)._scope());
+self._deny_($1);
+return self}, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.",
+messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testScope2",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $8,$7,$6,$5,$4,$3,$2,$1;
+src="foo | a | a + 1. [ [ | b | b := a ] ]";
+ast=_st($Smalltalk())._parse_(src);
+_st(self["@analyzer"])._visit_(ast);
+$8=_st(_st(_st(ast)._nodes())._first())._nodes();
+$ctx1.sendIdx["nodes"]=3;
+$7=_st($8)._last();
+$6=_st($7)._nodes();
+$ctx1.sendIdx["nodes"]=2;
+$5=_st($6)._first();
+$ctx1.sendIdx["first"]=2;
+$4=_st($5)._nodes();
+$ctx1.sendIdx["nodes"]=1;
+$3=_st($4)._first();
+$ctx1.sendIdx["first"]=1;
+$2=_st($3)._scope();
+$ctx1.sendIdx["scope"]=1;
+$1=_st($2).__eq_eq(_st(ast)._scope());
+self._deny_($1);
+return self}, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.",
+messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testScopeLevel",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
+src="foo | a | a + 1. [ [ | b | b := a ] ]";
+ast=_st($Smalltalk())._parse_(src);
+_st(self["@analyzer"])._visit_(ast);
+$2=_st(ast)._scope();
+$ctx1.sendIdx["scope"]=1;
+$1=_st($2)._scopeLevel();
+$ctx1.sendIdx["scopeLevel"]=1;
+self._assert_equals_($1,(1));
+$ctx1.sendIdx["assert:equals:"]=1;
+$10=_st(_st(_st(ast)._nodes())._first())._nodes();
+$ctx1.sendIdx["nodes"]=3;
+$9=_st($10)._last();
+$8=_st($9)._nodes();
+$ctx1.sendIdx["nodes"]=2;
+$7=_st($8)._first();
+$ctx1.sendIdx["first"]=2;
+$6=_st($7)._nodes();
+$ctx1.sendIdx["nodes"]=1;
+$5=_st($6)._first();
+$ctx1.sendIdx["first"]=1;
+$4=_st($5)._scope();
+$3=_st($4)._scopeLevel();
+self._assert_equals_($3,(3));
+return self}, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
+messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testUnknownVariables",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a | b + a";
+ast=_st($Smalltalk())._parse_(src);
+self._should_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@analyzer"])._visit_(ast);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
+return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
+messageSends: ["parse:", "should:raise:", "visit:"],
+referencedClasses: ["Smalltalk", "UnknownVariableError"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testUnknownVariablesWithScope",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
+ast=_st($Smalltalk())._parse_(src);
+self._should_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@analyzer"])._visit_(ast);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
+return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
+messageSends: ["parse:", "should:raise:", "visit:"],
+referencedClasses: ["Smalltalk", "UnknownVariableError"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testVariableShadowing",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a | a + 1";
+ast=_st($Smalltalk())._parse_(src);
+_st(self["@analyzer"])._visit_(ast);
+return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
+messageSends: ["parse:", "visit:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testVariableShadowing2",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a | a + 1. [ | a | a := 2 ]";
+ast=_st($Smalltalk())._parse_(src);
+self._should_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@analyzer"])._visit_(ast);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$ShadowingVariableError());
+return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
+messageSends: ["parse:", "should:raise:", "visit:"],
+referencedClasses: ["Smalltalk", "ShadowingVariableError"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testVariableShadowing3",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a | a + 1. [ | b | b := 2 ]";
+ast=_st($Smalltalk())._parse_(src);
+_st(self["@analyzer"])._visit_(ast);
+return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
+messageSends: ["parse:", "visit:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testVariableShadowing4",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
+ast=_st($Smalltalk())._parse_(src);
+_st(self["@analyzer"])._visit_(ast);
+return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
+messageSends: ["parse:", "visit:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testVariableShadowing5",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
+ast=_st($Smalltalk())._parse_(src);
+self._should_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@analyzer"])._visit_(ast);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$ShadowingVariableError());
+return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
+messageSends: ["parse:", "should:raise:", "visit:"],
+referencedClasses: ["Smalltalk", "ShadowingVariableError"]
+}),
+globals.SemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testVariablesLookup",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28;
+src="foo | a | a + 1. [ | b | b := a ]";
+ast=_st($Smalltalk())._parse_(src);
+_st(self["@analyzer"])._visit_(ast);
+$7=_st(ast)._nodes();
+$ctx1.sendIdx["nodes"]=2;
+$6=_st($7)._first();
+$ctx1.sendIdx["first"]=2;
+$5=_st($6)._nodes();
+$ctx1.sendIdx["nodes"]=1;
+$4=_st($5)._first();
+$ctx1.sendIdx["first"]=1;
+$3=_st($4)._receiver();
+$ctx1.sendIdx["receiver"]=1;
+$2=_st($3)._binding();
+$ctx1.sendIdx["binding"]=1;
+$1=_st($2)._isTempVar();
+$ctx1.sendIdx["isTempVar"]=1;
+self._assert_($1);
+$ctx1.sendIdx["assert:"]=1;
+$15=_st(ast)._nodes();
+$ctx1.sendIdx["nodes"]=4;
+$14=_st($15)._first();
+$ctx1.sendIdx["first"]=4;
+$13=_st($14)._nodes();
+$ctx1.sendIdx["nodes"]=3;
+$12=_st($13)._first();
+$ctx1.sendIdx["first"]=3;
+$11=_st($12)._receiver();
+$10=_st($11)._binding();
+$ctx1.sendIdx["binding"]=2;
+$9=_st($10)._scope();
+$ctx1.sendIdx["scope"]=1;
+$16=_st(ast)._scope();
+$ctx1.sendIdx["scope"]=2;
+$8=_st($9).__eq_eq($16);
+$ctx1.sendIdx["=="]=1;
+self._assert_($8);
+$ctx1.sendIdx["assert:"]=2;
+$27=_st(ast)._nodes();
+$ctx1.sendIdx["nodes"]=8;
+$26=_st($27)._first();
+$ctx1.sendIdx["first"]=7;
+$25=_st($26)._nodes();
+$ctx1.sendIdx["nodes"]=7;
+$24=_st($25)._last();
+$ctx1.sendIdx["last"]=1;
+$23=_st($24)._nodes();
+$ctx1.sendIdx["nodes"]=6;
+$22=_st($23)._first();
+$ctx1.sendIdx["first"]=6;
+$21=_st($22)._nodes();
+$ctx1.sendIdx["nodes"]=5;
+$20=_st($21)._first();
+$ctx1.sendIdx["first"]=5;
+$19=_st($20)._left();
+$ctx1.sendIdx["left"]=1;
+$18=_st($19)._binding();
+$ctx1.sendIdx["binding"]=3;
+$17=_st($18)._isTempVar();
+self._assert_($17);
+$ctx1.sendIdx["assert:"]=3;
+$39=_st(ast)._nodes();
+$ctx1.sendIdx["nodes"]=12;
+$38=_st($39)._first();
+$ctx1.sendIdx["first"]=10;
+$37=_st($38)._nodes();
+$ctx1.sendIdx["nodes"]=11;
+$36=_st($37)._last();
+$ctx1.sendIdx["last"]=2;
+$35=_st($36)._nodes();
+$ctx1.sendIdx["nodes"]=10;
+$34=_st($35)._first();
+$ctx1.sendIdx["first"]=9;
+$33=_st($34)._nodes();
+$ctx1.sendIdx["nodes"]=9;
+$32=_st($33)._first();
+$ctx1.sendIdx["first"]=8;
+$31=_st($32)._left();
+$30=_st($31)._binding();
+$29=_st($30)._scope();
+$ctx1.sendIdx["scope"]=3;
+$42=_st(_st(_st(ast)._nodes())._first())._nodes();
+$ctx1.sendIdx["nodes"]=13;
+$41=_st($42)._last();
+$40=_st($41)._scope();
+$28=_st($29).__eq_eq($40);
+self._assert_($28);
+return self}, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
+args: [],
+source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
+messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.SemanticAnalyzerTest);
+
+
+
+smalltalk.addClass('AISemanticAnalyzerTest', globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setUp",
+protocol: 'running',
+fn: function (){
+var self=this;
+function $AISemanticAnalyzer(){return globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
+function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
+function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$5,$3,$6;
+$1=_st($AISemanticAnalyzer())._on_($Object());
+$2=$1;
+$4=_st($AIContext())._new();
+_st($4)._defineLocal_("local");
+_st($4)._localAt_put_("local",(3));
+$5=_st($4)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+$3=$5;
+_st($2)._context_($3);
+$6=_st($1)._yourself();
+self["@analyzer"]=$6;
+return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.AISemanticAnalyzerTest)})},
+args: [],
+source: "setUp\x0a\x09analyzer := (AISemanticAnalyzer on: Object)\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09defineLocal: 'local';\x0a\x09\x09\x09localAt: 'local' put: 3;\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
+messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"],
+referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"]
+}),
+globals.AISemanticAnalyzerTest);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testContextVariables",
+protocol: 'tests',
+fn: function (){
+var self=this;
+var src,ast;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
+return smalltalk.withContext(function($ctx1) { 
+src="foo | a | local + a";
+ast=_st($Smalltalk())._parse_(src);
+self._shouldnt_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@analyzer"])._visit_(ast);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
+return self}, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},globals.AISemanticAnalyzerTest)})},
+args: [],
+source: "testContextVariables\x0a\x09| src ast |\x0a\x09\x0a\x09src := 'foo | a | local + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError",
+messageSends: ["parse:", "shouldnt:raise:", "visit:"],
+referencedClasses: ["Smalltalk", "UnknownVariableError"]
+}),
+globals.AISemanticAnalyzerTest);
+
+
+});

+ 781 - 0
src/Compiler-Tests.st

@@ -0,0 +1,781 @@
+Smalltalk createPackage: 'Compiler-Tests'!
+TestCase subclass: #ASTParsingTest
+	instanceVariableNames: ''
+	package: 'Compiler-Tests'!
+
+!ASTParsingTest methodsFor: 'convenience'!
+
+analyze: aNode forClass: aClass
+	(SemanticAnalyzer on: aClass) visit: aNode.
+	^ aNode
+! !
+
+!ASTParsingTest methodsFor: 'parsing'!
+
+parse: aString
+	^ Smalltalk parse: aString
+!
+
+parse: aString forClass: aClass
+	^ self analyze: (self parse: aString) forClass: aClass
+! !
+
+ASTParsingTest subclass: #ASTPCNodeVisitorTest
+	instanceVariableNames: ''
+	package: 'Compiler-Tests'!
+
+!ASTPCNodeVisitorTest methodsFor: 'factory'!
+
+astPCNodeVisitor
+	^ ASTPCNodeVisitor new
+		context: (AIContext new
+			yourself);
+		yourself
+!
+
+astPCNodeVisitorForSelector: aString
+	^ ASTPCNodeVisitor new
+		selector: aString;
+		context: (AIContext new
+			yourself);
+		yourself
+! !
+
+!ASTPCNodeVisitorTest methodsFor: 'tests'!
+
+testJSStatementNode
+	| ast visitor |
+	
+	ast := self parse: 'foo <consolee.log(1)>' forClass: Object.
+	self assert: (self astPCNodeVisitor
+		visit: ast;
+		currentNode) isJSStatementNode
+!
+
+testMessageSend
+	| ast |
+	
+	ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.
+	self assert: ((self astPCNodeVisitorForSelector: 'yourself')
+		visit: ast;
+		currentNode) selector equals: 'yourself'
+!
+
+testMessageSendWithBlocks
+	| ast |
+	
+	ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value.  ]. ^ self asBoolean' forClass: Object.
+	self assert: ((self astPCNodeVisitorForSelector: 'yourself')
+		visit: ast;
+		currentNode) selector equals: 'yourself'
+!
+
+testMessageSendWithInlining
+	| ast |
+	
+	ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.
+	self assert: ((self astPCNodeVisitorForSelector: 'yourself')
+		visit: ast;
+		currentNode) selector equals: 'yourself'.
+		
+	ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.
+	self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')
+		visit: ast;
+		currentNode) selector equals: 'asBoolean'
+!
+
+testNoMessageSend
+	| ast |
+	
+	ast := self parse: 'foo ^ self' forClass: Object.
+	self assert: (self astPCNodeVisitor
+		visit: ast;
+		currentNode) isNil
+!
+
+testPC
+	| ast visitor |
+	
+	ast := self parse: 'foo <console.log(1)>' forClass: Object.
+	self assert: (self astPCNodeVisitor
+		visit: ast;
+		currentNode) isJSStatementNode
+! !
+
+ASTParsingTest subclass: #ASTPositionTest
+	instanceVariableNames: ''
+	package: 'Compiler-Tests'!
+
+!ASTPositionTest methodsFor: 'tests'!
+
+testNodeAtPosition
+	| node |
+	
+	node := self parse: 'yourself
+	^ self'.
+	
+	self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.
+	
+	node := self parse: 'foo
+	true ifTrue: [ 1 ]'.
+	
+	self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.
+	
+	node := self parse: 'foo
+	self foo; bar; baz'.
+	
+	self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'
+! !
+
+ASTParsingTest subclass: #CodeGeneratorTest
+	instanceVariableNames: 'receiver'
+	package: 'Compiler-Tests'!
+
+!CodeGeneratorTest methodsFor: 'accessing'!
+
+codeGeneratorClass
+	^ CodeGenerator
+! !
+
+!CodeGeneratorTest methodsFor: 'factory'!
+
+compiler
+	^ Compiler new
+		codeGeneratorClass: self codeGeneratorClass;
+		yourself
+! !
+
+!CodeGeneratorTest methodsFor: 'initialization'!
+
+setUp
+	receiver := DoIt new
+!
+
+tearDown
+	"receiver := nil"
+! !
+
+!CodeGeneratorTest methodsFor: 'testing'!
+
+should: aString receiver: anObject return: aResult
+	| method result |
+
+	receiver := anObject.
+	method := self compiler install: aString forClass: anObject class protocol: 'tests'.
+	result := receiver perform: method selector.
+	anObject class removeCompiledMethod: method.
+	self assert: aResult equals: result
+!
+
+should: aString return: anObject
+	^ self 
+		should: aString 
+		receiver: receiver 
+		return: anObject
+! !
+
+!CodeGeneratorTest methodsFor: 'tests'!
+
+testAssignment
+	self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.
+	self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.
+
+	self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1
+!
+
+testBackslashSelectors
+	
+	self should: '\ arg ^ 4' return: 4.
+	self should: '\\ arg ^ 42' return: 42
+!
+
+testBlockReturn
+	self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).
+	self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).
+	self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).
+!
+
+testCascades
+	
+	self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)
+!
+
+testCascadesWithInlining
+	
+	self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.
+	self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2
+!
+
+testDynamicArrayElementsOrdered
+	self should: 'foo
+	| x |
+	x := 1.
+	^ { x. x := 2 }
+' return: #(1 2).
+
+	self should: 'foo
+	| x |
+	x := 1.
+	^ { x. true ifTrue: [ x := 2 ] }
+' return: #(1 2).
+!
+
+testDynamicDictionaryElementsOrdered
+	self should: 'foo
+	| x |
+	x := ''foo''.
+	^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }
+' return: #{'foo'->1. 'bar'->2}.
+!
+
+testDynamicDictionaryWithMoreArrows
+	self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)
+!
+
+testGlobalVar
+	self should: 'foo ^ eval class' return: BlockClosure.
+	self should: 'foo ^ Math cos: 0' return: 1.
+	self should: 'foo ^ NonExistingVar' return: nil
+!
+
+testInnerTemporalDependentElementsOrdered
+	self should: 'foo
+	| x |
+	x := Array.
+	^ x with: ''foo''->x with: ''bar''->(x := 2)
+' return: {'foo'->Array. 'bar'->2}.
+
+	self should: 'foo
+	| x |
+	x := Array.
+	^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])
+' return: {'foo'->Array. 'bar'->2}.
+
+	self should: 'foo
+	| x |
+	x := 1.
+	^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])
+' return: {'foo'->1. 'bar'->2}.
+
+	self should: 'foo
+	| x |
+	x := 1.
+	^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }
+' return: {'foo'->1. 'bar'->2}.
+
+	self should: 'foo
+	| x |
+	x := 1.
+	^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }
+' return: #{'foo'->1. 'bar'->2}.
+!
+
+testJSStatement
+	self should: 'foo <return 2+3>' return: 5
+!
+
+testLexicalScope
+	self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2
+!
+
+testLiterals
+	self should: 'foo ^ 1' return: 1.
+	self should: 'foo ^ ''hello''' return: 'hello'.
+	self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).
+	self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).
+	self should: 'foo ^ true' return: true.
+	self should: 'foo ^ false' return: false.
+	self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.
+	self should: 'foo ^ #hello' return: #hello.
+	self should: 'foo ^ $h' return: 'h'.
+	self should: 'foo ^ -123.456' return: -123.456.
+	self should: 'foo ^ -2.5e4' return: -25000.
+!
+
+testLocalReturn
+	self should: 'foo ^ 1' return: 1.
+	self should: 'foo ^ 1 + 1' return: 2.
+	self should: 'foo ' return: receiver.
+	self should: 'foo self asString' return: receiver.
+	self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3
+!
+
+testMessageSends
+	self should: 'foo ^ 1 asString' return: '1'.
+
+	self should: 'foo ^ 1 + 1' return: 2.
+	self should: 'foo ^ 1 + 2 * 3' return: 9.
+
+	self should: 'foo ^ 1 to: 3' return: #(1 2 3).
+	self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)
+!
+
+testMultipleSequences
+	self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30
+!
+
+testMutableLiterals
+	"Mutable literals must be aliased in cascades.
+	See https://github.com/amber-smalltalk/amber/issues/428"
+	
+	self 
+		should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' 
+		return: #(3 2)
+!
+
+testNestedIfTrue
+	self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.
+	self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.
+
+	self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.
+	self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.
+!
+
+testNestedSends
+	self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString
+!
+
+testNonLocalReturn
+	self should: 'foo [ ^ 1 ] value' return: 1.
+	self should: 'foo [ ^ 1 + 1 ] value' return: 2.
+	self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.
+	self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8
+!
+
+testPascalCaseGlobal
+	self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').
+	self should: 'foo ^NonExistent' return: nil
+!
+
+testSendReceiverAndArgumentsOrdered
+	self should: 'foo
+	| x |
+	x := 1.
+	^ Array with: x with: (true ifTrue: [ x := 2 ])
+' return: #(1 2).
+
+	self should: 'foo
+	| x |
+	x := Array.
+	^ x with: x with: (true ifTrue: [ x := 2 ])
+' return: {Array. 2}.
+!
+
+testSuperSend
+	self 
+		should: 'foo ^ super isBoolean' 
+		receiver: true
+		return: false
+!
+
+testTempVariables
+	self should: 'foo | a | ^ a' return: nil.
+	self should: 'foo | AVariable | ^ AVariable' return: nil.
+	self should: 'foo | a b c | ^ c' return: nil.
+	self should: 'foo | a | [ | d | ^ d ] value' return: nil.
+	
+	self should: 'foo | a | a:= 1. ^ a' return: 1.
+	self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.
+!
+
+testThisContext
+	self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true
+!
+
+testifFalse
+	self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.
+	self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.
+	
+	self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.
+	self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.
+!
+
+testifFalseIfTrue
+	self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.
+	self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.
+	
+	self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.
+	self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.
+!
+
+testifNil
+	self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.
+	self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.
+
+	self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.
+	self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.
+!
+
+testifNilIfNotNil
+	self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.
+	self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.
+
+	self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.
+	self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.
+!
+
+testifNotNil
+	self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.
+	self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.
+
+	self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.
+	self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.
+!
+
+testifNotNilWithArgument
+	self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.
+	self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.
+	
+	self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.
+	self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.
+	
+	self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.
+	self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5
+!
+
+testifTrue
+	self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.
+	self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.
+	
+	self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.
+	self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.
+!
+
+testifTrueIfFalse
+	self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.
+	self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.
+	
+	self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.
+	self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.
+! !
+
+CodeGeneratorTest subclass: #ASTInterpreterTest
+	instanceVariableNames: ''
+	package: 'Compiler-Tests'!
+
+!ASTInterpreterTest methodsFor: 'parsing'!
+
+analyze: aNode forClass: aClass
+	(SemanticAnalyzer on: aClass) visit: aNode.
+	^ aNode
+!
+
+parse: aString
+	^ Smalltalk parse: aString
+!
+
+parse: aString forClass: aClass
+	^ self analyze: (self parse: aString) forClass: aClass
+! !
+
+!ASTInterpreterTest methodsFor: 'private'!
+
+interpret: aString receiver: anObject withArguments: aDictionary
+	"The food is a methodNode. Interpret the sequenceNode only"
+	
+	| ctx ast interpreter |
+	
+	interpreter := ASTInterpreter new.
+	ast := self parse: aString forClass: anObject class.
+	
+	ctx := AIContext new
+		receiver: anObject;
+		interpreter: interpreter;
+		yourself.
+		
+	"Define locals for the context"
+	ast sequenceNode ifNotNil: [ :sequence |
+		sequence temps do: [ :each |
+			ctx defineLocal: each ] ].
+		
+	aDictionary keysAndValuesDo: [ :key :value |
+		ctx localAt: key put: value ].
+	
+	^ interpreter
+		context: ctx;
+		interpret: ast nextChild;
+		proceed;
+		result
+! !
+
+!ASTInterpreterTest methodsFor: 'testing'!
+
+should: aString receiver: anObject return: aResult
+	receiver := anObject.
+	
+	^ self 
+		assert: (self interpret: aString receiver: receiver withArguments: #{})
+		equals: aResult
+!
+
+should: aString return: anObject
+	^ self 
+		should: aString
+		receiver: receiver
+		return: anObject
+! !
+
+ASTInterpreterTest subclass: #ASTDebuggerTest
+	instanceVariableNames: ''
+	package: 'Compiler-Tests'!
+
+!ASTDebuggerTest methodsFor: 'private'!
+
+interpret: aString receiver: anObject withArguments: aDictionary
+	| ctx ast debugger |
+	
+	ctx := AIContext new
+		receiver: anObject;
+		interpreter: ASTInterpreter new;
+		yourself.
+	ast := self parse: aString forClass: anObject class.
+		
+	"Define locals for the context"
+	ast sequenceNode ifNotNil: [ :sequence |
+		sequence temps do: [ :each |
+			ctx defineLocal: each ] ].
+	
+	aDictionary keysAndValuesDo: [ :key :value |
+		ctx localAt: key put: value ].
+	ctx interpreter context: ctx.
+	
+	ctx interpreter node: ast nextChild.
+	
+	debugger := ASTDebugger context: ctx.
+	
+	^ debugger 
+		proceed; 
+		result
+! !
+
+CodeGeneratorTest subclass: #InliningCodeGeneratorTest
+	instanceVariableNames: ''
+	package: 'Compiler-Tests'!
+
+!InliningCodeGeneratorTest methodsFor: 'accessing'!
+
+codeGeneratorClass
+	^ InliningCodeGenerator
+! !
+
+TestCase subclass: #ScopeVarTest
+	instanceVariableNames: ''
+	package: 'Compiler-Tests'!
+
+!ScopeVarTest methodsFor: 'tests'!
+
+testClassRefVar
+	| node |
+	node := VariableNode new
+		value: 'Object';
+		yourself.
+	SemanticAnalyzer new 
+		pushScope: MethodLexicalScope new;
+		visit: node.
+	self assert: node binding isClassRefVar
+!
+
+testInstanceVar
+	| node scope |
+	node := VariableNode new
+		value: 'bzzz';
+		yourself.
+	scope := MethodLexicalScope new.
+	scope addIVar: 'bzzz'.
+	self assert: (scope bindingFor: node) isInstanceVar
+!
+
+testPseudoVar
+	| node pseudoVars |
+	pseudoVars := #('self' 'super' 'true' 'false' 'nil').
+	pseudoVars do: [:each |
+		node := VariableNode new
+		value: each;
+		yourself.
+		self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar ]
+!
+
+testTempVar
+	| node scope |
+	node := VariableNode new
+		value: 'bzzz';
+		yourself.
+	scope := MethodLexicalScope new.
+	scope addTemp: 'bzzz'.
+	self assert: (scope bindingFor: node) isTempVar
+!
+
+testUnknownVar
+	| node |
+	node := VariableNode new
+		value: 'bzzz';
+		yourself.
+	self assert: (MethodLexicalScope new bindingFor: node) isNil
+! !
+
+TestCase subclass: #SemanticAnalyzerTest
+	instanceVariableNames: 'analyzer'
+	package: 'Compiler-Tests'!
+
+!SemanticAnalyzerTest methodsFor: 'running'!
+
+setUp
+	analyzer := SemanticAnalyzer on: Object
+! !
+
+!SemanticAnalyzerTest methodsFor: 'tests'!
+
+testAssignment
+	| src ast |
+
+	src := 'foo self := 1'.
+	ast := Smalltalk parse: src.
+	self should: [analyzer visit: ast] raise: InvalidAssignmentError
+!
+
+testNonLocalReturn
+	| src ast |
+
+	src := 'foo | a | a + 1. ^ a'.
+	ast := Smalltalk parse: src.
+	analyzer visit: ast.
+
+	self deny: ast scope hasNonLocalReturn
+!
+
+testNonLocalReturn2
+	| src ast |
+
+	src := 'foo | a | a + 1. [ [ ^ a] ]'.
+	ast := Smalltalk parse: src.
+	analyzer visit: ast.
+
+	self assert: ast scope hasNonLocalReturn
+!
+
+testScope
+	| src ast |
+
+	src := 'foo | a | a + 1. [ | b | b := a ]'.
+	ast := Smalltalk parse: src.
+	analyzer visit: ast.
+
+	self deny: ast nodes first nodes last scope == ast scope.
+!
+
+testScope2
+	| src ast |
+
+	src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.
+	ast := Smalltalk parse: src.
+	analyzer visit: ast.
+
+	self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.
+!
+
+testScopeLevel
+	| src ast |
+
+	src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.
+	ast := Smalltalk parse: src.
+	analyzer visit: ast.
+
+	self assert: ast scope scopeLevel equals: 1.
+	self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3
+!
+
+testUnknownVariables
+	| src ast |
+
+	src := 'foo | a | b + a'.
+	ast := Smalltalk parse: src.
+
+	self should: [ analyzer visit: ast ] raise: UnknownVariableError
+!
+
+testUnknownVariablesWithScope
+	| src ast |
+
+	src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.
+	ast := Smalltalk parse: src.
+	
+	self should: [ analyzer visit: ast ] raise: UnknownVariableError
+!
+
+testVariableShadowing
+	| src ast |
+	src := 'foo | a | a + 1'.
+	ast := Smalltalk parse: src.
+	analyzer visit: ast
+!
+
+testVariableShadowing2
+	| src ast |
+	src := 'foo | a | a + 1. [ | a | a := 2 ]'.
+	ast := Smalltalk parse: src.
+	self should: [analyzer visit: ast] raise: ShadowingVariableError
+!
+
+testVariableShadowing3
+	| src ast |
+	src := 'foo | a | a + 1. [ | b | b := 2 ]'.
+	ast := Smalltalk parse: src.
+	analyzer visit: ast
+!
+
+testVariableShadowing4
+	| src ast |
+	src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.
+	ast := Smalltalk parse: src.
+	analyzer visit: ast
+!
+
+testVariableShadowing5
+	| src ast |
+	src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.
+	ast := Smalltalk parse: src.
+	self should: [analyzer visit: ast] raise: ShadowingVariableError
+!
+
+testVariablesLookup
+	| src ast |
+
+	src := 'foo | a | a + 1. [ | b | b := a ]'.
+	ast := Smalltalk parse: src.
+	analyzer visit: ast.
+
+	"Binding for `a` in the message send"
+	self assert: ast nodes first nodes first receiver binding isTempVar.
+	self assert: ast nodes first nodes first receiver binding scope == ast scope.
+
+	"Binding for `b`"
+	self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.
+	self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.
+! !
+
+SemanticAnalyzerTest subclass: #AISemanticAnalyzerTest
+	instanceVariableNames: ''
+	package: 'Compiler-Tests'!
+
+!AISemanticAnalyzerTest methodsFor: 'running'!
+
+setUp
+	analyzer := (AISemanticAnalyzer on: Object)
+		context: (AIContext new
+			defineLocal: 'local';
+			localAt: 'local' put: 3;
+			yourself);
+		yourself
+! !
+
+!AISemanticAnalyzerTest methodsFor: 'tests'!
+
+testContextVariables
+	| src ast |
+	
+	src := 'foo | a | local + a'.
+	ast := Smalltalk parse: src.
+
+	self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError
+! !
+

+ 118 - 0
src/Examples.js

@@ -0,0 +1,118 @@
+define("amber_core/Examples", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Web"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Examples');
+smalltalk.packages["Examples"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('Counter', globals.Widget, ['count', 'header'], 'Examples');
+globals.Counter.comment="This is a trivial Widget example mimicking the classic Counter example in Seaside.\x0aIn order to play with it, just evaluate the doit below in a workspace.\x0aThen take a look in the HTML document above the IDE.\x0a\x0a\x09\x09Counter tryExample";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "decrease",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@count"]=_st(self["@count"]).__minus((1));
+_st(self["@header"])._contents_((function(html){
+return smalltalk.withContext(function($ctx2) {
+return _st(html)._with_(_st(self["@count"])._asString());
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"decrease",{},globals.Counter)})},
+args: [],
+source: "decrease\x0a\x09count := count - 1.\x0a\x09header contents: [ :html | html with: count asString ]",
+messageSends: ["-", "contents:", "with:", "asString"],
+referencedClasses: []
+}),
+globals.Counter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "increase",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@count"]=_st(self["@count"]).__plus((1));
+_st(self["@header"])._contents_((function(html){
+return smalltalk.withContext(function($ctx2) {
+return _st(html)._with_(_st(self["@count"])._asString());
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"increase",{},globals.Counter)})},
+args: [],
+source: "increase\x0a\x09count := count + 1.\x0a\x09header contents: [ :html | html with: count asString ]",
+messageSends: ["+", "contents:", "with:", "asString"],
+referencedClasses: []
+}),
+globals.Counter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.Counter.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@count"]=(0);
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Counter)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09count := 0",
+messageSends: ["initialize"],
+referencedClasses: []
+}),
+globals.Counter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$6;
+$1=_st(html)._h1();
+_st($1)._with_(_st(self["@count"])._asString());
+$ctx1.sendIdx["with:"]=1;
+$2=_st($1)._yourself();
+self["@header"]=$2;
+$3=_st(html)._button();
+$ctx1.sendIdx["button"]=1;
+_st($3)._with_("++");
+$ctx1.sendIdx["with:"]=2;
+$4=_st($3)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._increase();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["onClick:"]=1;
+$5=_st(html)._button();
+_st($5)._with_("--");
+$6=_st($5)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._decrease();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.Counter)})},
+args: ["html"],
+source: "renderOn: html\x0a\x09header := html h1\x0a\x09\x09with: count asString;\x0a\x09\x09yourself.\x0a\x09html button\x0a\x09\x09with: '++';\x0a\x09\x09onClick: [ self increase ].\x0a\x09html button\x0a\x09\x09with: '--';\x0a\x09\x09onClick: [ self decrease ]",
+messageSends: ["with:", "h1", "asString", "yourself", "button", "onClick:", "increase", "decrease"],
+referencedClasses: []
+}),
+globals.Counter);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tryExample",
+protocol: 'example',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._new())._appendToJQuery_("body"._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"tryExample",{},globals.Counter.klass)})},
+args: [],
+source: "tryExample\x0a\x09\x22In order to play with the Counter, just select the\x0a\x09doit below and press the Do it button. Then take a\x0a\x09look in the HTML document above the IDE.\x22\x0a\x0a\x09\x22Counter tryExample\x22\x0a\x09\x09self new appendToJQuery: 'body' asJQuery",
+messageSends: ["appendToJQuery:", "new", "asJQuery"],
+referencedClasses: []
+}),
+globals.Counter.klass);
+
+});

+ 55 - 0
src/Examples.st

@@ -0,0 +1,55 @@
+Smalltalk createPackage: 'Examples'!
+Widget subclass: #Counter
+	instanceVariableNames: 'count header'
+	package: 'Examples'!
+!Counter commentStamp!
+This is a trivial Widget example mimicking the classic Counter example in Seaside.
+In order to play with it, just evaluate the doit below in a workspace.
+Then take a look in the HTML document above the IDE.
+
+		Counter tryExample!
+
+!Counter methodsFor: 'actions'!
+
+decrease
+	count := count - 1.
+	header contents: [ :html | html with: count asString ]
+!
+
+increase
+	count := count + 1.
+	header contents: [ :html | html with: count asString ]
+! !
+
+!Counter methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	count := 0
+! !
+
+!Counter methodsFor: 'rendering'!
+
+renderOn: html
+	header := html h1
+		with: count asString;
+		yourself.
+	html button
+		with: '++';
+		onClick: [ self increase ].
+	html button
+		with: '--';
+		onClick: [ self decrease ]
+! !
+
+!Counter class methodsFor: 'example'!
+
+tryExample
+	"In order to play with the Counter, just select the
+	doit below and press the Do it button. Then take a
+	look in the HTML document above the IDE."
+
+	"Counter tryExample"
+		self new appendToJQuery: 'body' asJQuery
+! !
+

+ 655 - 0
src/Helios-Announcements.js

@@ -0,0 +1,655 @@
+define("helios/Helios-Announcements", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Announcements');
+smalltalk.packages["Helios-Announcements"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLAboutToChange', globals.Object, ['actionBlock'], 'Helios-Announcements');
+globals.HLAboutToChange.comment="I am announced whenever a change of context is about to be made, and unsaved changes could be lost.\x0a\x0aI am used within `HLModel` to handle such user actions. See `HLModel >> withChangesDo:`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "actionBlock",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@actionBlock"];
+return $1;
+},
+args: [],
+source: "actionBlock\x0a\x09^ actionBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLAboutToChange);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "actionBlock:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@actionBlock"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "actionBlock: aBlock\x0a\x09actionBlock := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLAboutToChange);
+
+
+
+smalltalk.addClass('HLAnnouncement', globals.Object, [], 'Helios-Announcements');
+globals.HLAnnouncement.comment="I am the root of the announcement class hierarchy used in the Helios UI.";
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+protocol: 'helios',
+fn: function (){
+var self=this;
+return "announcement";
+},
+args: [],
+source: "heliosClass\x0a\x09^ 'announcement'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLAnnouncement.klass);
+
+
+smalltalk.addClass('HLCodeHandled', globals.HLAnnouncement, ['code'], 'Helios-Announcements');
+globals.HLCodeHandled.comment="I am the root class of announcements emitted by `HLCodeWidget`s";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "code",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@code"];
+return $1;
+},
+args: [],
+source: "code\x0a\x0a\x09^ code",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeHandled);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "code:",
+protocol: 'accessing',
+fn: function (aModel){
+var self=this;
+self["@code"]=aModel;
+return self},
+args: ["aModel"],
+source: "code: aModel\x0a\x0a\x09code := aModel",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeHandled);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'actions',
+fn: function (aCodeModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._code_(aCodeModel);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aCodeModel:aCodeModel},globals.HLCodeHandled.klass)})},
+args: ["aCodeModel"],
+source: "on: aCodeModel\x0a\x0a\x09^ self new \x0a    \x09code: aCodeModel;\x0a        yourself",
+messageSends: ["code:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLCodeHandled.klass);
+
+
+smalltalk.addClass('HLDoItExecuted', globals.HLCodeHandled, [], 'Helios-Announcements');
+globals.HLDoItExecuted.comment="I am emitted by a `HLCodeWidget` after a DoIt has been executed.";
+
+
+smalltalk.addClass('HLDebuggerAnnouncement', globals.HLAnnouncement, ['context'], 'Helios-Announcements');
+globals.HLDebuggerAnnouncement.comment="I am the root class of debugger announcements, and hold onto the debugged `context`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@context"];
+return $1;
+},
+args: [],
+source: "context\x0a\x09^ context",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebuggerAnnouncement);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context:",
+protocol: 'accessing',
+fn: function (aContext){
+var self=this;
+self["@context"]=aContext;
+return self},
+args: ["aContext"],
+source: "context: aContext\x0a\x09context := aContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebuggerAnnouncement);
+
+
+
+smalltalk.addClass('HLDebuggerContextSelected', globals.HLDebuggerAnnouncement, [], 'Helios-Announcements');
+globals.HLDebuggerContextSelected.comment="I am announced when a new context is selected in a debugger, to update the user interface.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@context"];
+return $1;
+},
+args: [],
+source: "context\x0a\x09^ context",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebuggerContextSelected);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context:",
+protocol: 'accessing',
+fn: function (aContext){
+var self=this;
+self["@context"]=aContext;
+return self},
+args: ["aContext"],
+source: "context: aContext\x0a\x09context := aContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebuggerContextSelected);
+
+
+
+smalltalk.addClass('HLDebuggerProceeded', globals.HLDebuggerAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLDebuggerStepped', globals.HLDebuggerAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLDebuggerWhere', globals.HLDebuggerAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLDiveRequested', globals.HLAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLEditComment', globals.HLAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLErrorRaised', globals.HLAnnouncement, ['error'], 'Helios-Announcements');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "error",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@error"];
+return $1;
+},
+args: [],
+source: "error\x0a\x09^ error",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLErrorRaised);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "error:",
+protocol: 'accessing',
+fn: function (anError){
+var self=this;
+self["@error"]=anError;
+return self},
+args: ["anError"],
+source: "error: anError\x0a\x09error := anError",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLErrorRaised);
+
+
+
+smalltalk.addClass('HLCompileErrorRaised', globals.HLErrorRaised, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLParseErrorRaised', globals.HLErrorRaised, ['line', 'column', 'message'], 'Helios-Announcements');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "column",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@column"];
+return $1;
+},
+args: [],
+source: "column\x0a\x09^ column",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLParseErrorRaised);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "column:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@column"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "column: anInteger\x0a\x09column := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLParseErrorRaised);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "line",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@line"];
+return $1;
+},
+args: [],
+source: "line\x0a\x09^ line",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLParseErrorRaised);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "line:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@line"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "line: anInteger\x0a\x09line := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLParseErrorRaised);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "message",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@message"];
+return $1;
+},
+args: [],
+source: "message\x0a\x09^ message",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLParseErrorRaised);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "message:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@message"]=aString;
+return self},
+args: ["aString"],
+source: "message: aString\x0a\x09message := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLParseErrorRaised);
+
+
+
+smalltalk.addClass('HLUnknownVariableErrorRaised', globals.HLErrorRaised, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLFocusRequested', globals.HLAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLClassesFocusRequested', globals.HLFocusRequested, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLDocumentationFocusRequested', globals.HLFocusRequested, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLMethodsFocusRequested', globals.HLFocusRequested, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLPackagesFocusRequested', globals.HLFocusRequested, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLProtocolsFocusRequested', globals.HLFocusRequested, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLSourceCodeFocusRequested', globals.HLFocusRequested, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLInstVarAdded', globals.HLAnnouncement, ['theClass', 'variableName'], 'Helios-Announcements');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@theClass"];
+return $1;
+},
+args: [],
+source: "theClass\x0a\x09^ theClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInstVarAdded);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@theClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInstVarAdded);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableName",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@variableName"];
+return $1;
+},
+args: [],
+source: "variableName\x0a\x09^ variableName",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInstVarAdded);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableName:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@variableName"]=aString;
+return self},
+args: ["aString"],
+source: "variableName: aString\x0a\x09variableName := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInstVarAdded);
+
+
+
+smalltalk.addClass('HLItemSelected', globals.HLAnnouncement, ['item'], 'Helios-Announcements');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "item",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@item"];
+return $1;
+},
+args: [],
+source: "item\x0a\x09^ item",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLItemSelected);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "item:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@item"]=anObject;
+return self},
+args: ["anObject"],
+source: "item: anObject\x0a\x09item := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLItemSelected);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._item_(anItem);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{anItem:anItem},globals.HLItemSelected.klass)})},
+args: ["anItem"],
+source: "on: anItem\x0a\x09^ self new\x0a    \x09item: anItem;\x0a        yourself",
+messageSends: ["item:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLItemSelected.klass);
+
+
+smalltalk.addClass('HLClassSelected', globals.HLItemSelected, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLInstanceVariableSelected', globals.HLItemSelected, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLMethodSelected', globals.HLItemSelected, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLPackageSelected', globals.HLItemSelected, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLProtocolSelected', globals.HLItemSelected, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLSaveSourceCode', globals.HLAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLSearchReferences', globals.HLAnnouncement, ['searchString'], 'Helios-Announcements');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "searchString",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@searchString"];
+return $1;
+},
+args: [],
+source: "searchString\x0a\x09^ searchString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSearchReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "searchString:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@searchString"]=aString;
+return self},
+args: ["aString"],
+source: "searchString: aString\x0a\x09searchString := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSearchReferences);
+
+
+
+smalltalk.addClass('HLShowCommentToggled', globals.HLAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLShowInstanceToggled', globals.HLAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLShowTemplate', globals.HLAnnouncement, ['template'], 'Helios-Announcements');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "template",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@template"];
+return $1;
+},
+args: [],
+source: "template\x0a\x09^ template",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLShowTemplate);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "template:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@template"]=aString;
+return self},
+args: ["aString"],
+source: "template: aString\x0a\x09template := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLShowTemplate);
+
+
+
+smalltalk.addClass('HLSourceCodeSaved', globals.HLAnnouncement, [], 'Helios-Announcements');
+
+
+smalltalk.addClass('HLTabLabelChanged', globals.HLAnnouncement, ['label', 'widget'], 'Helios-Announcements');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@label"];
+return $1;
+},
+args: [],
+source: "label\x0a\x09^ label",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabLabelChanged);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@label"]=aString;
+return self},
+args: ["aString"],
+source: "label: aString\x0a\x09label := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabLabelChanged);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "widget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@widget"];
+return $1;
+},
+args: [],
+source: "widget\x0a\x09^ widget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabLabelChanged);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "widget:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+self["@widget"]=aWidget;
+return self},
+args: ["aWidget"],
+source: "widget: aWidget\x0a\x09widget := aWidget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabLabelChanged);
+
+
+});

+ 326 - 0
src/Helios-Announcements.st

@@ -0,0 +1,326 @@
+Smalltalk createPackage: 'Helios-Announcements'!
+Object subclass: #HLAboutToChange
+	instanceVariableNames: 'actionBlock'
+	package: 'Helios-Announcements'!
+!HLAboutToChange commentStamp!
+I am announced whenever a change of context is about to be made, and unsaved changes could be lost.
+
+I am used within `HLModel` to handle such user actions. See `HLModel >> withChangesDo:`.!
+
+!HLAboutToChange methodsFor: 'accessing'!
+
+actionBlock
+	^ actionBlock
+!
+
+actionBlock: aBlock
+	actionBlock := aBlock
+! !
+
+Object subclass: #HLAnnouncement
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+!HLAnnouncement commentStamp!
+I am the root of the announcement class hierarchy used in the Helios UI.!
+
+!HLAnnouncement class methodsFor: 'helios'!
+
+heliosClass
+	^ 'announcement'
+! !
+
+HLAnnouncement subclass: #HLCodeHandled
+	instanceVariableNames: 'code'
+	package: 'Helios-Announcements'!
+!HLCodeHandled commentStamp!
+I am the root class of announcements emitted by `HLCodeWidget`s!
+
+!HLCodeHandled methodsFor: 'accessing'!
+
+code
+
+	^ code
+!
+
+code: aModel
+
+	code := aModel
+! !
+
+!HLCodeHandled class methodsFor: 'actions'!
+
+on: aCodeModel
+
+	^ self new 
+    	code: aCodeModel;
+        yourself
+! !
+
+HLCodeHandled subclass: #HLDoItExecuted
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+!HLDoItExecuted commentStamp!
+I am emitted by a `HLCodeWidget` after a DoIt has been executed.!
+
+HLAnnouncement subclass: #HLDebuggerAnnouncement
+	instanceVariableNames: 'context'
+	package: 'Helios-Announcements'!
+!HLDebuggerAnnouncement commentStamp!
+I am the root class of debugger announcements, and hold onto the debugged `context`.!
+
+!HLDebuggerAnnouncement methodsFor: 'accessing'!
+
+context
+	^ context
+!
+
+context: aContext
+	context := aContext
+! !
+
+HLDebuggerAnnouncement subclass: #HLDebuggerContextSelected
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+!HLDebuggerContextSelected commentStamp!
+I am announced when a new context is selected in a debugger, to update the user interface.!
+
+!HLDebuggerContextSelected methodsFor: 'accessing'!
+
+context
+	^ context
+!
+
+context: aContext
+	context := aContext
+! !
+
+HLDebuggerAnnouncement subclass: #HLDebuggerProceeded
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLDebuggerAnnouncement subclass: #HLDebuggerStepped
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLDebuggerAnnouncement subclass: #HLDebuggerWhere
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLDiveRequested
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLEditComment
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLErrorRaised
+	instanceVariableNames: 'error'
+	package: 'Helios-Announcements'!
+
+!HLErrorRaised methodsFor: 'accessing'!
+
+error
+	^ error
+!
+
+error: anError
+	error := anError
+! !
+
+HLErrorRaised subclass: #HLCompileErrorRaised
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLErrorRaised subclass: #HLParseErrorRaised
+	instanceVariableNames: 'line column message'
+	package: 'Helios-Announcements'!
+
+!HLParseErrorRaised methodsFor: 'accessing'!
+
+column
+	^ column
+!
+
+column: anInteger
+	column := anInteger
+!
+
+line
+	^ line
+!
+
+line: anInteger
+	line := anInteger
+!
+
+message
+	^ message
+!
+
+message: aString
+	message := aString
+! !
+
+HLErrorRaised subclass: #HLUnknownVariableErrorRaised
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLFocusRequested
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLFocusRequested subclass: #HLClassesFocusRequested
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLFocusRequested subclass: #HLDocumentationFocusRequested
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLFocusRequested subclass: #HLMethodsFocusRequested
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLFocusRequested subclass: #HLPackagesFocusRequested
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLFocusRequested subclass: #HLProtocolsFocusRequested
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLFocusRequested subclass: #HLSourceCodeFocusRequested
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLInstVarAdded
+	instanceVariableNames: 'theClass variableName'
+	package: 'Helios-Announcements'!
+
+!HLInstVarAdded methodsFor: 'accessing'!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
+!
+
+variableName
+	^ variableName
+!
+
+variableName: aString
+	variableName := aString
+! !
+
+HLAnnouncement subclass: #HLItemSelected
+	instanceVariableNames: 'item'
+	package: 'Helios-Announcements'!
+
+!HLItemSelected methodsFor: 'accessing'!
+
+item
+	^ item
+!
+
+item: anObject
+	item := anObject
+! !
+
+!HLItemSelected class methodsFor: 'instance creation'!
+
+on: anItem
+	^ self new
+    	item: anItem;
+        yourself
+! !
+
+HLItemSelected subclass: #HLClassSelected
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLItemSelected subclass: #HLInstanceVariableSelected
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLItemSelected subclass: #HLMethodSelected
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLItemSelected subclass: #HLPackageSelected
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLItemSelected subclass: #HLProtocolSelected
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLSaveSourceCode
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLSearchReferences
+	instanceVariableNames: 'searchString'
+	package: 'Helios-Announcements'!
+
+!HLSearchReferences methodsFor: 'accessing'!
+
+searchString
+	^ searchString
+!
+
+searchString: aString
+	searchString := aString
+! !
+
+HLAnnouncement subclass: #HLShowCommentToggled
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLShowInstanceToggled
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLShowTemplate
+	instanceVariableNames: 'template'
+	package: 'Helios-Announcements'!
+
+!HLShowTemplate methodsFor: 'accessing'!
+
+template
+	^ template
+!
+
+template: aString
+	template := aString
+! !
+
+HLAnnouncement subclass: #HLSourceCodeSaved
+	instanceVariableNames: ''
+	package: 'Helios-Announcements'!
+
+HLAnnouncement subclass: #HLTabLabelChanged
+	instanceVariableNames: 'label widget'
+	package: 'Helios-Announcements'!
+
+!HLTabLabelChanged methodsFor: 'accessing'!
+
+label
+	^ label
+!
+
+label: aString
+	label := aString
+!
+
+widget
+	^ widget
+!
+
+widget: aWidget
+	widget := aWidget
+! !
+

+ 4383 - 0
src/Helios-Browser.js

@@ -0,0 +1,4383 @@
+define("helios/Helios-Browser", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "helios/Helios-Core", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Browser');
+smalltalk.packages["Helios-Browser"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLBrowser', globals.HLWidget, ['model', 'packagesListWidget', 'classesListWidget', 'protocolsListWidget', 'methodsListWidget', 'sourceWidget', 'bottomDiv'], 'Helios-Browser');
+globals.HLBrowser.comment="I render a system browser with 4 panes (Packages, Classes, Protocols, Methods) and a source area.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canHaveFocus",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canHaveFocus\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classesListWidget",
+protocol: 'widgets',
+fn: function (){
+var self=this;
+function $HLClassesListWidget(){return globals.HLClassesListWidget||(typeof HLClassesListWidget=="undefined"?nil:HLClassesListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@classesListWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@classesListWidget"]=_st($HLClassesListWidget())._on_(self._model());
+self["@classesListWidget"];
+$1=_st(self["@classesListWidget"])._next_(self._protocolsListWidget());
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classesListWidget",{},globals.HLBrowser)})},
+args: [],
+source: "classesListWidget\x0a\x09^ classesListWidget ifNil: [\x0a      \x09classesListWidget := HLClassesListWidget on: self model.\x0a\x09\x09classesListWidget next: self protocolsListWidget ]",
+messageSends: ["ifNil:", "on:", "model", "next:", "protocolsListWidget"],
+referencedClasses: ["HLClassesListWidget"]
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "environment",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._environment();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"environment",{},globals.HLBrowser)})},
+args: [],
+source: "environment\x0a\x09^ self model environment",
+messageSends: ["environment", "model"],
+referencedClasses: []
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._packagesListWidget())._focus();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLBrowser)})},
+args: [],
+source: "focus\x0a\x09^ self packagesListWidget focus",
+messageSends: ["focus", "packagesListWidget"],
+referencedClasses: []
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodsListWidget",
+protocol: 'widgets',
+fn: function (){
+var self=this;
+function $HLMethodsListWidget(){return globals.HLMethodsListWidget||(typeof HLMethodsListWidget=="undefined"?nil:HLMethodsListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@methodsListWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@methodsListWidget"]=_st($HLMethodsListWidget())._on_(self._model());
+self["@methodsListWidget"];
+$1=_st(self["@methodsListWidget"])._next_(self._sourceWidget());
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodsListWidget",{},globals.HLBrowser)})},
+args: [],
+source: "methodsListWidget\x0a\x09^ methodsListWidget ifNil: [\x0a      \x09methodsListWidget := HLMethodsListWidget on: self model.\x0a\x09\x09methodsListWidget next: self sourceWidget ]",
+messageSends: ["ifNil:", "on:", "model", "next:", "sourceWidget"],
+referencedClasses: ["HLMethodsListWidget"]
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLBrowserModel(){return globals.HLBrowserModel||(typeof HLBrowserModel=="undefined"?nil:HLBrowserModel)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@model"];
+if(($receiver = $2) == null || $receiver.isNil){
+self._model_(_st($HLBrowserModel())._new());
+$1=self["@model"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},globals.HLBrowser)})},
+args: [],
+source: "model\x0a\x09^ model ifNil: [ self model: HLBrowserModel new. model ]",
+messageSends: ["ifNil:", "model:", "new"],
+referencedClasses: ["HLBrowserModel"]
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+protocol: 'accessing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@model"]=aModel;
+self._observeModel();
+return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},globals.HLBrowser)})},
+args: ["aModel"],
+source: "model: aModel\x0a\x09model := aModel.\x0a\x09self observeModel",
+messageSends: ["observeModel"],
+referencedClasses: []
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLPackageSelected(){return globals.HLPackageSelected||(typeof HLPackageSelected=="undefined"?nil:HLPackageSelected)}
+function $HLClassSelected(){return globals.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._model();
+$ctx1.sendIdx["model"]=1;
+$1=_st($2)._announcer();
+$ctx1.sendIdx["announcer"]=1;
+_st($1)._on_send_to_($HLPackageSelected(),"onPackageSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st(_st(self._model())._announcer())._on_send_to_($HLClassSelected(),"onClassSelected:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLBrowser)})},
+args: [],
+source: "observeModel\x0a\x09self model announcer\x0a\x09\x09on: HLPackageSelected\x0a\x09\x09send: #onPackageSelected:\x0a\x09\x09to: self.\x0a\x09\x09\x0a\x09self model announcer\x0a\x09\x09on: HLClassSelected\x0a\x09\x09send: #onClassSelected:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "model"],
+referencedClasses: ["HLPackageSelected", "HLClassSelected"]
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$receiver;
+$1=_st(anAnnouncement)._item();
+if(($receiver = $1) == null || $receiver.isNil){
+$3=_st(self._model())._selectedPackage();
+if(($receiver = $3) == null || $receiver.isNil){
+$2=self._defaultTabLabel();
+} else {
+var package_;
+package_=$receiver;
+$2=_st(package_)._name();
+$ctx1.sendIdx["name"]=1;
+};
+self._setTabLabel_($2);
+$ctx1.sendIdx["setTabLabel:"]=1;
+} else {
+var item;
+item=$receiver;
+self._setTabLabel_(_st(item)._name());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onClassSelected:",{anAnnouncement:anAnnouncement},globals.HLBrowser)})},
+args: ["anAnnouncement"],
+source: "onClassSelected: anAnnouncement\x0a\x09anAnnouncement item \x0a\x09\x09ifNil: [ self setTabLabel: (self model selectedPackage \x0a\x09\x09\x09ifNil: [ self defaultTabLabel ]\x0a\x09\x09\x09ifNotNil: [ :package | package name ]) ] \x0a\x09\x09ifNotNil: [ :item | self setTabLabel: item name ]",
+messageSends: ["ifNil:ifNotNil:", "item", "setTabLabel:", "selectedPackage", "model", "defaultTabLabel", "name"],
+referencedClasses: []
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPackageSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(anAnnouncement)._item();
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+var item;
+item=$receiver;
+self._setTabLabel_(_st(item)._name());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onPackageSelected:",{anAnnouncement:anAnnouncement},globals.HLBrowser)})},
+args: ["anAnnouncement"],
+source: "onPackageSelected: anAnnouncement\x0a\x09anAnnouncement item ifNotNil: [ :item |\x0a\x09self setTabLabel: item name ]",
+messageSends: ["ifNotNil:", "item", "setTabLabel:", "name"],
+referencedClasses: []
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openClassNamed:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._openClassNamed_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"openClassNamed:",{aString:aString},globals.HLBrowser)})},
+args: ["aString"],
+source: "openClassNamed: aString\x0a\x09self model openClassNamed: aString",
+messageSends: ["openClassNamed:", "model"],
+referencedClasses: []
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openMethod:",
+protocol: 'actions',
+fn: function (aCompiledMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3,$5;
+$1=self._model();
+_st($1)._focusOnSourceCode();
+$ctx1.sendIdx["focusOnSourceCode"]=1;
+$2=$1;
+$4=_st(aCompiledMethod)._methodClass();
+$ctx1.sendIdx["methodClass"]=1;
+$3=_st($4)._package();
+_st($2)._selectedPackage_($3);
+_st($1)._selectedClass_(_st(aCompiledMethod)._methodClass());
+_st($1)._selectedProtocol_(_st(aCompiledMethod)._protocol());
+_st($1)._selectedMethod_(aCompiledMethod);
+$5=_st($1)._focusOnSourceCode();
+return self}, function($ctx1) {$ctx1.fill(self,"openMethod:",{aCompiledMethod:aCompiledMethod},globals.HLBrowser)})},
+args: ["aCompiledMethod"],
+source: "openMethod: aCompiledMethod\x0a\x09self model\x0a\x09\x09\x22Workaround for the package selection announcement when the package list is focused\x22\x09\x0a\x09\x09focusOnSourceCode;\x0a\x09\x09selectedPackage: aCompiledMethod methodClass package;\x0a\x09\x09selectedClass: aCompiledMethod methodClass;\x0a\x09\x09selectedProtocol: aCompiledMethod protocol;\x0a\x09\x09selectedMethod: aCompiledMethod;\x0a\x09\x09focusOnSourceCode",
+messageSends: ["focusOnSourceCode", "model", "selectedPackage:", "package", "methodClass", "selectedClass:", "selectedProtocol:", "protocol", "selectedMethod:"],
+referencedClasses: []
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "packagesListWidget",
+protocol: 'widgets',
+fn: function (){
+var self=this;
+function $HLPackagesListWidget(){return globals.HLPackagesListWidget||(typeof HLPackagesListWidget=="undefined"?nil:HLPackagesListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@packagesListWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@packagesListWidget"]=_st($HLPackagesListWidget())._on_(self._model());
+self["@packagesListWidget"];
+$1=_st(self["@packagesListWidget"])._next_(self._classesListWidget());
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"packagesListWidget",{},globals.HLBrowser)})},
+args: [],
+source: "packagesListWidget\x0a\x09^ packagesListWidget ifNil: [\x0a      \x09packagesListWidget := HLPackagesListWidget on: self model.\x0a\x09\x09packagesListWidget next: self classesListWidget ]",
+messageSends: ["ifNil:", "on:", "model", "next:", "classesListWidget"],
+referencedClasses: ["HLPackagesListWidget"]
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "protocolsListWidget",
+protocol: 'widgets',
+fn: function (){
+var self=this;
+function $HLProtocolsListWidget(){return globals.HLProtocolsListWidget||(typeof HLProtocolsListWidget=="undefined"?nil:HLProtocolsListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@protocolsListWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@protocolsListWidget"]=_st($HLProtocolsListWidget())._on_(self._model());
+self["@protocolsListWidget"];
+$1=_st(self["@protocolsListWidget"])._next_(self._methodsListWidget());
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"protocolsListWidget",{},globals.HLBrowser)})},
+args: [],
+source: "protocolsListWidget\x0a\x09^ protocolsListWidget ifNil: [\x0a      \x09protocolsListWidget := HLProtocolsListWidget on: self model.\x0a\x09\x09protocolsListWidget next: self methodsListWidget ]",
+messageSends: ["ifNil:", "on:", "model", "next:", "methodsListWidget"],
+referencedClasses: ["HLProtocolsListWidget"]
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerBindingsOn:",
+protocol: 'keybindings',
+fn: function (aBindingGroup){
+var self=this;
+function $HLToolCommand(){return globals.HLToolCommand||(typeof HLToolCommand=="undefined"?nil:HLToolCommand)}
+return smalltalk.withContext(function($ctx1) { 
+_st($HLToolCommand())._registerConcreteClassesOn_for_(aBindingGroup,self._model());
+return self}, function($ctx1) {$ctx1.fill(self,"registerBindingsOn:",{aBindingGroup:aBindingGroup},globals.HLBrowser)})},
+args: ["aBindingGroup"],
+source: "registerBindingsOn: aBindingGroup\x0a\x09HLToolCommand \x0a\x09\x09registerConcreteClassesOn: aBindingGroup \x0a\x09\x09for: self model",
+messageSends: ["registerConcreteClassesOn:for:", "model"],
+referencedClasses: ["HLToolCommand"]
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $HLContainer(){return globals.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
+function $HLHorizontalSplitter(){return globals.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
+function $HLVerticalSplitter(){return globals.HLVerticalSplitter||(typeof HLVerticalSplitter=="undefined"?nil:HLVerticalSplitter)}
+return smalltalk.withContext(function($ctx1) { 
+var $5,$4,$3,$2,$1;
+$5=self._packagesListWidget();
+$ctx1.sendIdx["packagesListWidget"]=1;
+$4=_st($HLVerticalSplitter())._with_with_($5,self._classesListWidget());
+$ctx1.sendIdx["with:with:"]=3;
+$3=_st($HLVerticalSplitter())._with_with_($4,_st($HLVerticalSplitter())._with_with_(self._protocolsListWidget(),self._methodsListWidget()));
+$ctx1.sendIdx["with:with:"]=2;
+$2=_st($HLHorizontalSplitter())._with_with_($3,self._sourceWidget());
+$ctx1.sendIdx["with:with:"]=1;
+$1=_st($HLContainer())._with_($2);
+_st(html)._with_($1);
+$ctx1.sendIdx["with:"]=1;
+_st(self._packagesListWidget())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLBrowser)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html with: (HLContainer with: (HLHorizontalSplitter \x0a    \x09with: (HLVerticalSplitter\x0a        \x09with: (HLVerticalSplitter\x0a            \x09with: self packagesListWidget\x0a                with: self classesListWidget)\x0a            with: (HLVerticalSplitter\x0a            \x09with: self protocolsListWidget\x0a                with: self methodsListWidget)) \x0a        with: self sourceWidget)).\x0a\x09\x0a\x09self packagesListWidget focus",
+messageSends: ["with:", "with:with:", "packagesListWidget", "classesListWidget", "protocolsListWidget", "methodsListWidget", "sourceWidget", "focus"],
+referencedClasses: ["HLContainer", "HLHorizontalSplitter", "HLVerticalSplitter"]
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sourceWidget",
+protocol: 'widgets',
+fn: function (){
+var self=this;
+function $HLBrowserBottomWidget(){return globals.HLBrowserBottomWidget||(typeof HLBrowserBottomWidget=="undefined"?nil:HLBrowserBottomWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+$2=self["@sourceWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($HLBrowserBottomWidget())._new();
+_st($3)._model_(self._model());
+$4=_st($3)._yourself();
+self["@sourceWidget"]=$4;
+$1=self["@sourceWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sourceWidget",{},globals.HLBrowser)})},
+args: [],
+source: "sourceWidget\x0a\x09^ sourceWidget ifNil: [\x0a      \x09sourceWidget := HLBrowserBottomWidget new\x0a\x09\x09\x09model: self model;\x0a\x09\x09\x09yourself ]",
+messageSends: ["ifNil:", "model:", "new", "model", "yourself"],
+referencedClasses: ["HLBrowserBottomWidget"]
+}),
+globals.HLBrowser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLBrowser.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+$ctx1.sendIdx["unregister"]=1;
+_st([self._packagesListWidget(),self._classesListWidget(),self._protocolsListWidget(),self._methodsListWidget(),self._sourceWidget()])._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._unregister();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLBrowser)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x0a\x09{ \x0a\x09\x09self packagesListWidget.\x0a\x09\x09self classesListWidget.\x0a\x09\x09self protocolsListWidget.\x0a\x09\x09self methodsListWidget.\x0a\x09\x09self sourceWidget\x0a\x09} \x0a\x09\x09do: [ :each | each unregister ]",
+messageSends: ["unregister", "do:", "packagesListWidget", "classesListWidget", "protocolsListWidget", "methodsListWidget", "sourceWidget"],
+referencedClasses: []
+}),
+globals.HLBrowser);
+
+
+globals.HLBrowser.klass.iVarNames = ['nextId'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeOpenAsTab",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canBeOpenAsTab\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowser.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextId",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=self["@nextId"];
+if(($receiver = $1) == null || $receiver.isNil){
+self["@nextId"]=(0);
+self["@nextId"];
+} else {
+$1;
+};
+$2="browser_".__comma(_st(_st(self["@nextId"]).__plus((1)))._asString());
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"nextId",{},globals.HLBrowser.klass)})},
+args: [],
+source: "nextId\x0a\x09nextId ifNil: [ nextId := 0 ].\x0a    ^ 'browser_', (nextId + 1) asString",
+messageSends: ["ifNil:", ",", "asString", "+"],
+referencedClasses: []
+}),
+globals.HLBrowser.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "browser";
+},
+args: [],
+source: "tabClass\x0a\x09^ 'browser'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowser.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Browser";
+},
+args: [],
+source: "tabLabel\x0a\x09^ 'Browser'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowser.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabPriority",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return (0);
+},
+args: [],
+source: "tabPriority\x0a\x09^ 0",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowser.klass);
+
+
+smalltalk.addClass('HLBrowserBottomWidget', globals.HLWidget, ['model', 'codeWidget', 'documentationWidget'], 'Helios-Browser');
+globals.HLBrowserBottomWidget.comment="I render the code area of a browser and optionally the documentation for the selected class.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canHaveFocus",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canHaveFocus\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "codeWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLBrowserCodeWidget(){return globals.HLBrowserCodeWidget||(typeof HLBrowserCodeWidget=="undefined"?nil:HLBrowserCodeWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+$2=self["@codeWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($HLBrowserCodeWidget())._new();
+_st($3)._browserModel_(self._model());
+$4=_st($3)._yourself();
+self["@codeWidget"]=$4;
+$1=self["@codeWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"codeWidget",{},globals.HLBrowserBottomWidget)})},
+args: [],
+source: "codeWidget\x0a\x09^ codeWidget ifNil: [ codeWidget := HLBrowserCodeWidget new\x0a\x09\x09browserModel: self model;\x0a\x09\x09yourself ]",
+messageSends: ["ifNil:", "browserModel:", "new", "model", "yourself"],
+referencedClasses: ["HLBrowserCodeWidget"]
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "documentationWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLDocumentationWidget(){return globals.HLDocumentationWidget||(typeof HLDocumentationWidget=="undefined"?nil:HLDocumentationWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+$2=self["@documentationWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($HLDocumentationWidget())._new();
+_st($3)._model_(self._model());
+$4=_st($3)._yourself();
+self["@documentationWidget"]=$4;
+$1=self["@documentationWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"documentationWidget",{},globals.HLBrowserBottomWidget)})},
+args: [],
+source: "documentationWidget\x0a\x09^ documentationWidget ifNil: [ documentationWidget := HLDocumentationWidget new\x0a\x09\x09model: self model;\x0a\x09\x09yourself ]",
+messageSends: ["ifNil:", "model:", "new", "model", "yourself"],
+referencedClasses: ["HLDocumentationWidget"]
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._codeWidget())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLBrowserBottomWidget)})},
+args: [],
+source: "focus\x0a\x09self codeWidget focus",
+messageSends: ["focus", "codeWidget"],
+referencedClasses: []
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@model"];
+return $1;
+},
+args: [],
+source: "model\x0a\x09^ model",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+protocol: 'accessing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@model"]=aModel;
+self._observeModel();
+return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},globals.HLBrowserBottomWidget)})},
+args: ["aModel"],
+source: "model: aModel\x0a\x09model := aModel.\x0a\x09self observeModel",
+messageSends: ["observeModel"],
+referencedClasses: []
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLShowInstanceToggled(){return globals.HLShowInstanceToggled||(typeof HLShowInstanceToggled=="undefined"?nil:HLShowInstanceToggled)}
+function $HLShowCommentToggled(){return globals.HLShowCommentToggled||(typeof HLShowCommentToggled=="undefined"?nil:HLShowCommentToggled)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._announcer();
+_st($1)._on_send_to_($HLShowInstanceToggled(),"onShowInstanceToggled",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+$2=_st($1)._on_send_to_($HLShowCommentToggled(),"onShowCommentToggled",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLBrowserBottomWidget)})},
+args: [],
+source: "observeModel\x0a\x09self model announcer \x0a\x09\x09on: HLShowInstanceToggled\x0a\x09\x09send: #onShowInstanceToggled\x0a\x09\x09to: self;\x0a\x09\x09on: HLShowCommentToggled\x0a\x09\x09send: #onShowCommentToggled\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "model"],
+referencedClasses: ["HLShowInstanceToggled", "HLShowCommentToggled"]
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onShowCommentToggled",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onShowCommentToggled",{},globals.HLBrowserBottomWidget)})},
+args: [],
+source: "onShowCommentToggled\x0a\x09self refresh",
+messageSends: ["refresh"],
+referencedClasses: []
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onShowInstanceToggled",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onShowInstanceToggled",{},globals.HLBrowserBottomWidget)})},
+args: [],
+source: "onShowInstanceToggled\x0a\x09self refresh",
+messageSends: ["refresh"],
+referencedClasses: []
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "previous",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "previous\x0a\x09\x22For navigation\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "previous:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+return self},
+args: ["aWidget"],
+source: "previous: aWidget\x0a\x09\x22For navigation\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._showComment();
+if(smalltalk.assert($1)){
+self._renderPanesOn_(html);
+} else {
+_st(html)._with_(self._codeWidget());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLBrowserBottomWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09self model showComment \x0a\x09\x09ifTrue: [ self renderPanesOn: html ]\x0a\x09\x09ifFalse: [ html with: self codeWidget ]",
+messageSends: ["ifTrue:ifFalse:", "showComment", "model", "renderPanesOn:", "with:", "codeWidget"],
+referencedClasses: []
+}),
+globals.HLBrowserBottomWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderPanesOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $HLVerticalSplitter(){return globals.HLVerticalSplitter||(typeof HLVerticalSplitter=="undefined"?nil:HLVerticalSplitter)}
+return smalltalk.withContext(function($ctx1) { 
+_st(html)._with_(_st($HLVerticalSplitter())._with_with_(self._codeWidget(),self._documentationWidget()));
+return self}, function($ctx1) {$ctx1.fill(self,"renderPanesOn:",{html:html},globals.HLBrowserBottomWidget)})},
+args: ["html"],
+source: "renderPanesOn: html\x0a\x09html with: (HLVerticalSplitter\x0a\x09\x09with: self codeWidget\x0a\x09\x09with: self documentationWidget)",
+messageSends: ["with:", "with:with:", "codeWidget", "documentationWidget"],
+referencedClasses: ["HLVerticalSplitter"]
+}),
+globals.HLBrowserBottomWidget);
+
+
+
+smalltalk.addClass('HLBrowserModel', globals.HLToolModel, ['showInstance', 'showComment'], 'Helios-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "editComment",
+protocol: 'commands actions',
+fn: function (){
+var self=this;
+function $HLEditComment(){return globals.HLEditComment||(typeof HLEditComment=="undefined"?nil:HLEditComment)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLEditComment())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"editComment",{},globals.HLBrowserModel)})},
+args: [],
+source: "editComment\x0a\x09self announcer announce: HLEditComment new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLEditComment"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusOnClasses",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLClassesFocusRequested(){return globals.HLClassesFocusRequested||(typeof HLClassesFocusRequested=="undefined"?nil:HLClassesFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLClassesFocusRequested())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"focusOnClasses",{},globals.HLBrowserModel)})},
+args: [],
+source: "focusOnClasses\x0a\x09self announcer announce: HLClassesFocusRequested new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLClassesFocusRequested"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusOnDocumentation",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDocumentationFocusRequested(){return globals.HLDocumentationFocusRequested||(typeof HLDocumentationFocusRequested=="undefined"?nil:HLDocumentationFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLDocumentationFocusRequested())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"focusOnDocumentation",{},globals.HLBrowserModel)})},
+args: [],
+source: "focusOnDocumentation\x0a\x09self announcer announce: HLDocumentationFocusRequested new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLDocumentationFocusRequested"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusOnMethods",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLMethodsFocusRequested(){return globals.HLMethodsFocusRequested||(typeof HLMethodsFocusRequested=="undefined"?nil:HLMethodsFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLMethodsFocusRequested())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"focusOnMethods",{},globals.HLBrowserModel)})},
+args: [],
+source: "focusOnMethods\x0a\x09self announcer announce: HLMethodsFocusRequested new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLMethodsFocusRequested"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusOnPackages",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLPackagesFocusRequested(){return globals.HLPackagesFocusRequested||(typeof HLPackagesFocusRequested=="undefined"?nil:HLPackagesFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLPackagesFocusRequested())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"focusOnPackages",{},globals.HLBrowserModel)})},
+args: [],
+source: "focusOnPackages\x0a\x09self announcer announce: HLPackagesFocusRequested new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLPackagesFocusRequested"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusOnProtocols",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLProtocolsFocusRequested(){return globals.HLProtocolsFocusRequested||(typeof HLProtocolsFocusRequested=="undefined"?nil:HLProtocolsFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLProtocolsFocusRequested())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"focusOnProtocols",{},globals.HLBrowserModel)})},
+args: [],
+source: "focusOnProtocols\x0a\x09self announcer announce: HLProtocolsFocusRequested new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLProtocolsFocusRequested"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusOnSourceCode",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLSourceCodeFocusRequested(){return globals.HLSourceCodeFocusRequested||(typeof HLSourceCodeFocusRequested=="undefined"?nil:HLSourceCodeFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLSourceCodeFocusRequested())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"focusOnSourceCode",{},globals.HLBrowserModel)})},
+args: [],
+source: "focusOnSourceCode\x0a\x09self announcer announce: HLSourceCodeFocusRequested new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLSourceCodeFocusRequested"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBrowserModel",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isBrowserModel\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setClassComment:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._environment())._setClassCommentOf_to_(_st(self._selectedClass())._theNonMetaClass(),aString);
+return self}, function($ctx1) {$ctx1.fill(self,"setClassComment:",{aString:aString},globals.HLBrowserModel)})},
+args: ["aString"],
+source: "setClassComment: aString\x0a\x09self environment\x0a\x09\x09setClassCommentOf: self selectedClass theNonMetaClass\x0a\x09\x09to: aString",
+messageSends: ["setClassCommentOf:to:", "environment", "theNonMetaClass", "selectedClass"],
+referencedClasses: []
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showClassTemplate",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLShowTemplate(){return globals.HLShowTemplate||(typeof HLShowTemplate=="undefined"?nil:HLShowTemplate)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+$1=self._selectedPackage();
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+var package_;
+package_=$receiver;
+$2=_st($HLShowTemplate())._new();
+_st($2)._template_(_st(package_)._classTemplate());
+$3=_st($2)._yourself();
+_st(self._announcer())._announce_($3);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"showClassTemplate",{},globals.HLBrowserModel)})},
+args: [],
+source: "showClassTemplate\x0a\x09self selectedPackage ifNotNil: [ :package |\x0a\x09\x09self announcer announce: (HLShowTemplate new\x0a\x09\x09\x09template: package classTemplate;\x0a\x09\x09\x09yourself) ]",
+messageSends: ["ifNotNil:", "selectedPackage", "announce:", "announcer", "template:", "new", "classTemplate", "yourself"],
+referencedClasses: ["HLShowTemplate"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showComment",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@showComment"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=true;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"showComment",{},globals.HLBrowserModel)})},
+args: [],
+source: "showComment\x0a\x09^ showComment ifNil: [ true ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showComment:",
+protocol: 'accessing',
+fn: function (aBoolean){
+var self=this;
+function $HLShowCommentToggled(){return globals.HLShowCommentToggled||(typeof HLShowCommentToggled=="undefined"?nil:HLShowCommentToggled)}
+return smalltalk.withContext(function($ctx1) { 
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+self["@showComment"]=aBoolean;
+self["@showComment"];
+return _st(self._announcer())._announce_(_st($HLShowCommentToggled())._new());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"showComment:",{aBoolean:aBoolean},globals.HLBrowserModel)})},
+args: ["aBoolean"],
+source: "showComment: aBoolean\x0a\x09self withChangesDo: [\x0a\x09\x09showComment := aBoolean.\x0a\x09\x09self announcer announce: HLShowCommentToggled new ]",
+messageSends: ["withChangesDo:", "announce:", "announcer", "new"],
+referencedClasses: ["HLShowCommentToggled"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showInstance",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@showInstance"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=true;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"showInstance",{},globals.HLBrowserModel)})},
+args: [],
+source: "showInstance\x0a\x09^ showInstance ifNil: [ true ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showInstance:",
+protocol: 'accessing',
+fn: function (aBoolean){
+var self=this;
+function $HLShowInstanceToggled(){return globals.HLShowInstanceToggled||(typeof HLShowInstanceToggled=="undefined"?nil:HLShowInstanceToggled)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$receiver;
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+self["@showInstance"]=aBoolean;
+self["@showInstance"];
+$1=self._selectedClass();
+$ctx2.sendIdx["selectedClass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+if(smalltalk.assert(aBoolean)){
+$3=self._selectedClass();
+$ctx2.sendIdx["selectedClass"]=2;
+$2=_st($3)._theNonMetaClass();
+} else {
+$2=_st(self._selectedClass())._theMetaClass();
+};
+self._selectedClass_($2);
+};
+return _st(self._announcer())._announce_(_st($HLShowInstanceToggled())._new());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"showInstance:",{aBoolean:aBoolean},globals.HLBrowserModel)})},
+args: ["aBoolean"],
+source: "showInstance: aBoolean\x0a\x0a\x09self withChangesDo: [\x0a\x09\x09showInstance := aBoolean.\x0a\x0a    \x09self selectedClass ifNotNil: [\x0a    \x09\x09self selectedClass: (aBoolean\x0a    \x09\x09\x09ifTrue: [ self selectedClass theNonMetaClass ]\x0a\x09    \x09  \x09ifFalse: [ self selectedClass theMetaClass ]) ].\x0a    \x0a\x09\x09self announcer announce: HLShowInstanceToggled new ]",
+messageSends: ["withChangesDo:", "ifNotNil:", "selectedClass", "selectedClass:", "ifTrue:ifFalse:", "theNonMetaClass", "theMetaClass", "announce:", "announcer", "new"],
+referencedClasses: ["HLShowInstanceToggled"]
+}),
+globals.HLBrowserModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showMethodTemplate",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLShowTemplate(){return globals.HLShowTemplate||(typeof HLShowTemplate=="undefined"?nil:HLShowTemplate)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+$1=self._selectedClass();
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+var theClass;
+theClass=$receiver;
+$2=_st($HLShowTemplate())._new();
+_st($2)._template_(_st(theClass)._methodTemplate());
+$3=_st($2)._yourself();
+_st(self._announcer())._announce_($3);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"showMethodTemplate",{},globals.HLBrowserModel)})},
+args: [],
+source: "showMethodTemplate\x0a\x09self selectedClass ifNotNil: [ :theClass |\x0a\x09\x09self announcer announce: (HLShowTemplate new\x0a\x09\x09\x09template: theClass methodTemplate;\x0a\x09\x09\x09yourself) ]",
+messageSends: ["ifNotNil:", "selectedClass", "announce:", "announcer", "template:", "new", "methodTemplate", "yourself"],
+referencedClasses: ["HLShowTemplate"]
+}),
+globals.HLBrowserModel);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (anEnvironment){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._environment_(anEnvironment);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment},globals.HLBrowserModel.klass)})},
+args: ["anEnvironment"],
+source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a    \x09environment: anEnvironment;\x0a        yourself",
+messageSends: ["environment:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLBrowserModel.klass);
+
+
+smalltalk.addClass('HLClassCache', globals.Object, ['class', 'selectorsCache', 'overrideCache', 'overriddenCache'], 'Helios-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "invalidateChildrenSelector:",
+protocol: 'actions',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st(_st(self._theClass())._subclasses())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(self._selectorsCache())._cacheFor_(each);
+_st($1)._removeSelector_(aSelector);
+$2=_st($1)._invalidateChildrenSelector_(aSelector);
+return $2;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"invalidateChildrenSelector:",{aSelector:aSelector},globals.HLClassCache)})},
+args: ["aSelector"],
+source: "invalidateChildrenSelector: aSelector\x0a\x09self theClass subclasses do: [ :each |\x0a    \x09(self selectorsCache cacheFor: each)\x0a        \x09removeSelector: aSelector;\x0a        \x09invalidateChildrenSelector: aSelector ]",
+messageSends: ["do:", "subclasses", "theClass", "removeSelector:", "cacheFor:", "selectorsCache", "invalidateChildrenSelector:"],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "invalidateParentSelector:",
+protocol: 'actions',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$4,$receiver;
+$2=self._theClass();
+$ctx1.sendIdx["theClass"]=1;
+$1=_st($2)._superclass();
+$ctx1.sendIdx["superclass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+$3=_st(self._selectorsCache())._cacheFor_(_st(self._theClass())._superclass());
+_st($3)._removeSelector_(aSelector);
+$4=_st($3)._invalidateParentSelector_(aSelector);
+$4;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"invalidateParentSelector:",{aSelector:aSelector},globals.HLClassCache)})},
+args: ["aSelector"],
+source: "invalidateParentSelector: aSelector\x0a\x09self theClass superclass ifNotNil: [\x0a    \x09(self selectorsCache cacheFor: self theClass superclass)\x0a        \x09removeSelector: aSelector;\x0a\x09\x09\x09invalidateParentSelector: aSelector ]",
+messageSends: ["ifNotNil:", "superclass", "theClass", "removeSelector:", "cacheFor:", "selectorsCache", "invalidateParentSelector:"],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "invalidateSelector:",
+protocol: 'actions',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._invalidateParentSelector_(aSelector);
+self._invalidateChildrenSelector_(aSelector);
+$1=self._removeSelector_(aSelector);
+return self}, function($ctx1) {$ctx1.fill(self,"invalidateSelector:",{aSelector:aSelector},globals.HLClassCache)})},
+args: ["aSelector"],
+source: "invalidateSelector: aSelector\x0a\x09self \x0a    \x09invalidateParentSelector: aSelector;\x0a        invalidateChildrenSelector: aSelector;\x0a        removeSelector: aSelector",
+messageSends: ["invalidateParentSelector:", "invalidateChildrenSelector:", "removeSelector:"],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isOverridden:",
+protocol: 'testing',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._overriddenCache())._at_ifAbsentPut_(_st(aMethod)._selector(),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aMethod)._isOverridden();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isOverridden:",{aMethod:aMethod},globals.HLClassCache)})},
+args: ["aMethod"],
+source: "isOverridden: aMethod\x0a\x09^ self overriddenCache \x0a    \x09at: aMethod selector\x0a      \x09ifAbsentPut: [ aMethod isOverridden ]",
+messageSends: ["at:ifAbsentPut:", "overriddenCache", "selector", "isOverridden"],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isOverride:",
+protocol: 'testing',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._overrideCache())._at_ifAbsentPut_(_st(aMethod)._selector(),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aMethod)._isOverride();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isOverride:",{aMethod:aMethod},globals.HLClassCache)})},
+args: ["aMethod"],
+source: "isOverride: aMethod\x0a\x09^ self overrideCache\x0a    \x09at: aMethod selector\x0a      \x09ifAbsentPut: [ aMethod isOverride ]",
+messageSends: ["at:ifAbsentPut:", "overrideCache", "selector", "isOverride"],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "overriddenCache",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@overriddenCache"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@overriddenCache"]=_st($HashedCollection())._new();
+$1=self["@overriddenCache"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"overriddenCache",{},globals.HLClassCache)})},
+args: [],
+source: "overriddenCache\x0a\x09^ overriddenCache ifNil: [ overriddenCache := HashedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "overrideCache",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@overrideCache"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@overrideCache"]=_st($HashedCollection())._new();
+$1=self["@overrideCache"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"overrideCache",{},globals.HLClassCache)})},
+args: [],
+source: "overrideCache\x0a\x09^ overrideCache ifNil: [ overrideCache := HashedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeSelector:",
+protocol: 'private',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._overriddenCache())._removeKey_ifAbsent_(aSelector,(function(){
+}));
+$ctx1.sendIdx["removeKey:ifAbsent:"]=1;
+_st(self._overrideCache())._removeKey_ifAbsent_(aSelector,(function(){
+}));
+return self}, function($ctx1) {$ctx1.fill(self,"removeSelector:",{aSelector:aSelector},globals.HLClassCache)})},
+args: ["aSelector"],
+source: "removeSelector: aSelector\x0a\x09self overriddenCache \x0a    \x09removeKey: aSelector\x0a        ifAbsent: [ ].\x0a    self overrideCache \x0a    \x09removeKey: aSelector\x0a        ifAbsent: [ ]",
+messageSends: ["removeKey:ifAbsent:", "overriddenCache", "overrideCache"],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectorsCache",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selectorsCache"];
+return $1;
+},
+args: [],
+source: "selectorsCache\x0a\x09^ selectorsCache",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectorsCache:",
+protocol: 'accessing',
+fn: function (aCache){
+var self=this;
+self["@selectorsCache"]=aCache;
+return self},
+args: ["aCache"],
+source: "selectorsCache: aCache\x0a\x09selectorsCache := aCache",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@class"];
+return $1;
+},
+args: [],
+source: "theClass\x0a\x09^ class",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@class"]=aClass;
+return self},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09class := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLClassCache);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:selectorsCache:",
+protocol: 'instance creation',
+fn: function (aClass,aSelectorsCache){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._theClass_(aClass);
+_st($2)._selectorsCache_(aSelectorsCache);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:selectorsCache:",{aClass:aClass,aSelectorsCache:aSelectorsCache},globals.HLClassCache.klass)})},
+args: ["aClass", "aSelectorsCache"],
+source: "on: aClass selectorsCache: aSelectorsCache\x0a\x09^ self new\x0a    \x09theClass: aClass;\x0a        selectorsCache: aSelectorsCache;\x0a        yourself",
+messageSends: ["theClass:", "new", "selectorsCache:", "yourself"],
+referencedClasses: []
+}),
+globals.HLClassCache.klass);
+
+
+smalltalk.addClass('HLClassesListWidget', globals.HLToolListWidget, [], 'Helios-Browser');
+globals.HLClassesListWidget.comment="I render a list of classes in the selected package.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClassForItem:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(aClass)._theNonMetaClass())._heliosClass();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cssClassForItem:",{aClass:aClass},globals.HLClassesListWidget)})},
+args: ["aClass"],
+source: "cssClassForItem: aClass\x0a\x09^ aClass theNonMetaClass heliosClass",
+messageSends: ["heliosClass", "theNonMetaClass"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+($ctx1.supercall = true, globals.HLClassesListWidget.superclass.fn.prototype._focus.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=self._selectedItem();
+if(($receiver = $1) == null || $receiver.isNil){
+_st(self._model())._showClassTemplate();
+} else {
+$1;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLClassesListWidget)})},
+args: [],
+source: "focus\x0a\x09super focus.\x0a\x09\x0a\x09self selectedItem \x0a\x09\x09ifNil: [ self model showClassTemplate ]",
+messageSends: ["focus", "ifNil:", "selectedItem", "showClassTemplate", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusMethodsListWidget",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLMethodsListFocus(){return globals.HLMethodsListFocus||(typeof HLMethodsListFocus=="undefined"?nil:HLMethodsListFocus)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._model())._announcer())._announce_(_st($HLMethodsListFocus())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"focusMethodsListWidget",{},globals.HLClassesListWidget)})},
+args: [],
+source: "focusMethodsListWidget\x0a\x09self model announcer announce: HLMethodsListFocus new",
+messageSends: ["announce:", "announcer", "model", "new"],
+referencedClasses: ["HLMethodsListFocus"]
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusProtocolsListWidget",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLProtocolsListFocus(){return globals.HLProtocolsListFocus||(typeof HLProtocolsListFocus=="undefined"?nil:HLProtocolsListFocus)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._model())._announcer())._announce_(_st($HLProtocolsListFocus())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"focusProtocolsListWidget",{},globals.HLClassesListWidget)})},
+args: [],
+source: "focusProtocolsListWidget\x0a\x09self model announcer announce: HLProtocolsListFocus new",
+messageSends: ["announce:", "announcer", "model", "new"],
+referencedClasses: ["HLProtocolsListFocus"]
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "getChildrenOf:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._items())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._superclass()).__eq(aClass);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"getChildrenOf:",{aClass:aClass},globals.HLClassesListWidget)})},
+args: ["aClass"],
+source: "getChildrenOf: aClass\x0a\x09^ self items select: [ :each | each superclass = aClass ]",
+messageSends: ["select:", "items", "=", "superclass"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "getRootClassesOf:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aCollection)._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(aCollection)._includes_(_st(each)._superclass()))._not();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"getRootClassesOf:",{aCollection:aCollection},globals.HLClassesListWidget)})},
+args: ["aCollection"],
+source: "getRootClassesOf: aCollection\x0a\x09^ aCollection select: [ :each |\x0a    \x09\x09(aCollection includes: each superclass) not ]",
+messageSends: ["select:", "not", "includes:", "superclass"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Classes";
+},
+args: [],
+source: "label\x0a\x09^ 'Classes'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLPackageSelected(){return globals.HLPackageSelected||(typeof HLPackageSelected=="undefined"?nil:HLPackageSelected)}
+function $HLShowInstanceToggled(){return globals.HLShowInstanceToggled||(typeof HLShowInstanceToggled=="undefined"?nil:HLShowInstanceToggled)}
+function $HLShowCommentToggled(){return globals.HLShowCommentToggled||(typeof HLShowCommentToggled=="undefined"?nil:HLShowCommentToggled)}
+function $HLClassSelected(){return globals.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
+function $HLClassesFocusRequested(){return globals.HLClassesFocusRequested||(typeof HLClassesFocusRequested=="undefined"?nil:HLClassesFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._announcer();
+_st($1)._on_send_to_($HLPackageSelected(),"onPackageSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st($1)._on_send_to_($HLShowInstanceToggled(),"onShowInstanceToggled",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+_st($1)._on_send_to_($HLShowCommentToggled(),"onShowCommentToggled",self);
+$ctx1.sendIdx["on:send:to:"]=3;
+_st($1)._on_send_to_($HLClassSelected(),"onClassSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=4;
+$2=_st($1)._on_send_to_($HLClassesFocusRequested(),"onClassesFocusRequested",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLClassesListWidget)})},
+args: [],
+source: "observeModel\x0a\x09self model announcer \x0a    \x09on: HLPackageSelected\x0a\x09\x09send: #onPackageSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: HLShowInstanceToggled \x0a\x09\x09send: #onShowInstanceToggled\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLShowCommentToggled\x0a\x09\x09send: #onShowCommentToggled\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLClassSelected\x0a\x09\x09send: #onClassSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLClassesFocusRequested\x0a\x09\x09send: #onClassesFocusRequested\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "model"],
+referencedClasses: ["HLPackageSelected", "HLShowInstanceToggled", "HLShowCommentToggled", "HLClassSelected", "HLClassesFocusRequested"]
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeSystem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
+function $ClassRemoved(){return globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
+function $ClassMoved(){return globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
+function $ClassRenamed(){return globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
+function $ClassMigrated(){return globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
+function $ClassCommentChanged(){return globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._systemAnnouncer();
+_st($1)._on_send_to_($ClassAdded(),"onClassAdded:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st($1)._on_send_to_($ClassRemoved(),"onClassRemoved:",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+_st($1)._on_send_to_($ClassMoved(),"onClassMoved:",self);
+$ctx1.sendIdx["on:send:to:"]=3;
+_st($1)._on_send_to_($ClassRenamed(),"onClassRenamed:",self);
+$ctx1.sendIdx["on:send:to:"]=4;
+_st($1)._on_send_to_($ClassMigrated(),"onClassMigrated:",self);
+$ctx1.sendIdx["on:send:to:"]=5;
+$2=_st($1)._on_send_to_($ClassCommentChanged(),"onClassCommentChanged:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.HLClassesListWidget)})},
+args: [],
+source: "observeSystem\x0a\x09self model systemAnnouncer\x0a    \x09on: ClassAdded\x0a\x09\x09send: #onClassAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a        on: ClassRemoved\x0a        send: #onClassRemoved:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassMoved\x0a\x09\x09send: #onClassMoved:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassRenamed\x0a\x09\x09send: #onClassRenamed:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassMigrated\x0a\x09\x09send: #onClassMigrated:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassCommentChanged\x0a        send: #onClassCommentChanged:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "systemAnnouncer", "model"],
+referencedClasses: ["ClassAdded", "ClassRemoved", "ClassMoved", "ClassRenamed", "ClassMigrated", "ClassCommentChanged"]
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassAdded:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var class_;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+class_=_st(anAnnouncement)._theClass();
+$1=_st(_st(_st(class_)._package()).__eq(_st(self._model())._selectedPackage()))._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._items())._includes_(class_);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(! smalltalk.assert($1)){
+return self;
+};
+self._setItemsForSelectedPackage();
+self._refresh();
+$2=self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onClassAdded:",{anAnnouncement:anAnnouncement,class_:class_},globals.HLClassesListWidget)})},
+args: ["anAnnouncement"],
+source: "onClassAdded: anAnnouncement\x0a\x09| class |\x0a\x09\x0a\x09class := anAnnouncement theClass.\x0a\x09\x0a\x09(class package = self model selectedPackage or: [\x0a\x09\x09self items includes: class ]) ifFalse: [ ^ self ].\x0a    \x0a    self \x0a\x09\x09setItemsForSelectedPackage;\x0a\x09\x09refresh;\x0a\x09\x09focus",
+messageSends: ["theClass", "ifFalse:", "or:", "=", "package", "selectedPackage", "model", "includes:", "items", "setItemsForSelectedPackage", "refresh", "focus"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassCommentChanged:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var class_;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+class_=_st(anAnnouncement)._theClass();
+$1=_st(_st(class_)._package()).__eq(_st(self._model())._selectedPackage());
+if(! smalltalk.assert($1)){
+return self;
+};
+self._refresh();
+$2=self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onClassCommentChanged:",{anAnnouncement:anAnnouncement,class_:class_},globals.HLClassesListWidget)})},
+args: ["anAnnouncement"],
+source: "onClassCommentChanged: anAnnouncement\x0a\x09| class |\x0a\x09class := anAnnouncement theClass.\x0a\x0a\x09class package = self model selectedPackage ifFalse: [ ^ self ].\x0a    \x0a    self \x0a\x09\x09refresh;\x0a\x09\x09focus",
+messageSends: ["theClass", "ifFalse:", "=", "package", "selectedPackage", "model", "refresh", "focus"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassMigrated:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var class_,oldClass;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$4,$3,$2,$5;
+class_=_st(anAnnouncement)._theClass();
+oldClass=_st(anAnnouncement)._oldClass();
+$1=_st(self._items())._includes_(oldClass);
+if(! smalltalk.assert($1)){
+return self;
+};
+$4=self._model();
+$ctx1.sendIdx["model"]=1;
+$3=_st($4)._selectedClass();
+$2=_st($3).__eq(oldClass);
+if(smalltalk.assert($2)){
+_st(self._model())._selectedClass_(class_);
+};
+self._setItemsForSelectedPackage();
+self._refresh();
+$5=self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onClassMigrated:",{anAnnouncement:anAnnouncement,class_:class_,oldClass:oldClass},globals.HLClassesListWidget)})},
+args: ["anAnnouncement"],
+source: "onClassMigrated: anAnnouncement\x0a\x09| class oldClass |\x0a\x09\x0a\x09class := anAnnouncement theClass.\x0a\x09oldClass := anAnnouncement oldClass.\x0a\x0a\x09(self items includes: oldClass) ifFalse: [ ^ self ].\x0a\x0a\x09self model selectedClass = oldClass ifTrue: [\x0a\x09\x09self model selectedClass: class ].\x0a    \x0a    self setItemsForSelectedPackage.\x0a    self \x0a\x09\x09refresh;\x0a\x09\x09focus",
+messageSends: ["theClass", "oldClass", "ifFalse:", "includes:", "items", "ifTrue:", "=", "selectedClass", "model", "selectedClass:", "setItemsForSelectedPackage", "refresh", "focus"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassMoved:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var class_,oldPackage;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$5,$4,$2,$6,$8,$7,$1,$9,$10,$11;
+class_=_st(anAnnouncement)._theClass();
+oldPackage=_st(anAnnouncement)._oldPackage();
+$3=oldPackage;
+$5=self._model();
+$ctx1.sendIdx["model"]=1;
+$4=_st($5)._selectedPackage();
+$ctx1.sendIdx["selectedPackage"]=1;
+$2=_st($3).__eq($4);
+$ctx1.sendIdx["="]=1;
+$1=_st($2)._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+$6=_st(class_)._package();
+$8=self._model();
+$ctx2.sendIdx["model"]=2;
+$7=_st($8)._selectedPackage();
+$ctx2.sendIdx["selectedPackage"]=2;
+return _st($6).__eq($7);
+$ctx2.sendIdx["="]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(! smalltalk.assert($1)){
+return self;
+};
+$9=_st(oldPackage).__eq(_st(self._model())._selectedPackage());
+if(smalltalk.assert($9)){
+self._selectedItem_(nil);
+$10=self._selectItem_(nil);
+$10;
+};
+self._setItemsForSelectedPackage();
+self._refresh();
+$11=self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onClassMoved:",{anAnnouncement:anAnnouncement,class_:class_,oldPackage:oldPackage},globals.HLClassesListWidget)})},
+args: ["anAnnouncement"],
+source: "onClassMoved: anAnnouncement\x0a\x09| class oldPackage |\x0a\x09\x0a\x09class := anAnnouncement theClass.\x0a\x09oldPackage := anAnnouncement oldPackage.\x0a\x09\x0a\x09(oldPackage = self model selectedPackage or: [\x0a\x09\x09class package = self model selectedPackage ])\x0a\x09\x09\x09ifFalse: [ ^ self ].\x0a\x09\x0a\x09oldPackage = self model selectedPackage ifTrue: [ \x0a\x09\x09self \x0a\x09\x09\x09selectedItem: nil;\x0a\x09\x09\x09selectItem: nil ].\x0a    \x0a    self setItemsForSelectedPackage.\x0a    self \x09\x0a\x09\x09refresh;\x0a\x09\x09focus",
+messageSends: ["theClass", "oldPackage", "ifFalse:", "or:", "=", "selectedPackage", "model", "package", "ifTrue:", "selectedItem:", "selectItem:", "setItemsForSelectedPackage", "refresh", "focus"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassRemoved:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var class_;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+class_=_st(anAnnouncement)._theClass();
+$1=_st(_st(class_)._package()).__eq(_st(self._model())._selectedPackage());
+if(! smalltalk.assert($1)){
+return self;
+};
+self._selectItem_(nil);
+$2=self._selectedItem_(nil);
+self._setItemsForSelectedPackage();
+self._refresh();
+$3=self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onClassRemoved:",{anAnnouncement:anAnnouncement,class_:class_},globals.HLClassesListWidget)})},
+args: ["anAnnouncement"],
+source: "onClassRemoved: anAnnouncement\x0a\x09| class |\x0a\x09class := anAnnouncement theClass.\x0a\x0a\x09class package = self model selectedPackage ifFalse: [ ^ self ].\x0a    \x0a\x09self \x0a\x09\x09selectItem: nil;\x0a\x09\x09selectedItem: nil.\x0a    self setItemsForSelectedPackage.\x0a    self \x0a\x09\x09refresh;\x0a\x09\x09focus",
+messageSends: ["theClass", "ifFalse:", "=", "package", "selectedPackage", "model", "selectItem:", "selectedItem:", "setItemsForSelectedPackage", "refresh", "focus"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassRenamed:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(_st(_st(anAnnouncement)._theClass())._package()).__eq(_st(self._model())._selectedPackage());
+if(! smalltalk.assert($1)){
+return self;
+};
+self._setItemsForSelectedPackage();
+self._refresh();
+$2=self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onClassRenamed:",{anAnnouncement:anAnnouncement},globals.HLClassesListWidget)})},
+args: ["anAnnouncement"],
+source: "onClassRenamed: anAnnouncement\x0a\x09anAnnouncement theClass package = self model selectedPackage ifFalse: [ ^ self ].\x0a    \x0a    self setItemsForSelectedPackage.\x0a    self \x0a\x09\x09refresh;\x0a\x09\x09focus",
+messageSends: ["ifFalse:", "=", "package", "theClass", "selectedPackage", "model", "setItemsForSelectedPackage", "refresh", "focus"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var selectedClass;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+$1=_st(anAnnouncement)._item();
+$ctx1.sendIdx["item"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return self;
+} else {
+$1;
+};
+selectedClass=_st(_st(anAnnouncement)._item())._theNonMetaClass();
+self._selectedItem_(selectedClass);
+$2=self._hasFocus();
+if(! smalltalk.assert($2)){
+self._activateItem_(selectedClass);
+$3=self._focus();
+$3;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onClassSelected:",{anAnnouncement:anAnnouncement,selectedClass:selectedClass},globals.HLClassesListWidget)})},
+args: ["anAnnouncement"],
+source: "onClassSelected: anAnnouncement\x0a\x09| selectedClass |\x0a\x09\x0a\x09anAnnouncement item ifNil: [ ^ self ].\x0a\x09\x0a\x09selectedClass := anAnnouncement item theNonMetaClass.\x0a\x09self selectedItem: selectedClass.\x0a\x0a\x09self hasFocus ifFalse: [\x0a\x09\x09self \x0a\x09\x09\x09activateItem: selectedClass;\x0a\x09\x09\x09focus ]",
+messageSends: ["ifNil:", "item", "theNonMetaClass", "selectedItem:", "ifFalse:", "hasFocus", "activateItem:", "focus"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassesFocusRequested",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onClassesFocusRequested",{},globals.HLClassesListWidget)})},
+args: [],
+source: "onClassesFocusRequested\x0a\x09self focus",
+messageSends: ["focus"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPackageSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selectedItem_(nil);
+self._setItemsForSelectedPackage();
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onPackageSelected:",{anAnnouncement:anAnnouncement},globals.HLClassesListWidget)})},
+args: ["anAnnouncement"],
+source: "onPackageSelected: anAnnouncement\x0a    self selectedItem: nil.\x0a    \x0a    self setItemsForSelectedPackage.\x0a    self refresh",
+messageSends: ["selectedItem:", "setItemsForSelectedPackage", "refresh"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onShowCommentToggled",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onShowCommentToggled",{},globals.HLClassesListWidget)})},
+args: [],
+source: "onShowCommentToggled\x0a\x09self refresh",
+messageSends: ["refresh"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onShowInstanceToggled",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onShowInstanceToggled",{},globals.HLClassesListWidget)})},
+args: [],
+source: "onShowInstanceToggled\x0a\x09self refresh",
+messageSends: ["refresh"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+var checkbox;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$6,$5,$7,$8,$9,$10,$2,$11,$13,$14,$12,$15;
+$1=_st(html)._div();
+_st($1)._class_("btn-group");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._button();
+$ctx2.sendIdx["button"]=1;
+$4=$3;
+$5=_st($String())._streamContents_((function(str){
+return smalltalk.withContext(function($ctx3) {
+_st(str)._nextPutAll_("btn");
+$ctx3.sendIdx["nextPutAll:"]=1;
+$6=self._showInstance();
+if(smalltalk.assert($6)){
+return _st(str)._nextPutAll_(" active");
+$ctx3.sendIdx["nextPutAll:"]=2;
+};
+}, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)})}));
+$ctx2.sendIdx["streamContents:"]=1;
+_st($4)._class_($5);
+$ctx2.sendIdx["class:"]=2;
+_st($3)._with_("Instance");
+$ctx2.sendIdx["with:"]=2;
+$7=_st($3)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._showInstance_(true);
+$ctx3.sendIdx["showInstance:"]=1;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
+$ctx2.sendIdx["onClick:"]=1;
+$7;
+$8=_st(html)._button();
+_st($8)._class_(_st($String())._streamContents_((function(str){
+return smalltalk.withContext(function($ctx3) {
+_st(str)._nextPutAll_("btn");
+$ctx3.sendIdx["nextPutAll:"]=3;
+$9=self._showClass();
+if(smalltalk.assert($9)){
+return _st(str)._nextPutAll_(" active");
+};
+}, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,5)})})));
+$ctx2.sendIdx["class:"]=3;
+_st($8)._with_("Class");
+$ctx2.sendIdx["with:"]=3;
+$10=_st($8)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._showInstance_(false);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)})}));
+$ctx2.sendIdx["onClick:"]=2;
+return $10;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+$11=_st(html)._label();
+_st($11)._class_("checkbox");
+$12=_st($11)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$13=_st(html)._input();
+_st($13)._type_("checkbox");
+$14=_st($13)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._toggleShowComment();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,9)})}));
+checkbox=$14;
+checkbox;
+return _st(html)._with_("Doc");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
+$ctx1.sendIdx["with:"]=4;
+$15=self._showComment();
+if(smalltalk.assert($15)){
+_st(checkbox)._at_put_("checked","checked");
+};
+return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html,checkbox:checkbox},globals.HLClassesListWidget)})},
+args: ["html"],
+source: "renderButtonsOn: html\x0a\x09| checkbox |\x0a\x09\x0a\x09html div \x0a        class: 'btn-group';\x0a\x09\x09with: [ \x0a           \x09html button \x0a                class: (String streamContents: [ :str |\x0a                \x09str nextPutAll: 'btn'.\x0a                    self showInstance ifTrue: [ \x0a                    \x09str nextPutAll: ' active' ] ]);\x0a  \x09\x09\x09\x09with: 'Instance';\x0a                onClick: [ self showInstance: true ].\x0a  \x09\x09\x09html button\x0a  \x09\x09\x09\x09class: (String streamContents: [ :str |\x0a                \x09str nextPutAll: 'btn'.\x0a                    self showClass ifTrue: [ \x0a                    \x09str nextPutAll: ' active' ] ]);\x0a  \x09\x09\x09\x09with: 'Class';\x0a\x09\x09\x09\x09onClick: [ self showInstance: false ] ].\x0a\x09\x09html label \x0a\x09\x09\x09class: 'checkbox';\x0a\x09\x09\x09with: [\x0a\x09\x09\x09\x09checkbox := html input\x0a\x09\x09\x09\x09\x09type: 'checkbox';\x0a\x09\x09\x09\x09\x09onClick: [ self toggleShowComment ].\x0a\x09\x09\x09\x09html with: 'Doc' ].\x0a\x09\x09\x09\x09\x0a\x09\x09self showComment ifTrue: [\x0a\x09\x09\x09checkbox at: 'checked' put: 'checked' ]",
+messageSends: ["class:", "div", "with:", "button", "streamContents:", "nextPutAll:", "ifTrue:", "showInstance", "onClick:", "showInstance:", "showClass", "label", "type:", "input", "toggleShowComment", "showComment", "at:put:"],
+referencedClasses: ["String"]
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItem:level:on:",
+protocol: 'rendering',
+fn: function (aClass,anInteger,html){
+var self=this;
+var li;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$5,$3;
+li=_st(html)._li();
+$1=_st(li)._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($1)._data_put_("item",aClass);
+$2=li;
+_st($2)._class_(self._listCssClassForItem_(aClass));
+$ctx1.sendIdx["class:"]=1;
+$3=_st($2)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(html)._a();
+_st($4)._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+_st(_st(html)._tag_("i"))._class_(self._cssClassForItem_(aClass));
+return self._renderItemLabel_level_on_(aClass,anInteger,html);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$5=_st($4)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._reactivateListItem_(_st(li)._asJQuery());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+return $5;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+_st(self._getChildrenOf_(aClass))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._renderItem_level_on_(each,_st(anInteger).__plus((1)),html);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderItem:level:on:",{aClass:aClass,anInteger:anInteger,html:html,li:li},globals.HLClassesListWidget)})},
+args: ["aClass", "anInteger", "html"],
+source: "renderItem: aClass level: anInteger on: html\x0a\x09| li |\x0a    \x0a\x09li := html li.\x0a\x09li asJQuery data: 'item' put: aClass.\x0a    li\x0a\x09\x09class: (self listCssClassForItem: aClass);\x0a\x09\x09with: [ \x0a        \x09html a\x0a            \x09with: [ \x0a            \x09\x09(html tag: 'i') class: (self cssClassForItem: aClass).\x0a  \x09\x09\x09\x09\x09self renderItemLabel: aClass level: anInteger on: html ];\x0a\x09\x09\x09\x09onClick: [\x0a                  \x09self reactivateListItem: li asJQuery ] ].\x0a                    \x0a    (self getChildrenOf: aClass) do: [ :each |\x0a    \x09self renderItem: each level: anInteger + 1 on: html ]",
+messageSends: ["li", "data:put:", "asJQuery", "class:", "listCssClassForItem:", "with:", "a", "tag:", "cssClassForItem:", "renderItemLabel:level:on:", "onClick:", "reactivateListItem:", "do:", "getChildrenOf:", "renderItem:level:on:", "+"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItem:on:",
+protocol: 'rendering',
+fn: function (aClass,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLClassesListWidget.superclass.fn.prototype._renderItem_on_.apply(_st(self), [aClass,html]));
+$ctx1.supercall = false;
+_st(self._getChildrenOf_(aClass))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._renderItem_level_on_(each,(1),html);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderItem:on:",{aClass:aClass,html:html},globals.HLClassesListWidget)})},
+args: ["aClass", "html"],
+source: "renderItem: aClass on: html\x0a\x09super renderItem: aClass on: html.\x0a    (self getChildrenOf: aClass) do: [ :each |\x0a    \x09self renderItem: each level: 1 on: html ]",
+messageSends: ["renderItem:on:", "do:", "getChildrenOf:", "renderItem:level:on:"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItemLabel:level:on:",
+protocol: 'rendering',
+fn: function (aClass,anInteger,html){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(_st(html)._span())._asJQuery())._html_(_st($String())._streamContents_((function(str){
+return smalltalk.withContext(function($ctx2) {
+_st(anInteger)._timesRepeat_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(str)._nextPutAll_("&nbsp;&nbsp;&nbsp;&nbsp;");
+$ctx3.sendIdx["nextPutAll:"]=1;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+return _st(str)._nextPutAll_(_st(aClass)._name());
+}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})})));
+return self}, function($ctx1) {$ctx1.fill(self,"renderItemLabel:level:on:",{aClass:aClass,anInteger:anInteger,html:html},globals.HLClassesListWidget)})},
+args: ["aClass", "anInteger", "html"],
+source: "renderItemLabel: aClass level: anInteger on: html\x0a\x09html span asJQuery html: (String streamContents: [ :str |\x0a\x09\x09anInteger timesRepeat: [\x0a\x09\x09\x09str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;' ].\x0a\x09\x09\x09str nextPutAll: aClass name ])",
+messageSends: ["html:", "asJQuery", "span", "streamContents:", "timesRepeat:", "nextPutAll:", "name"],
+referencedClasses: ["String"]
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItemLabel:on:",
+protocol: 'rendering',
+fn: function (aClass,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._renderItemLabel_level_on_(aClass,(0),html);
+return self}, function($ctx1) {$ctx1.fill(self,"renderItemLabel:on:",{aClass:aClass,html:html},globals.HLClassesListWidget)})},
+args: ["aClass", "html"],
+source: "renderItemLabel: aClass on: html\x0a\x09self renderItemLabel: aClass level: 0 on: html",
+messageSends: ["renderItemLabel:level:on:"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderListOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._getRootClassesOf_(self._items()))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._renderItem_on_(each,html);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderListOn:",{html:html},globals.HLClassesListWidget)})},
+args: ["html"],
+source: "renderListOn: html\x0a\x09(self getRootClassesOf: self items)\x0a    \x09do: [ :each | self renderItem: each on: html ]",
+messageSends: ["do:", "getRootClassesOf:", "items", "renderItem:on:"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._forceSelectedClass_(anItem);
+return self}, function($ctx1) {$ctx1.fill(self,"reselectItem:",{anItem:anItem},globals.HLClassesListWidget)})},
+args: ["anItem"],
+source: "reselectItem: anItem\x0a\x09self model forceSelectedClass: anItem",
+messageSends: ["forceSelectedClass:", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectItem:",
+protocol: 'actions',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._selectedClass_(aClass);
+return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aClass:aClass},globals.HLClassesListWidget)})},
+args: ["aClass"],
+source: "selectItem: aClass\x0a    self model selectedClass: aClass",
+messageSends: ["selectedClass:", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setItemsForPackage:",
+protocol: 'private',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+if(($receiver = aPackage) == null || $receiver.isNil){
+$1=[];
+} else {
+$1=_st(_st(_st(aPackage)._classes())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._theNonMetaClass();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})})))._sort_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(a)._name();
+$ctx2.sendIdx["name"]=1;
+return _st($2).__lt(_st(b)._name());
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)})}));
+};
+self._items_($1);
+return self}, function($ctx1) {$ctx1.fill(self,"setItemsForPackage:",{aPackage:aPackage},globals.HLClassesListWidget)})},
+args: ["aPackage"],
+source: "setItemsForPackage: aPackage\x0a\x09self items: (aPackage \x0a    \x09ifNil: [ #() ]\x0a  \x09\x09ifNotNil: [ (aPackage classes \x0a        \x09collect: [ :each | each theNonMetaClass ]) \x0a            \x09sort: [ :a :b | a name < b name ] ]).",
+messageSends: ["items:", "ifNil:ifNotNil:", "sort:", "collect:", "classes", "theNonMetaClass", "<", "name"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setItemsForSelectedPackage",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._setItemsForPackage_(_st(self._model())._selectedPackage());
+return self}, function($ctx1) {$ctx1.fill(self,"setItemsForSelectedPackage",{},globals.HLClassesListWidget)})},
+args: [],
+source: "setItemsForSelectedPackage\x0a\x09self setItemsForPackage: self model selectedPackage",
+messageSends: ["setItemsForPackage:", "selectedPackage", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showClass",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._showInstance())._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"showClass",{},globals.HLClassesListWidget)})},
+args: [],
+source: "showClass\x0a\x09^ self model showInstance not",
+messageSends: ["not", "showInstance", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showComment",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._showComment();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"showComment",{},globals.HLClassesListWidget)})},
+args: [],
+source: "showComment\x0a\x09^ self model showComment",
+messageSends: ["showComment", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showComment:",
+protocol: 'actions',
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._showComment_(aBoolean);
+return self}, function($ctx1) {$ctx1.fill(self,"showComment:",{aBoolean:aBoolean},globals.HLClassesListWidget)})},
+args: ["aBoolean"],
+source: "showComment: aBoolean\x0a\x09self model showComment: aBoolean",
+messageSends: ["showComment:", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showInstance",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._showInstance();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"showInstance",{},globals.HLClassesListWidget)})},
+args: [],
+source: "showInstance\x0a\x09^ self model showInstance",
+messageSends: ["showInstance", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showInstance:",
+protocol: 'actions',
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._showInstance_(aBoolean);
+return self}, function($ctx1) {$ctx1.fill(self,"showInstance:",{aBoolean:aBoolean},globals.HLClassesListWidget)})},
+args: ["aBoolean"],
+source: "showInstance: aBoolean\x0a\x09self model showInstance: aBoolean",
+messageSends: ["showInstance:", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "toggleShowComment",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._showComment_(_st(self._showComment())._not());
+return self}, function($ctx1) {$ctx1.fill(self,"toggleShowComment",{},globals.HLClassesListWidget)})},
+args: [],
+source: "toggleShowComment\x0a\x09self model showComment: self showComment not",
+messageSends: ["showComment:", "model", "not", "showComment"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
+
+
+smalltalk.addClass('HLDocumentationWidget', globals.HLFocusableWidget, ['model'], 'Helios-Browser');
+globals.HLDocumentationWidget.comment="I render the documentation for the selected class";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultDocumentation",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return "No documentation is available for this class.";
+},
+args: [],
+source: "defaultDocumentation\x0a\x09^ 'No documentation is available for this class.'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultHead",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return "No class selected";
+},
+args: [],
+source: "defaultHead\x0a\x09^ 'No class selected'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "documentation",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._selectedItem();
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+var item;
+item=$receiver;
+$1=_st(_st(item)._comment())._ifEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._defaultDocumentation();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"documentation",{},globals.HLDocumentationWidget)})},
+args: [],
+source: "documentation\x0a\x09^ self selectedItem \x0a\x09\x09ifNil: [ '' ]\x0a\x09\x09ifNotNil: [ :item | item comment ifEmpty: [ self defaultDocumentation ] ]",
+messageSends: ["ifNil:ifNotNil:", "selectedItem", "ifEmpty:", "comment", "defaultDocumentation"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "editDocumentation",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._editComment();
+return self}, function($ctx1) {$ctx1.fill(self,"editDocumentation",{},globals.HLDocumentationWidget)})},
+args: [],
+source: "editDocumentation\x0a\x09self model editComment",
+messageSends: ["editComment", "model"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "head",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._selectedItem();
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._defaultHead();
+} else {
+var item;
+item=$receiver;
+$1=_st(item)._name();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"head",{},globals.HLDocumentationWidget)})},
+args: [],
+source: "head\x0a\x09^ self selectedItem \x0a\x09\x09ifNil: [ self defaultHead ]\x0a\x09\x09ifNotNil: [ :item | item name ]",
+messageSends: ["ifNil:ifNotNil:", "selectedItem", "defaultHead", "name"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@model"];
+return $1;
+},
+args: [],
+source: "model\x0a\x09^ model",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+protocol: 'accessing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self["@model"]=aModel;
+self._observeSystem();
+$1=self._observeModel();
+return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},globals.HLDocumentationWidget)})},
+args: ["aModel"],
+source: "model: aModel\x0a\x09model := aModel.\x0a\x09self \x0a\x09\x09observeSystem;\x0a\x09\x09observeModel",
+messageSends: ["observeSystem", "observeModel"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLClassSelected(){return globals.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
+function $HLEditComment(){return globals.HLEditComment||(typeof HLEditComment=="undefined"?nil:HLEditComment)}
+function $HLDocumentationFocusRequested(){return globals.HLDocumentationFocusRequested||(typeof HLDocumentationFocusRequested=="undefined"?nil:HLDocumentationFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._announcer();
+_st($1)._on_send_to_($HLClassSelected(),"onClassSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st($1)._on_send_to_($HLEditComment(),"onEditDocumentation",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+$2=_st($1)._on_send_to_($HLDocumentationFocusRequested(),"onDocumentationFocusRequested",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLDocumentationWidget)})},
+args: [],
+source: "observeModel\x0a\x09self model announcer \x0a\x09\x09on: HLClassSelected\x0a\x09\x09send: #onClassSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLEditComment\x0a\x09\x09send: #onEditDocumentation\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLDocumentationFocusRequested\x0a\x09\x09send: #onDocumentationFocusRequested\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "model"],
+referencedClasses: ["HLClassSelected", "HLEditComment", "HLDocumentationFocusRequested"]
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeSystem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $ClassCommentChanged(){return globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._model())._systemAnnouncer())._on_send_to_($ClassCommentChanged(),"onClassCommentChanged:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.HLDocumentationWidget)})},
+args: [],
+source: "observeSystem\x0a\x09self model systemAnnouncer \x0a\x09\x09on: ClassCommentChanged\x0a\x09\x09send: #onClassCommentChanged:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "systemAnnouncer", "model"],
+referencedClasses: ["ClassCommentChanged"]
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassCommentChanged:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$receiver;
+$2=self._model();
+$ctx1.sendIdx["model"]=1;
+$1=_st($2)._selectedClass();
+$ctx1.sendIdx["selectedClass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return self;
+} else {
+$1;
+};
+$3=_st(_st(anAnnouncement)._theClass()).__eq(_st(_st(self._model())._selectedClass())._theNonMetaClass());
+if(smalltalk.assert($3)){
+self._refresh();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onClassCommentChanged:",{anAnnouncement:anAnnouncement},globals.HLDocumentationWidget)})},
+args: ["anAnnouncement"],
+source: "onClassCommentChanged: anAnnouncement\x0a\x09self model selectedClass ifNil: [ ^ self ].\x0a\x09\x0a\x09anAnnouncement theClass = self model selectedClass theNonMetaClass\x0a\x09\x09ifTrue: [ self refresh ]",
+messageSends: ["ifNil:", "selectedClass", "model", "ifTrue:", "=", "theClass", "theNonMetaClass", "refresh"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onClassSelected:",{anAnnouncement:anAnnouncement},globals.HLDocumentationWidget)})},
+args: ["anAnnouncement"],
+source: "onClassSelected: anAnnouncement\x0a\x09self refresh",
+messageSends: ["refresh"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onDocumentationFocusRequested",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onDocumentationFocusRequested",{},globals.HLDocumentationWidget)})},
+args: [],
+source: "onDocumentationFocusRequested\x0a\x09self focus",
+messageSends: ["focus"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onEditDocumentation",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $5,$4,$3,$2,$1;
+$5=self._model();
+$ctx1.sendIdx["model"]=1;
+$4=_st($5)._selectedClass();
+$ctx1.sendIdx["selectedClass"]=1;
+$3=_st($4)._theNonMetaClass();
+$ctx1.sendIdx["theNonMetaClass"]=1;
+$2=_st($3)._name();
+$1=_st($2).__comma(" comment");
+self._request_value_do_($1,_st(_st(_st(self._model())._selectedClass())._theNonMetaClass())._comment(),(function(comment){
+return smalltalk.withContext(function($ctx2) {
+return self._setClassComment_(comment);
+}, function($ctx2) {$ctx2.fillBlock({comment:comment},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"onEditDocumentation",{},globals.HLDocumentationWidget)})},
+args: [],
+source: "onEditDocumentation\x0a\x09self \x0a\x09\x09request: self model selectedClass theNonMetaClass name, ' comment'\x0a\x09\x09value: self model selectedClass theNonMetaClass comment\x0a\x09\x09do: [ :comment | self setClassComment: comment ]",
+messageSends: ["request:value:do:", ",", "name", "theNonMetaClass", "selectedClass", "model", "comment", "setClassComment:"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2;
+$1=_st(html)._div();
+_st($1)._class_("doc");
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+self._renderHeadOn_(html);
+$3=self._renderDocOn_(html);
+return $3;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLDocumentationWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html div \x0a\x09\x09class: 'doc';\x0a\x09\x09with: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09renderHeadOn: html;\x0a\x09\x09\x09\x09renderDocOn: html ]",
+messageSends: ["class:", "div", "with:", "renderHeadOn:", "renderDocOn:"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderDocOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $Showdown(){return globals.Showdown||(typeof Showdown=="undefined"?nil:Showdown)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$5,$3,$6,$7,$receiver;
+$1=self._selectedItem();
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+self._renderInheritanceOn_(html);
+$2=_st(html)._h1();
+_st($2)._with_("Overview");
+$ctx1.sendIdx["with:"]=1;
+$3=_st($2)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(html)._button();
+_st($4)._class_("button default");
+$ctx2.sendIdx["class:"]=1;
+_st($4)._with_("Edit");
+$5=_st($4)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._editDocumentation();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+return $5;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$ctx1.sendIdx["with:"]=2;
+$3;
+$6=_st(html)._div();
+_st($6)._class_("markdown");
+$7=_st($6)._asJQuery();
+_st($7)._html_(_st(_st(_st($Showdown())._at_("converter"))._new())._makeHtml_(self._documentation()));
+};
+return self}, function($ctx1) {$ctx1.fill(self,"renderDocOn:",{html:html},globals.HLDocumentationWidget)})},
+args: ["html"],
+source: "renderDocOn: html\x0a\x09self selectedItem ifNotNil: [\x0a\x09\x09self renderInheritanceOn: html.\x0a\x09\x09html h1 \x0a\x09\x09\x09with: 'Overview';\x0a\x09\x09\x09with: [ \x0a\x09\x09\x09\x09html button\x0a\x09\x09\x09\x09\x09class: 'button default';\x0a\x09\x09\x09\x09\x09with: 'Edit';\x0a\x09\x09\x09\x09\x09onClick: [ self editDocumentation ] ].\x0a\x09\x09(html div \x0a\x09\x09\x09class: 'markdown';\x0a\x09\x09\x09asJQuery) html: ((Showdown at: 'converter') new makeHtml: self documentation) ]",
+messageSends: ["ifNotNil:", "selectedItem", "renderInheritanceOn:", "with:", "h1", "class:", "button", "onClick:", "editDocumentation", "html:", "div", "asJQuery", "makeHtml:", "new", "at:", "documentation"],
+referencedClasses: ["Showdown"]
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderHeadOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("head");
+$2=_st($1)._with_(self._head());
+return self}, function($ctx1) {$ctx1.fill(self,"renderHeadOn:",{html:html},globals.HLDocumentationWidget)})},
+args: ["html"],
+source: "renderHeadOn: html\x0a\x09html div \x0a\x09\x09class: 'head';\x0a\x09\x09with: self head",
+messageSends: ["class:", "div", "with:", "head"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderInheritanceOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$4,$3,$5,$6,$9,$8,$7,$10,$2,$receiver;
+$1=_st(html)._div();
+_st($1)._class_("inheritance");
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(html)._with_("Subclass of ");
+$ctx2.sendIdx["with:"]=2;
+$4=self._selectedItem();
+$ctx2.sendIdx["selectedItem"]=1;
+$3=_st($4)._superclass();
+$ctx2.sendIdx["superclass"]=1;
+if(($receiver = $3) == null || $receiver.isNil){
+return _st(_st(html)._em())._with_("nil");
+$ctx2.sendIdx["with:"]=3;
+} else {
+$5=_st(html)._a();
+$6=$5;
+$9=self._selectedItem();
+$ctx2.sendIdx["selectedItem"]=2;
+$8=_st($9)._superclass();
+$ctx2.sendIdx["superclass"]=2;
+$7=_st($8)._name();
+_st($6)._with_($7);
+$10=_st($5)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._selectClass_(_st(self._selectedItem())._superclass());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
+return $10;
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderInheritanceOn:",{html:html},globals.HLDocumentationWidget)})},
+args: ["html"],
+source: "renderInheritanceOn: html\x0a\x09html div \x09\x0a\x09\x09class: 'inheritance';\x0a\x09\x09with: [\x0a\x09\x09\x09html with: 'Subclass of '.\x0a\x09\x09\x09self selectedItem superclass \x0a\x09\x09\x09\x09ifNil: [ html em with: 'nil' ]\x0a\x09\x09\x09\x09ifNotNil: [\x0a\x09\x09\x09\x09\x09html a \x0a\x09\x09\x09\x09\x09\x09with: self selectedItem superclass name;\x0a\x09\x09\x09\x09\x09\x09onClick: [ self selectClass: self selectedItem superclass ] ] ]",
+messageSends: ["class:", "div", "with:", "ifNil:ifNotNil:", "superclass", "selectedItem", "em", "a", "name", "onClick:", "selectClass:"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectClass:",
+protocol: 'actions',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._selectedClass_(aClass);
+return self}, function($ctx1) {$ctx1.fill(self,"selectClass:",{aClass:aClass},globals.HLDocumentationWidget)})},
+args: ["aClass"],
+source: "selectClass: aClass\x0a\x09self model selectedClass: aClass",
+messageSends: ["selectedClass:", "model"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedItem",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=_st(self._model())._selectedClass();
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$2;
+} else {
+var class_;
+class_=$receiver;
+$1=_st(class_)._theNonMetaClass();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectedItem",{},globals.HLDocumentationWidget)})},
+args: [],
+source: "selectedItem\x0a\x09^ self model selectedClass ifNotNil: [ :class | class theNonMetaClass ]",
+messageSends: ["ifNotNil:", "selectedClass", "model", "theNonMetaClass"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setClassComment:",
+protocol: 'reactions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._setClassComment_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"setClassComment:",{aString:aString},globals.HLDocumentationWidget)})},
+args: ["aString"],
+source: "setClassComment: aString\x0a\x09self model setClassComment: aString",
+messageSends: ["setClassComment:", "model"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLDocumentationWidget.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+_st(_st(self._model())._announcer())._unregister_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLDocumentationWidget)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x09self model announcer unregister: self",
+messageSends: ["unregister", "unregister:", "announcer", "model"],
+referencedClasses: []
+}),
+globals.HLDocumentationWidget);
+
+
+
+smalltalk.addClass('HLMethodsListWidget', globals.HLToolListWidget, ['selectorsCache'], 'Helios-Browser');
+globals.HLMethodsListWidget.comment="I render a list of methods for the selected protocol.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allProtocol",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._allProtocol();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allProtocol",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "allProtocol\x0a\x09^ self model allProtocol",
+messageSends: ["allProtocol", "model"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClassForItem:",
+protocol: 'accessing',
+fn: function (aSelector){
+var self=this;
+var override,overriden,method;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1;
+method=self._methodForSelector_(aSelector);
+override=self._isOverride_(method);
+overriden=self._isOverridden_(method);
+$2=override;
+if(smalltalk.assert($2)){
+$3=overriden;
+if(smalltalk.assert($3)){
+$1="override-overridden";
+} else {
+$1="override";
+};
+} else {
+$4=overriden;
+if(smalltalk.assert($4)){
+$1="overridden";
+} else {
+$1="";
+};
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cssClassForItem:",{aSelector:aSelector,override:override,overriden:overriden,method:method},globals.HLMethodsListWidget)})},
+args: ["aSelector"],
+source: "cssClassForItem: aSelector\x0a\x09| override overriden method |\x0a    \x0a    method := self methodForSelector: aSelector.\x0a    override := self isOverride: method.\x0a    overriden := self isOverridden: method.\x0a    \x0a\x09^ override\x0a    \x09ifTrue: [ overriden\x0a\x09\x09\x09ifTrue: [ 'override-overridden' ]\x0a\x09\x09\x09ifFalse: [ 'override' ] ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09overriden\x0a\x09\x09\x09ifTrue: [ 'overridden' ]\x0a\x09\x09\x09ifFalse: [ '' ] ]",
+messageSends: ["methodForSelector:", "isOverride:", "isOverridden:", "ifTrue:ifFalse:"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+($ctx1.supercall = true, globals.HLMethodsListWidget.superclass.fn.prototype._focus.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=self._selectedItem();
+if(($receiver = $1) == null || $receiver.isNil){
+_st(self._model())._showMethodTemplate();
+} else {
+$1;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "focus\x0a\x09super focus.\x0a\x09\x0a\x09self selectedItem ifNil: [\x0a\x09\x09self model showMethodTemplate ]",
+messageSends: ["focus", "ifNil:", "selectedItem", "showMethodTemplate", "model"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isOverridden:",
+protocol: 'testing',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._selectorsCache())._isOverridden_(aMethod);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isOverridden:",{aMethod:aMethod},globals.HLMethodsListWidget)})},
+args: ["aMethod"],
+source: "isOverridden: aMethod\x0a   ^ self selectorsCache isOverridden: aMethod",
+messageSends: ["isOverridden:", "selectorsCache"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isOverride:",
+protocol: 'testing',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._selectorsCache())._isOverride_(aMethod);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isOverride:",{aMethod:aMethod},globals.HLMethodsListWidget)})},
+args: ["aMethod"],
+source: "isOverride: aMethod\x0a   ^ self selectorsCache isOverride: aMethod",
+messageSends: ["isOverride:", "selectorsCache"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Methods";
+},
+args: [],
+source: "label\x0a\x09^ 'Methods'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodForSelector:",
+protocol: 'accessing',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(self._model())._selectedClass())._methodDictionary())._at_(aSelector);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodForSelector:",{aSelector:aSelector},globals.HLMethodsListWidget)})},
+args: ["aSelector"],
+source: "methodForSelector: aSelector\x0a\x09^ self model selectedClass\x0a    \x09methodDictionary at: aSelector",
+messageSends: ["at:", "methodDictionary", "selectedClass", "model"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodsInProtocol:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$5,$7,$6,$4,$receiver;
+$2=self._model();
+$ctx1.sendIdx["model"]=1;
+$1=_st($2)._selectedClass();
+$ctx1.sendIdx["selectedClass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$3=[];
+return $3;
+} else {
+$1;
+};
+$5=_st(aString).__eq(self._allProtocol());
+if(smalltalk.assert($5)){
+$7=self._model();
+$ctx1.sendIdx["model"]=2;
+$6=_st($7)._selectedClass();
+$ctx1.sendIdx["selectedClass"]=2;
+$4=_st($6)._methods();
+} else {
+$4=_st(_st(self._model())._selectedClass())._methodsInProtocol_(aString);
+};
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},globals.HLMethodsListWidget)})},
+args: ["aString"],
+source: "methodsInProtocol: aString\x0a\x09self model selectedClass ifNil: [ ^ #() ].\x0a    \x0a\x09^ aString = self allProtocol\x0a    \x09ifTrue: [ self model selectedClass methods ]\x0a      \x09ifFalse: [ self model selectedClass methodsInProtocol: aString ]",
+messageSends: ["ifNil:", "selectedClass", "model", "ifTrue:ifFalse:", "=", "allProtocol", "methods", "methodsInProtocol:"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLProtocolSelected(){return globals.HLProtocolSelected||(typeof HLProtocolSelected=="undefined"?nil:HLProtocolSelected)}
+function $HLShowInstanceToggled(){return globals.HLShowInstanceToggled||(typeof HLShowInstanceToggled=="undefined"?nil:HLShowInstanceToggled)}
+function $HLMethodSelected(){return globals.HLMethodSelected||(typeof HLMethodSelected=="undefined"?nil:HLMethodSelected)}
+function $HLMethodsFocusRequested(){return globals.HLMethodsFocusRequested||(typeof HLMethodsFocusRequested=="undefined"?nil:HLMethodsFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._announcer();
+_st($1)._on_send_to_($HLProtocolSelected(),"onProtocolSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st($1)._on_send_to_($HLShowInstanceToggled(),"onShowInstanceToggled",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+_st($1)._on_send_to_($HLMethodSelected(),"onMethodSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=3;
+$2=_st($1)._on_send_to_($HLMethodsFocusRequested(),"onMethodsFocusRequested",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "observeModel\x0a\x09self model announcer \x0a\x09\x09on: HLProtocolSelected \x0a\x09\x09send: #onProtocolSelected: \x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLShowInstanceToggled \x0a\x09\x09send: #onShowInstanceToggled\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLMethodSelected \x0a\x09\x09send: #onMethodSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLMethodsFocusRequested \x0a\x09\x09send: #onMethodsFocusRequested\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "model"],
+referencedClasses: ["HLProtocolSelected", "HLShowInstanceToggled", "HLMethodSelected", "HLMethodsFocusRequested"]
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeSystem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $ProtocolAdded(){return globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
+function $ProtocolRemoved(){return globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
+function $MethodAdded(){return globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
+function $MethodRemoved(){return globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
+function $MethodMoved(){return globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._systemAnnouncer();
+_st($1)._on_send_to_($ProtocolAdded(),"onProtocolAdded:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st($1)._on_send_to_($ProtocolRemoved(),"onProtocolRemoved:",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+_st($1)._on_send_to_($MethodAdded(),"onMethodAdded:",self);
+$ctx1.sendIdx["on:send:to:"]=3;
+_st($1)._on_send_to_($MethodRemoved(),"onMethodRemoved:",self);
+$ctx1.sendIdx["on:send:to:"]=4;
+$2=_st($1)._on_send_to_($MethodMoved(),"onMethodMoved:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "observeSystem\x0a\x09self model systemAnnouncer \x0a    \x09on: ProtocolAdded\x0a        send: #onProtocolAdded:\x0a\x09\x09to: self;\x0a    \x09\x0a\x09\x09on: ProtocolRemoved\x0a        send: #onProtocolRemoved:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: MethodAdded \x0a        send: #onMethodAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a        on: MethodRemoved \x0a        send: #onMethodRemoved:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodMoved \x0a        send: #onMethodMoved:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "systemAnnouncer", "model"],
+referencedClasses: ["ProtocolAdded", "ProtocolRemoved", "MethodAdded", "MethodRemoved", "MethodMoved"]
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodAdded:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedClass()).__eq(_st(_st(anAnnouncement)._method())._methodClass());
+if(! smalltalk.assert($1)){
+return self;
+};
+self._setItemsForSelectedProtocol();
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodAdded:",{anAnnouncement:anAnnouncement},globals.HLMethodsListWidget)})},
+args: ["anAnnouncement"],
+source: "onMethodAdded: anAnnouncement\x0a\x09self model selectedClass = anAnnouncement method methodClass ifFalse: [ ^ self ].\x0a    \x0a    self setItemsForSelectedProtocol.\x0a    self refresh",
+messageSends: ["ifFalse:", "=", "selectedClass", "model", "methodClass", "method", "setItemsForSelectedProtocol", "refresh"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodMoved:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$6,$5,$4,$7;
+$3=self._model();
+$ctx1.sendIdx["model"]=1;
+$2=_st($3)._selectedMethod();
+$1=_st($2).__eq(_st(anAnnouncement)._method());
+$ctx1.sendIdx["="]=1;
+if(! smalltalk.assert($1)){
+return self;
+};
+$6=self._model();
+$ctx1.sendIdx["model"]=2;
+$5=_st($6)._selectedProtocol();
+$4=_st($5).__eq(_st(self._model())._allProtocol());
+if(! smalltalk.assert($4)){
+self._selectedItem_(nil);
+self._selectItem_(nil);
+self._setItemsForSelectedProtocol();
+$7=self._refresh();
+$7;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodMoved:",{anAnnouncement:anAnnouncement},globals.HLMethodsListWidget)})},
+args: ["anAnnouncement"],
+source: "onMethodMoved: anAnnouncement\x0a\x09self model selectedMethod = anAnnouncement method ifFalse: [ ^ self ].\x0a    \x0a\x09self model selectedProtocol = self model allProtocol ifFalse: [\x0a\x09\x09self \x0a\x09\x09\x09selectedItem: nil; \x0a\x09\x09\x09selectItem: nil;\x0a\x09\x09\x09setItemsForSelectedProtocol;\x0a    \x09\x09refresh ]",
+messageSends: ["ifFalse:", "=", "selectedMethod", "model", "method", "selectedProtocol", "allProtocol", "selectedItem:", "selectItem:", "setItemsForSelectedProtocol", "refresh"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodRemoved:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var method;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3,$5,$6,$receiver;
+var $early={};
+try {
+method=_st(anAnnouncement)._method();
+_st(self._items())._detect_ifNone_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(method)._selector();
+$ctx2.sendIdx["selector"]=1;
+return _st(each).__eq($1);
+$ctx2.sendIdx["="]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+throw $early=[self];
+}));
+$2=self._selectedItem();
+$ctx1.sendIdx["selectedItem"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+$2;
+} else {
+$4=_st(_st(method)._methodClass()).__eq(_st(self._model())._selectedClass());
+$ctx1.sendIdx["="]=2;
+$3=_st($4)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(method)._selector()).__eq(self._selectedItem());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
+if(smalltalk.assert($3)){
+self._selectedItem_(nil);
+$5=self._selectItem_(nil);
+$5;
+};
+};
+self._setItemsForSelectedProtocol();
+self._refresh();
+$6=self._focus();
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"onMethodRemoved:",{anAnnouncement:anAnnouncement,method:method},globals.HLMethodsListWidget)})},
+args: ["anAnnouncement"],
+source: "onMethodRemoved: anAnnouncement\x0a\x09| method |\x0a\x09\x0a\x09method := anAnnouncement method.\x0a\x09\x0a\x09self items detect: [ :each | each = method selector ] ifNone: [ ^ self ].\x0a\x0a    self selectedItem ifNotNil: [\x0a      \x09(method methodClass = self model selectedClass and: [ method selector = self selectedItem ])\x0a  \x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09self selectedItem: nil; \x0a\x09\x09\x09\x09selectItem: nil ] ].\x0a\x0a    self setItemsForSelectedProtocol.\x0a\x09self \x0a\x09\x09refresh;\x0a\x09\x09focus",
+messageSends: ["method", "detect:ifNone:", "items", "=", "selector", "ifNotNil:", "selectedItem", "ifTrue:", "and:", "methodClass", "selectedClass", "model", "selectedItem:", "selectItem:", "setItemsForSelectedProtocol", "refresh", "focus"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var selector,method;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+method=_st(anAnnouncement)._item();
+$1=_st(method)._isCompiledMethod();
+if(smalltalk.assert($1)){
+selector=_st(method)._selector();
+} else {
+selector=nil;
+};
+self._selectedItem_(selector);
+$2=self._activateItem_(selector);
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodSelected:",{anAnnouncement:anAnnouncement,selector:selector,method:method},globals.HLMethodsListWidget)})},
+args: ["anAnnouncement"],
+source: "onMethodSelected: anAnnouncement\x0a\x09| selector method |\x0a\x09\x0a\x09method := anAnnouncement item.\x0a\x09\x0a\x09selector := method isCompiledMethod \x0a\x09\x09ifTrue: [ method selector ]\x0a\x09\x09ifFalse: [ nil ].\x0a\x09\x09\x0a\x09self \x0a\x09\x09selectedItem: selector;\x0a\x09\x09activateItem: selector",
+messageSends: ["item", "ifTrue:ifFalse:", "isCompiledMethod", "selector", "selectedItem:", "activateItem:"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodsFocusRequested",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodsFocusRequested",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "onMethodsFocusRequested\x0a\x09self focus",
+messageSends: ["focus"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onProtocolAdded:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedClass()).__eq(_st(anAnnouncement)._theClass());
+if(! smalltalk.assert($1)){
+return self;
+};
+self._setItemsForSelectedProtocol();
+self._refresh();
+self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onProtocolAdded:",{anAnnouncement:anAnnouncement},globals.HLMethodsListWidget)})},
+args: ["anAnnouncement"],
+source: "onProtocolAdded: anAnnouncement\x0a\x09self model selectedClass = anAnnouncement theClass ifFalse: [ ^ self ].\x0a\x09\x0a\x09self setItemsForSelectedProtocol.\x0a    self refresh.\x0a\x09self focus",
+messageSends: ["ifFalse:", "=", "selectedClass", "model", "theClass", "setItemsForSelectedProtocol", "refresh", "focus"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onProtocolRemoved:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedClass()).__eq(_st(anAnnouncement)._theClass());
+if(! smalltalk.assert($1)){
+return self;
+};
+self._setItemsForSelectedProtocol();
+self._refresh();
+self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onProtocolRemoved:",{anAnnouncement:anAnnouncement},globals.HLMethodsListWidget)})},
+args: ["anAnnouncement"],
+source: "onProtocolRemoved: anAnnouncement\x0a\x09self model selectedClass = anAnnouncement theClass ifFalse: [ ^ self ].\x0a\x09\x0a\x09self setItemsForSelectedProtocol.\x0a    self refresh.\x0a\x09self focus",
+messageSends: ["ifFalse:", "=", "selectedClass", "model", "theClass", "setItemsForSelectedProtocol", "refresh", "focus"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onProtocolSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selectedItem_(nil);
+self._setItemsForSelectedProtocol();
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onProtocolSelected:",{anAnnouncement:anAnnouncement},globals.HLMethodsListWidget)})},
+args: ["anAnnouncement"],
+source: "onProtocolSelected: anAnnouncement\x0a    self selectedItem: nil.\x0a    \x0a\x09self setItemsForSelectedProtocol.\x0a    self refresh",
+messageSends: ["selectedItem:", "setItemsForSelectedProtocol", "refresh"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onShowInstanceToggled",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._onProtocolSelected_(nil);
+return self}, function($ctx1) {$ctx1.fill(self,"onShowInstanceToggled",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "onShowInstanceToggled\x0a\x09self onProtocolSelected: nil",
+messageSends: ["onProtocolSelected:"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "overrideSelectors",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st(self._selectorsCache())._at_ifAbsentPut_("override",(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(_st(self._model())._selectedClass())._allSuperclasses())._inject_into_(_st($Set())._new(),(function(acc,each){
+return smalltalk.withContext(function($ctx3) {
+_st(acc)._addAll_(_st(each)._selectors());
+$2=_st(acc)._yourself();
+return $2;
+}, function($ctx3) {$ctx3.fillBlock({acc:acc,each:each},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"overrideSelectors",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "overrideSelectors\x0a\x09^ self selectorsCache \x0a    \x09at: 'override'\x0a        ifAbsentPut: [ \x0a        \x09self model selectedClass allSuperclasses\x0a\x09\x09\x09\x09inject: Set new into: [ :acc :each | acc addAll: each selectors; yourself ] ]",
+messageSends: ["at:ifAbsentPut:", "selectorsCache", "inject:into:", "allSuperclasses", "selectedClass", "model", "new", "addAll:", "selectors", "yourself"],
+referencedClasses: ["Set"]
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "overridenSelectors",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st(self._selectorsCache())._at_ifAbsentPut_("overriden",(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(_st(self._model())._selectedClass())._allSubclasses())._inject_into_(_st($Set())._new(),(function(acc,each){
+return smalltalk.withContext(function($ctx3) {
+_st(acc)._addAll_(_st(each)._selectors());
+$2=_st(acc)._yourself();
+return $2;
+}, function($ctx3) {$ctx3.fillBlock({acc:acc,each:each},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"overridenSelectors",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "overridenSelectors\x0a\x09^ self selectorsCache \x0a    \x09at: 'overriden'\x0a        ifAbsentPut: [ \x0a        \x09self model selectedClass allSubclasses\x0a\x09\x09\x09\x09inject: Set new into: [ :acc :each | acc addAll: each selectors; yourself ] ]",
+messageSends: ["at:ifAbsentPut:", "selectorsCache", "inject:into:", "allSubclasses", "selectedClass", "model", "new", "addAll:", "selectors", "yourself"],
+referencedClasses: ["Set"]
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=_st(self._model())._showInstance();
+if(smalltalk.assert($1)){
+($ctx1.supercall = true, globals.HLMethodsListWidget.superclass.fn.prototype._renderContentOn_.apply(_st(self), [html]));
+$ctx1.supercall = false;
+} else {
+$2=_st(html)._div();
+_st($2)._class_("class_side");
+$3=_st($2)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return ($ctx2.supercall = true, globals.HLMethodsListWidget.superclass.fn.prototype._renderContentOn_.apply(_st(self), [html]));
+$ctx2.supercall = false;
+$ctx2.sendIdx["renderContentOn:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$3;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLMethodsListWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09self model showInstance\x0a    \x09ifFalse: [ html div \x0a        \x09class: 'class_side'; \x0a            with: [ super renderContentOn: html ] ]\x0a      \x09ifTrue: [ super renderContentOn: html ]",
+messageSends: ["ifFalse:ifTrue:", "showInstance", "model", "class:", "div", "with:", "renderContentOn:"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItemLabel:on:",
+protocol: 'rendering',
+fn: function (aSelector,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(html)._with_(aSelector);
+return self}, function($ctx1) {$ctx1.fill(self,"renderItemLabel:on:",{aSelector:aSelector,html:html},globals.HLMethodsListWidget)})},
+args: ["aSelector", "html"],
+source: "renderItemLabel: aSelector on: html\x0a\x09html with: aSelector",
+messageSends: ["with:"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._forceSelectedMethod_(self._methodForSelector_(aSelector));
+return self}, function($ctx1) {$ctx1.fill(self,"reselectItem:",{aSelector:aSelector},globals.HLMethodsListWidget)})},
+args: ["aSelector"],
+source: "reselectItem: aSelector\x0a\x09self model forceSelectedMethod: (self methodForSelector: aSelector)",
+messageSends: ["forceSelectedMethod:", "model", "methodForSelector:"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectItem:",
+protocol: 'actions',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+if(($receiver = aSelector) == null || $receiver.isNil){
+$2=self._model();
+$ctx1.sendIdx["model"]=1;
+$1=_st($2)._selectedMethod_(nil);
+$ctx1.sendIdx["selectedMethod:"]=1;
+return $1;
+} else {
+aSelector;
+};
+_st(self._model())._selectedMethod_(self._methodForSelector_(aSelector));
+return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aSelector:aSelector},globals.HLMethodsListWidget)})},
+args: ["aSelector"],
+source: "selectItem: aSelector\x0a\x09aSelector ifNil: [ ^ self model selectedMethod: nil ].\x0a\x0a   \x09self model selectedMethod: (self methodForSelector: aSelector)",
+messageSends: ["ifNil:", "selectedMethod:", "model", "methodForSelector:"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectorsCache",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._selectorsCache();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectorsCache",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "selectorsCache\x0a\x09^ self class selectorsCache",
+messageSends: ["selectorsCache", "class"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectorsInProtocol:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._methodsInProtocol_(aString))._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._selector();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._sorted();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectorsInProtocol:",{aString:aString},globals.HLMethodsListWidget)})},
+args: ["aString"],
+source: "selectorsInProtocol: aString\x0a\x09^ ((self methodsInProtocol: aString)\x0a    \x09collect: [ :each | each selector ]) sorted",
+messageSends: ["sorted", "collect:", "methodsInProtocol:", "selector"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setItemsForProtocol:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+if(($receiver = aString) == null || $receiver.isNil){
+$2=[];
+} else {
+$2=self._selectorsInProtocol_(aString);
+};
+$1=self._items_($2);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"setItemsForProtocol:",{aString:aString},globals.HLMethodsListWidget)})},
+args: ["aString"],
+source: "setItemsForProtocol: aString\x0a\x09^ self items: (aString\x0a    \x09ifNil: [ #() ]\x0a      \x09ifNotNil: [ self selectorsInProtocol: aString ])",
+messageSends: ["items:", "ifNil:ifNotNil:", "selectorsInProtocol:"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setItemsForSelectedProtocol",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._setItemsForProtocol_(_st(self._model())._selectedProtocol());
+return self}, function($ctx1) {$ctx1.fill(self,"setItemsForSelectedProtocol",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "setItemsForSelectedProtocol\x0a\x09self setItemsForProtocol: self model selectedProtocol",
+messageSends: ["setItemsForProtocol:", "selectedProtocol", "model"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
+
+globals.HLMethodsListWidget.klass.iVarNames = ['selectorsCache'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectorsCache",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLSelectorsCache(){return globals.HLSelectorsCache||(typeof HLSelectorsCache=="undefined"?nil:HLSelectorsCache)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLSelectorsCache())._current();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectorsCache",{},globals.HLMethodsListWidget.klass)})},
+args: [],
+source: "selectorsCache\x0a\x09^ HLSelectorsCache current",
+messageSends: ["current"],
+referencedClasses: ["HLSelectorsCache"]
+}),
+globals.HLMethodsListWidget.klass);
+
+
+smalltalk.addClass('HLPackagesListWidget', globals.HLToolListWidget, [], 'Helios-Browser');
+globals.HLPackagesListWidget.comment="I render a list of the system packages.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClassForItem:",
+protocol: 'accessing',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(anItem)._isDirty();
+if(smalltalk.assert($2)){
+$1="package_dirty";
+} else {
+$1="package";
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cssClassForItem:",{anItem:anItem},globals.HLPackagesListWidget)})},
+args: ["anItem"],
+source: "cssClassForItem: anItem\x09\x0a\x09^ anItem isDirty \x0a\x09\x09ifTrue: [ 'package_dirty' ]\x0a\x09\x09ifFalse: [ 'package' ]",
+messageSends: ["ifTrue:ifFalse:", "isDirty"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusClassesListWidget",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLClassesListFocus(){return globals.HLClassesListFocus||(typeof HLClassesListFocus=="undefined"?nil:HLClassesListFocus)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._model())._announcer())._announce_(_st($HLClassesListFocus())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"focusClassesListWidget",{},globals.HLPackagesListWidget)})},
+args: [],
+source: "focusClassesListWidget\x0a\x09self model announcer announce: HLClassesListFocus new",
+messageSends: ["announce:", "announcer", "model", "new"],
+referencedClasses: ["HLClassesListFocus"]
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeItems",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+self["@items"]=_st(_st(self._model())._packages())._sort_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(a)._name();
+$ctx2.sendIdx["name"]=1;
+return _st($2).__lt(_st(b)._name());
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
+$1=self["@items"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"initializeItems",{},globals.HLPackagesListWidget)})},
+args: [],
+source: "initializeItems\x0a\x09^ items := self model packages \x0a\x09\x09sort: [ :a :b | a name < b name ]",
+messageSends: ["sort:", "packages", "model", "<", "name"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "items",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@items"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._initializeItems();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"items",{},globals.HLPackagesListWidget)})},
+args: [],
+source: "items\x0a\x09^ items ifNil: [ self initializeItems ]",
+messageSends: ["ifNil:", "initializeItems"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Packages";
+},
+args: [],
+source: "label\x0a\x09^ 'Packages'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLPackageSelected(){return globals.HLPackageSelected||(typeof HLPackageSelected=="undefined"?nil:HLPackageSelected)}
+function $HLPackagesFocusRequested(){return globals.HLPackagesFocusRequested||(typeof HLPackagesFocusRequested=="undefined"?nil:HLPackagesFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._announcer();
+_st($1)._on_send_to_($HLPackageSelected(),"onPackageSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+$2=_st($1)._on_send_to_($HLPackagesFocusRequested(),"onPackagesFocusRequested",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLPackagesListWidget)})},
+args: [],
+source: "observeModel\x0a    self model announcer \x0a\x09\x09on: HLPackageSelected\x0a\x09\x09send: #onPackageSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLPackagesFocusRequested \x0a\x09\x09send: #onPackagesFocusRequested\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "model"],
+referencedClasses: ["HLPackageSelected", "HLPackagesFocusRequested"]
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeSystem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
+function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
+function $PackageClean(){return globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
+function $PackageDirty(){return globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$4,$3,$6,$5;
+$2=self._model();
+$ctx1.sendIdx["model"]=1;
+$1=_st($2)._systemAnnouncer();
+$ctx1.sendIdx["systemAnnouncer"]=1;
+_st($1)._on_send_to_($ClassAdded(),"onClassAdded:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+$4=self._model();
+$ctx1.sendIdx["model"]=2;
+$3=_st($4)._systemAnnouncer();
+$ctx1.sendIdx["systemAnnouncer"]=2;
+_st($3)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+$6=self._model();
+$ctx1.sendIdx["model"]=3;
+$5=_st($6)._systemAnnouncer();
+$ctx1.sendIdx["systemAnnouncer"]=3;
+_st($5)._on_send_to_($PackageClean(),"onPackageStateChanged",self);
+$ctx1.sendIdx["on:send:to:"]=3;
+_st(_st(self._model())._systemAnnouncer())._on_send_to_($PackageDirty(),"onPackageStateChanged",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.HLPackagesListWidget)})},
+args: [],
+source: "observeSystem\x0a    self model systemAnnouncer \x0a\x09\x09on: ClassAdded \x0a\x09\x09send: #onClassAdded:\x0a\x09\x09to: self.\x0a\x09\x09\x0a\x09self model systemAnnouncer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self.\x0a\x09\x09\x0a\x09self model systemAnnouncer\x0a\x09\x09on: PackageClean\x0a\x09\x09send: #onPackageStateChanged\x0a\x09\x09to: self.\x0a\x09\x09\x0a\x09self model systemAnnouncer\x0a\x09\x09on: PackageDirty\x0a\x09\x09send: #onPackageStateChanged\x0a\x09\x09to: self.\x0a\x09",
+messageSends: ["on:send:to:", "systemAnnouncer", "model"],
+referencedClasses: ["ClassAdded", "PackageAdded", "PackageClean", "PackageDirty"]
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassAdded:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._items())._includes_(_st(_st(anAnnouncement)._theClass())._package());
+if(! smalltalk.assert($1)){
+self._initializeItems();
+$2=self._refresh();
+$2;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onClassAdded:",{anAnnouncement:anAnnouncement},globals.HLPackagesListWidget)})},
+args: ["anAnnouncement"],
+source: "onClassAdded: anAnnouncement\x0a\x09\x22Amber doesn't have yet a global organizer for packages\x22\x0a\x09\x0a\x09(self items includes: anAnnouncement theClass package) ifFalse: [ \x0a\x09\x09self \x0a\x09\x09\x09initializeItems;\x0a\x09\x09\x09refresh ]",
+messageSends: ["ifFalse:", "includes:", "items", "package", "theClass", "initializeItems", "refresh"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPackageAdded:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._initializeItems();
+$1=self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},globals.HLPackagesListWidget)})},
+args: ["anAnnouncement"],
+source: "onPackageAdded: anAnnouncement\x0a\x09self \x0a\x09\x09initializeItems;\x0a\x09\x09refresh",
+messageSends: ["initializeItems", "refresh"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPackageSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var package_;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+package_=_st(anAnnouncement)._item();
+self._selectedItem_(package_);
+$1=self._hasFocus();
+if(! smalltalk.assert($1)){
+self._activateItem_(package_);
+$2=self._focus();
+$2;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onPackageSelected:",{anAnnouncement:anAnnouncement,package_:package_},globals.HLPackagesListWidget)})},
+args: ["anAnnouncement"],
+source: "onPackageSelected: anAnnouncement\x0a\x09| package |\x0a\x09\x0a\x09package := anAnnouncement item.\x0a\x09\x0a\x09self selectedItem: package.\x0a\x09self hasFocus ifFalse: [\x0a\x09\x09self\x0a\x09\x09\x09activateItem: package;\x0a\x09\x09\x09focus ]",
+messageSends: ["item", "selectedItem:", "ifFalse:", "hasFocus", "activateItem:", "focus"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPackageStateChanged",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onPackageStateChanged",{},globals.HLPackagesListWidget)})},
+args: [],
+source: "onPackageStateChanged\x0a\x09self refresh",
+messageSends: ["refresh"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPackagesFocusRequested",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onPackagesFocusRequested",{},globals.HLPackagesListWidget)})},
+args: [],
+source: "onPackagesFocusRequested\x0a\x09self focus",
+messageSends: ["focus"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItemLabel:on:",
+protocol: 'rendering',
+fn: function (aPackage,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(html)._with_(_st(aPackage)._name());
+return self}, function($ctx1) {$ctx1.fill(self,"renderItemLabel:on:",{aPackage:aPackage,html:html},globals.HLPackagesListWidget)})},
+args: ["aPackage", "html"],
+source: "renderItemLabel: aPackage on: html\x0a\x09html with: aPackage name",
+messageSends: ["with:", "name"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._forceSelectedPackage_(anItem);
+return self}, function($ctx1) {$ctx1.fill(self,"reselectItem:",{anItem:anItem},globals.HLPackagesListWidget)})},
+args: ["anItem"],
+source: "reselectItem: anItem\x0a\x09self model forceSelectedPackage: anItem",
+messageSends: ["forceSelectedPackage:", "model"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectItem:",
+protocol: 'actions',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLPackagesListWidget.superclass.fn.prototype._selectItem_.apply(_st(self), [aPackage]));
+$ctx1.supercall = false;
+_st(self._model())._selectedPackage_(aPackage);
+return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aPackage:aPackage},globals.HLPackagesListWidget)})},
+args: ["aPackage"],
+source: "selectItem: aPackage\x0a\x09super selectItem: aPackage.\x0a\x09self model selectedPackage: aPackage",
+messageSends: ["selectItem:", "selectedPackage:", "model"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
+
+
+smalltalk.addClass('HLProtocolsListWidget', globals.HLToolListWidget, [], 'Helios-Browser');
+globals.HLProtocolsListWidget.comment="I render a list of protocols for the selected class.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allProtocol",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._allProtocol();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allProtocol",{},globals.HLProtocolsListWidget)})},
+args: [],
+source: "allProtocol\x0a\x09^ self model allProtocol",
+messageSends: ["allProtocol", "model"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClassForItem:",
+protocol: 'accessing',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+$1=_st(anItem).__eq(self._allProtocol());
+$ctx1.sendIdx["="]=1;
+if(smalltalk.assert($1)){
+return "";
+};
+$2=_st(anItem).__eq("private");
+$ctx1.sendIdx["="]=2;
+if(smalltalk.assert($2)){
+return "private";
+};
+$3=_st(anItem).__eq("initialization");
+if(smalltalk.assert($3)){
+return "initialization";
+};
+$4=_st(anItem)._match_("^\x5c*");
+if(smalltalk.assert($4)){
+return "extension";
+};
+return "";
+}, function($ctx1) {$ctx1.fill(self,"cssClassForItem:",{anItem:anItem},globals.HLProtocolsListWidget)})},
+args: ["anItem"],
+source: "cssClassForItem: anItem\x0a\x09anItem = self allProtocol ifTrue: [ ^ '' ].\x0a\x09anItem = 'private' ifTrue: [ ^ 'private' ].\x0a\x09anItem = 'initialization' ifTrue: [ ^ 'initialization' ].\x0a\x09(anItem match: '^\x5c*') ifTrue: [ ^ 'extension' ].\x0a\x09^ ''",
+messageSends: ["ifTrue:", "=", "allProtocol", "match:"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Protocols";
+},
+args: [],
+source: "label\x0a\x09^ 'Protocols'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLClassSelected(){return globals.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
+function $HLShowInstanceToggled(){return globals.HLShowInstanceToggled||(typeof HLShowInstanceToggled=="undefined"?nil:HLShowInstanceToggled)}
+function $HLProtocolSelected(){return globals.HLProtocolSelected||(typeof HLProtocolSelected=="undefined"?nil:HLProtocolSelected)}
+function $HLProtocolsFocusRequested(){return globals.HLProtocolsFocusRequested||(typeof HLProtocolsFocusRequested=="undefined"?nil:HLProtocolsFocusRequested)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._announcer();
+_st($1)._on_send_to_($HLClassSelected(),"onClassSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st($1)._on_send_to_($HLShowInstanceToggled(),"onClassSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+_st($1)._on_send_to_($HLProtocolSelected(),"onProtocolSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=3;
+$2=_st($1)._on_send_to_($HLProtocolsFocusRequested(),"onProtocolsFocusRequested",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLProtocolsListWidget)})},
+args: [],
+source: "observeModel\x0a    self model announcer \x0a\x09\x09on: HLClassSelected\x0a\x09\x09send: #onClassSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: HLShowInstanceToggled \x0a\x09\x09send: #onClassSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: HLProtocolSelected\x0a\x09\x09send: #onProtocolSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLProtocolsFocusRequested \x0a\x09\x09send: #onProtocolsFocusRequested\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "model"],
+referencedClasses: ["HLClassSelected", "HLShowInstanceToggled", "HLProtocolSelected", "HLProtocolsFocusRequested"]
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeSystem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $ProtocolAdded(){return globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
+function $ProtocolRemoved(){return globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._systemAnnouncer();
+_st($1)._on_send_to_($ProtocolAdded(),"onProtocolAdded:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+$2=_st($1)._on_send_to_($ProtocolRemoved(),"onProtocolRemoved:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.HLProtocolsListWidget)})},
+args: [],
+source: "observeSystem\x0a\x09self model systemAnnouncer\x0a\x09\x09on: ProtocolAdded \x0a\x09\x09send: #onProtocolAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolRemoved\x0a\x09\x09send: #onProtocolRemoved:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "systemAnnouncer", "model"],
+referencedClasses: ["ProtocolAdded", "ProtocolRemoved"]
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selectedItem_(nil);
+self._setItemsForSelectedClass();
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onClassSelected:",{anAnnouncement:anAnnouncement},globals.HLProtocolsListWidget)})},
+args: ["anAnnouncement"],
+source: "onClassSelected: anAnnouncement\x0a    self selectedItem: nil.\x0a    \x0a    self setItemsForSelectedClass.\x0a    self refresh",
+messageSends: ["selectedItem:", "setItemsForSelectedClass", "refresh"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onProtocolAdded:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var class_;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+class_=_st(anAnnouncement)._theClass();
+$1=_st(class_).__eq(_st(self._model())._selectedClass());
+if(! smalltalk.assert($1)){
+return self;
+};
+self._setItemsForSelectedClass();
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onProtocolAdded:",{anAnnouncement:anAnnouncement,class_:class_},globals.HLProtocolsListWidget)})},
+args: ["anAnnouncement"],
+source: "onProtocolAdded: anAnnouncement\x0a\x09| class |\x0a\x09\x0a\x09class := anAnnouncement theClass.\x0a\x09\x0a\x09class = self model selectedClass ifFalse: [ ^ self ].\x0a    \x0a    self setItemsForSelectedClass.\x0a    self refresh",
+messageSends: ["theClass", "ifFalse:", "=", "selectedClass", "model", "setItemsForSelectedClass", "refresh"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onProtocolRemoved:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var class_,protocol;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$4,$3,$1,$5,$6;
+class_=_st(anAnnouncement)._theClass();
+protocol=_st(anAnnouncement)._protocol();
+$2=class_;
+$4=self._model();
+$ctx1.sendIdx["model"]=1;
+$3=_st($4)._selectedClass();
+$1=_st($2).__eq($3);
+$ctx1.sendIdx["="]=1;
+if(! smalltalk.assert($1)){
+return self;
+};
+$5=_st(_st(self._model())._selectedProtocol()).__eq(protocol);
+if(smalltalk.assert($5)){
+self._selectedItem_(nil);
+$6=self._selectItem_(nil);
+$6;
+};
+self._setItemsForSelectedClass();
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onProtocolRemoved:",{anAnnouncement:anAnnouncement,class_:class_,protocol:protocol},globals.HLProtocolsListWidget)})},
+args: ["anAnnouncement"],
+source: "onProtocolRemoved: anAnnouncement\x0a\x09| class protocol |\x0a\x09\x0a\x09class := anAnnouncement theClass.\x0a\x09protocol := anAnnouncement protocol.\x0a\x09\x0a\x09class = self model selectedClass ifFalse: [ ^ self ].\x0a    \x0a    self model selectedProtocol = protocol \x0a    \x09ifTrue: [ \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09selectedItem: nil;\x0a\x09\x09\x09\x09selectItem: nil ].\x0a        \x0a    self setItemsForSelectedClass.\x0a    self refresh",
+messageSends: ["theClass", "protocol", "ifFalse:", "=", "selectedClass", "model", "ifTrue:", "selectedProtocol", "selectedItem:", "selectItem:", "setItemsForSelectedClass", "refresh"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onProtocolSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var protocol;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+protocol=_st(anAnnouncement)._item();
+self._selectedItem_(protocol);
+$1=protocol;
+if(($receiver = $1) == null || $receiver.isNil){
+return self;
+} else {
+$1;
+};
+$2=self._hasFocus();
+if(! smalltalk.assert($2)){
+self._activateItem_(protocol);
+$3=self._focus();
+$3;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onProtocolSelected:",{anAnnouncement:anAnnouncement,protocol:protocol},globals.HLProtocolsListWidget)})},
+args: ["anAnnouncement"],
+source: "onProtocolSelected: anAnnouncement\x0a\x09| protocol |\x0a\x09\x0a\x09protocol := anAnnouncement item.\x0a\x09\x0a\x09self selectedItem: protocol.\x0a\x09protocol ifNil: [ ^ self ].\x0a    \x0a\x09self hasFocus ifFalse: [\x0a\x09\x09self \x0a\x09\x09\x09activateItem: protocol;\x0a\x09\x09\x09focus ]",
+messageSends: ["item", "selectedItem:", "ifNil:", "ifFalse:", "hasFocus", "activateItem:", "focus"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onProtocolsFocusRequested",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onProtocolsFocusRequested",{},globals.HLProtocolsListWidget)})},
+args: [],
+source: "onProtocolsFocusRequested\x0a\x09self focus",
+messageSends: ["focus"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=_st(self._model())._showInstance();
+if(smalltalk.assert($1)){
+($ctx1.supercall = true, globals.HLProtocolsListWidget.superclass.fn.prototype._renderContentOn_.apply(_st(self), [html]));
+$ctx1.supercall = false;
+} else {
+$2=_st(html)._div();
+_st($2)._class_("class_side");
+$3=_st($2)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return ($ctx2.supercall = true, globals.HLProtocolsListWidget.superclass.fn.prototype._renderContentOn_.apply(_st(self), [html]));
+$ctx2.supercall = false;
+$ctx2.sendIdx["renderContentOn:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$3;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLProtocolsListWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09self model showInstance\x0a    \x09ifFalse: [ html div \x0a        \x09class: 'class_side'; \x0a            with: [ super renderContentOn: html ] ]\x0a      \x09ifTrue: [ super renderContentOn: html ]",
+messageSends: ["ifFalse:ifTrue:", "showInstance", "model", "class:", "div", "with:", "renderContentOn:"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._forceSelectedProtocol_(anItem);
+return self}, function($ctx1) {$ctx1.fill(self,"reselectItem:",{anItem:anItem},globals.HLProtocolsListWidget)})},
+args: ["anItem"],
+source: "reselectItem: anItem\x0a\x09self model forceSelectedProtocol: anItem",
+messageSends: ["forceSelectedProtocol:", "model"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectItem:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._selectedProtocol_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aString:aString},globals.HLProtocolsListWidget)})},
+args: ["aString"],
+source: "selectItem: aString\x0a    self model selectedProtocol: aString",
+messageSends: ["selectedProtocol:", "model"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedItem",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=($ctx1.supercall = true, globals.HLProtocolsListWidget.superclass.fn.prototype._selectedItem.apply(_st(self), []));
+$ctx1.supercall = false;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectedItem",{},globals.HLProtocolsListWidget)})},
+args: [],
+source: "selectedItem\x0a\x09^ super selectedItem\x22 ifNil: [ self allProtocol ]\x22",
+messageSends: ["selectedItem"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setItemsForClass:",
+protocol: 'private',
+fn: function (aClass){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+if(($receiver = aClass) == null || $receiver.isNil){
+$2=self._allProtocol();
+$ctx1.sendIdx["allProtocol"]=1;
+$1=_st($Array())._with_($2);
+$ctx1.sendIdx["with:"]=1;
+} else {
+$3=_st($Array())._with_(self._allProtocol());
+_st($3)._addAll_(_st(aClass)._protocols());
+$4=_st($3)._yourself();
+$1=$4;
+};
+self._items_($1);
+return self}, function($ctx1) {$ctx1.fill(self,"setItemsForClass:",{aClass:aClass},globals.HLProtocolsListWidget)})},
+args: ["aClass"],
+source: "setItemsForClass: aClass\x0a\x09self items: (aClass\x0a    \x09ifNil: [ Array with: self allProtocol ]\x0a      \x09ifNotNil: [ \x0a        \x09(Array with: self allProtocol) \x0a            \x09addAll: aClass protocols; \x0a                yourself ])",
+messageSends: ["items:", "ifNil:ifNotNil:", "with:", "allProtocol", "addAll:", "protocols", "yourself"],
+referencedClasses: ["Array"]
+}),
+globals.HLProtocolsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setItemsForSelectedClass",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._setItemsForClass_(_st(self._model())._selectedClass());
+return self}, function($ctx1) {$ctx1.fill(self,"setItemsForSelectedClass",{},globals.HLProtocolsListWidget)})},
+args: [],
+source: "setItemsForSelectedClass\x0a\x09self setItemsForClass: self model selectedClass",
+messageSends: ["setItemsForClass:", "selectedClass", "model"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
+
+
+smalltalk.addClass('HLSelectorsCache', globals.Object, ['classesCache'], 'Helios-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cacheFor:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+if(($receiver = aClass) == null || $receiver.isNil){
+return nil;
+} else {
+aClass;
+};
+$1=_st(self._classesCache())._at_ifAbsentPut_(_st(aClass)._name(),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._newCacheFor_(aClass);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cacheFor:",{aClass:aClass},globals.HLSelectorsCache)})},
+args: ["aClass"],
+source: "cacheFor: aClass\x0a\x09aClass ifNil: [ ^ nil ].\x0a    \x0a\x09^ self classesCache\x0a    \x09at: aClass name\x0a        ifAbsentPut: [ self newCacheFor: aClass ]",
+messageSends: ["ifNil:", "at:ifAbsentPut:", "classesCache", "name", "newCacheFor:"],
+referencedClasses: []
+}),
+globals.HLSelectorsCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classesCache",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@classesCache"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@classesCache"]=_st($HashedCollection())._new();
+$1=self["@classesCache"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classesCache",{},globals.HLSelectorsCache)})},
+args: [],
+source: "classesCache\x0a\x09^ classesCache ifNil: [ classesCache := HashedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.HLSelectorsCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLSelectorsCache.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self._observeSystem();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLSelectorsCache)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a    self observeSystem",
+messageSends: ["initialize", "observeSystem"],
+referencedClasses: []
+}),
+globals.HLSelectorsCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "invalidateCacheFor:",
+protocol: 'private',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._cacheFor_(_st(aMethod)._methodClass()))._invalidateSelector_(_st(aMethod)._selector());
+return self}, function($ctx1) {$ctx1.fill(self,"invalidateCacheFor:",{aMethod:aMethod},globals.HLSelectorsCache)})},
+args: ["aMethod"],
+source: "invalidateCacheFor: aMethod\x0a\x09(self cacheFor: aMethod methodClass)\x0a    \x09invalidateSelector: aMethod selector",
+messageSends: ["invalidateSelector:", "cacheFor:", "methodClass", "selector"],
+referencedClasses: []
+}),
+globals.HLSelectorsCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isOverridden:",
+protocol: 'testing',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._cacheFor_(_st(aMethod)._methodClass()))._isOverridden_(aMethod);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isOverridden:",{aMethod:aMethod},globals.HLSelectorsCache)})},
+args: ["aMethod"],
+source: "isOverridden: aMethod\x0a\x09^ (self cacheFor: aMethod methodClass)\x0a    \x09isOverridden: aMethod",
+messageSends: ["isOverridden:", "cacheFor:", "methodClass"],
+referencedClasses: []
+}),
+globals.HLSelectorsCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isOverride:",
+protocol: 'testing',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._cacheFor_(_st(aMethod)._methodClass()))._isOverride_(aMethod);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isOverride:",{aMethod:aMethod},globals.HLSelectorsCache)})},
+args: ["aMethod"],
+source: "isOverride: aMethod\x0a\x09^ (self cacheFor: aMethod methodClass)\x0a    \x09isOverride: aMethod",
+messageSends: ["isOverride:", "cacheFor:", "methodClass"],
+referencedClasses: []
+}),
+globals.HLSelectorsCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newCacheFor:",
+protocol: 'factory',
+fn: function (aClass){
+var self=this;
+function $HLClassCache(){return globals.HLClassCache||(typeof HLClassCache=="undefined"?nil:HLClassCache)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLClassCache())._on_selectorsCache_(aClass,self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newCacheFor:",{aClass:aClass},globals.HLSelectorsCache)})},
+args: ["aClass"],
+source: "newCacheFor: aClass\x0a\x09^ HLClassCache \x0a    \x09on: aClass\x0a        selectorsCache: self",
+messageSends: ["on:selectorsCache:"],
+referencedClasses: ["HLClassCache"]
+}),
+globals.HLSelectorsCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeSystem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $MethodAdded(){return globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
+function $MethodRemoved(){return globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($SystemAnnouncer())._current();
+_st($1)._on_send_to_($MethodAdded(),"onMethodAdded:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+$2=_st($1)._on_send_to_($MethodRemoved(),"onMethodRemoved:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.HLSelectorsCache)})},
+args: [],
+source: "observeSystem\x0a\x09SystemAnnouncer current\x0a\x09\x09on: MethodAdded\x0a\x09\x09send: #onMethodAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodRemoved\x0a        send: #onMethodRemoved:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "current"],
+referencedClasses: ["SystemAnnouncer", "MethodAdded", "MethodRemoved"]
+}),
+globals.HLSelectorsCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodAdded:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._invalidateCacheFor_(_st(anAnnouncement)._method());
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodAdded:",{anAnnouncement:anAnnouncement},globals.HLSelectorsCache)})},
+args: ["anAnnouncement"],
+source: "onMethodAdded: anAnnouncement\x0a\x09self invalidateCacheFor: anAnnouncement method",
+messageSends: ["invalidateCacheFor:", "method"],
+referencedClasses: []
+}),
+globals.HLSelectorsCache);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodRemoved:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._invalidateCacheFor_(_st(anAnnouncement)._method());
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodRemoved:",{anAnnouncement:anAnnouncement},globals.HLSelectorsCache)})},
+args: ["anAnnouncement"],
+source: "onMethodRemoved: anAnnouncement\x0a\x09self invalidateCacheFor: anAnnouncement method",
+messageSends: ["invalidateCacheFor:", "method"],
+referencedClasses: []
+}),
+globals.HLSelectorsCache);
+
+
+globals.HLSelectorsCache.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "current",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@current"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@current"]=($ctx1.supercall = true, globals.HLSelectorsCache.klass.superclass.fn.prototype._new.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=self["@current"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"current",{},globals.HLSelectorsCache.klass)})},
+args: [],
+source: "current\x0a\x09^ current ifNil: [ current := super new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: []
+}),
+globals.HLSelectorsCache.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "flush",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+self["@current"]=nil;
+return self},
+args: [],
+source: "flush\x0a\x09current := nil",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSelectorsCache.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._shouldNotImplement();
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.HLSelectorsCache.klass)})},
+args: [],
+source: "new\x0a\x09self shouldNotImplement",
+messageSends: ["shouldNotImplement"],
+referencedClasses: []
+}),
+globals.HLSelectorsCache.klass);
+
+});

+ 1557 - 0
src/Helios-Browser.st

@@ -0,0 +1,1557 @@
+Smalltalk createPackage: 'Helios-Browser'!
+HLWidget subclass: #HLBrowser
+	instanceVariableNames: 'model packagesListWidget classesListWidget protocolsListWidget methodsListWidget sourceWidget bottomDiv'
+	package: 'Helios-Browser'!
+!HLBrowser commentStamp!
+I render a system browser with 4 panes (Packages, Classes, Protocols, Methods) and a source area.!
+
+!HLBrowser methodsFor: 'accessing'!
+
+environment
+	^ self model environment
+!
+
+model
+	^ model ifNil: [ self model: HLBrowserModel new. model ]
+!
+
+model: aModel
+	model := aModel.
+	self observeModel
+! !
+
+!HLBrowser methodsFor: 'actions'!
+
+focus
+	^ self packagesListWidget focus
+!
+
+observeModel
+	self model announcer
+		on: HLPackageSelected
+		send: #onPackageSelected:
+		to: self.
+		
+	self model announcer
+		on: HLClassSelected
+		send: #onClassSelected:
+		to: self
+!
+
+openClassNamed: aString
+	self model openClassNamed: aString
+!
+
+openMethod: aCompiledMethod
+	self model
+		"Workaround for the package selection announcement when the package list is focused"	
+		focusOnSourceCode;
+		selectedPackage: aCompiledMethod methodClass package;
+		selectedClass: aCompiledMethod methodClass;
+		selectedProtocol: aCompiledMethod protocol;
+		selectedMethod: aCompiledMethod;
+		focusOnSourceCode
+!
+
+unregister
+	super unregister.
+
+	{ 
+		self packagesListWidget.
+		self classesListWidget.
+		self protocolsListWidget.
+		self methodsListWidget.
+		self sourceWidget
+	} 
+		do: [ :each | each unregister ]
+! !
+
+!HLBrowser methodsFor: 'keybindings'!
+
+registerBindingsOn: aBindingGroup
+	HLToolCommand 
+		registerConcreteClassesOn: aBindingGroup 
+		for: self model
+! !
+
+!HLBrowser methodsFor: 'reactions'!
+
+onClassSelected: anAnnouncement
+	anAnnouncement item 
+		ifNil: [ self setTabLabel: (self model selectedPackage 
+			ifNil: [ self defaultTabLabel ]
+			ifNotNil: [ :package | package name ]) ] 
+		ifNotNil: [ :item | self setTabLabel: item name ]
+!
+
+onPackageSelected: anAnnouncement
+	anAnnouncement item ifNotNil: [ :item |
+	self setTabLabel: item name ]
+! !
+
+!HLBrowser methodsFor: 'rendering'!
+
+renderContentOn: html
+	html with: (HLContainer with: (HLHorizontalSplitter 
+    	with: (HLVerticalSplitter
+        	with: (HLVerticalSplitter
+            	with: self packagesListWidget
+                with: self classesListWidget)
+            with: (HLVerticalSplitter
+            	with: self protocolsListWidget
+                with: self methodsListWidget)) 
+        with: self sourceWidget)).
+	
+	self packagesListWidget focus
+! !
+
+!HLBrowser methodsFor: 'testing'!
+
+canHaveFocus
+	^ true
+! !
+
+!HLBrowser methodsFor: 'widgets'!
+
+classesListWidget
+	^ classesListWidget ifNil: [
+      	classesListWidget := HLClassesListWidget on: self model.
+		classesListWidget next: self protocolsListWidget ]
+!
+
+methodsListWidget
+	^ methodsListWidget ifNil: [
+      	methodsListWidget := HLMethodsListWidget on: self model.
+		methodsListWidget next: self sourceWidget ]
+!
+
+packagesListWidget
+	^ packagesListWidget ifNil: [
+      	packagesListWidget := HLPackagesListWidget on: self model.
+		packagesListWidget next: self classesListWidget ]
+!
+
+protocolsListWidget
+	^ protocolsListWidget ifNil: [
+      	protocolsListWidget := HLProtocolsListWidget on: self model.
+		protocolsListWidget next: self methodsListWidget ]
+!
+
+sourceWidget
+	^ sourceWidget ifNil: [
+      	sourceWidget := HLBrowserBottomWidget new
+			model: self model;
+			yourself ]
+! !
+
+HLBrowser class instanceVariableNames: 'nextId'!
+
+!HLBrowser class methodsFor: 'accessing'!
+
+nextId
+	nextId ifNil: [ nextId := 0 ].
+    ^ 'browser_', (nextId + 1) asString
+!
+
+tabClass
+	^ 'browser'
+!
+
+tabLabel
+	^ 'Browser'
+!
+
+tabPriority
+	^ 0
+! !
+
+!HLBrowser class methodsFor: 'testing'!
+
+canBeOpenAsTab
+	^ true
+! !
+
+HLWidget subclass: #HLBrowserBottomWidget
+	instanceVariableNames: 'model codeWidget documentationWidget'
+	package: 'Helios-Browser'!
+!HLBrowserBottomWidget commentStamp!
+I render the code area of a browser and optionally the documentation for the selected class.!
+
+!HLBrowserBottomWidget methodsFor: 'accessing'!
+
+codeWidget
+	^ codeWidget ifNil: [ codeWidget := HLBrowserCodeWidget new
+		browserModel: self model;
+		yourself ]
+!
+
+documentationWidget
+	^ documentationWidget ifNil: [ documentationWidget := HLDocumentationWidget new
+		model: self model;
+		yourself ]
+!
+
+model
+	^ model
+!
+
+model: aModel
+	model := aModel.
+	self observeModel
+!
+
+previous
+	"For navigation"
+!
+
+previous: aWidget
+	"For navigation"
+! !
+
+!HLBrowserBottomWidget methodsFor: 'actions'!
+
+focus
+	self codeWidget focus
+!
+
+observeModel
+	self model announcer 
+		on: HLShowInstanceToggled
+		send: #onShowInstanceToggled
+		to: self;
+		on: HLShowCommentToggled
+		send: #onShowCommentToggled
+		to: self
+! !
+
+!HLBrowserBottomWidget methodsFor: 'reactions'!
+
+onShowCommentToggled
+	self refresh
+!
+
+onShowInstanceToggled
+	self refresh
+! !
+
+!HLBrowserBottomWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+	self model showComment 
+		ifTrue: [ self renderPanesOn: html ]
+		ifFalse: [ html with: self codeWidget ]
+!
+
+renderPanesOn: html
+	html with: (HLVerticalSplitter
+		with: self codeWidget
+		with: self documentationWidget)
+! !
+
+!HLBrowserBottomWidget methodsFor: 'testing'!
+
+canHaveFocus
+	^ true
+! !
+
+HLToolModel subclass: #HLBrowserModel
+	instanceVariableNames: 'showInstance showComment'
+	package: 'Helios-Browser'!
+
+!HLBrowserModel methodsFor: 'accessing'!
+
+showComment
+	^ showComment ifNil: [ true ]
+!
+
+showComment: aBoolean
+	self withChangesDo: [
+		showComment := aBoolean.
+		self announcer announce: HLShowCommentToggled new ]
+!
+
+showInstance
+	^ showInstance ifNil: [ true ]
+!
+
+showInstance: aBoolean
+
+	self withChangesDo: [
+		showInstance := aBoolean.
+
+    	self selectedClass ifNotNil: [
+    		self selectedClass: (aBoolean
+    			ifTrue: [ self selectedClass theNonMetaClass ]
+	    	  	ifFalse: [ self selectedClass theMetaClass ]) ].
+    
+		self announcer announce: HLShowInstanceToggled new ]
+! !
+
+!HLBrowserModel methodsFor: 'actions'!
+
+focusOnClasses
+	self announcer announce: HLClassesFocusRequested new
+!
+
+focusOnDocumentation
+	self announcer announce: HLDocumentationFocusRequested new
+!
+
+focusOnMethods
+	self announcer announce: HLMethodsFocusRequested new
+!
+
+focusOnPackages
+	self announcer announce: HLPackagesFocusRequested new
+!
+
+focusOnProtocols
+	self announcer announce: HLProtocolsFocusRequested new
+!
+
+focusOnSourceCode
+	self announcer announce: HLSourceCodeFocusRequested new
+!
+
+setClassComment: aString
+	self environment
+		setClassCommentOf: self selectedClass theNonMetaClass
+		to: aString
+!
+
+showClassTemplate
+	self selectedPackage ifNotNil: [ :package |
+		self announcer announce: (HLShowTemplate new
+			template: package classTemplate;
+			yourself) ]
+!
+
+showMethodTemplate
+	self selectedClass ifNotNil: [ :theClass |
+		self announcer announce: (HLShowTemplate new
+			template: theClass methodTemplate;
+			yourself) ]
+! !
+
+!HLBrowserModel methodsFor: 'commands actions'!
+
+editComment
+	self announcer announce: HLEditComment new
+! !
+
+!HLBrowserModel methodsFor: 'testing'!
+
+isBrowserModel
+	^ true
+! !
+
+!HLBrowserModel class methodsFor: 'instance creation'!
+
+on: anEnvironment
+
+	^ self new
+    	environment: anEnvironment;
+        yourself
+! !
+
+Object subclass: #HLClassCache
+	instanceVariableNames: 'class selectorsCache overrideCache overriddenCache'
+	package: 'Helios-Browser'!
+
+!HLClassCache methodsFor: 'accessing'!
+
+overriddenCache
+	^ overriddenCache ifNil: [ overriddenCache := HashedCollection new ]
+!
+
+overrideCache
+	^ overrideCache ifNil: [ overrideCache := HashedCollection new ]
+!
+
+selectorsCache
+	^ selectorsCache
+!
+
+selectorsCache: aCache
+	selectorsCache := aCache
+!
+
+theClass
+	^ class
+!
+
+theClass: aClass
+	class := aClass
+! !
+
+!HLClassCache methodsFor: 'actions'!
+
+invalidateChildrenSelector: aSelector
+	self theClass subclasses do: [ :each |
+    	(self selectorsCache cacheFor: each)
+        	removeSelector: aSelector;
+        	invalidateChildrenSelector: aSelector ]
+!
+
+invalidateParentSelector: aSelector
+	self theClass superclass ifNotNil: [
+    	(self selectorsCache cacheFor: self theClass superclass)
+        	removeSelector: aSelector;
+			invalidateParentSelector: aSelector ]
+!
+
+invalidateSelector: aSelector
+	self 
+    	invalidateParentSelector: aSelector;
+        invalidateChildrenSelector: aSelector;
+        removeSelector: aSelector
+! !
+
+!HLClassCache methodsFor: 'private'!
+
+removeSelector: aSelector
+	self overriddenCache 
+    	removeKey: aSelector
+        ifAbsent: [ ].
+    self overrideCache 
+    	removeKey: aSelector
+        ifAbsent: [ ]
+! !
+
+!HLClassCache methodsFor: 'testing'!
+
+isOverridden: aMethod
+	^ self overriddenCache 
+    	at: aMethod selector
+      	ifAbsentPut: [ aMethod isOverridden ]
+!
+
+isOverride: aMethod
+	^ self overrideCache
+    	at: aMethod selector
+      	ifAbsentPut: [ aMethod isOverride ]
+! !
+
+!HLClassCache class methodsFor: 'instance creation'!
+
+on: aClass selectorsCache: aSelectorsCache
+	^ self new
+    	theClass: aClass;
+        selectorsCache: aSelectorsCache;
+        yourself
+! !
+
+HLToolListWidget subclass: #HLClassesListWidget
+	instanceVariableNames: ''
+	package: 'Helios-Browser'!
+!HLClassesListWidget commentStamp!
+I render a list of classes in the selected package.!
+
+!HLClassesListWidget methodsFor: 'accessing'!
+
+cssClassForItem: aClass
+	^ aClass theNonMetaClass heliosClass
+!
+
+getChildrenOf: aClass
+	^ self items select: [ :each | each superclass = aClass ]
+!
+
+getRootClassesOf: aCollection
+	^ aCollection select: [ :each |
+    		(aCollection includes: each superclass) not ]
+!
+
+label
+	^ 'Classes'
+! !
+
+!HLClassesListWidget methodsFor: 'actions'!
+
+focus
+	super focus.
+	
+	self selectedItem 
+		ifNil: [ self model showClassTemplate ]
+!
+
+focusMethodsListWidget
+	self model announcer announce: HLMethodsListFocus new
+!
+
+focusProtocolsListWidget
+	self model announcer announce: HLProtocolsListFocus new
+!
+
+observeModel
+	self model announcer 
+    	on: HLPackageSelected
+		send: #onPackageSelected:
+		to: self;
+		
+    	on: HLShowInstanceToggled 
+		send: #onShowInstanceToggled
+		to: self;
+		
+		on: HLShowCommentToggled
+		send: #onShowCommentToggled
+		to: self;
+		
+		on: HLClassSelected
+		send: #onClassSelected:
+		to: self;
+		
+		on: HLClassesFocusRequested
+		send: #onClassesFocusRequested
+		to: self
+!
+
+observeSystem
+	self model systemAnnouncer
+    	on: ClassAdded
+		send: #onClassAdded:
+		to: self;
+		
+        on: ClassRemoved
+        send: #onClassRemoved:
+		to: self;
+		
+		on: ClassMoved
+		send: #onClassMoved:
+		to: self;
+		
+		on: ClassRenamed
+		send: #onClassRenamed:
+		to: self;
+		
+		on: ClassMigrated
+		send: #onClassMigrated:
+		to: self;
+		
+		on: ClassCommentChanged
+        send: #onClassCommentChanged:
+		to: self
+!
+
+reselectItem: anItem
+	self model forceSelectedClass: anItem
+!
+
+selectItem: aClass
+    self model selectedClass: aClass
+!
+
+showComment: aBoolean
+	self model showComment: aBoolean
+!
+
+showInstance: aBoolean
+	self model showInstance: aBoolean
+!
+
+toggleShowComment
+	self model showComment: self showComment not
+! !
+
+!HLClassesListWidget methodsFor: 'private'!
+
+setItemsForPackage: aPackage
+	self items: (aPackage 
+    	ifNil: [ #() ]
+  		ifNotNil: [ (aPackage classes 
+        	collect: [ :each | each theNonMetaClass ]) 
+            	sort: [ :a :b | a name < b name ] ]).
+!
+
+setItemsForSelectedPackage
+	self setItemsForPackage: self model selectedPackage
+! !
+
+!HLClassesListWidget methodsFor: 'reactions'!
+
+onClassAdded: anAnnouncement
+	| class |
+	
+	class := anAnnouncement theClass.
+	
+	(class package = self model selectedPackage or: [
+		self items includes: class ]) ifFalse: [ ^ self ].
+    
+    self 
+		setItemsForSelectedPackage;
+		refresh;
+		focus
+!
+
+onClassCommentChanged: anAnnouncement
+	| class |
+	class := anAnnouncement theClass.
+
+	class package = self model selectedPackage ifFalse: [ ^ self ].
+    
+    self 
+		refresh;
+		focus
+!
+
+onClassMigrated: anAnnouncement
+	| class oldClass |
+	
+	class := anAnnouncement theClass.
+	oldClass := anAnnouncement oldClass.
+
+	(self items includes: oldClass) ifFalse: [ ^ self ].
+
+	self model selectedClass = oldClass ifTrue: [
+		self model selectedClass: class ].
+    
+    self setItemsForSelectedPackage.
+    self 
+		refresh;
+		focus
+!
+
+onClassMoved: anAnnouncement
+	| class oldPackage |
+	
+	class := anAnnouncement theClass.
+	oldPackage := anAnnouncement oldPackage.
+	
+	(oldPackage = self model selectedPackage or: [
+		class package = self model selectedPackage ])
+			ifFalse: [ ^ self ].
+	
+	oldPackage = self model selectedPackage ifTrue: [ 
+		self 
+			selectedItem: nil;
+			selectItem: nil ].
+    
+    self setItemsForSelectedPackage.
+    self 	
+		refresh;
+		focus
+!
+
+onClassRemoved: anAnnouncement
+	| class |
+	class := anAnnouncement theClass.
+
+	class package = self model selectedPackage ifFalse: [ ^ self ].
+    
+	self 
+		selectItem: nil;
+		selectedItem: nil.
+    self setItemsForSelectedPackage.
+    self 
+		refresh;
+		focus
+!
+
+onClassRenamed: anAnnouncement
+	anAnnouncement theClass package = self model selectedPackage ifFalse: [ ^ self ].
+    
+    self setItemsForSelectedPackage.
+    self 
+		refresh;
+		focus
+!
+
+onClassSelected: anAnnouncement
+	| selectedClass |
+	
+	anAnnouncement item ifNil: [ ^ self ].
+	
+	selectedClass := anAnnouncement item theNonMetaClass.
+	self selectedItem: selectedClass.
+
+	self hasFocus ifFalse: [
+		self 
+			activateItem: selectedClass;
+			focus ]
+!
+
+onClassesFocusRequested
+	self focus
+!
+
+onPackageSelected: anAnnouncement
+    self selectedItem: nil.
+    
+    self setItemsForSelectedPackage.
+    self refresh
+!
+
+onShowCommentToggled
+	self refresh
+!
+
+onShowInstanceToggled
+	self refresh
+! !
+
+!HLClassesListWidget methodsFor: 'rendering'!
+
+renderButtonsOn: html
+	| checkbox |
+	
+	html div 
+        class: 'btn-group';
+		with: [ 
+           	html button 
+                class: (String streamContents: [ :str |
+                	str nextPutAll: 'btn'.
+                    self showInstance ifTrue: [ 
+                    	str nextPutAll: ' active' ] ]);
+  				with: 'Instance';
+                onClick: [ self showInstance: true ].
+  			html button
+  				class: (String streamContents: [ :str |
+                	str nextPutAll: 'btn'.
+                    self showClass ifTrue: [ 
+                    	str nextPutAll: ' active' ] ]);
+  				with: 'Class';
+				onClick: [ self showInstance: false ] ].
+		html label 
+			class: 'checkbox';
+			with: [
+				checkbox := html input
+					type: 'checkbox';
+					onClick: [ self toggleShowComment ].
+				html with: 'Doc' ].
+				
+		self showComment ifTrue: [
+			checkbox at: 'checked' put: 'checked' ]
+!
+
+renderItem: aClass level: anInteger on: html
+	| li |
+    
+	li := html li.
+	li asJQuery data: 'item' put: aClass.
+    li
+		class: (self listCssClassForItem: aClass);
+		with: [ 
+        	html a
+            	with: [ 
+            		(html tag: 'i') class: (self cssClassForItem: aClass).
+  					self renderItemLabel: aClass level: anInteger on: html ];
+				onClick: [
+                  	self reactivateListItem: li asJQuery ] ].
+                    
+    (self getChildrenOf: aClass) do: [ :each |
+    	self renderItem: each level: anInteger + 1 on: html ]
+!
+
+renderItem: aClass on: html
+	super renderItem: aClass on: html.
+    (self getChildrenOf: aClass) do: [ :each |
+    	self renderItem: each level: 1 on: html ]
+!
+
+renderItemLabel: aClass level: anInteger on: html
+	html span asJQuery html: (String streamContents: [ :str |
+		anInteger timesRepeat: [
+			str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;' ].
+			str nextPutAll: aClass name ])
+!
+
+renderItemLabel: aClass on: html
+	self renderItemLabel: aClass level: 0 on: html
+!
+
+renderListOn: html
+	(self getRootClassesOf: self items)
+    	do: [ :each | self renderItem: each on: html ]
+! !
+
+!HLClassesListWidget methodsFor: 'testing'!
+
+showClass
+	^ self model showInstance not
+!
+
+showComment
+	^ self model showComment
+!
+
+showInstance
+	^ self model showInstance
+! !
+
+HLFocusableWidget subclass: #HLDocumentationWidget
+	instanceVariableNames: 'model'
+	package: 'Helios-Browser'!
+!HLDocumentationWidget commentStamp!
+I render the documentation for the selected class!
+
+!HLDocumentationWidget methodsFor: 'accessing'!
+
+documentation
+	^ self selectedItem 
+		ifNil: [ '' ]
+		ifNotNil: [ :item | item comment ifEmpty: [ self defaultDocumentation ] ]
+!
+
+head
+	^ self selectedItem 
+		ifNil: [ self defaultHead ]
+		ifNotNil: [ :item | item name ]
+!
+
+model
+	^ model
+!
+
+model: aModel
+	model := aModel.
+	self 
+		observeSystem;
+		observeModel
+!
+
+selectedItem
+	^ self model selectedClass ifNotNil: [ :class | class theNonMetaClass ]
+! !
+
+!HLDocumentationWidget methodsFor: 'actions'!
+
+editDocumentation
+	self model editComment
+!
+
+observeModel
+	self model announcer 
+		on: HLClassSelected
+		send: #onClassSelected:
+		to: self;
+		
+		on: HLEditComment
+		send: #onEditDocumentation
+		to: self;
+		
+		on: HLDocumentationFocusRequested
+		send: #onDocumentationFocusRequested
+		to: self
+!
+
+observeSystem
+	self model systemAnnouncer 
+		on: ClassCommentChanged
+		send: #onClassCommentChanged:
+		to: self
+!
+
+selectClass: aClass
+	self model selectedClass: aClass
+!
+
+unregister
+	super unregister.
+	self model announcer unregister: self
+! !
+
+!HLDocumentationWidget methodsFor: 'defaults'!
+
+defaultDocumentation
+	^ 'No documentation is available for this class.'
+!
+
+defaultHead
+	^ 'No class selected'
+! !
+
+!HLDocumentationWidget methodsFor: 'reactions'!
+
+onClassCommentChanged: anAnnouncement
+	self model selectedClass ifNil: [ ^ self ].
+	
+	anAnnouncement theClass = self model selectedClass theNonMetaClass
+		ifTrue: [ self refresh ]
+!
+
+onClassSelected: anAnnouncement
+	self refresh
+!
+
+onDocumentationFocusRequested
+	self focus
+!
+
+onEditDocumentation
+	self 
+		request: self model selectedClass theNonMetaClass name, ' comment'
+		value: self model selectedClass theNonMetaClass comment
+		do: [ :comment | self setClassComment: comment ]
+!
+
+setClassComment: aString
+	self model setClassComment: aString
+! !
+
+!HLDocumentationWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+	html div 
+		class: 'doc';
+		with: [
+			self 
+				renderHeadOn: html;
+				renderDocOn: html ]
+!
+
+renderDocOn: html
+	self selectedItem ifNotNil: [
+		self renderInheritanceOn: html.
+		html h1 
+			with: 'Overview';
+			with: [ 
+				html button
+					class: 'button default';
+					with: 'Edit';
+					onClick: [ self editDocumentation ] ].
+		(html div 
+			class: 'markdown';
+			asJQuery) html: ((Showdown at: 'converter') new makeHtml: self documentation) ]
+!
+
+renderHeadOn: html
+	html div 
+		class: 'head';
+		with: self head
+!
+
+renderInheritanceOn: html
+	html div 	
+		class: 'inheritance';
+		with: [
+			html with: 'Subclass of '.
+			self selectedItem superclass 
+				ifNil: [ html em with: 'nil' ]
+				ifNotNil: [
+					html a 
+						with: self selectedItem superclass name;
+						onClick: [ self selectClass: self selectedItem superclass ] ] ]
+! !
+
+HLToolListWidget subclass: #HLMethodsListWidget
+	instanceVariableNames: 'selectorsCache'
+	package: 'Helios-Browser'!
+!HLMethodsListWidget commentStamp!
+I render a list of methods for the selected protocol.!
+
+!HLMethodsListWidget methodsFor: 'accessing'!
+
+allProtocol
+	^ self model allProtocol
+!
+
+cssClassForItem: aSelector
+	| override overriden method |
+    
+    method := self methodForSelector: aSelector.
+    override := self isOverride: method.
+    overriden := self isOverridden: method.
+    
+	^ override
+    	ifTrue: [ overriden
+			ifTrue: [ 'override-overridden' ]
+			ifFalse: [ 'override' ] ]
+		ifFalse: [
+			overriden
+			ifTrue: [ 'overridden' ]
+			ifFalse: [ '' ] ]
+!
+
+label
+	^ 'Methods'
+!
+
+methodForSelector: aSelector
+	^ self model selectedClass
+    	methodDictionary at: aSelector
+!
+
+methodsInProtocol: aString
+	self model selectedClass ifNil: [ ^ #() ].
+    
+	^ aString = self allProtocol
+    	ifTrue: [ self model selectedClass methods ]
+      	ifFalse: [ self model selectedClass methodsInProtocol: aString ]
+!
+
+overrideSelectors
+	^ self selectorsCache 
+    	at: 'override'
+        ifAbsentPut: [ 
+        	self model selectedClass allSuperclasses
+				inject: Set new into: [ :acc :each | acc addAll: each selectors; yourself ] ]
+!
+
+overridenSelectors
+	^ self selectorsCache 
+    	at: 'overriden'
+        ifAbsentPut: [ 
+        	self model selectedClass allSubclasses
+				inject: Set new into: [ :acc :each | acc addAll: each selectors; yourself ] ]
+!
+
+selectorsCache
+	^ self class selectorsCache
+!
+
+selectorsInProtocol: aString
+	^ ((self methodsInProtocol: aString)
+    	collect: [ :each | each selector ]) sorted
+! !
+
+!HLMethodsListWidget methodsFor: 'actions'!
+
+focus
+	super focus.
+	
+	self selectedItem ifNil: [
+		self model showMethodTemplate ]
+!
+
+observeModel
+	self model announcer 
+		on: HLProtocolSelected 
+		send: #onProtocolSelected: 
+		to: self;
+		
+		on: HLShowInstanceToggled 
+		send: #onShowInstanceToggled
+		to: self;
+		
+		on: HLMethodSelected 
+		send: #onMethodSelected:
+		to: self;
+		
+		on: HLMethodsFocusRequested 
+		send: #onMethodsFocusRequested
+		to: self
+!
+
+observeSystem
+	self model systemAnnouncer 
+    	on: ProtocolAdded
+        send: #onProtocolAdded:
+		to: self;
+    	
+		on: ProtocolRemoved
+        send: #onProtocolRemoved:
+		to: self;
+		
+    	on: MethodAdded 
+        send: #onMethodAdded:
+		to: self;
+		
+        on: MethodRemoved 
+        send: #onMethodRemoved:
+		to: self;
+		
+		on: MethodMoved 
+        send: #onMethodMoved:
+		to: self
+!
+
+reselectItem: aSelector
+	self model forceSelectedMethod: (self methodForSelector: aSelector)
+!
+
+selectItem: aSelector
+	aSelector ifNil: [ ^ self model selectedMethod: nil ].
+
+   	self model selectedMethod: (self methodForSelector: aSelector)
+! !
+
+!HLMethodsListWidget methodsFor: 'private'!
+
+setItemsForProtocol: aString
+	^ self items: (aString
+    	ifNil: [ #() ]
+      	ifNotNil: [ self selectorsInProtocol: aString ])
+!
+
+setItemsForSelectedProtocol
+	self setItemsForProtocol: self model selectedProtocol
+! !
+
+!HLMethodsListWidget methodsFor: 'reactions'!
+
+onMethodAdded: anAnnouncement
+	self model selectedClass = anAnnouncement method methodClass ifFalse: [ ^ self ].
+    
+    self setItemsForSelectedProtocol.
+    self refresh
+!
+
+onMethodMoved: anAnnouncement
+	self model selectedMethod = anAnnouncement method ifFalse: [ ^ self ].
+    
+	self model selectedProtocol = self model allProtocol ifFalse: [
+		self 
+			selectedItem: nil; 
+			selectItem: nil;
+			setItemsForSelectedProtocol;
+    		refresh ]
+!
+
+onMethodRemoved: anAnnouncement
+	| method |
+	
+	method := anAnnouncement method.
+	
+	self items detect: [ :each | each = method selector ] ifNone: [ ^ self ].
+
+    self selectedItem ifNotNil: [
+      	(method methodClass = self model selectedClass and: [ method selector = self selectedItem ])
+  			ifTrue: [ 
+				self selectedItem: nil; 
+				selectItem: nil ] ].
+
+    self setItemsForSelectedProtocol.
+	self 
+		refresh;
+		focus
+!
+
+onMethodSelected: anAnnouncement
+	| selector method |
+	
+	method := anAnnouncement item.
+	
+	selector := method isCompiledMethod 
+		ifTrue: [ method selector ]
+		ifFalse: [ nil ].
+		
+	self 
+		selectedItem: selector;
+		activateItem: selector
+!
+
+onMethodsFocusRequested
+	self focus
+!
+
+onProtocolAdded: anAnnouncement
+	self model selectedClass = anAnnouncement theClass ifFalse: [ ^ self ].
+	
+	self setItemsForSelectedProtocol.
+    self refresh.
+	self focus
+!
+
+onProtocolRemoved: anAnnouncement
+	self model selectedClass = anAnnouncement theClass ifFalse: [ ^ self ].
+	
+	self setItemsForSelectedProtocol.
+    self refresh.
+	self focus
+!
+
+onProtocolSelected: anAnnouncement
+    self selectedItem: nil.
+    
+	self setItemsForSelectedProtocol.
+    self refresh
+!
+
+onShowInstanceToggled
+	self onProtocolSelected: nil
+! !
+
+!HLMethodsListWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+	self model showInstance
+    	ifFalse: [ html div 
+        	class: 'class_side'; 
+            with: [ super renderContentOn: html ] ]
+      	ifTrue: [ super renderContentOn: html ]
+!
+
+renderItemLabel: aSelector on: html
+	html with: aSelector
+! !
+
+!HLMethodsListWidget methodsFor: 'testing'!
+
+isOverridden: aMethod
+   ^ self selectorsCache isOverridden: aMethod
+!
+
+isOverride: aMethod
+   ^ self selectorsCache isOverride: aMethod
+! !
+
+HLMethodsListWidget class instanceVariableNames: 'selectorsCache'!
+
+!HLMethodsListWidget class methodsFor: 'accessing'!
+
+selectorsCache
+	^ HLSelectorsCache current
+! !
+
+HLToolListWidget subclass: #HLPackagesListWidget
+	instanceVariableNames: ''
+	package: 'Helios-Browser'!
+!HLPackagesListWidget commentStamp!
+I render a list of the system packages.!
+
+!HLPackagesListWidget methodsFor: 'accessing'!
+
+cssClassForItem: anItem	
+	^ anItem isDirty 
+		ifTrue: [ 'package_dirty' ]
+		ifFalse: [ 'package' ]
+!
+
+items
+	^ items ifNil: [ self initializeItems ]
+!
+
+label
+	^ 'Packages'
+! !
+
+!HLPackagesListWidget methodsFor: 'actions'!
+
+focusClassesListWidget
+	self model announcer announce: HLClassesListFocus new
+!
+
+observeModel
+    self model announcer 
+		on: HLPackageSelected
+		send: #onPackageSelected:
+		to: self;
+		
+		on: HLPackagesFocusRequested 
+		send: #onPackagesFocusRequested
+		to: self
+!
+
+observeSystem
+    self model systemAnnouncer 
+		on: ClassAdded 
+		send: #onClassAdded:
+		to: self.
+		
+	self model systemAnnouncer
+		on: PackageAdded
+		send: #onPackageAdded:
+		to: self.
+		
+	self model systemAnnouncer
+		on: PackageClean
+		send: #onPackageStateChanged
+		to: self.
+		
+	self model systemAnnouncer
+		on: PackageDirty
+		send: #onPackageStateChanged
+		to: self.
+!
+
+reselectItem: anItem
+	self model forceSelectedPackage: anItem
+!
+
+selectItem: aPackage
+	super selectItem: aPackage.
+	self model selectedPackage: aPackage
+! !
+
+!HLPackagesListWidget methodsFor: 'initialization'!
+
+initializeItems
+	^ items := self model packages 
+		sort: [ :a :b | a name < b name ]
+! !
+
+!HLPackagesListWidget methodsFor: 'reactions'!
+
+onClassAdded: anAnnouncement
+	"Amber doesn't have yet a global organizer for packages"
+	
+	(self items includes: anAnnouncement theClass package) ifFalse: [ 
+		self 
+			initializeItems;
+			refresh ]
+!
+
+onPackageAdded: anAnnouncement
+	self 
+		initializeItems;
+		refresh
+!
+
+onPackageSelected: anAnnouncement
+	| package |
+	
+	package := anAnnouncement item.
+	
+	self selectedItem: package.
+	self hasFocus ifFalse: [
+		self
+			activateItem: package;
+			focus ]
+!
+
+onPackageStateChanged
+	self refresh
+!
+
+onPackagesFocusRequested
+	self focus
+! !
+
+!HLPackagesListWidget methodsFor: 'rendering'!
+
+renderItemLabel: aPackage on: html
+	html with: aPackage name
+! !
+
+HLToolListWidget subclass: #HLProtocolsListWidget
+	instanceVariableNames: ''
+	package: 'Helios-Browser'!
+!HLProtocolsListWidget commentStamp!
+I render a list of protocols for the selected class.!
+
+!HLProtocolsListWidget methodsFor: 'accessing'!
+
+allProtocol
+	^ self model allProtocol
+!
+
+cssClassForItem: anItem
+	anItem = self allProtocol ifTrue: [ ^ '' ].
+	anItem = 'private' ifTrue: [ ^ 'private' ].
+	anItem = 'initialization' ifTrue: [ ^ 'initialization' ].
+	(anItem match: '^\*') ifTrue: [ ^ 'extension' ].
+	^ ''
+!
+
+label
+	^ 'Protocols'
+!
+
+selectedItem
+	^ super selectedItem" ifNil: [ self allProtocol ]"
+! !
+
+!HLProtocolsListWidget methodsFor: 'actions'!
+
+observeModel
+    self model announcer 
+		on: HLClassSelected
+		send: #onClassSelected:
+		to: self;
+		
+    	on: HLShowInstanceToggled 
+		send: #onClassSelected:
+		to: self;
+		
+    	on: HLProtocolSelected
+		send: #onProtocolSelected:
+		to: self;
+		
+		on: HLProtocolsFocusRequested 
+		send: #onProtocolsFocusRequested
+		to: self
+!
+
+observeSystem
+	self model systemAnnouncer
+		on: ProtocolAdded 
+		send: #onProtocolAdded:
+		to: self;
+		
+		on: ProtocolRemoved
+		send: #onProtocolRemoved:
+		to: self
+!
+
+reselectItem: anItem
+	self model forceSelectedProtocol: anItem
+!
+
+selectItem: aString
+    self model selectedProtocol: aString
+! !
+
+!HLProtocolsListWidget methodsFor: 'private'!
+
+setItemsForClass: aClass
+	self items: (aClass
+    	ifNil: [ Array with: self allProtocol ]
+      	ifNotNil: [ 
+        	(Array with: self allProtocol) 
+            	addAll: aClass protocols; 
+                yourself ])
+!
+
+setItemsForSelectedClass
+	self setItemsForClass: self model selectedClass
+! !
+
+!HLProtocolsListWidget methodsFor: 'reactions'!
+
+onClassSelected: anAnnouncement
+    self selectedItem: nil.
+    
+    self setItemsForSelectedClass.
+    self refresh
+!
+
+onProtocolAdded: anAnnouncement
+	| class |
+	
+	class := anAnnouncement theClass.
+	
+	class = self model selectedClass ifFalse: [ ^ self ].
+    
+    self setItemsForSelectedClass.
+    self refresh
+!
+
+onProtocolRemoved: anAnnouncement
+	| class protocol |
+	
+	class := anAnnouncement theClass.
+	protocol := anAnnouncement protocol.
+	
+	class = self model selectedClass ifFalse: [ ^ self ].
+    
+    self model selectedProtocol = protocol 
+    	ifTrue: [ 
+			self 
+				selectedItem: nil;
+				selectItem: nil ].
+        
+    self setItemsForSelectedClass.
+    self refresh
+!
+
+onProtocolSelected: anAnnouncement
+	| protocol |
+	
+	protocol := anAnnouncement item.
+	
+	self selectedItem: protocol.
+	protocol ifNil: [ ^ self ].
+    
+	self hasFocus ifFalse: [
+		self 
+			activateItem: protocol;
+			focus ]
+!
+
+onProtocolsFocusRequested
+	self focus
+! !
+
+!HLProtocolsListWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+	self model showInstance
+    	ifFalse: [ html div 
+        	class: 'class_side'; 
+            with: [ super renderContentOn: html ] ]
+      	ifTrue: [ super renderContentOn: html ]
+! !
+
+Object subclass: #HLSelectorsCache
+	instanceVariableNames: 'classesCache'
+	package: 'Helios-Browser'!
+
+!HLSelectorsCache methodsFor: 'accessing'!
+
+cacheFor: aClass
+	aClass ifNil: [ ^ nil ].
+    
+	^ self classesCache
+    	at: aClass name
+        ifAbsentPut: [ self newCacheFor: aClass ]
+!
+
+classesCache
+	^ classesCache ifNil: [ classesCache := HashedCollection new ]
+! !
+
+!HLSelectorsCache methodsFor: 'actions'!
+
+observeSystem
+	SystemAnnouncer current
+		on: MethodAdded
+		send: #onMethodAdded:
+		to: self;
+		
+		on: MethodRemoved
+        send: #onMethodRemoved:
+		to: self
+! !
+
+!HLSelectorsCache methodsFor: 'factory'!
+
+newCacheFor: aClass
+	^ HLClassCache 
+    	on: aClass
+        selectorsCache: self
+! !
+
+!HLSelectorsCache methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+    self observeSystem
+! !
+
+!HLSelectorsCache methodsFor: 'private'!
+
+invalidateCacheFor: aMethod
+	(self cacheFor: aMethod methodClass)
+    	invalidateSelector: aMethod selector
+! !
+
+!HLSelectorsCache methodsFor: 'reactions'!
+
+onMethodAdded: anAnnouncement
+	self invalidateCacheFor: anAnnouncement method
+!
+
+onMethodRemoved: anAnnouncement
+	self invalidateCacheFor: anAnnouncement method
+! !
+
+!HLSelectorsCache methodsFor: 'testing'!
+
+isOverridden: aMethod
+	^ (self cacheFor: aMethod methodClass)
+    	isOverridden: aMethod
+!
+
+isOverride: aMethod
+	^ (self cacheFor: aMethod methodClass)
+    	isOverride: aMethod
+! !
+
+HLSelectorsCache class instanceVariableNames: 'current'!
+
+!HLSelectorsCache class methodsFor: 'accessing'!
+
+current
+	^ current ifNil: [ current := super new ]
+!
+
+flush
+	current := nil
+! !
+
+!HLSelectorsCache class methodsFor: 'instance creation'!
+
+new
+	self shouldNotImplement
+! !
+

+ 799 - 0
src/Helios-Commands-Browser.js

@@ -0,0 +1,799 @@
+define("helios/Helios-Commands-Browser", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "helios/Helios-Commands-Tools"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Commands-Browser');
+smalltalk.packages["Helios-Commands-Browser"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLBrowserCommand', globals.HLToolCommand, [], 'Helios-Commands-Browser');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isValidFor:",
+protocol: 'testing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aModel)._isBrowserModel();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isValidFor:",{aModel:aModel},globals.HLBrowserCommand.klass)})},
+args: ["aModel"],
+source: "isValidFor: aModel\x0a\x09^ aModel isBrowserModel",
+messageSends: ["isBrowserModel"],
+referencedClasses: []
+}),
+globals.HLBrowserCommand.klass);
+
+
+smalltalk.addClass('HLBrowserGoToCommand', globals.HLBrowserCommand, [], 'Helios-Commands-Browser');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isValidFor:",
+protocol: 'testing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aModel)._isBrowserModel();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isValidFor:",{aModel:aModel},globals.HLBrowserGoToCommand.klass)})},
+args: ["aModel"],
+source: "isValidFor: aModel\x0a\x09^ aModel isBrowserModel",
+messageSends: ["isBrowserModel"],
+referencedClasses: []
+}),
+globals.HLBrowserGoToCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "g";
+},
+args: [],
+source: "key\x0a\x09^ 'g'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowserGoToCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Go to";
+},
+args: [],
+source: "label\x0a\x09^ 'Go to'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowserGoToCommand.klass);
+
+
+smalltalk.addClass('HLGoToClassesCommand', globals.HLBrowserGoToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._focusOnClasses();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLGoToClassesCommand)})},
+args: [],
+source: "execute\x0a\x09self model focusOnClasses",
+messageSends: ["focusOnClasses", "model"],
+referencedClasses: []
+}),
+globals.HLGoToClassesCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToClassesCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Classes";
+},
+args: [],
+source: "label\x0a\x09^ 'Classes'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToClassesCommand.klass);
+
+
+smalltalk.addClass('HLGoToDocumentationCommand', globals.HLBrowserGoToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._focusOnDocumentation();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLGoToDocumentationCommand)})},
+args: [],
+source: "execute\x0a\x09self model focusOnDocumentation",
+messageSends: ["focusOnDocumentation", "model"],
+referencedClasses: []
+}),
+globals.HLGoToDocumentationCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "d";
+},
+args: [],
+source: "key\x0a\x09^ 'd'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToDocumentationCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Documentation";
+},
+args: [],
+source: "label\x0a\x09^ 'Documentation'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToDocumentationCommand.klass);
+
+
+smalltalk.addClass('HLGoToMethodsCommand', globals.HLBrowserGoToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._focusOnMethods();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLGoToMethodsCommand)})},
+args: [],
+source: "execute\x0a\x09self model focusOnMethods",
+messageSends: ["focusOnMethods", "model"],
+referencedClasses: []
+}),
+globals.HLGoToMethodsCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "m";
+},
+args: [],
+source: "key\x0a\x09^ 'm'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToMethodsCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Methods";
+},
+args: [],
+source: "label\x0a\x09^ 'Methods'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToMethodsCommand.klass);
+
+
+smalltalk.addClass('HLGoToPackagesCommand', globals.HLBrowserGoToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._focusOnPackages();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLGoToPackagesCommand)})},
+args: [],
+source: "execute\x0a\x09self model focusOnPackages",
+messageSends: ["focusOnPackages", "model"],
+referencedClasses: []
+}),
+globals.HLGoToPackagesCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "p";
+},
+args: [],
+source: "key\x0a\x09^ 'p'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToPackagesCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Packages";
+},
+args: [],
+source: "label\x0a\x09^ 'Packages'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToPackagesCommand.klass);
+
+
+smalltalk.addClass('HLGoToProtocolsCommand', globals.HLBrowserGoToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._focusOnProtocols();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLGoToProtocolsCommand)})},
+args: [],
+source: "execute\x0a\x09self model focusOnProtocols",
+messageSends: ["focusOnProtocols", "model"],
+referencedClasses: []
+}),
+globals.HLGoToProtocolsCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "t";
+},
+args: [],
+source: "key\x0a\x09^ 't'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToProtocolsCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Protocols";
+},
+args: [],
+source: "label\x0a\x09^ 'Protocols'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToProtocolsCommand.klass);
+
+
+smalltalk.addClass('HLGoToSourceCodeCommand', globals.HLBrowserGoToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._focusOnSourceCode();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLGoToSourceCodeCommand)})},
+args: [],
+source: "execute\x0a\x09self model focusOnSourceCode",
+messageSends: ["focusOnSourceCode", "model"],
+referencedClasses: []
+}),
+globals.HLGoToSourceCodeCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "s";
+},
+args: [],
+source: "key\x0a\x09^ 's'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToSourceCodeCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Source code";
+},
+args: [],
+source: "label\x0a\x09^ 'Source code'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGoToSourceCodeCommand.klass);
+
+
+smalltalk.addClass('HLEditCommentCommand', globals.HLBrowserCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._editComment();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLEditCommentCommand)})},
+args: [],
+source: "execute\x0a\x09self model editComment",
+messageSends: ["editComment", "model"],
+referencedClasses: []
+}),
+globals.HLEditCommentCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self._model();
+$ctx1.sendIdx["model"]=1;
+$2=_st($3)._showComment();
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(self._model())._selectedClass())._notNil();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLEditCommentCommand)})},
+args: [],
+source: "isActive\x0a\x09^ self model showComment and: [ self model selectedClass notNil ]",
+messageSends: ["and:", "showComment", "model", "notNil", "selectedClass"],
+referencedClasses: []
+}),
+globals.HLEditCommentCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "d";
+},
+args: [],
+source: "key\x0a\x09^ 'd'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLEditCommentCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Edit documentation";
+},
+args: [],
+source: "label\x0a\x09^ 'Edit documentation'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLEditCommentCommand.klass);
+
+
+smalltalk.addClass('HLGenerateCommand', globals.HLBrowserCommand, [], 'Helios-Commands-Browser');
+globals.HLGenerateCommand.comment="I am a group command used to gather all the commands generating code (`accessors`, `initialize`, etc)";
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "h";
+},
+args: [],
+source: "key\x0a\x09^ 'h'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerateCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Generate";
+},
+args: [],
+source: "label\x0a\x09^ 'Generate'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerateCommand.klass);
+
+
+smalltalk.addClass('HLCategorizeUnclassifiedCommand', globals.HLGenerateCommand, [], 'Helios-Commands-Browser');
+globals.HLCategorizeUnclassifiedCommand.comment="I am the command used to categorize unclassified methods";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+var targetClass,unclassified;
+function $HLMethodClassifier(){return globals.HLMethodClassifier||(typeof HLMethodClassifier=="undefined"?nil:HLMethodClassifier)}
+return smalltalk.withContext(function($ctx1) { 
+targetClass=_st(self._model())._selectedClass();
+unclassified=_st(_st(targetClass)._methods())._select_((function(e){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(e)._protocol()).__eq("as yet unclassified");
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,1)})}));
+_st(_st($HLMethodClassifier())._new())._classifyAll_(unclassified);
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{targetClass:targetClass,unclassified:unclassified},globals.HLCategorizeUnclassifiedCommand)})},
+args: [],
+source: "execute\x0a\x09| targetClass unclassified |\x0a\x09targetClass := self model selectedClass.\x0a\x0a\x09unclassified := targetClass methods select:[ :e | e protocol = 'as yet unclassified' ].\x0a\x09\x09\x0a\x09HLMethodClassifier new\x0a\x09\x09classifyAll: unclassified",
+messageSends: ["selectedClass", "model", "select:", "methods", "=", "protocol", "classifyAll:", "new"],
+referencedClasses: ["HLMethodClassifier"]
+}),
+globals.HLCategorizeUnclassifiedCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCategorizeUnclassifiedCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Categorize";
+},
+args: [],
+source: "label\x0a\x09^ 'Categorize'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCategorizeUnclassifiedCommand.klass);
+
+
+smalltalk.addClass('HLGenerateAccessorsCommand', globals.HLGenerateCommand, [], 'Helios-Commands-Browser');
+globals.HLGenerateAccessorsCommand.comment="I am the command used to generate the `getter` and the `setter` methods depending of the selected class";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+var targetClass,output,first;
+function $HLInitializeGenerator(){return globals.HLInitializeGenerator||(typeof HLInitializeGenerator=="undefined"?nil:HLInitializeGenerator)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5;
+$1=self._model();
+$ctx1.sendIdx["model"]=1;
+targetClass=_st($1)._selectedClass();
+$2=_st($HLInitializeGenerator())._new();
+_st($2)._class_(targetClass);
+_st($2)._generate();
+$3=_st($2)._output();
+output=$3;
+_st(output)._compile();
+first=_st(_st(output)._sourceCodes())._first();
+$4=self._model();
+_st($4)._selectedProtocol_(_st(output)._protocol());
+_st($4)._selectedMethod_(_st(targetClass).__gt_gt(_st(first)._selector()));
+$5=_st($4)._focusOnSourceCode();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{targetClass:targetClass,output:output,first:first},globals.HLGenerateAccessorsCommand)})},
+args: [],
+source: "execute\x0a\x09| targetClass output first |\x0a\x09targetClass := self model selectedClass.\x0a\x0a\x09output := HLInitializeGenerator new\x0a\x09\x09class: targetClass;\x0a\x09\x09generate;\x0a\x09\x09output.\x0a\x09\x09\x0a\x09output compile.\x0a\x09first := output sourceCodes first.\x0a\x09self model\x0a\x09\x09selectedProtocol: output protocol;\x0a\x09\x09selectedMethod:(targetClass>>first selector);\x0a\x09\x09focusOnSourceCode",
+messageSends: ["selectedClass", "model", "class:", "new", "generate", "output", "compile", "first", "sourceCodes", "selectedProtocol:", "protocol", "selectedMethod:", ">>", "selector", "focusOnSourceCode"],
+referencedClasses: ["HLInitializeGenerator"]
+}),
+globals.HLGenerateAccessorsCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "i";
+},
+args: [],
+source: "key\x0a\x09^ 'i'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerateAccessorsCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Initialize";
+},
+args: [],
+source: "label\x0a\x09^ 'Initialize'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerateAccessorsCommand.klass);
+
+
+smalltalk.addClass('HLGenerateInitializeCommand', globals.HLGenerateCommand, [], 'Helios-Commands-Browser');
+globals.HLGenerateInitializeCommand.comment="I am the command used to generate the `initialize` method depending of the selected class";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+var targetClass,output;
+function $HLAccessorsGenerator(){return globals.HLAccessorsGenerator||(typeof HLAccessorsGenerator=="undefined"?nil:HLAccessorsGenerator)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=self._model();
+$ctx1.sendIdx["model"]=1;
+targetClass=_st($1)._selectedClass();
+$2=_st($HLAccessorsGenerator())._new();
+_st($2)._class_(targetClass);
+_st($2)._generate();
+$3=_st($2)._output();
+output=$3;
+_st(output)._compile();
+_st(self._model())._selectedProtocol_(_st(output)._protocol());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{targetClass:targetClass,output:output},globals.HLGenerateInitializeCommand)})},
+args: [],
+source: "execute\x0a\x09| targetClass output |\x0a\x09targetClass := self model selectedClass.\x0a\x0a\x09output := HLAccessorsGenerator new\x0a\x09\x09class: targetClass;\x0a\x09\x09generate;\x0a\x09\x09output.\x0a\x09\x09\x0a\x09output compile.\x0a\x09self model selectedProtocol: output protocol",
+messageSends: ["selectedClass", "model", "class:", "new", "generate", "output", "compile", "selectedProtocol:", "protocol"],
+referencedClasses: ["HLAccessorsGenerator"]
+}),
+globals.HLGenerateInitializeCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "a";
+},
+args: [],
+source: "key\x0a\x09^ 'a'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerateInitializeCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Accessors";
+},
+args: [],
+source: "label\x0a\x09^ 'Accessors'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerateInitializeCommand.klass);
+
+
+smalltalk.addClass('HLToggleCommand', globals.HLBrowserCommand, [], 'Helios-Commands-Browser');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "t";
+},
+args: [],
+source: "key\x0a\x09^ 't'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToggleCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Toggle";
+},
+args: [],
+source: "label\x0a\x09^ 'Toggle'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToggleCommand.klass);
+
+
+smalltalk.addClass('HLToggleClassCommentCommand', globals.HLToggleCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._model();
+$ctx1.sendIdx["model"]=1;
+_st($1)._showComment_(_st(_st(self._model())._showComment())._not());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLToggleClassCommentCommand)})},
+args: [],
+source: "execute\x0a\x09self model showComment: self model showComment not",
+messageSends: ["showComment:", "model", "not", "showComment"],
+referencedClasses: []
+}),
+globals.HLToggleClassCommentCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "d";
+},
+args: [],
+source: "key\x0a\x09^ 'd'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToggleClassCommentCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Documentation";
+},
+args: [],
+source: "label\x0a\x09^ 'Documentation'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToggleClassCommentCommand.klass);
+
+
+smalltalk.addClass('HLToggleClassSideCommand', globals.HLToggleCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._model();
+$ctx1.sendIdx["model"]=1;
+_st($1)._showInstance_(_st(_st(self._model())._showInstance())._not());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLToggleClassSideCommand)})},
+args: [],
+source: "execute\x0a\x09self model showInstance: self model showInstance not",
+messageSends: ["showInstance:", "model", "not", "showInstance"],
+referencedClasses: []
+}),
+globals.HLToggleClassSideCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToggleClassSideCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Class side";
+},
+args: [],
+source: "label\x0a\x09^ 'Class side'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToggleClassSideCommand.klass);
+
+});

+ 341 - 0
src/Helios-Commands-Browser.st

@@ -0,0 +1,341 @@
+Smalltalk createPackage: 'Helios-Commands-Browser'!
+HLToolCommand subclass: #HLBrowserCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLBrowserCommand class methodsFor: 'testing'!
+
+isValidFor: aModel
+	^ aModel isBrowserModel
+! !
+
+HLBrowserCommand subclass: #HLBrowserGoToCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLBrowserGoToCommand class methodsFor: 'accessing'!
+
+key
+	^ 'g'
+!
+
+label
+	^ 'Go to'
+! !
+
+!HLBrowserGoToCommand class methodsFor: 'testing'!
+
+isValidFor: aModel
+	^ aModel isBrowserModel
+! !
+
+HLBrowserGoToCommand subclass: #HLGoToClassesCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLGoToClassesCommand methodsFor: 'executing'!
+
+execute
+	self model focusOnClasses
+! !
+
+!HLGoToClassesCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label
+	^ 'Classes'
+! !
+
+HLBrowserGoToCommand subclass: #HLGoToDocumentationCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLGoToDocumentationCommand methodsFor: 'executing'!
+
+execute
+	self model focusOnDocumentation
+! !
+
+!HLGoToDocumentationCommand class methodsFor: 'accessing'!
+
+key
+	^ 'd'
+!
+
+label
+	^ 'Documentation'
+! !
+
+HLBrowserGoToCommand subclass: #HLGoToMethodsCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLGoToMethodsCommand methodsFor: 'executing'!
+
+execute
+	self model focusOnMethods
+! !
+
+!HLGoToMethodsCommand class methodsFor: 'accessing'!
+
+key
+	^ 'm'
+!
+
+label
+	^ 'Methods'
+! !
+
+HLBrowserGoToCommand subclass: #HLGoToPackagesCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLGoToPackagesCommand methodsFor: 'executing'!
+
+execute
+	self model focusOnPackages
+! !
+
+!HLGoToPackagesCommand class methodsFor: 'accessing'!
+
+key
+	^ 'p'
+!
+
+label
+	^ 'Packages'
+! !
+
+HLBrowserGoToCommand subclass: #HLGoToProtocolsCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLGoToProtocolsCommand methodsFor: 'executing'!
+
+execute
+	self model focusOnProtocols
+! !
+
+!HLGoToProtocolsCommand class methodsFor: 'accessing'!
+
+key
+	^ 't'
+!
+
+label
+	^ 'Protocols'
+! !
+
+HLBrowserGoToCommand subclass: #HLGoToSourceCodeCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLGoToSourceCodeCommand methodsFor: 'executing'!
+
+execute
+	self model focusOnSourceCode
+! !
+
+!HLGoToSourceCodeCommand class methodsFor: 'accessing'!
+
+key
+	^ 's'
+!
+
+label
+	^ 'Source code'
+! !
+
+HLBrowserCommand subclass: #HLEditCommentCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLEditCommentCommand methodsFor: 'executing'!
+
+execute
+	self model editComment
+! !
+
+!HLEditCommentCommand methodsFor: 'testing'!
+
+isActive
+	^ self model showComment and: [ self model selectedClass notNil ]
+! !
+
+!HLEditCommentCommand class methodsFor: 'accessing'!
+
+key
+	^ 'd'
+!
+
+label
+	^ 'Edit documentation'
+! !
+
+HLBrowserCommand subclass: #HLGenerateCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+!HLGenerateCommand commentStamp!
+I am a group command used to gather all the commands generating code (`accessors`, `initialize`, etc)!
+
+!HLGenerateCommand class methodsFor: 'accessing'!
+
+key
+	^ 'h'
+!
+
+label
+	^ 'Generate'
+! !
+
+HLGenerateCommand subclass: #HLCategorizeUnclassifiedCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+!HLCategorizeUnclassifiedCommand commentStamp!
+I am the command used to categorize unclassified methods!
+
+!HLCategorizeUnclassifiedCommand methodsFor: 'executing'!
+
+execute
+	| targetClass unclassified |
+	targetClass := self model selectedClass.
+
+	unclassified := targetClass methods select:[ :e | e protocol = 'as yet unclassified' ].
+		
+	HLMethodClassifier new
+		classifyAll: unclassified
+! !
+
+!HLCategorizeUnclassifiedCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label
+	^ 'Categorize'
+! !
+
+HLGenerateCommand subclass: #HLGenerateAccessorsCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+!HLGenerateAccessorsCommand commentStamp!
+I am the command used to generate the `getter` and the `setter` methods depending of the selected class!
+
+!HLGenerateAccessorsCommand methodsFor: 'executing'!
+
+execute
+	| targetClass output first |
+	targetClass := self model selectedClass.
+
+	output := HLInitializeGenerator new
+		class: targetClass;
+		generate;
+		output.
+		
+	output compile.
+	first := output sourceCodes first.
+	self model
+		selectedProtocol: output protocol;
+		selectedMethod:(targetClass>>first selector);
+		focusOnSourceCode
+! !
+
+!HLGenerateAccessorsCommand class methodsFor: 'accessing'!
+
+key
+	^ 'i'
+!
+
+label
+	^ 'Initialize'
+! !
+
+HLGenerateCommand subclass: #HLGenerateInitializeCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+!HLGenerateInitializeCommand commentStamp!
+I am the command used to generate the `initialize` method depending of the selected class!
+
+!HLGenerateInitializeCommand methodsFor: 'executing'!
+
+execute
+	| targetClass output |
+	targetClass := self model selectedClass.
+
+	output := HLAccessorsGenerator new
+		class: targetClass;
+		generate;
+		output.
+		
+	output compile.
+	self model selectedProtocol: output protocol
+! !
+
+!HLGenerateInitializeCommand class methodsFor: 'accessing'!
+
+key
+	^ 'a'
+!
+
+label
+	^ 'Accessors'
+! !
+
+HLBrowserCommand subclass: #HLToggleCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLToggleCommand class methodsFor: 'accessing'!
+
+key
+	^ 't'
+!
+
+label
+	^ 'Toggle'
+! !
+
+HLToggleCommand subclass: #HLToggleClassCommentCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLToggleClassCommentCommand methodsFor: 'executing'!
+
+execute
+	self model showComment: self model showComment not
+! !
+
+!HLToggleClassCommentCommand class methodsFor: 'accessing'!
+
+key
+	^ 'd'
+!
+
+label
+	^ 'Documentation'
+! !
+
+HLToggleCommand subclass: #HLToggleClassSideCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
+
+!HLToggleClassSideCommand methodsFor: 'executing'!
+
+execute
+	self model showInstance: self model showInstance not
+! !
+
+!HLToggleClassSideCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label
+	^ 'Class side'
+! !
+

+ 1002 - 0
src/Helios-Commands-Core.js

@@ -0,0 +1,1002 @@
+define("helios/Helios-Commands-Core", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Commands-Core');
+smalltalk.packages["Helios-Commands-Core"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLCommand', globals.Object, ['input'], 'Helios-Commands-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asActionBinding",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $HLBindingAction(){return globals.HLBindingAction||(typeof HLBindingAction=="undefined"?nil:HLBindingAction)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($HLBindingAction())._on_labelled_(self._keyCode(),self._label());
+_st($2)._command_(self);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asActionBinding",{},globals.HLCommand)})},
+args: [],
+source: "asActionBinding\x0a\x09^ (HLBindingAction on: self keyCode labelled: self label)\x0a    \x09command: self;\x0a\x09\x09yourself",
+messageSends: ["command:", "on:labelled:", "keyCode", "label", "yourself"],
+referencedClasses: ["HLBindingAction"]
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asBinding",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._isBindingGroup();
+if(smalltalk.assert($2)){
+$1=self._asGroupBinding();
+} else {
+$1=self._asActionBinding();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asBinding",{},globals.HLCommand)})},
+args: [],
+source: "asBinding\x0a\x09^ self isBindingGroup\x0a\x09\x09ifTrue: [ self asGroupBinding ]\x0a\x09\x09ifFalse: [ self asActionBinding ]",
+messageSends: ["ifTrue:ifFalse:", "isBindingGroup", "asGroupBinding", "asActionBinding"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asGroupBinding",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $HLBindingGroup(){return globals.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLBindingGroup())._on_labelled_(self._keyCode(),self._label());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asGroupBinding",{},globals.HLCommand)})},
+args: [],
+source: "asGroupBinding\x0a\x09^ HLBindingGroup \x0a\x09\x09on: self keyCode\x0a\x09\x09labelled: self label",
+messageSends: ["on:labelled:", "keyCode", "label"],
+referencedClasses: ["HLBindingGroup"]
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commandError:",
+protocol: 'error handling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._error_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"commandError:",{aString:aString},globals.HLCommand)})},
+args: ["aString"],
+source: "commandError: aString\x0a\x09self error: aString",
+messageSends: ["error:"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultInput",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return "";
+},
+args: [],
+source: "defaultInput\x0a\x09^ ''",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "documentation",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._documentation();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"documentation",{},globals.HLCommand)})},
+args: [],
+source: "documentation\x0a\x09^ self class documentation",
+messageSends: ["documentation", "class"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "execute",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "input",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@input"];
+return $1;
+},
+args: [],
+source: "input\x0a\x09^ input",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "input:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+var $1;
+self["@input"]=aString;
+$1=self["@input"];
+return $1;
+},
+args: ["aString"],
+source: "input: aString\x0a\x09^ input := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputCompletion",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=[];
+return $1;
+},
+args: [],
+source: "inputCompletion\x0a\x09^ #()",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._label();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputLabel",{},globals.HLCommand)})},
+args: [],
+source: "inputLabel\x0a\x09^ self label",
+messageSends: ["label"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isAction",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._isBindingGroup())._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isAction",{},globals.HLCommand)})},
+args: [],
+source: "isAction\x0a\x09^ self isBindingGroup not",
+messageSends: ["not", "isBindingGroup"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isActive\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBindingGroup",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(self._class())._methodDictionary())._includesKey_("execute"))._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isBindingGroup",{},globals.HLCommand)})},
+args: [],
+source: "isBindingGroup\x0a\x09^ (self class methodDictionary includesKey: 'execute') not",
+messageSends: ["not", "includesKey:", "methodDictionary", "class"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInputRequired",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isInputRequired\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._key();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"key",{},globals.HLCommand)})},
+args: [],
+source: "key\x0a\x09^ self class key",
+messageSends: ["key", "class"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyCode",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._key())._asUppercase())._charCodeAt_((1));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"keyCode",{},globals.HLCommand)})},
+args: [],
+source: "keyCode\x0a\x09^ self key asUppercase charCodeAt: 1",
+messageSends: ["charCodeAt:", "asUppercase", "key"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._label();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"label",{},globals.HLCommand)})},
+args: [],
+source: "label\x0a\x09^ self class label",
+messageSends: ["label", "class"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._menuLabel();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"menuLabel",{},globals.HLCommand)})},
+args: [],
+source: "menuLabel\x0a\x09^ self class menuLabel",
+messageSends: ["menuLabel", "class"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerOn:",
+protocol: 'registration',
+fn: function (aBinding){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aBinding)._add_(self._asBinding());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"registerOn:",{aBinding:aBinding},globals.HLCommand)})},
+args: ["aBinding"],
+source: "registerOn: aBinding\x0a\x09^ aBinding add: self asBinding",
+messageSends: ["add:", "asBinding"],
+referencedClasses: []
+}),
+globals.HLCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "concreteClasses",
+protocol: 'registration',
+fn: function (){
+var self=this;
+var classes;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+classes=_st($OrderedCollection())._new();
+$1=self._isConcrete();
+if(smalltalk.assert($1)){
+_st(classes)._add_(self);
+};
+_st(self._subclasses())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(classes)._addAll_(_st(each)._concreteClasses());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+$2=classes;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"concreteClasses",{classes:classes},globals.HLCommand.klass)})},
+args: [],
+source: "concreteClasses\x0a\x09| classes |\x0a\x09\x0a\x09classes := OrderedCollection new.\x0a\x09\x0a\x09self isConcrete\x0a\x09\x09ifTrue: [ classes add: self ].\x0a\x09\x09\x0a\x09self subclasses do: [ :each | \x0a\x09\x09classes addAll: each concreteClasses ].\x0a\x09\x09\x0a\x09^ classes",
+messageSends: ["new", "ifTrue:", "isConcrete", "add:", "do:", "subclasses", "addAll:", "concreteClasses"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "documentation",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "";
+},
+args: [],
+source: "documentation\x0a\x09^ ''",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isConcrete",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._key())._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isConcrete",{},globals.HLCommand.klass)})},
+args: [],
+source: "isConcrete\x0a\x09^ self key notNil",
+messageSends: ["notNil", "key"],
+referencedClasses: []
+}),
+globals.HLCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isValidFor:",
+protocol: 'testing',
+fn: function (aModel){
+var self=this;
+return true;
+},
+args: ["aModel"],
+source: "isValidFor: aModel\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return nil;
+},
+args: [],
+source: "key\x0a\x09\x22Answer a single character string or nil if no key\x22\x0a\x09\x0a\x09^ nil",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "";
+},
+args: [],
+source: "label\x0a\x09^ ''",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._label();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"menuLabel",{},globals.HLCommand.klass)})},
+args: [],
+source: "menuLabel\x0a\x09^ self label",
+messageSends: ["label"],
+referencedClasses: []
+}),
+globals.HLCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerConcreteClassesOn:",
+protocol: 'accessing',
+fn: function (aBinding){
+var self=this;
+var newBinding;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._isConcrete();
+if(smalltalk.assert($1)){
+newBinding=self._registerOn_(aBinding);
+newBinding;
+} else {
+newBinding=aBinding;
+newBinding;
+};
+_st(self._subclasses())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._registerConcreteClassesOn_(newBinding);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"registerConcreteClassesOn:",{aBinding:aBinding,newBinding:newBinding},globals.HLCommand.klass)})},
+args: ["aBinding"],
+source: "registerConcreteClassesOn: aBinding\x0a\x09| newBinding |\x0a\x09\x0a\x09self isConcrete\x0a\x09\x09ifTrue: [ newBinding := self registerOn: aBinding ]\x0a\x09\x09ifFalse: [ newBinding := aBinding ].\x0a\x09\x09\x0a\x09self subclasses do: [ :each | each registerConcreteClassesOn: newBinding ]",
+messageSends: ["ifTrue:ifFalse:", "isConcrete", "registerOn:", "do:", "subclasses", "registerConcreteClassesOn:"],
+referencedClasses: []
+}),
+globals.HLCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerOn:",
+protocol: 'registration',
+fn: function (aBinding){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._new())._registerOn_(aBinding);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"registerOn:",{aBinding:aBinding},globals.HLCommand.klass)})},
+args: ["aBinding"],
+source: "registerOn: aBinding\x0a\x09^ self new registerOn: aBinding",
+messageSends: ["registerOn:", "new"],
+referencedClasses: []
+}),
+globals.HLCommand.klass);
+
+
+smalltalk.addClass('HLCloseTabCommand', globals.HLCommand, [], 'Helios-Commands-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($HLManager())._current())._removeActiveTab();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLCloseTabCommand)})},
+args: [],
+source: "execute\x0a\x09HLManager current removeActiveTab",
+messageSends: ["removeActiveTab", "current"],
+referencedClasses: ["HLManager"]
+}),
+globals.HLCloseTabCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "w";
+},
+args: [],
+source: "key\x0a\x09^ 'w'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCloseTabCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Close tab";
+},
+args: [],
+source: "label\x0a\x09^ 'Close tab'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCloseTabCommand.klass);
+
+
+smalltalk.addClass('HLModelCommand', globals.HLCommand, ['model'], 'Helios-Commands-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@model"];
+return $1;
+},
+args: [],
+source: "model\x0a\x09^ model",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLModelCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+protocol: 'accessing',
+fn: function (aModel){
+var self=this;
+self["@model"]=aModel;
+return self},
+args: ["aModel"],
+source: "model: aModel\x0a\x09model := aModel",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLModelCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "for:",
+protocol: 'instance creation',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"for:",{aModel:aModel},globals.HLModelCommand.klass)})},
+args: ["aModel"],
+source: "for: aModel\x0a\x09^ self new",
+messageSends: ["new"],
+referencedClasses: []
+}),
+globals.HLModelCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerConcreteClassesOn:for:",
+protocol: 'registration',
+fn: function (aBinding,aModel){
+var self=this;
+var newBinding;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._isConcrete())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._isValidFor_(aModel);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(smalltalk.assert($1)){
+newBinding=self._registerOn_for_(aBinding,aModel);
+newBinding;
+} else {
+newBinding=aBinding;
+newBinding;
+};
+_st(self._subclasses())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._registerConcreteClassesOn_for_(newBinding,aModel);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"registerConcreteClassesOn:for:",{aBinding:aBinding,aModel:aModel,newBinding:newBinding},globals.HLModelCommand.klass)})},
+args: ["aBinding", "aModel"],
+source: "registerConcreteClassesOn: aBinding for: aModel\x0a\x09| newBinding |\x0a\x09\x0a\x09(self isConcrete and: [ self isValidFor: aModel ])\x0a\x09\x09ifTrue: [ newBinding := self registerOn: aBinding for: aModel ]\x0a\x09\x09ifFalse: [ newBinding := aBinding ].\x0a\x09\x09\x0a\x09self subclasses do: [ :each |\x0a\x09\x09each registerConcreteClassesOn: newBinding for: aModel ]",
+messageSends: ["ifTrue:ifFalse:", "and:", "isConcrete", "isValidFor:", "registerOn:for:", "do:", "subclasses", "registerConcreteClassesOn:for:"],
+referencedClasses: []
+}),
+globals.HLModelCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerOn:for:",
+protocol: 'registration',
+fn: function (aBinding,aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._for_(aModel))._registerOn_(aBinding);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"registerOn:for:",{aBinding:aBinding,aModel:aModel},globals.HLModelCommand.klass)})},
+args: ["aBinding", "aModel"],
+source: "registerOn: aBinding for: aModel\x0a\x09^ (self for: aModel) registerOn: aBinding",
+messageSends: ["registerOn:", "for:"],
+referencedClasses: []
+}),
+globals.HLModelCommand.klass);
+
+
+smalltalk.addClass('HLOpenCommand', globals.HLCommand, [], 'Helios-Commands-Core');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "o";
+},
+args: [],
+source: "key\x0a\x09^ 'o'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLOpenCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Open";
+},
+args: [],
+source: "label\x0a\x09^ 'Open'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLOpenCommand.klass);
+
+
+smalltalk.addClass('HLOpenBrowserCommand', globals.HLOpenCommand, [], 'Helios-Commands-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+function $HLBrowser(){return globals.HLBrowser||(typeof HLBrowser=="undefined"?nil:HLBrowser)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLBrowser())._openAsTab();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLOpenBrowserCommand)})},
+args: [],
+source: "execute\x0a\x09^ HLBrowser openAsTab",
+messageSends: ["openAsTab"],
+referencedClasses: ["HLBrowser"]
+}),
+globals.HLOpenBrowserCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "b";
+},
+args: [],
+source: "key\x0a\x09^ 'b'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLOpenBrowserCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Browser";
+},
+args: [],
+source: "label\x0a\x09^ 'Browser'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLOpenBrowserCommand.klass);
+
+
+smalltalk.addClass('HLOpenSUnitCommand', globals.HLOpenCommand, [], 'Helios-Commands-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+function $HLSUnit(){return globals.HLSUnit||(typeof HLSUnit=="undefined"?nil:HLSUnit)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLSUnit())._openAsTab();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLOpenSUnitCommand)})},
+args: [],
+source: "execute\x0a\x09^ HLSUnit openAsTab",
+messageSends: ["openAsTab"],
+referencedClasses: ["HLSUnit"]
+}),
+globals.HLOpenSUnitCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "s";
+},
+args: [],
+source: "key\x0a\x09^ 's'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLOpenSUnitCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "SUnit";
+},
+args: [],
+source: "label\x0a\x09^ 'SUnit'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLOpenSUnitCommand.klass);
+
+
+smalltalk.addClass('HLOpenWorkspaceCommand', globals.HLOpenCommand, [], 'Helios-Commands-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+function $HLWorkspace(){return globals.HLWorkspace||(typeof HLWorkspace=="undefined"?nil:HLWorkspace)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLWorkspace())._openAsTab();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLOpenWorkspaceCommand)})},
+args: [],
+source: "execute\x0a\x09^ HLWorkspace openAsTab",
+messageSends: ["openAsTab"],
+referencedClasses: ["HLWorkspace"]
+}),
+globals.HLOpenWorkspaceCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "w";
+},
+args: [],
+source: "key\x0a\x09^ 'w'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLOpenWorkspaceCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Workspace";
+},
+args: [],
+source: "label\x0a\x09^ 'Workspace'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLOpenWorkspaceCommand.klass);
+
+
+smalltalk.addClass('HLSwitchTabCommand', globals.HLCommand, [], 'Helios-Commands-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+var activeTab;
+function $HLTabSelectionWidget(){return globals.HLTabSelectionWidget||(typeof HLTabSelectionWidget=="undefined"?nil:HLTabSelectionWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+activeTab=self._selectedTab();
+$ctx1.sendIdx["selectedTab"]=1;
+$2=_st($HLTabSelectionWidget())._new();
+_st($2)._tabs_(self._tabs());
+_st($2)._selectedTab_(self._selectedTab());
+_st($2)._selectCallback_((function(tab){
+return smalltalk.withContext(function($ctx2) {
+return _st(tab)._activate();
+$ctx2.sendIdx["activate"]=1;
+}, function($ctx2) {$ctx2.fillBlock({tab:tab},$ctx1,1)})}));
+_st($2)._confirmCallback_((function(tab){
+return smalltalk.withContext(function($ctx2) {
+return _st(tab)._focus();
+}, function($ctx2) {$ctx2.fillBlock({tab:tab},$ctx1,2)})}));
+_st($2)._cancelCallback_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(activeTab)._activate();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$3=_st($2)._show();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"execute",{activeTab:activeTab},globals.HLSwitchTabCommand)})},
+args: [],
+source: "execute\x0a\x09| activeTab |\x0a\x09\x0a\x09activeTab := self selectedTab.\x0a\x09\x0a\x09^ HLTabSelectionWidget new\x0a\x09\x09tabs: self tabs;\x0a\x09\x09selectedTab: self selectedTab;\x0a\x09\x09selectCallback: [ :tab | tab activate ];\x0a\x09\x09confirmCallback: [ :tab | tab focus ];\x0a\x09\x09cancelCallback: [ activeTab activate ];\x0a\x09\x09show",
+messageSends: ["selectedTab", "tabs:", "new", "tabs", "selectedTab:", "selectCallback:", "activate", "confirmCallback:", "focus", "cancelCallback:", "show"],
+referencedClasses: ["HLTabSelectionWidget"]
+}),
+globals.HLSwitchTabCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedTab",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($HLManager())._current())._activeTab();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectedTab",{},globals.HLSwitchTabCommand)})},
+args: [],
+source: "selectedTab\x0a\x09^ HLManager current activeTab",
+messageSends: ["activeTab", "current"],
+referencedClasses: ["HLManager"]
+}),
+globals.HLSwitchTabCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabs",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($HLManager())._current())._tabs();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tabs",{},globals.HLSwitchTabCommand)})},
+args: [],
+source: "tabs\x0a\x09^ HLManager current tabs",
+messageSends: ["tabs", "current"],
+referencedClasses: ["HLManager"]
+}),
+globals.HLSwitchTabCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "s";
+},
+args: [],
+source: "key\x0a\x09^ 's'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSwitchTabCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Switch tab";
+},
+args: [],
+source: "label\x0a\x09^ 'Switch tab'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSwitchTabCommand.klass);
+
+
+smalltalk.addClass('HLViewCommand', globals.HLCommand, [], 'Helios-Commands-Core');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "View";
+},
+args: [],
+source: "label\x0a\x09^ 'View'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLViewCommand.klass);
+
+});

+ 345 - 0
src/Helios-Commands-Core.st

@@ -0,0 +1,345 @@
+Smalltalk createPackage: 'Helios-Commands-Core'!
+Object subclass: #HLCommand
+	instanceVariableNames: 'input'
+	package: 'Helios-Commands-Core'!
+
+!HLCommand methodsFor: 'accessing'!
+
+documentation
+	^ self class documentation
+!
+
+input
+	^ input
+!
+
+input: aString
+	^ input := aString
+!
+
+inputCompletion
+	^ #()
+!
+
+inputLabel
+	^ self label
+!
+
+key
+	^ self class key
+!
+
+keyCode
+	^ self key asUppercase charCodeAt: 1
+!
+
+label
+	^ self class label
+!
+
+menuLabel
+	^ self class menuLabel
+! !
+
+!HLCommand methodsFor: 'converting'!
+
+asActionBinding
+	^ (HLBindingAction on: self keyCode labelled: self label)
+    	command: self;
+		yourself
+!
+
+asBinding
+	^ self isBindingGroup
+		ifTrue: [ self asGroupBinding ]
+		ifFalse: [ self asActionBinding ]
+!
+
+asGroupBinding
+	^ HLBindingGroup 
+		on: self keyCode
+		labelled: self label
+! !
+
+!HLCommand methodsFor: 'defaults'!
+
+defaultInput
+	^ ''
+! !
+
+!HLCommand methodsFor: 'error handling'!
+
+commandError: aString
+	self error: aString
+! !
+
+!HLCommand methodsFor: 'executing'!
+
+execute
+! !
+
+!HLCommand methodsFor: 'registration'!
+
+registerOn: aBinding
+	^ aBinding add: self asBinding
+! !
+
+!HLCommand methodsFor: 'testing'!
+
+isAction
+	^ self isBindingGroup not
+!
+
+isActive
+	^ true
+!
+
+isBindingGroup
+	^ (self class methodDictionary includesKey: 'execute') not
+!
+
+isInputRequired
+	^ false
+! !
+
+!HLCommand class methodsFor: 'accessing'!
+
+documentation
+	^ ''
+!
+
+key
+	"Answer a single character string or nil if no key"
+	
+	^ nil
+!
+
+label
+	^ ''
+!
+
+menuLabel
+	^ self label
+!
+
+registerConcreteClassesOn: aBinding
+	| newBinding |
+	
+	self isConcrete
+		ifTrue: [ newBinding := self registerOn: aBinding ]
+		ifFalse: [ newBinding := aBinding ].
+		
+	self subclasses do: [ :each | each registerConcreteClassesOn: newBinding ]
+! !
+
+!HLCommand class methodsFor: 'registration'!
+
+concreteClasses
+	| classes |
+	
+	classes := OrderedCollection new.
+	
+	self isConcrete
+		ifTrue: [ classes add: self ].
+		
+	self subclasses do: [ :each | 
+		classes addAll: each concreteClasses ].
+		
+	^ classes
+!
+
+registerOn: aBinding
+	^ self new registerOn: aBinding
+! !
+
+!HLCommand class methodsFor: 'testing'!
+
+isConcrete
+	^ self key notNil
+!
+
+isValidFor: aModel
+	^ true
+! !
+
+HLCommand subclass: #HLCloseTabCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Core'!
+
+!HLCloseTabCommand methodsFor: 'executing'!
+
+execute
+	HLManager current removeActiveTab
+! !
+
+!HLCloseTabCommand class methodsFor: 'accessing'!
+
+key
+	^ 'w'
+!
+
+label
+	^ 'Close tab'
+! !
+
+HLCommand subclass: #HLModelCommand
+	instanceVariableNames: 'model'
+	package: 'Helios-Commands-Core'!
+
+!HLModelCommand methodsFor: 'accessing'!
+
+model
+	^ model
+!
+
+model: aModel
+	model := aModel
+! !
+
+!HLModelCommand class methodsFor: 'instance creation'!
+
+for: aModel
+	^ self new
+! !
+
+!HLModelCommand class methodsFor: 'registration'!
+
+registerConcreteClassesOn: aBinding for: aModel
+	| newBinding |
+	
+	(self isConcrete and: [ self isValidFor: aModel ])
+		ifTrue: [ newBinding := self registerOn: aBinding for: aModel ]
+		ifFalse: [ newBinding := aBinding ].
+		
+	self subclasses do: [ :each |
+		each registerConcreteClassesOn: newBinding for: aModel ]
+!
+
+registerOn: aBinding for: aModel
+	^ (self for: aModel) registerOn: aBinding
+! !
+
+HLCommand subclass: #HLOpenCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Core'!
+
+!HLOpenCommand class methodsFor: 'accessing'!
+
+key
+	^ 'o'
+!
+
+label
+	^ 'Open'
+! !
+
+HLOpenCommand subclass: #HLOpenBrowserCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Core'!
+
+!HLOpenBrowserCommand methodsFor: 'executing'!
+
+execute
+	^ HLBrowser openAsTab
+! !
+
+!HLOpenBrowserCommand class methodsFor: 'accessing'!
+
+key
+	^ 'b'
+!
+
+label
+	^ 'Browser'
+! !
+
+HLOpenCommand subclass: #HLOpenSUnitCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Core'!
+
+!HLOpenSUnitCommand methodsFor: 'executing'!
+
+execute
+	^ HLSUnit openAsTab
+! !
+
+!HLOpenSUnitCommand class methodsFor: 'accessing'!
+
+key
+	^ 's'
+!
+
+label
+	^ 'SUnit'
+! !
+
+HLOpenCommand subclass: #HLOpenWorkspaceCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Core'!
+
+!HLOpenWorkspaceCommand methodsFor: 'executing'!
+
+execute
+	^ HLWorkspace openAsTab
+! !
+
+!HLOpenWorkspaceCommand class methodsFor: 'accessing'!
+
+key
+	^ 'w'
+!
+
+label
+	^ 'Workspace'
+! !
+
+HLCommand subclass: #HLSwitchTabCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Core'!
+
+!HLSwitchTabCommand methodsFor: 'accessing'!
+
+selectedTab
+	^ HLManager current activeTab
+!
+
+tabs
+	^ HLManager current tabs
+! !
+
+!HLSwitchTabCommand methodsFor: 'executing'!
+
+execute
+	| activeTab |
+	
+	activeTab := self selectedTab.
+	
+	^ HLTabSelectionWidget new
+		tabs: self tabs;
+		selectedTab: self selectedTab;
+		selectCallback: [ :tab | tab activate ];
+		confirmCallback: [ :tab | tab focus ];
+		cancelCallback: [ activeTab activate ];
+		show
+! !
+
+!HLSwitchTabCommand class methodsFor: 'accessing'!
+
+key
+	^ 's'
+!
+
+label
+	^ 'Switch tab'
+! !
+
+HLCommand subclass: #HLViewCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Core'!
+
+!HLViewCommand class methodsFor: 'accessing'!
+
+label
+	^ 'View'
+! !
+

+ 1965 - 0
src/Helios-Commands-Tools.js

@@ -0,0 +1,1965 @@
+define("helios/Helios-Commands-Tools", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "helios/Helios-Commands-Core"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Commands-Tools');
+smalltalk.packages["Helios-Commands-Tools"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLToolCommand', globals.HLModelCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return nil;
+},
+args: [],
+source: "category\x0a\x09^ nil",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "for:",
+protocol: 'instance creation',
+fn: function (aToolModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._model_(aToolModel);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"for:",{aToolModel:aToolModel},globals.HLToolCommand.klass)})},
+args: ["aToolModel"],
+source: "for: aToolModel\x0a\x09^ self new\x0a    \x09model: aToolModel;\x0a        yourself",
+messageSends: ["model:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLToolCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isValidFor:",
+protocol: 'testing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aModel)._isToolModel();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isValidFor:",{aModel:aModel},globals.HLToolCommand.klass)})},
+args: ["aModel"],
+source: "isValidFor: aModel\x0a\x09^ aModel isToolModel",
+messageSends: ["isToolModel"],
+referencedClasses: []
+}),
+globals.HLToolCommand.klass);
+
+
+smalltalk.addClass('HLBrowseMethodCommand', globals.HLToolCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "browse method";
+},
+args: [],
+source: "displayLabel\x0a\x09^ 'browse method'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowseMethodCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._openMethod();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLBrowseMethodCommand)})},
+args: [],
+source: "execute\x0a\x09self model openMethod",
+messageSends: ["openMethod", "model"],
+referencedClasses: []
+}),
+globals.HLBrowseMethodCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isValidFor:",
+protocol: 'testing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aModel)._isReferencesModel();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isValidFor:",{aModel:aModel},globals.HLBrowseMethodCommand.klass)})},
+args: ["aModel"],
+source: "isValidFor: aModel\x0a\x09^ aModel isReferencesModel",
+messageSends: ["isReferencesModel"],
+referencedClasses: []
+}),
+globals.HLBrowseMethodCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "b";
+},
+args: [],
+source: "key\x0a\x09^ 'b'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowseMethodCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "browse method";
+},
+args: [],
+source: "label\x0a\x09^ 'browse method'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowseMethodCommand.klass);
+
+
+smalltalk.addClass('HLCommitPackageCommand', globals.HLToolCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Packages";
+},
+args: [],
+source: "category\x0a\x09^ 'Packages'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommitPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPackage",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._commitPackageOnSuccess_onError_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._informSuccess();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(error){
+return smalltalk.withContext(function($ctx2) {
+return self._onPackageCommitError_(error);
+}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"commitPackage",{},globals.HLCommitPackageCommand)})},
+args: [],
+source: "commitPackage\x0a\x09self model \x0a\x09\x09commitPackageOnSuccess: [ self informSuccess ]\x0a\x09\x09onError: [ :error | self onPackageCommitError: error ]",
+messageSends: ["commitPackageOnSuccess:onError:", "model", "informSuccess", "onPackageCommitError:"],
+referencedClasses: []
+}),
+globals.HLCommitPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._commitPackage();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLCommitPackageCommand)})},
+args: [],
+source: "execute\x0a\x09self commitPackage",
+messageSends: ["commitPackage"],
+referencedClasses: []
+}),
+globals.HLCommitPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "informSuccess",
+protocol: 'executing',
+fn: function (){
+var self=this;
+function $HLInformationWidget(){return globals.HLInformationWidget||(typeof HLInformationWidget=="undefined"?nil:HLInformationWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLInformationWidget())._new();
+_st($1)._informationString_("Commit successful!");
+$2=_st($1)._show();
+return self}, function($ctx1) {$ctx1.fill(self,"informSuccess",{},globals.HLCommitPackageCommand)})},
+args: [],
+source: "informSuccess\x0a\x09HLInformationWidget new\x0a\x09\x09informationString: 'Commit successful!';\x0a\x09\x09show",
+messageSends: ["informationString:", "new", "show"],
+referencedClasses: ["HLInformationWidget"]
+}),
+globals.HLCommitPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isActive\x0a\x09^ true\x0a\x09\x22self model isPackageDirty\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommitPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPackageCommitError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+function $HLPackageCommitErrorHelper(){return globals.HLPackageCommitErrorHelper||(typeof HLPackageCommitErrorHelper=="undefined"?nil:HLPackageCommitErrorHelper)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($HLPackageCommitErrorHelper())._on_(self._model()))._showHelp();
+return self}, function($ctx1) {$ctx1.fill(self,"onPackageCommitError:",{anError:anError},globals.HLCommitPackageCommand)})},
+args: ["anError"],
+source: "onPackageCommitError: anError\x0a\x09(HLPackageCommitErrorHelper on: self model)\x0a\x09\x09showHelp",
+messageSends: ["showHelp", "on:", "model"],
+referencedClasses: ["HLPackageCommitErrorHelper"]
+}),
+globals.HLCommitPackageCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "k";
+},
+args: [],
+source: "key\x0a\x09^ 'k'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommitPackageCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Commit package";
+},
+args: [],
+source: "label\x0a\x09^ 'Commit package'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCommitPackageCommand.klass);
+
+
+smalltalk.addClass('HLCopyCommand', globals.HLToolCommand, [], 'Helios-Commands-Tools');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCopyCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Copy";
+},
+args: [],
+source: "label\x0a\x09^ 'Copy'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCopyCommand.klass);
+
+
+smalltalk.addClass('HLCopyClassCommand', globals.HLCopyCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Classes";
+},
+args: [],
+source: "category\x0a\x09^ 'Classes'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCopyClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultInput",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(self._model())._selectedClass())._theNonMetaClass())._name();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultInput",{},globals.HLCopyClassCommand)})},
+args: [],
+source: "defaultInput\x0a\x09^ self model selectedClass theNonMetaClass name",
+messageSends: ["name", "theNonMetaClass", "selectedClass", "model"],
+referencedClasses: []
+}),
+globals.HLCopyClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "New class name:";
+},
+args: [],
+source: "displayLabel\x0a\x09^ 'New class name:'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCopyClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._copyClassTo_(self._input());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLCopyClassCommand)})},
+args: [],
+source: "execute\x0a\x09self model copyClassTo: self input",
+messageSends: ["copyClassTo:", "model", "input"],
+referencedClasses: []
+}),
+globals.HLCopyClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedClass())._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLCopyClassCommand)})},
+args: [],
+source: "isActive\x0a\x09^ self model selectedClass notNil",
+messageSends: ["notNil", "selectedClass", "model"],
+referencedClasses: []
+}),
+globals.HLCopyClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInputRequired",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInputRequired\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCopyClassCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCopyClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Copy class";
+},
+args: [],
+source: "label\x0a\x09^ 'Copy class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCopyClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Copy class...";
+},
+args: [],
+source: "menuLabel\x0a\x09^ 'Copy class...'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCopyClassCommand.klass);
+
+
+smalltalk.addClass('HLFindCommand', globals.HLToolCommand, [], 'Helios-Commands-Tools');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "f";
+},
+args: [],
+source: "key\x0a\x09^ 'f'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Find";
+},
+args: [],
+source: "label\x0a\x09^ 'Find'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindCommand.klass);
+
+
+smalltalk.addClass('HLFindClassCommand', globals.HLFindCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "select a class";
+},
+args: [],
+source: "displayLabel\x0a\x09^ 'select a class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._openClassNamed_(self._input());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLFindClassCommand)})},
+args: [],
+source: "execute\x0a\x09self model openClassNamed: self input",
+messageSends: ["openClassNamed:", "model", "input"],
+referencedClasses: []
+}),
+globals.HLFindClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputCompletion",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._availableClassNames();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},globals.HLFindClassCommand)})},
+args: [],
+source: "inputCompletion\x0a\x09^ self model availableClassNames",
+messageSends: ["availableClassNames", "model"],
+referencedClasses: []
+}),
+globals.HLFindClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Find a class";
+},
+args: [],
+source: "inputLabel\x0a\x09^ 'Find a class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInputRequired",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInputRequired\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindClassCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isValidFor:",
+protocol: 'testing',
+fn: function (aModel){
+var self=this;
+return true;
+},
+args: ["aModel"],
+source: "isValidFor: aModel\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Find class";
+},
+args: [],
+source: "label\x0a\x09^ 'Find class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindClassCommand.klass);
+
+
+smalltalk.addClass('HLFindReferencesCommand', globals.HLFindCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultInput",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$4,$1,$receiver;
+$3=self._model();
+$ctx1.sendIdx["model"]=1;
+$2=_st($3)._selectedMethod();
+if(($receiver = $2) == null || $receiver.isNil){
+$4=_st(self._model())._selectedClass();
+if(($receiver = $4) == null || $receiver.isNil){
+$1="";
+} else {
+var class_;
+class_=$receiver;
+$1=_st(_st(class_)._theNonMetaClass())._name();
+};
+} else {
+var method;
+method=$receiver;
+$1=_st(method)._selector();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultInput",{},globals.HLFindReferencesCommand)})},
+args: [],
+source: "defaultInput\x0a\x09^ self model selectedMethod \x0a\x09\x09ifNil: [\x0a\x09\x09\x09self model selectedClass\x0a\x09\x09\x09\x09ifNil: [ '' ]\x0a\x09\x09\x09\x09ifNotNil: [ :class | class theNonMetaClass name ] ]\x0a\x09\x09ifNotNil: [ :method | method selector ]",
+messageSends: ["ifNil:ifNotNil:", "selectedMethod", "model", "selectedClass", "name", "theNonMetaClass", "selector"],
+referencedClasses: []
+}),
+globals.HLFindReferencesCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "find references";
+},
+args: [],
+source: "displayLabel\x0a\x09^ 'find references'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindReferencesCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+function $HLReferences(){return globals.HLReferences||(typeof HLReferences=="undefined"?nil:HLReferences)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLReferences())._new();
+_st($1)._openAsTab();
+$2=_st($1)._search_(self._input());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLFindReferencesCommand)})},
+args: [],
+source: "execute\x0a\x09HLReferences new \x0a\x09\x09openAsTab;\x0a\x09\x09search: self input",
+messageSends: ["openAsTab", "new", "search:", "input"],
+referencedClasses: ["HLReferences"]
+}),
+globals.HLFindReferencesCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputCompletion",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self._model();
+$ctx1.sendIdx["model"]=1;
+$2=_st($3)._availableClassNames();
+$1=_st($2).__comma(_st(self._model())._allSelectors());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},globals.HLFindReferencesCommand)})},
+args: [],
+source: "inputCompletion\x0a\x09^ self model availableClassNames, self model allSelectors",
+messageSends: [",", "availableClassNames", "model", "allSelectors"],
+referencedClasses: []
+}),
+globals.HLFindReferencesCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Find references of";
+},
+args: [],
+source: "inputLabel\x0a\x09^ 'Find references of'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindReferencesCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInputRequired",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInputRequired\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindReferencesCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "r";
+},
+args: [],
+source: "key\x0a\x09^ 'r'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindReferencesCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Find references";
+},
+args: [],
+source: "label\x0a\x09^ 'Find references'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFindReferencesCommand.klass);
+
+
+smalltalk.addClass('HLMoveToCommand', globals.HLToolCommand, [], 'Helios-Commands-Tools');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "m";
+},
+args: [],
+source: "key\x0a\x09^ 'm'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveToCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move";
+},
+args: [],
+source: "label\x0a\x09^ 'Move'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveToCommand.klass);
+
+
+smalltalk.addClass('HLMoveClassToCommand', globals.HLMoveToCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedClass())._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLMoveClassToCommand)})},
+args: [],
+source: "isActive\x0a\x09^ self model selectedClass notNil",
+messageSends: ["notNil", "selectedClass", "model"],
+referencedClasses: []
+}),
+globals.HLMoveClassToCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveClassToCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move class";
+},
+args: [],
+source: "label\x0a\x09^ 'Move class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveClassToCommand.klass);
+
+
+smalltalk.addClass('HLMoveClassToPackageCommand', globals.HLMoveClassToCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Classes";
+},
+args: [],
+source: "category\x0a\x09^ 'Classes'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveClassToPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "select a package";
+},
+args: [],
+source: "displayLabel\x0a\x09^ 'select a package'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveClassToPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._moveClassToPackage_(self._input());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLMoveClassToPackageCommand)})},
+args: [],
+source: "execute\x0a\x09self model moveClassToPackage: self input",
+messageSends: ["moveClassToPackage:", "model", "input"],
+referencedClasses: []
+}),
+globals.HLMoveClassToPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputCompletion",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._availablePackageNames();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},globals.HLMoveClassToPackageCommand)})},
+args: [],
+source: "inputCompletion\x0a\x09^ self model availablePackageNames",
+messageSends: ["availablePackageNames", "model"],
+referencedClasses: []
+}),
+globals.HLMoveClassToPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move class to package:";
+},
+args: [],
+source: "inputLabel\x0a\x09^ 'Move class to package:'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveClassToPackageCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInputRequired",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInputRequired\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveClassToPackageCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "p";
+},
+args: [],
+source: "key\x0a\x09^ 'p'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveClassToPackageCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move class to package";
+},
+args: [],
+source: "label\x0a\x09^ 'Move class to package'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveClassToPackageCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move to package...";
+},
+args: [],
+source: "menuLabel\x09\x0a\x09^ 'Move to package...'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveClassToPackageCommand.klass);
+
+
+smalltalk.addClass('HLMoveMethodToCommand', globals.HLMoveToCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Methods";
+},
+args: [],
+source: "category\x0a\x09^ 'Methods'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedMethod())._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLMoveMethodToCommand)})},
+args: [],
+source: "isActive\x0a\x09^ self model selectedMethod notNil",
+messageSends: ["notNil", "selectedMethod", "model"],
+referencedClasses: []
+}),
+globals.HLMoveMethodToCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "m";
+},
+args: [],
+source: "key\x0a\x09^ 'm'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move method";
+},
+args: [],
+source: "label\x0a\x09^ 'Move method'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToCommand.klass);
+
+
+smalltalk.addClass('HLMoveMethodToClassCommand', globals.HLMoveMethodToCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "select a class";
+},
+args: [],
+source: "displayLabel\x0a\x09^ 'select a class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._moveMethodToClass_(self._input());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLMoveMethodToClassCommand)})},
+args: [],
+source: "execute\x0a\x09self model moveMethodToClass: self input",
+messageSends: ["moveMethodToClass:", "model", "input"],
+referencedClasses: []
+}),
+globals.HLMoveMethodToClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputCompletion",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._availableClassNames();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},globals.HLMoveMethodToClassCommand)})},
+args: [],
+source: "inputCompletion\x0a\x09^ self model availableClassNames",
+messageSends: ["availableClassNames", "model"],
+referencedClasses: []
+}),
+globals.HLMoveMethodToClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move method to class:";
+},
+args: [],
+source: "inputLabel\x0a\x09^ 'Move method to class:'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInputRequired",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInputRequired\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToClassCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move method to class";
+},
+args: [],
+source: "label\x09\x0a\x09^ 'Move method to class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move to class...";
+},
+args: [],
+source: "menuLabel\x09\x0a\x09^ 'Move to class...'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToClassCommand.klass);
+
+
+smalltalk.addClass('HLMoveMethodToProtocolCommand', globals.HLMoveMethodToCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "select a protocol";
+},
+args: [],
+source: "displayLabel\x0a\x09^ 'select a protocol'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._moveMethodToProtocol_(self._input());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLMoveMethodToProtocolCommand)})},
+args: [],
+source: "execute\x0a\x09self model moveMethodToProtocol: self input",
+messageSends: ["moveMethodToProtocol:", "model", "input"],
+referencedClasses: []
+}),
+globals.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputCompletion",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._availableProtocols();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},globals.HLMoveMethodToProtocolCommand)})},
+args: [],
+source: "inputCompletion\x0a\x09^ self model availableProtocols",
+messageSends: ["availableProtocols", "model"],
+referencedClasses: []
+}),
+globals.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move method to a protocol:";
+},
+args: [],
+source: "inputLabel\x0a\x09^ 'Move method to a protocol:'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInputRequired",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInputRequired\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToProtocolCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "t";
+},
+args: [],
+source: "key\x0a\x09^ 't'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToProtocolCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move method to protocol";
+},
+args: [],
+source: "label\x0a\x09^ 'Move method to protocol'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToProtocolCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Move to protocol...";
+},
+args: [],
+source: "menuLabel\x0a\x09^ 'Move to protocol...'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMoveMethodToProtocolCommand.klass);
+
+
+smalltalk.addClass('HLRemoveCommand', globals.HLToolCommand, [], 'Helios-Commands-Tools');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "x";
+},
+args: [],
+source: "key\x0a\x09^ 'x'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Remove";
+},
+args: [],
+source: "label\x0a\x09^ 'Remove'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveCommand.klass);
+
+
+smalltalk.addClass('HLRemoveClassCommand', globals.HLRemoveCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Classes";
+},
+args: [],
+source: "category\x0a\x09^ 'Classes'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._removeClass();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLRemoveClassCommand)})},
+args: [],
+source: "execute\x0a\x09self model removeClass",
+messageSends: ["removeClass", "model"],
+referencedClasses: []
+}),
+globals.HLRemoveClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedClass())._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLRemoveClassCommand)})},
+args: [],
+source: "isActive\x0a\x09^ self model selectedClass notNil",
+messageSends: ["notNil", "selectedClass", "model"],
+referencedClasses: []
+}),
+globals.HLRemoveClassCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Remove class";
+},
+args: [],
+source: "label\x0a\x09^ 'Remove class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Remove class";
+},
+args: [],
+source: "menuLabel\x0a\x09^ 'Remove class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveClassCommand.klass);
+
+
+smalltalk.addClass('HLRemoveMethodCommand', globals.HLRemoveCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Methods";
+},
+args: [],
+source: "category\x0a\x09^ 'Methods'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveMethodCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._removeMethod();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLRemoveMethodCommand)})},
+args: [],
+source: "execute\x0a\x09self model removeMethod",
+messageSends: ["removeMethod", "model"],
+referencedClasses: []
+}),
+globals.HLRemoveMethodCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedMethod())._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLRemoveMethodCommand)})},
+args: [],
+source: "isActive\x0a\x09^ self model selectedMethod notNil",
+messageSends: ["notNil", "selectedMethod", "model"],
+referencedClasses: []
+}),
+globals.HLRemoveMethodCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "m";
+},
+args: [],
+source: "key\x0a\x09^ 'm'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveMethodCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Remove method";
+},
+args: [],
+source: "label\x0a\x09^ 'Remove method'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveMethodCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Remove method";
+},
+args: [],
+source: "menuLabel\x0a\x09^ 'Remove method'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveMethodCommand.klass);
+
+
+smalltalk.addClass('HLRemoveProtocolCommand', globals.HLRemoveCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Protocols";
+},
+args: [],
+source: "category\x0a\x09^ 'Protocols'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._removeProtocol();
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLRemoveProtocolCommand)})},
+args: [],
+source: "execute\x0a\x09self model removeProtocol",
+messageSends: ["removeProtocol", "model"],
+referencedClasses: []
+}),
+globals.HLRemoveProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedProtocol())._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLRemoveProtocolCommand)})},
+args: [],
+source: "isActive\x0a\x09^ self model selectedProtocol notNil",
+messageSends: ["notNil", "selectedProtocol", "model"],
+referencedClasses: []
+}),
+globals.HLRemoveProtocolCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "t";
+},
+args: [],
+source: "key\x0a\x09^ 't'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveProtocolCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Remove protocol";
+},
+args: [],
+source: "label\x0a\x09^ 'Remove protocol'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveProtocolCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Remove protocol";
+},
+args: [],
+source: "menuLabel\x0a\x09^ 'Remove protocol'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRemoveProtocolCommand.klass);
+
+
+smalltalk.addClass('HLRenameCommand', globals.HLToolCommand, [], 'Helios-Commands-Tools');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "r";
+},
+args: [],
+source: "key\x0a\x09^ 'r'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Rename";
+},
+args: [],
+source: "label\x0a\x09^ 'Rename'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameCommand.klass);
+
+
+smalltalk.addClass('HLRenameClassCommand', globals.HLRenameCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Classes";
+},
+args: [],
+source: "category\x0a\x09^ 'Classes'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultInput",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(self._model())._selectedClass())._theNonMetaClass())._name();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultInput",{},globals.HLRenameClassCommand)})},
+args: [],
+source: "defaultInput\x0a\x09^ self model selectedClass theNonMetaClass name",
+messageSends: ["name", "theNonMetaClass", "selectedClass", "model"],
+referencedClasses: []
+}),
+globals.HLRenameClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Rename class to:";
+},
+args: [],
+source: "displayLabel\x0a\x09^ 'Rename class to:'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._renameClassTo_(self._input());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLRenameClassCommand)})},
+args: [],
+source: "execute\x0a\x09self model renameClassTo: self input",
+messageSends: ["renameClassTo:", "model", "input"],
+referencedClasses: []
+}),
+globals.HLRenameClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedClass())._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLRenameClassCommand)})},
+args: [],
+source: "isActive\x0a\x09^ self model selectedClass notNil",
+messageSends: ["notNil", "selectedClass", "model"],
+referencedClasses: []
+}),
+globals.HLRenameClassCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInputRequired",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInputRequired\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameClassCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "c";
+},
+args: [],
+source: "key\x0a\x09^ 'c'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Rename class";
+},
+args: [],
+source: "label\x0a\x09^ 'Rename class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameClassCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Rename class...";
+},
+args: [],
+source: "menuLabel\x0a\x09^ 'Rename class...'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameClassCommand.klass);
+
+
+smalltalk.addClass('HLRenameProtocolCommand', globals.HLRenameCommand, [], 'Helios-Commands-Tools');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Protocols";
+},
+args: [],
+source: "category\x0a\x09^ 'Protocols'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultInput",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._selectedProtocol();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultInput",{},globals.HLRenameProtocolCommand)})},
+args: [],
+source: "defaultInput\x0a\x09^ self model selectedProtocol",
+messageSends: ["selectedProtocol", "model"],
+referencedClasses: []
+}),
+globals.HLRenameProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Rename protocol to:";
+},
+args: [],
+source: "displayLabel\x0a\x09^ 'Rename protocol to:'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute",
+protocol: 'executing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._renameProtocolTo_(self._input());
+return self}, function($ctx1) {$ctx1.fill(self,"execute",{},globals.HLRenameProtocolCommand)})},
+args: [],
+source: "execute\x0a\x09self model renameProtocolTo: self input",
+messageSends: ["renameProtocolTo:", "model", "input"],
+referencedClasses: []
+}),
+globals.HLRenameProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._selectedProtocol())._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLRenameProtocolCommand)})},
+args: [],
+source: "isActive\x0a\x09^ self model selectedProtocol notNil",
+messageSends: ["notNil", "selectedProtocol", "model"],
+referencedClasses: []
+}),
+globals.HLRenameProtocolCommand);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isInputRequired",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isInputRequired\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameProtocolCommand);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "t";
+},
+args: [],
+source: "key\x0a\x09^ 't'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameProtocolCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Rename protocol";
+},
+args: [],
+source: "label\x0a\x09^ 'Rename protocol'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameProtocolCommand.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Rename protocol...";
+},
+args: [],
+source: "menuLabel\x0a\x09^ 'Rename protocol...'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRenameProtocolCommand.klass);
+
+});

+ 718 - 0
src/Helios-Commands-Tools.st

@@ -0,0 +1,718 @@
+Smalltalk createPackage: 'Helios-Commands-Tools'!
+HLModelCommand subclass: #HLToolCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLToolCommand methodsFor: 'accessing'!
+
+category
+	^ nil
+! !
+
+!HLToolCommand class methodsFor: 'instance creation'!
+
+for: aToolModel
+	^ self new
+    	model: aToolModel;
+        yourself
+! !
+
+!HLToolCommand class methodsFor: 'testing'!
+
+isValidFor: aModel
+	^ aModel isToolModel
+! !
+
+HLToolCommand subclass: #HLBrowseMethodCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLBrowseMethodCommand methodsFor: 'accessing'!
+
+displayLabel
+	^ 'browse method'
+! !
+
+!HLBrowseMethodCommand methodsFor: 'executing'!
+
+execute
+	self model openMethod
+! !
+
+!HLBrowseMethodCommand class methodsFor: 'accessing'!
+
+key
+	^ 'b'
+!
+
+label
+	^ 'browse method'
+! !
+
+!HLBrowseMethodCommand class methodsFor: 'testing'!
+
+isValidFor: aModel
+	^ aModel isReferencesModel
+! !
+
+HLToolCommand subclass: #HLCommitPackageCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLCommitPackageCommand methodsFor: 'accessing'!
+
+category
+	^ 'Packages'
+! !
+
+!HLCommitPackageCommand methodsFor: 'error handling'!
+
+onPackageCommitError: anError
+	(HLPackageCommitErrorHelper on: self model)
+		showHelp
+! !
+
+!HLCommitPackageCommand methodsFor: 'executing'!
+
+commitPackage
+	self model 
+		commitPackageOnSuccess: [ self informSuccess ]
+		onError: [ :error | self onPackageCommitError: error ]
+!
+
+execute
+	self commitPackage
+!
+
+informSuccess
+	HLInformationWidget new
+		informationString: 'Commit successful!!';
+		show
+! !
+
+!HLCommitPackageCommand methodsFor: 'testing'!
+
+isActive
+	^ true
+	"self model isPackageDirty"
+! !
+
+!HLCommitPackageCommand class methodsFor: 'accessing'!
+
+key
+	^ 'k'
+!
+
+label
+	^ 'Commit package'
+! !
+
+HLToolCommand subclass: #HLCopyCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLCopyCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label
+	^ 'Copy'
+! !
+
+HLCopyCommand subclass: #HLCopyClassCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLCopyClassCommand methodsFor: 'accessing'!
+
+category
+	^ 'Classes'
+!
+
+displayLabel
+	^ 'New class name:'
+! !
+
+!HLCopyClassCommand methodsFor: 'defaults'!
+
+defaultInput
+	^ self model selectedClass theNonMetaClass name
+! !
+
+!HLCopyClassCommand methodsFor: 'executing'!
+
+execute
+	self model copyClassTo: self input
+! !
+
+!HLCopyClassCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedClass notNil
+!
+
+isInputRequired
+	^ true
+! !
+
+!HLCopyClassCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label
+	^ 'Copy class'
+!
+
+menuLabel
+	^ 'Copy class...'
+! !
+
+HLToolCommand subclass: #HLFindCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLFindCommand class methodsFor: 'accessing'!
+
+key
+	^ 'f'
+!
+
+label
+	^ 'Find'
+! !
+
+HLFindCommand subclass: #HLFindClassCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLFindClassCommand methodsFor: 'accessing'!
+
+displayLabel
+	^ 'select a class'
+!
+
+inputCompletion
+	^ self model availableClassNames
+!
+
+inputLabel
+	^ 'Find a class'
+! !
+
+!HLFindClassCommand methodsFor: 'executing'!
+
+execute
+	self model openClassNamed: self input
+! !
+
+!HLFindClassCommand methodsFor: 'testing'!
+
+isInputRequired
+	^ true
+! !
+
+!HLFindClassCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label
+	^ 'Find class'
+! !
+
+!HLFindClassCommand class methodsFor: 'testing'!
+
+isValidFor: aModel
+	^ true
+! !
+
+HLFindCommand subclass: #HLFindReferencesCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLFindReferencesCommand methodsFor: 'accessing'!
+
+displayLabel
+	^ 'find references'
+!
+
+inputCompletion
+	^ self model availableClassNames, self model allSelectors
+!
+
+inputLabel
+	^ 'Find references of'
+! !
+
+!HLFindReferencesCommand methodsFor: 'defaults'!
+
+defaultInput
+	^ self model selectedMethod 
+		ifNil: [
+			self model selectedClass
+				ifNil: [ '' ]
+				ifNotNil: [ :class | class theNonMetaClass name ] ]
+		ifNotNil: [ :method | method selector ]
+! !
+
+!HLFindReferencesCommand methodsFor: 'executing'!
+
+execute
+	HLReferences new 
+		openAsTab;
+		search: self input
+! !
+
+!HLFindReferencesCommand methodsFor: 'testing'!
+
+isInputRequired
+	^ true
+! !
+
+!HLFindReferencesCommand class methodsFor: 'accessing'!
+
+key
+	^ 'r'
+!
+
+label
+	^ 'Find references'
+! !
+
+HLToolCommand subclass: #HLMoveToCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLMoveToCommand class methodsFor: 'accessing'!
+
+key
+	^ 'm'
+!
+
+label
+	^ 'Move'
+! !
+
+HLMoveToCommand subclass: #HLMoveClassToCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLMoveClassToCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedClass notNil
+! !
+
+!HLMoveClassToCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label
+	^ 'Move class'
+! !
+
+HLMoveClassToCommand subclass: #HLMoveClassToPackageCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLMoveClassToPackageCommand methodsFor: 'accessing'!
+
+category
+	^ 'Classes'
+!
+
+displayLabel
+	^ 'select a package'
+!
+
+inputCompletion
+	^ self model availablePackageNames
+!
+
+inputLabel
+	^ 'Move class to package:'
+! !
+
+!HLMoveClassToPackageCommand methodsFor: 'executing'!
+
+execute
+	self model moveClassToPackage: self input
+! !
+
+!HLMoveClassToPackageCommand methodsFor: 'testing'!
+
+isInputRequired
+	^ true
+! !
+
+!HLMoveClassToPackageCommand class methodsFor: 'accessing'!
+
+key
+	^ 'p'
+!
+
+label
+	^ 'Move class to package'
+!
+
+menuLabel	
+	^ 'Move to package...'
+! !
+
+HLMoveToCommand subclass: #HLMoveMethodToCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLMoveMethodToCommand methodsFor: 'accessing'!
+
+category
+	^ 'Methods'
+! !
+
+!HLMoveMethodToCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedMethod notNil
+! !
+
+!HLMoveMethodToCommand class methodsFor: 'accessing'!
+
+key
+	^ 'm'
+!
+
+label
+	^ 'Move method'
+! !
+
+HLMoveMethodToCommand subclass: #HLMoveMethodToClassCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLMoveMethodToClassCommand methodsFor: 'accessing'!
+
+displayLabel
+	^ 'select a class'
+!
+
+inputCompletion
+	^ self model availableClassNames
+!
+
+inputLabel
+	^ 'Move method to class:'
+! !
+
+!HLMoveMethodToClassCommand methodsFor: 'executing'!
+
+execute
+	self model moveMethodToClass: self input
+! !
+
+!HLMoveMethodToClassCommand methodsFor: 'testing'!
+
+isInputRequired
+	^ true
+! !
+
+!HLMoveMethodToClassCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label	
+	^ 'Move method to class'
+!
+
+menuLabel	
+	^ 'Move to class...'
+! !
+
+HLMoveMethodToCommand subclass: #HLMoveMethodToProtocolCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLMoveMethodToProtocolCommand methodsFor: 'accessing'!
+
+displayLabel
+	^ 'select a protocol'
+!
+
+inputCompletion
+	^ self model availableProtocols
+!
+
+inputLabel
+	^ 'Move method to a protocol:'
+! !
+
+!HLMoveMethodToProtocolCommand methodsFor: 'executing'!
+
+execute
+	self model moveMethodToProtocol: self input
+! !
+
+!HLMoveMethodToProtocolCommand methodsFor: 'testing'!
+
+isInputRequired
+	^ true
+! !
+
+!HLMoveMethodToProtocolCommand class methodsFor: 'accessing'!
+
+key
+	^ 't'
+!
+
+label
+	^ 'Move method to protocol'
+!
+
+menuLabel
+	^ 'Move to protocol...'
+! !
+
+HLToolCommand subclass: #HLRemoveCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLRemoveCommand class methodsFor: 'accessing'!
+
+key
+	^ 'x'
+!
+
+label
+	^ 'Remove'
+! !
+
+HLRemoveCommand subclass: #HLRemoveClassCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLRemoveClassCommand methodsFor: 'accessing'!
+
+category
+	^ 'Classes'
+! !
+
+!HLRemoveClassCommand methodsFor: 'executing'!
+
+execute
+	self model removeClass
+! !
+
+!HLRemoveClassCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedClass notNil
+! !
+
+!HLRemoveClassCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label
+	^ 'Remove class'
+!
+
+menuLabel
+	^ 'Remove class'
+! !
+
+HLRemoveCommand subclass: #HLRemoveMethodCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLRemoveMethodCommand methodsFor: 'accessing'!
+
+category
+	^ 'Methods'
+! !
+
+!HLRemoveMethodCommand methodsFor: 'executing'!
+
+execute
+	self model removeMethod
+! !
+
+!HLRemoveMethodCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedMethod notNil
+! !
+
+!HLRemoveMethodCommand class methodsFor: 'accessing'!
+
+key
+	^ 'm'
+!
+
+label
+	^ 'Remove method'
+!
+
+menuLabel
+	^ 'Remove method'
+! !
+
+HLRemoveCommand subclass: #HLRemoveProtocolCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLRemoveProtocolCommand methodsFor: 'accessing'!
+
+category
+	^ 'Protocols'
+! !
+
+!HLRemoveProtocolCommand methodsFor: 'executing'!
+
+execute
+	self model removeProtocol
+! !
+
+!HLRemoveProtocolCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedProtocol notNil
+! !
+
+!HLRemoveProtocolCommand class methodsFor: 'accessing'!
+
+key
+	^ 't'
+!
+
+label
+	^ 'Remove protocol'
+!
+
+menuLabel
+	^ 'Remove protocol'
+! !
+
+HLToolCommand subclass: #HLRenameCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLRenameCommand class methodsFor: 'accessing'!
+
+key
+	^ 'r'
+!
+
+label
+	^ 'Rename'
+! !
+
+HLRenameCommand subclass: #HLRenameClassCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLRenameClassCommand methodsFor: 'accessing'!
+
+category
+	^ 'Classes'
+!
+
+displayLabel
+	^ 'Rename class to:'
+! !
+
+!HLRenameClassCommand methodsFor: 'defaults'!
+
+defaultInput
+	^ self model selectedClass theNonMetaClass name
+! !
+
+!HLRenameClassCommand methodsFor: 'executing'!
+
+execute
+	self model renameClassTo: self input
+! !
+
+!HLRenameClassCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedClass notNil
+!
+
+isInputRequired
+	^ true
+! !
+
+!HLRenameClassCommand class methodsFor: 'accessing'!
+
+key
+	^ 'c'
+!
+
+label
+	^ 'Rename class'
+!
+
+menuLabel
+	^ 'Rename class...'
+! !
+
+HLRenameCommand subclass: #HLRenameProtocolCommand
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Tools'!
+
+!HLRenameProtocolCommand methodsFor: 'accessing'!
+
+category
+	^ 'Protocols'
+!
+
+displayLabel
+	^ 'Rename protocol to:'
+! !
+
+!HLRenameProtocolCommand methodsFor: 'defaults'!
+
+defaultInput
+	^ self model selectedProtocol
+! !
+
+!HLRenameProtocolCommand methodsFor: 'executing'!
+
+execute
+	self model renameProtocolTo: self input
+! !
+
+!HLRenameProtocolCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedProtocol notNil
+!
+
+isInputRequired
+	^ true
+! !
+
+!HLRenameProtocolCommand class methodsFor: 'accessing'!
+
+key
+	^ 't'
+!
+
+label
+	^ 'Rename protocol'
+!
+
+menuLabel
+	^ 'Rename protocol...'
+! !
+

+ 6966 - 0
src/Helios-Core.js

@@ -0,0 +1,6966 @@
+define("helios/Helios-Core", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects", "amber_core/Web"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Core');
+smalltalk.packages["Helios-Core"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLModel', globals.InterfacingObject, ['announcer', 'environment'], 'Helios-Core');
+globals.HLModel.comment="I am the abstract superclass of all models of Helios.\x0aI am the \x22Model\x22 part of the MVC pattern implementation in Helios.\x0a\x0aI provide access to an `Environment` object and both a local (model-specific) and global (system-specific) announcer.\x0a\x0aThe `#withChangesDo:` method is handy for performing model changes ensuring that all widgets are aware of the change and can prevent it from happening.\x0a\x0aModifications of the system should be done via commands (see `HLCommand` and subclasses).";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announcer",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@announcer"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@announcer"]=_st($Announcer())._new();
+$1=self["@announcer"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.HLModel)})},
+args: [],
+source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Announcer"]
+}),
+globals.HLModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "environment",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@environment"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=_st(self._manager())._environment();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"environment",{},globals.HLModel)})},
+args: [],
+source: "environment\x0a\x09^ environment ifNil: [ self manager environment ]",
+messageSends: ["ifNil:", "environment", "manager"],
+referencedClasses: []
+}),
+globals.HLModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "environment:",
+protocol: 'accessing',
+fn: function (anEnvironment){
+var self=this;
+self["@environment"]=anEnvironment;
+return self},
+args: ["anEnvironment"],
+source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBrowserModel",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isBrowserModel\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isReferencesModel",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isReferencesModel\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isToolModel",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isToolModel\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "manager",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLManager())._current();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"manager",{},globals.HLModel)})},
+args: [],
+source: "manager\x0a\x09^ HLManager current",
+messageSends: ["current"],
+referencedClasses: ["HLManager"]
+}),
+globals.HLModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "systemAnnouncer",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._environment())._systemAnnouncer();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},globals.HLModel)})},
+args: [],
+source: "systemAnnouncer\x0a\x09^ self environment systemAnnouncer",
+messageSends: ["systemAnnouncer", "environment"],
+referencedClasses: []
+}),
+globals.HLModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withChangesDo:",
+protocol: 'error handling',
+fn: function (aBlock){
+var self=this;
+function $HLAboutToChange(){return globals.HLAboutToChange||(typeof HLAboutToChange=="undefined"?nil:HLAboutToChange)}
+function $HLChangeForbidden(){return globals.HLChangeForbidden||(typeof HLChangeForbidden=="undefined"?nil:HLChangeForbidden)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=_st($HLAboutToChange())._new();
+_st($1)._actionBlock_(aBlock);
+$2=_st($1)._yourself();
+_st(self._announcer())._announce_($2);
+return _st(aBlock)._value();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($HLChangeForbidden(),(function(ex){
+}));
+return self}, function($ctx1) {$ctx1.fill(self,"withChangesDo:",{aBlock:aBlock},globals.HLModel)})},
+args: ["aBlock"],
+source: "withChangesDo: aBlock\x0a\x09[ \x0a\x09\x09self announcer announce: (HLAboutToChange new\x0a\x09\x09\x09actionBlock: aBlock;\x0a\x09\x09\x09yourself).\x0a\x09\x09aBlock value.\x0a\x09]\x0a\x09\x09on: HLChangeForbidden \x0a\x09\x09do: [ :ex | ]",
+messageSends: ["on:do:", "announce:", "announcer", "actionBlock:", "new", "yourself", "value"],
+referencedClasses: ["HLAboutToChange", "HLChangeForbidden"]
+}),
+globals.HLModel);
+
+
+
+smalltalk.addClass('HLFinder', globals.HLModel, [], 'Helios-Core');
+globals.HLFinder.comment="I am the `Finder` service handler of Helios.\x0a\x0aFinding a class will open a new class browser, while finding a method will open a references browser.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "findClass:",
+protocol: 'finding',
+fn: function (aClass){
+var self=this;
+function $HLBrowser(){return globals.HLBrowser||(typeof HLBrowser=="undefined"?nil:HLBrowser)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($HLBrowser())._openAsTab())._openClassNamed_(_st(aClass)._name());
+return self}, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},globals.HLFinder)})},
+args: ["aClass"],
+source: "findClass: aClass\x0a\x09HLBrowser openAsTab openClassNamed: aClass name",
+messageSends: ["openClassNamed:", "openAsTab", "name"],
+referencedClasses: ["HLBrowser"]
+}),
+globals.HLFinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "findMethod:",
+protocol: 'finding',
+fn: function (aCompiledMethod){
+var self=this;
+function $HLBrowser(){return globals.HLBrowser||(typeof HLBrowser=="undefined"?nil:HLBrowser)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($HLBrowser())._openAsTab())._openMethod_(aCompiledMethod);
+return self}, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},globals.HLFinder)})},
+args: ["aCompiledMethod"],
+source: "findMethod: aCompiledMethod\x0a\x09HLBrowser openAsTab openMethod: aCompiledMethod",
+messageSends: ["openMethod:", "openAsTab"],
+referencedClasses: ["HLBrowser"]
+}),
+globals.HLFinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "findString:",
+protocol: 'finding',
+fn: function (aString){
+var self=this;
+var foundClass;
+function $HLReferences(){return globals.HLReferences||(typeof HLReferences=="undefined"?nil:HLReferences)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+foundClass=_st(_st(self._environment())._classes())._detect_ifNone_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._name()).__eq(aString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return nil;
+}));
+$1=foundClass;
+if(($receiver = $1) == null || $receiver.isNil){
+_st(_st($HLReferences())._openAsTab())._search_(aString);
+} else {
+self._findClass_(foundClass);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString,foundClass:foundClass},globals.HLFinder)})},
+args: ["aString"],
+source: "findString: aString\x0a\x09| foundClass |\x0a\x09\x0a\x09foundClass := self environment classes \x0a\x09\x09detect: [ :each | each name = aString ]\x0a\x09\x09ifNone: [ nil ].\x0a\x09\x0a\x09foundClass \x0a\x09\x09ifNil: [ HLReferences openAsTab search: aString ]\x0a\x09\x09ifNotNil: [ self findClass: foundClass ]",
+messageSends: ["detect:ifNone:", "classes", "environment", "=", "name", "ifNil:ifNotNil:", "search:", "openAsTab", "findClass:"],
+referencedClasses: ["HLReferences"]
+}),
+globals.HLFinder);
+
+
+
+smalltalk.addClass('HLToolModel', globals.HLModel, ['selectedClass', 'selectedPackage', 'selectedProtocol', 'selectedSelector'], 'Helios-Core');
+globals.HLToolModel.comment="I am a model specific to package and class manipulation. All browsers should either use me or a subclass as their model.\x0a\x0aI provide methods for package, class, protocol and method manipulation and access, forwarding to my environment.\x0a\x0aI also handle compilation of classes and methods as well as compilation and parsing errors.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addInstVarNamed:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $HLInstVarAdded(){return globals.HLInstVarAdded||(typeof HLInstVarAdded=="undefined"?nil:HLInstVarAdded)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+$1=self._environment();
+$2=self._selectedClass();
+$ctx1.sendIdx["selectedClass"]=1;
+_st($1)._addInstVarNamed_to_(aString,$2);
+$3=_st($HLInstVarAdded())._new();
+_st($3)._theClass_(self._selectedClass());
+_st($3)._variableName_(aString);
+$4=_st($3)._yourself();
+_st(self._announcer())._announce_($4);
+return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:",{aString:aString},globals.HLToolModel)})},
+args: ["aString"],
+source: "addInstVarNamed: aString\x0a\x09self environment addInstVarNamed: aString to: self selectedClass.\x0a\x09self announcer announce: (HLInstVarAdded new\x0a\x09\x09theClass: self selectedClass;\x0a\x09\x09variableName: aString;\x0a\x09\x09yourself)",
+messageSends: ["addInstVarNamed:to:", "environment", "selectedClass", "announce:", "announcer", "theClass:", "new", "variableName:", "yourself"],
+referencedClasses: ["HLInstVarAdded"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allProtocol",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return "-- all --";
+},
+args: [],
+source: "allProtocol\x0a\x09^ '-- all --'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allSelectors",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._environment())._allSelectors();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.HLToolModel)})},
+args: [],
+source: "allSelectors\x0a\x09^ self environment allSelectors",
+messageSends: ["allSelectors", "environment"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "availableClassNames",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._environment())._availableClassNames();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},globals.HLToolModel)})},
+args: [],
+source: "availableClassNames\x0a\x09^ self environment availableClassNames",
+messageSends: ["availableClassNames", "environment"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "availablePackageNames",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._environment())._availablePackageNames();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},globals.HLToolModel)})},
+args: [],
+source: "availablePackageNames\x0a\x09^ self environment availablePackageNames",
+messageSends: ["availablePackageNames", "environment"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "availablePackages",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._environment())._availablePackageNames();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"availablePackages",{},globals.HLToolModel)})},
+args: [],
+source: "availablePackages\x0a\x09^ self environment availablePackageNames",
+messageSends: ["availablePackageNames", "environment"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "availableProtocols",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._environment())._availableProtocolsFor_(self._selectedClass());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"availableProtocols",{},globals.HLToolModel)})},
+args: [],
+source: "availableProtocols\x0a\x09^ self environment availableProtocolsFor: self selectedClass",
+messageSends: ["availableProtocolsFor:", "environment", "selectedClass"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPackageOnSuccess:onError:",
+protocol: 'commands actions',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._environment())._commitPackage_onSuccess_onError_(self._packageToCommit(),aBlock,anotherBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"commitPackageOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.HLToolModel)})},
+args: ["aBlock", "anotherBlock"],
+source: "commitPackageOnSuccess: aBlock onError: anotherBlock\x0a\x09self environment \x0a\x09\x09commitPackage: self packageToCommit\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
+messageSends: ["commitPackage:onSuccess:onError:", "environment", "packageToCommit"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compilationProtocol",
+protocol: 'private',
+fn: function (){
+var self=this;
+var currentProtocol;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3,$receiver;
+currentProtocol=self._selectedProtocol();
+$1=currentProtocol;
+if(($receiver = $1) == null || $receiver.isNil){
+currentProtocol=self._unclassifiedProtocol();
+$ctx1.sendIdx["unclassifiedProtocol"]=1;
+currentProtocol;
+} else {
+$1;
+};
+$2=self._selectedMethod();
+$ctx1.sendIdx["selectedMethod"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+$2;
+} else {
+currentProtocol=_st(self._selectedMethod())._protocol();
+currentProtocol;
+};
+$4=_st(currentProtocol).__eq(self._allProtocol());
+if(smalltalk.assert($4)){
+$3=self._unclassifiedProtocol();
+} else {
+$3=currentProtocol;
+};
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"compilationProtocol",{currentProtocol:currentProtocol},globals.HLToolModel)})},
+args: [],
+source: "compilationProtocol\x0a\x09| currentProtocol |\x0a\x09\x0a\x09currentProtocol := self selectedProtocol.\x0a\x09currentProtocol ifNil: [ currentProtocol := self unclassifiedProtocol ].\x0a\x09self selectedMethod ifNotNil: [ currentProtocol := self selectedMethod protocol ].\x0a\x0a\x09^ currentProtocol = self allProtocol\x0a\x09\x09ifTrue: [ self unclassifiedProtocol ]\x0a\x09\x09ifFalse: [ currentProtocol ]",
+messageSends: ["selectedProtocol", "ifNil:", "unclassifiedProtocol", "ifNotNil:", "selectedMethod", "protocol", "ifTrue:ifFalse:", "=", "allProtocol"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileClassComment:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._environment())._compileClassComment_for_(aString,self._selectedClass());
+return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:",{aString:aString},globals.HLToolModel)})},
+args: ["aString"],
+source: "compileClassComment: aString\x0a\x09self environment \x0a\x09\x09compileClassComment: aString \x0a\x09\x09for: self selectedClass",
+messageSends: ["compileClassComment:for:", "environment", "selectedClass"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileClassDefinition:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._environment())._compileClassDefinition_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},globals.HLToolModel)})},
+args: ["aString"],
+source: "compileClassDefinition: aString\x0a\x09self environment compileClassDefinition: aString",
+messageSends: ["compileClassDefinition:", "environment"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileMethod:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+var method;
+return smalltalk.withContext(function($ctx1) { 
+self._withCompileErrorHandling_((function(){
+return smalltalk.withContext(function($ctx2) {
+method=_st(self._environment())._compileMethod_for_protocol_(aString,self._selectedClass(),self._compilationProtocol());
+method;
+return self._selectedMethod_(method);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString,method:method},globals.HLToolModel)})},
+args: ["aString"],
+source: "compileMethod: aString\x0a\x09| method |\x0a\x09\x0a\x09self withCompileErrorHandling: [ \x0a\x09\x09method := self environment \x0a\x09\x09\x09compileMethod: aString \x0a\x09\x09\x09for: self selectedClass\x0a\x09\x09\x09protocol: self compilationProtocol.\x0a\x0a\x09\x09self selectedMethod: method ]",
+messageSends: ["withCompileErrorHandling:", "compileMethod:for:protocol:", "environment", "selectedClass", "compilationProtocol", "selectedMethod:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copyClassTo:",
+protocol: 'commands actions',
+fn: function (aClassName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._environment())._copyClass_to_(_st(self._selectedClass())._theNonMetaClass(),aClassName);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"copyClassTo:",{aClassName:aClassName},globals.HLToolModel)})},
+args: ["aClassName"],
+source: "copyClassTo: aClassName\x0a\x09self withChangesDo: [ \x0a\x09\x09self environment \x0a\x09\x09\x09copyClass: self selectedClass theNonMetaClass\x0a\x09\x09\x09to: aClassName ]",
+messageSends: ["withChangesDo:", "copyClass:to:", "environment", "theNonMetaClass", "selectedClass"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forceSelectedClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+self._selectedClass_(nil);
+$ctx2.sendIdx["selectedClass:"]=1;
+$1=self._selectedClass_(aClass);
+return $1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"forceSelectedClass:",{aClass:aClass},globals.HLToolModel)})},
+args: ["aClass"],
+source: "forceSelectedClass: aClass\x0a\x09self withChangesDo: [\x0a\x09\x09self \x09\x0a\x09\x09\x09selectedClass: nil;\x0a\x09\x09\x09selectedClass: aClass ]",
+messageSends: ["withChangesDo:", "selectedClass:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forceSelectedMethod:",
+protocol: 'accessing',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+self._selectedMethod_(nil);
+$ctx2.sendIdx["selectedMethod:"]=1;
+$1=self._selectedMethod_(aMethod);
+return $1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"forceSelectedMethod:",{aMethod:aMethod},globals.HLToolModel)})},
+args: ["aMethod"],
+source: "forceSelectedMethod: aMethod\x0a\x09self withChangesDo: [\x0a\x09\x09self \x09\x0a\x09\x09\x09selectedMethod: nil;\x0a\x09\x09\x09selectedMethod: aMethod ]",
+messageSends: ["withChangesDo:", "selectedMethod:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forceSelectedPackage:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+self._selectedPackage_(nil);
+$ctx2.sendIdx["selectedPackage:"]=1;
+$1=self._selectedPackage_(aPackage);
+return $1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"forceSelectedPackage:",{aPackage:aPackage},globals.HLToolModel)})},
+args: ["aPackage"],
+source: "forceSelectedPackage: aPackage\x0a\x09self withChangesDo: [\x0a\x09\x09self \x09\x0a\x09\x09\x09selectedPackage: nil;\x0a\x09\x09\x09selectedPackage: aPackage ]",
+messageSends: ["withChangesDo:", "selectedPackage:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forceSelectedProtocol:",
+protocol: 'accessing',
+fn: function (aProtocol){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+self._selectedProtocol_(nil);
+$ctx2.sendIdx["selectedProtocol:"]=1;
+$1=self._selectedProtocol_(aProtocol);
+return $1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"forceSelectedProtocol:",{aProtocol:aProtocol},globals.HLToolModel)})},
+args: ["aProtocol"],
+source: "forceSelectedProtocol: aProtocol\x0a\x09self withChangesDo: [\x0a\x09\x09self \x09\x0a\x09\x09\x09selectedProtocol: nil;\x0a\x09\x09\x09selectedProtocol: aProtocol ]",
+messageSends: ["withChangesDo:", "selectedProtocol:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleCompileError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+function $HLCompileErrorRaised(){return globals.HLCompileErrorRaised||(typeof HLCompileErrorRaised=="undefined"?nil:HLCompileErrorRaised)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLCompileErrorRaised())._new();
+_st($1)._error_(anError);
+$2=_st($1)._yourself();
+_st(self._announcer())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"handleCompileError:",{anError:anError},globals.HLToolModel)})},
+args: ["anError"],
+source: "handleCompileError: anError\x0a\x09self announcer announce: (HLCompileErrorRaised new\x0a\x09\x09error: anError;\x0a\x09\x09yourself)",
+messageSends: ["announce:", "announcer", "error:", "new", "yourself"],
+referencedClasses: ["HLCompileErrorRaised"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleParseError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+var split,line,column,messageToInsert;
+function $HLParseErrorRaised(){return globals.HLParseErrorRaised||(typeof HLParseErrorRaised=="undefined"?nil:HLParseErrorRaised)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4,$6,$7,$8,$9,$5;
+split=_st(_st(anError)._messageText())._tokenize_(" : ");
+$ctx1.sendIdx["tokenize:"]=1;
+messageToInsert=_st(split)._second();
+$ctx1.sendIdx["second"]=1;
+$1=_st(split)._first();
+$ctx1.sendIdx["first"]=1;
+$3=_st(split)._first();
+$ctx1.sendIdx["first"]=2;
+$2=_st($3)._size();
+split=_st($1)._copyFrom_to_((21),$2);
+split=_st(split)._tokenize_(" column ");
+line=_st(split)._first();
+column=_st(split)._second();
+$4=self._announcer();
+$6=_st($HLParseErrorRaised())._new();
+$7=$6;
+$8=_st(line)._asNumber();
+$ctx1.sendIdx["asNumber"]=1;
+_st($7)._line_($8);
+_st($6)._column_(_st(column)._asNumber());
+_st($6)._message_(messageToInsert);
+_st($6)._error_(anError);
+$9=_st($6)._yourself();
+$5=$9;
+_st($4)._announce_($5);
+return self}, function($ctx1) {$ctx1.fill(self,"handleParseError:",{anError:anError,split:split,line:line,column:column,messageToInsert:messageToInsert},globals.HLToolModel)})},
+args: ["anError"],
+source: "handleParseError: anError\x0a\x09| split line column messageToInsert |\x0a\x09\x0a\x09split := anError messageText tokenize: ' : '.\x0a\x09messageToInsert := split second.\x0a\x0a\x09\x2221 = 'Parse error on line ' size + 1\x22\x0a\x09split := split first copyFrom: 21 to: split first size.\x0a\x09\x0a\x09split := split tokenize: ' column '.\x0a\x09line := split first.\x0a\x09column := split second.\x0a\x09\x0a\x09self announcer announce: (HLParseErrorRaised new\x0a\x09\x09line: line asNumber;\x0a\x09\x09column: column asNumber;\x0a\x09\x09message: messageToInsert;\x0a\x09\x09error: anError;\x0a\x09\x09yourself)",
+messageSends: ["tokenize:", "messageText", "second", "copyFrom:to:", "first", "size", "announce:", "announcer", "line:", "new", "asNumber", "column:", "message:", "error:", "yourself"],
+referencedClasses: ["HLParseErrorRaised"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleUnkownVariableError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+function $HLUnknownVariableErrorRaised(){return globals.HLUnknownVariableErrorRaised||(typeof HLUnknownVariableErrorRaised=="undefined"?nil:HLUnknownVariableErrorRaised)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLUnknownVariableErrorRaised())._new();
+_st($1)._error_(anError);
+$2=_st($1)._yourself();
+_st(self._announcer())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"handleUnkownVariableError:",{anError:anError},globals.HLToolModel)})},
+args: ["anError"],
+source: "handleUnkownVariableError: anError\x0a\x09self announcer announce: (HLUnknownVariableErrorRaised new\x0a\x09\x09error: anError;\x0a\x09\x09yourself)",
+messageSends: ["announce:", "announcer", "error:", "new", "yourself"],
+referencedClasses: ["HLUnknownVariableErrorRaised"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isToolModel",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isToolModel\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "moveClassToPackage:",
+protocol: 'commands actions',
+fn: function (aPackageName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._environment())._moveClass_toPackage_(_st(self._selectedClass())._theNonMetaClass(),aPackageName);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"moveClassToPackage:",{aPackageName:aPackageName},globals.HLToolModel)})},
+args: ["aPackageName"],
+source: "moveClassToPackage: aPackageName\x0a\x09self withChangesDo: [\x0a\x09\x09self environment \x0a\x09\x09\x09moveClass: self selectedClass theNonMetaClass\x0a\x09\x09\x09toPackage: aPackageName ]",
+messageSends: ["withChangesDo:", "moveClass:toPackage:", "environment", "theNonMetaClass", "selectedClass"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "moveMethodToClass:",
+protocol: 'commands actions',
+fn: function (aClassName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._environment())._moveMethod_toClass_(self._selectedMethod(),aClassName);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"moveMethodToClass:",{aClassName:aClassName},globals.HLToolModel)})},
+args: ["aClassName"],
+source: "moveMethodToClass: aClassName\x0a\x09self withChangesDo: [\x0a\x09\x09self environment \x0a\x09\x09\x09moveMethod: self selectedMethod \x0a\x09\x09\x09toClass: aClassName ]",
+messageSends: ["withChangesDo:", "moveMethod:toClass:", "environment", "selectedMethod"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "moveMethodToProtocol:",
+protocol: 'commands actions',
+fn: function (aProtocol){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._environment())._moveMethod_toProtocol_(self._selectedMethod(),aProtocol);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"moveMethodToProtocol:",{aProtocol:aProtocol},globals.HLToolModel)})},
+args: ["aProtocol"],
+source: "moveMethodToProtocol: aProtocol\x0a\x09self withChangesDo: [\x0a\x09\x09self environment \x0a\x09\x09\x09moveMethod: self selectedMethod \x0a\x09\x09\x09toProtocol: aProtocol ]",
+messageSends: ["withChangesDo:", "moveMethod:toProtocol:", "environment", "selectedMethod"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openClassNamed:",
+protocol: 'commands actions',
+fn: function (aString){
+var self=this;
+var class_;
+return smalltalk.withContext(function($ctx1) { 
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+class_=_st(self._environment())._classNamed_(aString);
+class_;
+self._selectedPackage_(_st(class_)._package());
+return self._selectedClass_(class_);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"openClassNamed:",{aString:aString,class_:class_},globals.HLToolModel)})},
+args: ["aString"],
+source: "openClassNamed: aString\x0a\x09| class |\x0a\x09\x0a\x09self withChangesDo: [\x0a\x09\x09class := self environment classNamed: aString.\x0a\x09\x09self selectedPackage: class package.\x0a\x09\x09self selectedClass: class ]",
+messageSends: ["withChangesDo:", "classNamed:", "environment", "selectedPackage:", "package", "selectedClass:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "packageToCommit",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._selectedMethod();
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._selectedPackage();
+} else {
+var method;
+method=$receiver;
+$1=_st(method)._package();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"packageToCommit",{},globals.HLToolModel)})},
+args: [],
+source: "packageToCommit\x0a\x09\x22Answer the package to commit depending on the context:\x0a\x09- if a Method is selected, answer its package\x0a\x09- else answer the `selectedPackage`\x22\x0a\x09\x0a\x09^ self selectedMethod \x0a\x09\x09ifNil: [ self selectedPackage ]\x0a\x09\x09ifNotNil: [ :method | method package ]",
+messageSends: ["ifNil:ifNotNil:", "selectedMethod", "selectedPackage", "package"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "packages",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._environment())._packages();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"packages",{},globals.HLToolModel)})},
+args: [],
+source: "packages\x0a\x09^ self environment packages",
+messageSends: ["packages", "environment"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeClass",
+protocol: 'commands actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$5,$4,$3,$2;
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=self._manager();
+$5=self._selectedClass();
+$ctx2.sendIdx["selectedClass"]=1;
+$4=_st($5)._theNonMetaClass();
+$ctx2.sendIdx["theNonMetaClass"]=1;
+$3=_st($4)._name();
+$2="Do you REALLY want to remove class ".__comma($3);
+return _st($1)._confirm_ifTrue_($2,(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._environment())._removeClass_(_st(self._selectedClass())._theNonMetaClass());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"removeClass",{},globals.HLToolModel)})},
+args: [],
+source: "removeClass\x0a\x09self withChangesDo: [\x0a\x09\x09self manager \x0a\x09\x09\x09confirm: 'Do you REALLY want to remove class ', self selectedClass theNonMetaClass name\x0a\x09\x09\x09ifTrue: [ self environment removeClass: self selectedClass theNonMetaClass ] ]",
+messageSends: ["withChangesDo:", "confirm:ifTrue:", "manager", ",", "name", "theNonMetaClass", "selectedClass", "removeClass:", "environment"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeMethod",
+protocol: 'commands actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$7,$6,$5,$4,$3,$9,$8,$2;
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=self._manager();
+$7=self._selectedMethod();
+$ctx2.sendIdx["selectedMethod"]=1;
+$6=_st($7)._methodClass();
+$5=_st($6)._name();
+$4="Do you REALLY want to remove method ".__comma($5);
+$3=_st($4).__comma(" >> #");
+$ctx2.sendIdx[","]=2;
+$9=self._selectedMethod();
+$ctx2.sendIdx["selectedMethod"]=2;
+$8=_st($9)._selector();
+$2=_st($3).__comma($8);
+$ctx2.sendIdx[","]=1;
+return _st($1)._confirm_ifTrue_($2,(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._environment())._removeMethod_(self._selectedMethod());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"removeMethod",{},globals.HLToolModel)})},
+args: [],
+source: "removeMethod\x0a\x09self withChangesDo: [\x0a\x09\x09self manager \x0a\x09\x09\x09confirm: 'Do you REALLY want to remove method ', self selectedMethod methodClass name,' >> #', self selectedMethod selector\x0a\x09\x09\x09ifTrue: [ self environment removeMethod: self selectedMethod ] ]",
+messageSends: ["withChangesDo:", "confirm:ifTrue:", "manager", ",", "name", "methodClass", "selectedMethod", "selector", "removeMethod:", "environment"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeProtocol",
+protocol: 'commands actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2;
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=self._manager();
+$3=self._selectedProtocol();
+$ctx2.sendIdx["selectedProtocol"]=1;
+$2="Do you REALLY want to remove protocol ".__comma($3);
+return _st($1)._confirm_ifTrue_($2,(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._environment())._removeProtocol_from_(self._selectedProtocol(),self._selectedClass());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol",{},globals.HLToolModel)})},
+args: [],
+source: "removeProtocol\x0a\x09self withChangesDo: [\x0a\x09\x09self manager \x0a\x09\x09\x09confirm: 'Do you REALLY want to remove protocol ', self selectedProtocol\x0a\x09\x09\x09ifTrue: [ self environment \x0a\x09\x09\x09\x09removeProtocol: self selectedProtocol \x0a\x09\x09\x09\x09from: self selectedClass ] ]",
+messageSends: ["withChangesDo:", "confirm:ifTrue:", "manager", ",", "selectedProtocol", "removeProtocol:from:", "environment", "selectedClass"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renameClassTo:",
+protocol: 'commands actions',
+fn: function (aClassName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._environment())._renameClass_to_(_st(self._selectedClass())._theNonMetaClass(),aClassName);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renameClassTo:",{aClassName:aClassName},globals.HLToolModel)})},
+args: ["aClassName"],
+source: "renameClassTo: aClassName\x0a\x09self withChangesDo: [\x0a\x09\x09self environment \x0a\x09\x09\x09renameClass: self selectedClass theNonMetaClass\x0a\x09\x09\x09to: aClassName ]",
+messageSends: ["withChangesDo:", "renameClass:to:", "environment", "theNonMetaClass", "selectedClass"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renameProtocolTo:",
+protocol: 'commands actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._environment())._renameProtocol_to_in_(self._selectedProtocol(),aString,self._selectedClass());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renameProtocolTo:",{aString:aString},globals.HLToolModel)})},
+args: ["aString"],
+source: "renameProtocolTo: aString\x0a\x09self withChangesDo: [\x0a\x09\x09self environment \x0a\x09\x09\x09renameProtocol: self selectedProtocol\x0a\x09\x09\x09to: aString\x0a\x09\x09\x09in: self selectedClass ]",
+messageSends: ["withChangesDo:", "renameProtocol:to:in:", "environment", "selectedProtocol", "selectedClass"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "save:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $HLSourceCodeSaved(){return globals.HLSourceCodeSaved||(typeof HLSourceCodeSaved=="undefined"?nil:HLSourceCodeSaved)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(self._announcer())._announce_(_st($HLSourceCodeSaved())._new());
+$1=self._shouldCompileClassDefinition_(aString);
+if(smalltalk.assert($1)){
+self._compileClassDefinition_(aString);
+} else {
+self._compileMethod_(aString);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"save:",{aString:aString},globals.HLToolModel)})},
+args: ["aString"],
+source: "save: aString\x0a\x09self announcer announce: HLSourceCodeSaved new.\x0a\x09\x0a\x09(self shouldCompileClassDefinition: aString)\x0a\x09\x09ifTrue: [ self compileClassDefinition: aString ]\x0a\x09\x09ifFalse: [ self compileMethod: aString ]",
+messageSends: ["announce:", "announcer", "new", "ifTrue:ifFalse:", "shouldCompileClassDefinition:", "compileClassDefinition:", "compileMethod:"],
+referencedClasses: ["HLSourceCodeSaved"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "saveSourceCode",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLSaveSourceCode(){return globals.HLSaveSourceCode||(typeof HLSaveSourceCode=="undefined"?nil:HLSaveSourceCode)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLSaveSourceCode())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"saveSourceCode",{},globals.HLToolModel)})},
+args: [],
+source: "saveSourceCode\x0a\x09self announcer announce: HLSaveSourceCode new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLSaveSourceCode"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selectedClass"];
+return $1;
+},
+args: [],
+source: "selectedClass\x0a\x09^ selectedClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+function $HLClassSelected(){return globals.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$4,$6,$5,$7,$receiver;
+$3=self._selectedClass();
+$ctx1.sendIdx["selectedClass"]=1;
+$2=_st($3).__eq(aClass);
+$ctx1.sendIdx["="]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aClass)._isNil();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(smalltalk.assert($1)){
+return self;
+};
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(self["@selectedClass"]).__eq(aClass);
+if(smalltalk.assert($4)){
+self._selectedProtocol_(nil);
+$ctx2.sendIdx["selectedProtocol:"]=1;
+};
+if(($receiver = aClass) == null || $receiver.isNil){
+self["@selectedClass"]=nil;
+self["@selectedClass"];
+} else {
+$6=_st(aClass)._theNonMetaClass();
+$ctx2.sendIdx["theNonMetaClass"]=1;
+$5=_st($6)._package();
+self._selectedPackage_($5);
+$7=self._showInstance();
+if(smalltalk.assert($7)){
+self["@selectedClass"]=_st(aClass)._theNonMetaClass();
+self["@selectedClass"];
+} else {
+self["@selectedClass"]=_st(aClass)._theMetaClass();
+self["@selectedClass"];
+};
+};
+self._selectedProtocol_(nil);
+return _st(self._announcer())._announce_(_st($HLClassSelected())._on_(self._selectedClass()));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"selectedClass:",{aClass:aClass},globals.HLToolModel)})},
+args: ["aClass"],
+source: "selectedClass: aClass\x0a\x09(self selectedClass = aClass and: [ aClass isNil ]) \x0a\x09\x09ifTrue: [ ^ self ].\x0a\x09\x0a\x09self withChangesDo: [\x0a\x09\x09selectedClass = aClass ifTrue: [ \x0a\x09\x09\x09self selectedProtocol: nil ].\x0a    \x0a\x09\x09aClass \x0a   \x09\x09\x09ifNil: [ selectedClass := nil ]\x0a    \x09\x09ifNotNil: [\x0a\x09\x09\x09\x09self selectedPackage: aClass theNonMetaClass package.\x0a\x09\x09\x09\x09self showInstance \x0a   \x09\x09\x09\x09\x09ifTrue: [ selectedClass := aClass theNonMetaClass ]\x0a     \x09\x09\x09\x09ifFalse: [ selectedClass := aClass theMetaClass ] ].\x0a\x09\x09self selectedProtocol: nil.\x0a\x09\x09self announcer announce: (HLClassSelected on: self selectedClass) ]",
+messageSends: ["ifTrue:", "and:", "=", "selectedClass", "isNil", "withChangesDo:", "selectedProtocol:", "ifNil:ifNotNil:", "selectedPackage:", "package", "theNonMetaClass", "ifTrue:ifFalse:", "showInstance", "theMetaClass", "announce:", "announcer", "on:"],
+referencedClasses: ["HLClassSelected"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedMethod",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._selectedClass();
+$ctx1.sendIdx["selectedClass"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+$1=$2;
+} else {
+$1=_st(_st(self._selectedClass())._methodDictionary())._at_ifAbsent_(self["@selectedSelector"],(function(){
+return nil;
+}));
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectedMethod",{},globals.HLToolModel)})},
+args: [],
+source: "selectedMethod\x0a\x09^ self selectedClass ifNotNil: [ \x0a\x09\x09self selectedClass methodDictionary \x0a\x09\x09\x09at: selectedSelector \x0a\x09\x09\x09ifAbsent: [ nil ] ]",
+messageSends: ["ifNotNil:", "selectedClass", "at:ifAbsent:", "methodDictionary"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedMethod:",
+protocol: 'accessing',
+fn: function (aCompiledMethod){
+var self=this;
+function $HLMethodSelected(){return globals.HLMethodSelected||(typeof HLMethodSelected=="undefined"?nil:HLMethodSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(self["@selectedSelector"]).__eq(aCompiledMethod);
+if(smalltalk.assert($1)){
+return self;
+};
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+if(($receiver = aCompiledMethod) == null || $receiver.isNil){
+self["@selectedSelector"]=nil;
+self["@selectedSelector"];
+} else {
+self["@selectedClass"]=_st(aCompiledMethod)._methodClass();
+self["@selectedClass"];
+self["@selectedPackage"]=_st(_st(self["@selectedClass"])._theNonMetaClass())._package();
+self["@selectedPackage"];
+self["@selectedSelector"]=_st(aCompiledMethod)._selector();
+self["@selectedSelector"];
+};
+return _st(self._announcer())._announce_(_st($HLMethodSelected())._on_(aCompiledMethod));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"selectedMethod:",{aCompiledMethod:aCompiledMethod},globals.HLToolModel)})},
+args: ["aCompiledMethod"],
+source: "selectedMethod: aCompiledMethod\x0a\x09selectedSelector = aCompiledMethod ifTrue: [ ^ self ].\x0a    \x0a    self withChangesDo: [\x0a\x09\x09aCompiledMethod\x0a    \x09\x09ifNil: [ selectedSelector := nil ]\x0a      \x09\x09ifNotNil: [\x0a\x09\x09\x09\x09selectedClass := aCompiledMethod methodClass.\x0a\x09\x09\x09\x09selectedPackage := selectedClass theNonMetaClass package.\x0a\x09\x09\x09\x09selectedSelector := aCompiledMethod selector ].\x0a\x0a\x09\x09self announcer announce: (HLMethodSelected on: aCompiledMethod) ]",
+messageSends: ["ifTrue:", "=", "withChangesDo:", "ifNil:ifNotNil:", "methodClass", "package", "theNonMetaClass", "selector", "announce:", "announcer", "on:"],
+referencedClasses: ["HLMethodSelected"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedPackage",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selectedPackage"];
+return $1;
+},
+args: [],
+source: "selectedPackage\x0a\x09^ selectedPackage",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedPackage:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+function $HLPackageSelected(){return globals.HLPackageSelected||(typeof HLPackageSelected=="undefined"?nil:HLPackageSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@selectedPackage"]).__eq(aPackage);
+if(smalltalk.assert($1)){
+return self;
+};
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+self["@selectedPackage"]=aPackage;
+self["@selectedPackage"];
+self._selectedClass_(nil);
+return _st(self._announcer())._announce_(_st($HLPackageSelected())._on_(aPackage));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"selectedPackage:",{aPackage:aPackage},globals.HLToolModel)})},
+args: ["aPackage"],
+source: "selectedPackage: aPackage\x0a\x09selectedPackage = aPackage ifTrue: [ ^ self ].\x0a    \x0a\x09self withChangesDo: [\x0a\x09\x09selectedPackage := aPackage.\x0a\x09\x09self selectedClass: nil.\x0a\x09\x09self announcer announce: (HLPackageSelected on: aPackage) ]",
+messageSends: ["ifTrue:", "=", "withChangesDo:", "selectedClass:", "announce:", "announcer", "on:"],
+referencedClasses: ["HLPackageSelected"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedProtocol",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selectedProtocol"];
+return $1;
+},
+args: [],
+source: "selectedProtocol\x0a\x09^ selectedProtocol",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedProtocol:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+function $HLProtocolSelected(){return globals.HLProtocolSelected||(typeof HLProtocolSelected=="undefined"?nil:HLProtocolSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@selectedProtocol"]).__eq(aString);
+if(smalltalk.assert($1)){
+return self;
+};
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+self["@selectedProtocol"]=aString;
+self["@selectedProtocol"];
+self._selectedMethod_(nil);
+return _st(self._announcer())._announce_(_st($HLProtocolSelected())._on_(aString));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"selectedProtocol:",{aString:aString},globals.HLToolModel)})},
+args: ["aString"],
+source: "selectedProtocol: aString\x0a\x09selectedProtocol = aString ifTrue: [ ^ self ].\x0a\x0a\x09self withChangesDo: [\x0a\x09\x09selectedProtocol := aString.\x0a\x09\x09self selectedMethod: nil.\x0a\x09\x09self announcer announce: (HLProtocolSelected on: aString) ]",
+messageSends: ["ifTrue:", "=", "withChangesDo:", "selectedMethod:", "announce:", "announcer", "on:"],
+referencedClasses: ["HLProtocolSelected"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldCompileClassDefinition:",
+protocol: 'testing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._selectedClass())._isNil())._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aString)._match_("^\x5cs*[A-Z]");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shouldCompileClassDefinition:",{aString:aString},globals.HLToolModel)})},
+args: ["aString"],
+source: "shouldCompileClassDefinition: aString\x0a\x09^ self selectedClass isNil or: [\x0a\x09\x09aString match: '^\x5cs*[A-Z]' ]",
+messageSends: ["or:", "isNil", "selectedClass", "match:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unclassifiedProtocol",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return "as yet unclassified";
+},
+args: [],
+source: "unclassifiedProtocol\x0a\x09^ 'as yet unclassified'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withCompileErrorHandling:",
+protocol: 'error handling',
+fn: function (aBlock){
+var self=this;
+function $ParseError(){return globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
+function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
+function $CompilerError(){return globals.CompilerError||(typeof CompilerError=="undefined"?nil:CompilerError)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._environment();
+$ctx1.sendIdx["environment"]=1;
+_st($1)._evaluate_on_do_((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._environment();
+$ctx2.sendIdx["environment"]=2;
+return _st($2)._evaluate_on_do_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._environment())._evaluate_on_do_(aBlock,$ParseError(),(function(ex){
+return smalltalk.withContext(function($ctx4) {
+return self._handleParseError_(ex);
+}, function($ctx4) {$ctx4.fillBlock({ex:ex},$ctx3,3)})}));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$UnknownVariableError(),(function(ex){
+return smalltalk.withContext(function($ctx3) {
+return self._handleUnkownVariableError_(ex);
+}, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,4)})}));
+$ctx2.sendIdx["evaluate:on:do:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$CompilerError(),(function(ex){
+return smalltalk.withContext(function($ctx2) {
+return self._handleCompileError_(ex);
+}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,5)})}));
+$ctx1.sendIdx["evaluate:on:do:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"withCompileErrorHandling:",{aBlock:aBlock},globals.HLToolModel)})},
+args: ["aBlock"],
+source: "withCompileErrorHandling: aBlock\x0a\x09self environment\x0a\x09\x09evaluate: [\x0a\x09\x09\x09self environment \x0a\x09\x09\x09evaluate: [\x0a\x09\x09\x09\x09self environment \x0a\x09\x09\x09\x09\x09evaluate: aBlock\x0a\x09\x09\x09\x09\x09on: ParseError\x0a\x09\x09\x09\x09\x09do: [ :ex | self handleParseError: ex ] ]\x0a\x09\x09\x09on: UnknownVariableError\x0a\x09\x09\x09do: [ :ex | self handleUnkownVariableError: ex ] ]\x0a\x09\x09on: CompilerError\x0a\x09\x09do: [ :ex | self handleCompileError: ex ]",
+messageSends: ["evaluate:on:do:", "environment", "handleParseError:", "handleUnkownVariableError:", "handleCompileError:"],
+referencedClasses: ["ParseError", "UnknownVariableError", "CompilerError"]
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withHelperLabelled:do:",
+protocol: 'private',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2,$5;
+$1="#helper"._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($1)._remove();
+$ctx1.sendIdx["remove"]=1;
+$2=(function(html){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._div();
+_st($3)._id_("helper");
+$4=_st($3)._with_(aString);
+return $4;
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})});
+$5="body"._asJQuery();
+$ctx1.sendIdx["asJQuery"]=2;
+_st($2)._appendToJQuery_($5);
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(aBlock)._value();
+return _st("#helper"._asJQuery())._remove();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._valueWithTimeout_((10));
+return self}, function($ctx1) {$ctx1.fill(self,"withHelperLabelled:do:",{aString:aString,aBlock:aBlock},globals.HLToolModel)})},
+args: ["aString", "aBlock"],
+source: "withHelperLabelled: aString do: aBlock\x0a\x09\x22TODO: doesn't belong here\x22\x0a\x0a\x09'#helper' asJQuery remove.\x0a\x0a\x09[ :html |\x0a\x09\x09html div \x0a\x09\x09\x09id: 'helper';\x0a\x09\x09\x09with: aString ] appendToJQuery: 'body' asJQuery.\x0a\x09\x0a\x09[\x0a\x09\x09aBlock value.\x0a\x09\x09'#helper' asJQuery remove\x0a\x09] \x0a\x09\x09valueWithTimeout: 10",
+messageSends: ["remove", "asJQuery", "appendToJQuery:", "id:", "div", "with:", "valueWithTimeout:", "value"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'actions',
+fn: function (anEnvironment){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._environment_(anEnvironment);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment},globals.HLToolModel.klass)})},
+args: ["anEnvironment"],
+source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a    \x09environment: anEnvironment;\x0a        yourself",
+messageSends: ["environment:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLToolModel.klass);
+
+
+smalltalk.addClass('HLProgressHandler', globals.Object, [], 'Helios-Core');
+globals.HLProgressHandler.comment="I am a specific progress handler for Helios, displaying progresses in a modal window.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:on:displaying:",
+protocol: 'progress handling',
+fn: function (aBlock,aCollection,aString){
+var self=this;
+function $HLProgressWidget(){return globals.HLProgressWidget||(typeof HLProgressWidget=="undefined"?nil:HLProgressWidget)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($HLProgressWidget())._default())._do_on_displaying_(aBlock,aCollection,aString);
+return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.HLProgressHandler)})},
+args: ["aBlock", "aCollection", "aString"],
+source: "do: aBlock on: aCollection displaying: aString\x0a\x09HLProgressWidget default\x0a\x09\x09do: aBlock \x0a\x09\x09on: aCollection \x0a\x09\x09displaying: aString",
+messageSends: ["do:on:displaying:", "default"],
+referencedClasses: ["HLProgressWidget"]
+}),
+globals.HLProgressHandler);
+
+
+
+smalltalk.addClass('HLWidget', globals.Widget, ['wrapper'], 'Helios-Core');
+globals.HLWidget.comment="I am the abstract superclass of all Helios widgets.\x0a\x0aI provide common methods, additional behavior to widgets useful for Helios, like dialog creation, command execution and tab creation.\x0a\x0a## API\x0a\x0a1. Rendering\x0a\x0a    Instead of overriding `#renderOn:` as with other Widget subclasses, my subclasses should override `#renderContentOn:`.\x0a\x0a2. Refreshing\x0a\x0a    To re-render a widget, use `#refresh`.\x0a\x0a3. Key bindings registration and tabs\x0a\x0a    When displayed as a tab, the widget has a chance to register keybindings with the `#registerBindingsOn:` hook method.\x0a    \x0a4. Unregistration\x0a\x0a    When a widget has subscribed to announcements or other actions that need to be cleared when closing the tab, the hook method `#unregister` will be called by helios.\x0a\x0a5. Tabs\x0a\x0a   To enable a widget class to be open as a tab, override the class-side `#canBeOpenAsTab` method to answer `true`. `#tabClass` and `#tabPriority` can be overridden too to respectively change the css class of the tab and the order of tabs in the main menu.\x0a\x0a6. Command execution\x0a\x0a    An helios command (instance of `HLCommand` or one of its subclass) can be executed with `#execute:`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "bindKeyDown:keyUp:",
+protocol: 'keybindings',
+fn: function (keyDownBlock,keyUpBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._wrapper())._asJQuery();
+_st($1)._keydown_(keyDownBlock);
+$2=_st($1)._keyup_(keyUpBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"bindKeyDown:keyUp:",{keyDownBlock:keyDownBlock,keyUpBlock:keyUpBlock},globals.HLWidget)})},
+args: ["keyDownBlock", "keyUpBlock"],
+source: "bindKeyDown: keyDownBlock keyUp: keyUpBlock\x0a\x09self wrapper asJQuery\x0a\x09\x09keydown: keyDownBlock;\x0a\x09\x09keyup: keyUpBlock",
+messageSends: ["keydown:", "asJQuery", "wrapper", "keyup:"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canHaveFocus",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "canHaveFocus\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm:ifTrue:",
+protocol: 'actions',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._manager())._confirm_ifTrue_(aString,aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"confirm:ifTrue:",{aString:aString,aBlock:aBlock},globals.HLWidget)})},
+args: ["aString", "aBlock"],
+source: "confirm: aString ifTrue: aBlock\x0a\x09self manager confirm: aString ifTrue: aBlock",
+messageSends: ["confirm:ifTrue:", "manager"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm:ifTrue:ifFalse:",
+protocol: 'actions',
+fn: function (aString,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._manager())._confirm_ifTrue_ifFalse_(aString,aBlock,anotherBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"confirm:ifTrue:ifFalse:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.HLWidget)})},
+args: ["aString", "aBlock", "anotherBlock"],
+source: "confirm: aString ifTrue: aBlock ifFalse: anotherBlock\x0a\x09self manager \x0a\x09\x09confirm: aString \x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: anotherBlock",
+messageSends: ["confirm:ifTrue:ifFalse:", "manager"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "hl_widget";
+},
+args: [],
+source: "cssClass\x0a\x09^ 'hl_widget'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultTabLabel",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._tabLabel();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultTabLabel",{},globals.HLWidget)})},
+args: [],
+source: "defaultTabLabel\x0a\x09^ self class tabLabel",
+messageSends: ["tabLabel", "class"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "execute:",
+protocol: 'actions',
+fn: function (aCommand){
+var self=this;
+function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(_st($HLManager())._current())._keyBinder();
+_st($1)._activate();
+$2=_st($1)._applyBinding_(_st(aCommand)._asBinding());
+return self}, function($ctx1) {$ctx1.fill(self,"execute:",{aCommand:aCommand},globals.HLWidget)})},
+args: ["aCommand"],
+source: "execute: aCommand\x0a\x09HLManager current keyBinder\x0a\x09\x09activate;\x0a\x09\x09applyBinding: aCommand asBinding",
+messageSends: ["activate", "keyBinder", "current", "applyBinding:", "asBinding"],
+referencedClasses: ["HLManager"]
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inform:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._manager())._inform_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"inform:",{aString:aString},globals.HLWidget)})},
+args: ["aString"],
+source: "inform: aString\x0a\x09self manager inform: aString",
+messageSends: ["inform:", "manager"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "manager",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLManager())._current();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"manager",{},globals.HLWidget)})},
+args: [],
+source: "manager\x0a\x09^ HLManager current",
+messageSends: ["current"],
+referencedClasses: ["HLManager"]
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openAsTab",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLTabWidget(){return globals.HLTabWidget||(typeof HLTabWidget=="undefined"?nil:HLTabWidget)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($HLTabWidget())._on_labelled_(self,self._defaultTabLabel()))._add();
+return self}, function($ctx1) {$ctx1.fill(self,"openAsTab",{},globals.HLWidget)})},
+args: [],
+source: "openAsTab\x0a\x09(HLTabWidget on: self labelled: self defaultTabLabel)\x0a\x09\x09add",
+messageSends: ["add", "on:labelled:", "defaultTabLabel"],
+referencedClasses: ["HLTabWidget"]
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "refresh",
+protocol: 'updating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$receiver;
+$1=self._wrapper();
+$ctx1.sendIdx["wrapper"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return self;
+} else {
+$1;
+};
+$3=self._wrapper();
+$ctx1.sendIdx["wrapper"]=2;
+$2=_st($3)._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($2)._empty();
+_st((function(html){
+return smalltalk.withContext(function($ctx2) {
+return self._renderContentOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,2)})}))._appendToJQuery_(_st(self._wrapper())._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},globals.HLWidget)})},
+args: [],
+source: "refresh\x0a\x09self wrapper ifNil: [ ^ self ].\x0a    \x0a\x09self wrapper asJQuery empty.\x0a    [ :html | self renderContentOn: html ] appendToJQuery: self wrapper asJQuery",
+messageSends: ["ifNil:", "wrapper", "empty", "asJQuery", "appendToJQuery:", "renderContentOn:"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerBindings",
+protocol: 'keybindings',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._registerBindingsOn_(_st(_st(self._manager())._keyBinder())._bindings());
+return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{},globals.HLWidget)})},
+args: [],
+source: "registerBindings\x0a\x09self registerBindingsOn: self manager keyBinder bindings",
+messageSends: ["registerBindingsOn:", "bindings", "keyBinder", "manager"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerBindingsOn:",
+protocol: 'keybindings',
+fn: function (aBindingGroup){
+var self=this;
+return self},
+args: ["aBindingGroup"],
+source: "registerBindingsOn: aBindingGroup",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeTab",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._manager())._removeTabForWidget_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"removeTab",{},globals.HLWidget)})},
+args: [],
+source: "removeTab\x0a\x09self manager removeTabForWidget: self",
+messageSends: ["removeTabForWidget:", "manager"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return self},
+args: ["html"],
+source: "renderContentOn: html",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_(self._cssClass());
+$2=_st($1)._yourself();
+self["@wrapper"]=$2;
+_st((function(renderer){
+return smalltalk.withContext(function($ctx2) {
+return self._renderContentOn_(renderer);
+}, function($ctx2) {$ctx2.fillBlock({renderer:renderer},$ctx1,1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.HLWidget)})},
+args: ["html"],
+source: "renderOn: html\x0a\x09wrapper := html div\x0a\x09\x09class: self cssClass;\x0a\x09\x09yourself.\x0a    [ :renderer | self renderContentOn: renderer ] appendToJQuery: wrapper asJQuery",
+messageSends: ["class:", "div", "cssClass", "yourself", "appendToJQuery:", "renderContentOn:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "request:do:",
+protocol: 'actions',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._manager())._request_do_(aString,aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"request:do:",{aString:aString,aBlock:aBlock},globals.HLWidget)})},
+args: ["aString", "aBlock"],
+source: "request: aString do: aBlock\x0a\x09self manager request: aString do: aBlock",
+messageSends: ["request:do:", "manager"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "request:value:do:",
+protocol: 'actions',
+fn: function (aString,valueString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._manager())._request_value_do_(aString,valueString,aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"request:value:do:",{aString:aString,valueString:valueString,aBlock:aBlock},globals.HLWidget)})},
+args: ["aString", "valueString", "aBlock"],
+source: "request: aString value: valueString do: aBlock\x0a\x09self manager \x0a\x09\x09request: aString \x0a\x09\x09value: valueString\x0a\x09\x09do: aBlock",
+messageSends: ["request:value:do:", "manager"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setTabLabel:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+function $HLTabLabelChanged(){return globals.HLTabLabelChanged||(typeof HLTabLabelChanged=="undefined"?nil:HLTabLabelChanged)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLTabLabelChanged())._new();
+_st($1)._widget_(self);
+_st($1)._label_(aString);
+$2=_st($1)._yourself();
+_st(_st(self._manager())._announcer())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"setTabLabel:",{aString:aString},globals.HLWidget)})},
+args: ["aString"],
+source: "setTabLabel: aString\x0a\x09self manager announcer announce: (HLTabLabelChanged new\x0a\x09\x09widget: self;\x0a\x09\x09label: aString;\x0a\x09\x09yourself)",
+messageSends: ["announce:", "announcer", "manager", "widget:", "new", "label:", "yourself"],
+referencedClasses: ["HLTabLabelChanged"]
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._tabClass();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tabClass",{},globals.HLWidget)})},
+args: [],
+source: "tabClass\x0a\x09^ self class tabClass",
+messageSends: ["tabClass", "class"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unbindKeyDownKeyUp",
+protocol: 'keybindings',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._wrapper())._asJQuery();
+_st($1)._unbind_("keydown");
+$ctx1.sendIdx["unbind:"]=1;
+$2=_st($1)._unbind_("keyup");
+return self}, function($ctx1) {$ctx1.fill(self,"unbindKeyDownKeyUp",{},globals.HLWidget)})},
+args: [],
+source: "unbindKeyDownKeyUp\x0a\x09self wrapper asJQuery\x0a\x09\x09unbind: 'keydown';\x0a\x09\x09unbind: 'keyup'",
+messageSends: ["unbind:", "asJQuery", "wrapper"],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "unregister\x0a\x09\x22This method is called whenever the receiver is closed (as a tab).\x0a\x09Widgets subscribing to announcements should unregister there\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "wrapper",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@wrapper"];
+return $1;
+},
+args: [],
+source: "wrapper\x0a\x09^ wrapper",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeOpenAsTab",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "canBeOpenAsTab\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openAsTab",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var instance;
+function $HLTabWidget(){return globals.HLTabWidget||(typeof HLTabWidget=="undefined"?nil:HLTabWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+instance=self._new();
+_st(_st($HLTabWidget())._on_labelled_(instance,_st(instance)._defaultTabLabel()))._add();
+$1=instance;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"openAsTab",{instance:instance},globals.HLWidget.klass)})},
+args: [],
+source: "openAsTab\x0a\x09| instance |\x0a\x09\x0a\x09instance := self new.\x0a\x09(HLTabWidget \x0a\x09\x09on: instance \x0a\x09\x09labelled: instance defaultTabLabel) add.\x0a\x09^ instance",
+messageSends: ["new", "add", "on:labelled:", "defaultTabLabel"],
+referencedClasses: ["HLTabWidget"]
+}),
+globals.HLWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "";
+},
+args: [],
+source: "tabClass\x0a\x09^ ''",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Tab";
+},
+args: [],
+source: "tabLabel\x0a\x09^ 'Tab'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabPriority",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return (500);
+},
+args: [],
+source: "tabPriority\x0a\x09^ 500",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWidget.klass);
+
+
+smalltalk.addClass('HLFocusableWidget', globals.HLWidget, [], 'Helios-Core');
+globals.HLFocusableWidget.comment="I am a widget that can be focused.\x0a\x0a## API \x0a\x0aInstead of overriding `#renderOn:` as with other `Widget` subclasses, my subclasses should override `#renderContentOn:`.\x0a\x0aTo bring the focus to the widget, use the `#focus` method.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "blur",
+protocol: 'events',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._wrapper())._asJQuery())._blur();
+return self}, function($ctx1) {$ctx1.fill(self,"blur",{},globals.HLFocusableWidget)})},
+args: [],
+source: "blur\x0a\x09self wrapper asJQuery blur",
+messageSends: ["blur", "asJQuery", "wrapper"],
+referencedClasses: []
+}),
+globals.HLFocusableWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canHaveFocus",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canHaveFocus\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFocusableWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'events',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._wrapper())._asJQuery())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLFocusableWidget)})},
+args: [],
+source: "focus\x0a\x09self wrapper asJQuery focus",
+messageSends: ["focus", "asJQuery", "wrapper"],
+referencedClasses: []
+}),
+globals.HLFocusableWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focusClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "focused";
+},
+args: [],
+source: "focusClass\x0a\x09^ 'focused'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFocusableWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hasFocus",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self._wrapper();
+$ctx1.sendIdx["wrapper"]=1;
+$2=_st($3)._notNil();
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(self._wrapper())._asJQuery())._hasClass_(self._focusClass());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"hasFocus",{},globals.HLFocusableWidget)})},
+args: [],
+source: "hasFocus\x0a\x09^ self wrapper notNil and: [ self wrapper asJQuery hasClass: self focusClass ]",
+messageSends: ["and:", "notNil", "wrapper", "hasClass:", "asJQuery", "focusClass"],
+referencedClasses: []
+}),
+globals.HLFocusableWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return self},
+args: ["html"],
+source: "renderContentOn: html",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLFocusableWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$5,$4,$6,$7;
+$1=_st(html)._div();
+_st($1)._class_(self._cssClass());
+$2=_st($1)._yourself();
+self["@wrapper"]=$2;
+_st(self["@wrapper"])._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._renderContentOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$3=self["@wrapper"];
+_st($3)._at_put_("tabindex","0");
+_st($3)._onBlur_((function(){
+return smalltalk.withContext(function($ctx2) {
+$5=self._wrapper();
+$ctx2.sendIdx["wrapper"]=1;
+$4=_st($5)._asJQuery();
+$ctx2.sendIdx["asJQuery"]=1;
+$6=self._focusClass();
+$ctx2.sendIdx["focusClass"]=1;
+return _st($4)._removeClass_($6);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$7=_st($3)._onFocus_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(self._wrapper())._asJQuery())._addClass_(self._focusClass());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.HLFocusableWidget)})},
+args: ["html"],
+source: "renderOn: html\x0a    wrapper := html div \x0a    \x09class: self cssClass;\x0a\x09\x09yourself.\x0a\x09\x09\x0a       wrapper with: [ self renderContentOn: html ].\x0a\x09\x0a\x09wrapper\x0a\x09\x09at: 'tabindex' put: '0';\x0a\x09\x09onBlur: [ self wrapper asJQuery removeClass: self focusClass ];\x0a        onFocus: [ self wrapper asJQuery addClass: self focusClass ]",
+messageSends: ["class:", "div", "cssClass", "yourself", "with:", "renderContentOn:", "at:put:", "onBlur:", "removeClass:", "asJQuery", "wrapper", "focusClass", "onFocus:", "addClass:"],
+referencedClasses: []
+}),
+globals.HLFocusableWidget);
+
+
+
+smalltalk.addClass('HLListWidget', globals.HLFocusableWidget, ['items', 'selectedItem'], 'Helios-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activateFirstListItem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._activateListItem_(_st(_st(_st(self["@wrapper"])._asJQuery())._find_("li.inactive"))._eq_((0)));
+return self}, function($ctx1) {$ctx1.fill(self,"activateFirstListItem",{},globals.HLListWidget)})},
+args: [],
+source: "activateFirstListItem\x0a\x09self activateListItem: ((wrapper asJQuery find: 'li.inactive') eq: 0)",
+messageSends: ["activateListItem:", "eq:", "find:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activateItem:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._activateListItem_(self._findListItemFor_(anObject));
+return self}, function($ctx1) {$ctx1.fill(self,"activateItem:",{anObject:anObject},globals.HLListWidget)})},
+args: ["anObject"],
+source: "activateItem: anObject\x0a\x09self activateListItem: (self findListItemFor: anObject)",
+messageSends: ["activateListItem:", "findListItemFor:"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activateListItem:",
+protocol: 'actions',
+fn: function (aListItem){
+var self=this;
+var item;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=_st(aListItem)._get_((0));
+if(($receiver = $1) == null || $receiver.isNil){
+return self;
+} else {
+$1;
+};
+_st(_st(_st(aListItem)._parent())._children())._removeClass_("active");
+_st(aListItem)._addClass_("active");
+self._ensureVisible_(aListItem);
+item=_st(aListItem)._data_("item");
+$2=_st(self._selectedItem()).__eq_eq(item);
+if(! smalltalk.assert($2)){
+self._selectItem_(item);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"activateListItem:",{aListItem:aListItem,item:item},globals.HLListWidget)})},
+args: ["aListItem"],
+source: "activateListItem: aListItem\x0a\x09| item |\x0a\x09\x0a\x09(aListItem get: 0) ifNil: [ ^ self ].\x0a\x09aListItem parent children removeClass: 'active'.\x0a\x09aListItem addClass: 'active'.\x0a    \x0a\x09self ensureVisible: aListItem.\x0a    \x0a   \x22Activate the corresponding item\x22\x0a   item := aListItem data: 'item'.\x0a   self selectedItem == item ifFalse: [\x0a\x09   self selectItem: item ]",
+messageSends: ["ifNil:", "get:", "removeClass:", "children", "parent", "addClass:", "ensureVisible:", "data:", "ifFalse:", "==", "selectedItem", "selectItem:"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activateNextListItem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+$4=self._wrapper();
+$ctx1.sendIdx["wrapper"]=1;
+$3=_st($4)._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+$2=_st($3)._find_("li.active");
+$ctx1.sendIdx["find:"]=1;
+$1=_st($2)._next();
+self._activateListItem_($1);
+_st(_st(_st(_st(self._wrapper())._asJQuery())._find_(" .active"))._get())._ifEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._activateFirstListItem();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"activateNextListItem",{},globals.HLListWidget)})},
+args: [],
+source: "activateNextListItem\x0a\x09self activateListItem: (self wrapper asJQuery find: 'li.active') next.\x0a\x09\x0a\x09\x22select the first item if none is selected\x22\x0a\x09(self wrapper asJQuery find: ' .active') get ifEmpty: [\x0a\x09\x09self activateFirstListItem ]",
+messageSends: ["activateListItem:", "next", "find:", "asJQuery", "wrapper", "ifEmpty:", "get", "activateFirstListItem"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activatePreviousListItem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._activateListItem_(_st(_st(_st(self._wrapper())._asJQuery())._find_("li.active"))._prev());
+return self}, function($ctx1) {$ctx1.fill(self,"activatePreviousListItem",{},globals.HLListWidget)})},
+args: [],
+source: "activatePreviousListItem\x0a\x09self activateListItem: (self wrapper asJQuery find: 'li.active') prev",
+messageSends: ["activateListItem:", "prev", "find:", "asJQuery", "wrapper"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClassForItem:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return "";
+},
+args: ["anObject"],
+source: "cssClassForItem: anObject\x0a\x09^ ''",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultItems",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+var $1;
+$1=[];
+return $1;
+},
+args: [],
+source: "defaultItems\x0a\x09^ #()",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ensureVisible:",
+protocol: 'actions',
+fn: function (aListItem){
+var self=this;
+var parent,position;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$4,$3,$2,$5,$9,$8,$11,$10,$7,$6,$15,$14,$16,$13,$17,$12,$18,$22,$23,$21,$20,$19,$receiver;
+$1=_st(aListItem)._get_((0));
+$ctx1.sendIdx["get:"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return self;
+} else {
+$1;
+};
+position=self._positionOf_(aListItem);
+parent=_st(aListItem)._parent();
+$4=_st(aListItem)._position();
+$ctx1.sendIdx["position"]=1;
+$3=_st($4)._top();
+$ctx1.sendIdx["top"]=1;
+$2=_st($3).__lt((0));
+if(smalltalk.assert($2)){
+$5=_st(parent)._get_((0));
+$ctx1.sendIdx["get:"]=2;
+$9=_st(parent)._get_((0));
+$ctx1.sendIdx["get:"]=3;
+$8=_st($9)._scrollTop();
+$ctx1.sendIdx["scrollTop"]=1;
+$11=_st(aListItem)._position();
+$ctx1.sendIdx["position"]=2;
+$10=_st($11)._top();
+$ctx1.sendIdx["top"]=2;
+$7=_st($8).__plus($10);
+$ctx1.sendIdx["+"]=1;
+$6=_st($7).__minus((10));
+$ctx1.sendIdx["-"]=1;
+_st($5)._scrollTop_($6);
+$ctx1.sendIdx["scrollTop:"]=1;
+};
+$15=_st(aListItem)._position();
+$ctx1.sendIdx["position"]=3;
+$14=_st($15)._top();
+$ctx1.sendIdx["top"]=3;
+$16=_st(aListItem)._height();
+$ctx1.sendIdx["height"]=1;
+$13=_st($14).__plus($16);
+$ctx1.sendIdx["+"]=2;
+$17=_st(parent)._height();
+$ctx1.sendIdx["height"]=2;
+$12=_st($13).__gt($17);
+if(smalltalk.assert($12)){
+$18=_st(parent)._get_((0));
+$ctx1.sendIdx["get:"]=4;
+$22=_st(_st(parent)._get_((0)))._scrollTop();
+$23=_st(aListItem)._height();
+$ctx1.sendIdx["height"]=3;
+$21=_st($22).__plus($23);
+$20=_st($21).__minus(_st(_st(parent)._height()).__minus(_st(_st(aListItem)._position())._top()));
+$ctx1.sendIdx["-"]=2;
+$19=_st($20).__plus((10));
+$ctx1.sendIdx["+"]=3;
+_st($18)._scrollTop_($19);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"ensureVisible:",{aListItem:aListItem,parent:parent,position:position},globals.HLListWidget)})},
+args: ["aListItem"],
+source: "ensureVisible: aListItem\x09\x0a\x09\x22Move the scrollbar to show the active element\x22\x0a\x09\x0a\x09| parent position |\x0a\x09(aListItem get: 0) ifNil: [ ^ self ].\x0a\x09position := self positionOf: aListItem.\x0a\x09parent := aListItem parent.\x0a\x09\x0a    aListItem position top < 0 ifTrue: [\x0a\x09\x09(parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem position top - 10) ].\x0a    aListItem position top + aListItem height > parent height ifTrue: [ \x0a\x09\x09(parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem height - (parent height - aListItem position top)) +10 ]",
+messageSends: ["ifNil:", "get:", "positionOf:", "parent", "ifTrue:", "<", "top", "position", "scrollTop:", "-", "+", "scrollTop", ">", "height"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "findListItemFor:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+$4=_st(self["@wrapper"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+$3=_st($4)._find_("li");
+$2=_st($3)._filter_(_st((function(thisArg,otherArg){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(_st(thisArg)._asJQuery())._data_("item")).__eq(anObject);
+}, function($ctx2) {$ctx2.fillBlock({thisArg:thisArg,otherArg:otherArg},$ctx1,1)})}))._currySelf());
+$1=_st($2)._eq_((0));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"findListItemFor:",{anObject:anObject},globals.HLListWidget)})},
+args: ["anObject"],
+source: "findListItemFor: anObject\x0a\x09^ (((wrapper asJQuery find: 'li') \x0a\x09\x09filter: [ :thisArg :otherArg | (thisArg asJQuery data: 'item') = anObject ] currySelf) eq: 0)",
+messageSends: ["eq:", "filter:", "find:", "asJQuery", "currySelf", "=", "data:"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+($ctx1.supercall = true, globals.HLListWidget.superclass.fn.prototype._focus.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st(self._items())._isEmpty();
+if(! smalltalk.assert($1)){
+$2=self._selectedItem();
+if(($receiver = $2) == null || $receiver.isNil){
+self._activateFirstListItem();
+} else {
+$2;
+};
+};
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLListWidget)})},
+args: [],
+source: "focus\x0a\x09super focus.\x0a    self items isEmpty ifFalse: [ \x0a\x09\x09self selectedItem ifNil: [ self activateFirstListItem ] ]",
+messageSends: ["focus", "ifFalse:", "isEmpty", "items", "ifNil:", "selectedItem", "activateFirstListItem"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "items",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@items"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@items"]=self._defaultItems();
+$1=self["@items"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"items",{},globals.HLListWidget)})},
+args: [],
+source: "items\x0a\x09^ items ifNil: [ items := self defaultItems ]",
+messageSends: ["ifNil:", "defaultItems"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "items:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@items"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "items: aCollection\x0a\x09items := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "listCssClassForItem:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(self._selectedItem()).__eq(anObject);
+if(smalltalk.assert($2)){
+$1="active";
+} else {
+$1="inactive";
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"listCssClassForItem:",{anObject:anObject},globals.HLListWidget)})},
+args: ["anObject"],
+source: "listCssClassForItem: anObject\x0a\x09^ self selectedItem = anObject\x0a\x09\x09ifTrue: [ 'active' ]\x0a\x09\x09ifFalse: [ 'inactive' ]",
+messageSends: ["ifTrue:ifFalse:", "=", "selectedItem"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "positionOf:",
+protocol: 'accessing',
+fn: function (aListItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+    	return aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"positionOf:",{aListItem:aListItem},globals.HLListWidget)})},
+args: ["aListItem"],
+source: "positionOf: aListItem\x0a\x09<\x0a    \x09return aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reactivateListItem:",
+protocol: 'actions',
+fn: function (aListItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._activateListItem_(aListItem);
+self._reselectItem_(self._selectedItem());
+return self}, function($ctx1) {$ctx1.fill(self,"reactivateListItem:",{aListItem:aListItem},globals.HLListWidget)})},
+args: ["aListItem"],
+source: "reactivateListItem: aListItem\x0a\x09self activateListItem: aListItem.\x0a\x09self reselectItem: self selectedItem",
+messageSends: ["activateListItem:", "reselectItem:", "selectedItem"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "refresh",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+($ctx1.supercall = true, globals.HLListWidget.superclass.fn.prototype._refresh.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=self._selectedItem();
+$ctx1.sendIdx["selectedItem"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+self._ensureVisible_(self._findListItemFor_(self._selectedItem()));
+};
+return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},globals.HLListWidget)})},
+args: [],
+source: "refresh\x0a\x09super refresh.\x0a\x09self selectedItem ifNotNil: [self ensureVisible: (self findListItemFor: self selectedItem)].",
+messageSends: ["refresh", "ifNotNil:", "selectedItem", "ensureVisible:", "findListItemFor:"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return self},
+args: ["html"],
+source: "renderButtonsOn: html",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+$1=_st(html)._ul();
+_st($1)._class_("nav nav-pills nav-stacked");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._renderListOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+$3=_st(html)._div();
+_st($3)._class_("pane_actions form-actions");
+$4=_st($3)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._renderButtonsOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+self._setupKeyBindings();
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLListWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html ul \x0a    \x09class: 'nav nav-pills nav-stacked';\x0a        with: [ self renderListOn: html ].\x0a    html div class: 'pane_actions form-actions'; with: [\x0a      \x09self renderButtonsOn: html ].\x0a        \x0a   self setupKeyBindings",
+messageSends: ["class:", "ul", "with:", "renderListOn:", "div", "renderButtonsOn:", "setupKeyBindings"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItem:on:",
+protocol: 'rendering',
+fn: function (anObject,html){
+var self=this;
+var li;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$5,$3;
+li=_st(html)._li();
+$1=_st(li)._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($1)._data_put_("item",anObject);
+$2=li;
+_st($2)._class_(self._listCssClassForItem_(anObject));
+$ctx1.sendIdx["class:"]=1;
+$3=_st($2)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(html)._a();
+_st($4)._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+_st(_st(html)._tag_("i"))._class_(self._cssClassForItem_(anObject));
+return self._renderItemLabel_on_(anObject,html);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$5=_st($4)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._reactivateListItem_(_st(li)._asJQuery());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+return $5;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderItem:on:",{anObject:anObject,html:html,li:li},globals.HLListWidget)})},
+args: ["anObject", "html"],
+source: "renderItem: anObject on: html\x0a\x09| li |\x0a    \x0a\x09li := html li.\x0a\x09li asJQuery data: 'item' put: anObject.\x0a    li\x0a\x09\x09class: (self listCssClassForItem: anObject);\x0a        with: [ \x0a        \x09html a\x0a            \x09with: [ \x0a            \x09\x09(html tag: 'i') class: (self cssClassForItem: anObject).\x0a  \x09\x09\x09\x09\x09self renderItemLabel: anObject on: html ];\x0a\x09\x09\x09\x09onClick: [\x0a                  \x09self reactivateListItem: li asJQuery ] ]",
+messageSends: ["li", "data:put:", "asJQuery", "class:", "listCssClassForItem:", "with:", "a", "tag:", "cssClassForItem:", "renderItemLabel:on:", "onClick:", "reactivateListItem:"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItemLabel:on:",
+protocol: 'rendering',
+fn: function (anObject,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(html)._with_(_st(anObject)._asString());
+return self}, function($ctx1) {$ctx1.fill(self,"renderItemLabel:on:",{anObject:anObject,html:html},globals.HLListWidget)})},
+args: ["anObject", "html"],
+source: "renderItemLabel: anObject on: html\x0a\x09html with: anObject asString",
+messageSends: ["with:", "asString"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderListOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._items())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._renderItem_on_(each,html);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderListOn:",{html:html},globals.HLListWidget)})},
+args: ["html"],
+source: "renderListOn: html\x0a\x09self items do: [ :each  | \x0a    \x09self renderItem: each  on: html ]",
+messageSends: ["do:", "items", "renderItem:on:"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return self},
+args: ["anObject"],
+source: "reselectItem: anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectItem:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selectedItem_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{anObject:anObject},globals.HLListWidget)})},
+args: ["anObject"],
+source: "selectItem: anObject\x0a\x09self selectedItem: anObject",
+messageSends: ["selectedItem:"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedItem",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selectedItem"];
+return $1;
+},
+args: [],
+source: "selectedItem\x0a\x09^ selectedItem",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedItem:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@selectedItem"]=anObject;
+return self},
+args: ["anObject"],
+source: "selectedItem: anObject\x0a\x09selectedItem := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupKeyBindings",
+protocol: 'events',
+fn: function (){
+var self=this;
+function $HLRepeatedKeyDownHandler(){return globals.HLRepeatedKeyDownHandler||(typeof HLRepeatedKeyDownHandler=="undefined"?nil:HLRepeatedKeyDownHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=_st($HLRepeatedKeyDownHandler())._on_(self);
+_st($1)._whileKeyDown_do_((38),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._activatePreviousListItem();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["whileKeyDown:do:"]=1;
+_st($1)._whileKeyDown_do_((40),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._activateNextListItem();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$2=_st($1)._rebindKeys();
+_st(_st(self._wrapper())._asJQuery())._keydown_((function(e){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(_st(e)._which()).__eq((13));
+if(smalltalk.assert($3)){
+return self._reselectItem_(self._selectedItem());
+};
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"setupKeyBindings",{},globals.HLListWidget)})},
+args: [],
+source: "setupKeyBindings \x0a\x09(HLRepeatedKeyDownHandler on: self)\x0a\x09\x09whileKeyDown: 38 do: [ self activatePreviousListItem ];\x0a\x09\x09whileKeyDown: 40 do: [ self activateNextListItem ];\x0a\x09\x09rebindKeys.\x0a\x09\x09\x0a\x09self wrapper asJQuery keydown: [ :e |\x0a        e which = 13 ifTrue: [ \x0a        \x09self reselectItem: self selectedItem ] ]",
+messageSends: ["whileKeyDown:do:", "on:", "activatePreviousListItem", "activateNextListItem", "rebindKeys", "keydown:", "asJQuery", "wrapper", "ifTrue:", "=", "which", "reselectItem:", "selectedItem"],
+referencedClasses: ["HLRepeatedKeyDownHandler"]
+}),
+globals.HLListWidget);
+
+
+
+smalltalk.addClass('HLNavigationListWidget', globals.HLListWidget, ['previous', 'next'], 'Helios-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@next"];
+return $1;
+},
+args: [],
+source: "next\x0a\x09^ next",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLNavigationListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self["@next"]=aWidget;
+$1=_st(_st(aWidget)._previous()).__eq(self);
+if(! smalltalk.assert($1)){
+_st(aWidget)._previous_(self);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"next:",{aWidget:aWidget},globals.HLNavigationListWidget)})},
+args: ["aWidget"],
+source: "next: aWidget\x0a\x09next := aWidget.\x0a    aWidget previous = self ifFalse: [ aWidget previous: self ]",
+messageSends: ["ifFalse:", "=", "previous", "previous:"],
+referencedClasses: []
+}),
+globals.HLNavigationListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextFocus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self._next();
+$ctx1.sendIdx["next"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(self._next())._focus();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"nextFocus",{},globals.HLNavigationListWidget)})},
+args: [],
+source: "nextFocus\x0a\x09self next ifNotNil: [ self next focus ]",
+messageSends: ["ifNotNil:", "next", "focus"],
+referencedClasses: []
+}),
+globals.HLNavigationListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "previous",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@previous"];
+return $1;
+},
+args: [],
+source: "previous\x0a\x09^ previous",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLNavigationListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "previous:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self["@previous"]=aWidget;
+$1=_st(_st(aWidget)._next()).__eq(self);
+if(! smalltalk.assert($1)){
+_st(aWidget)._next_(self);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"previous:",{aWidget:aWidget},globals.HLNavigationListWidget)})},
+args: ["aWidget"],
+source: "previous: aWidget\x0a\x09previous := aWidget.\x0a    aWidget next = self ifFalse: [ aWidget next: self ]",
+messageSends: ["ifFalse:", "=", "next", "next:"],
+referencedClasses: []
+}),
+globals.HLNavigationListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "previousFocus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self._previous();
+$ctx1.sendIdx["previous"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(self._previous())._focus();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"previousFocus",{},globals.HLNavigationListWidget)})},
+args: [],
+source: "previousFocus\x0a\x09self previous ifNotNil: [ self previous focus ]",
+messageSends: ["ifNotNil:", "previous", "focus"],
+referencedClasses: []
+}),
+globals.HLNavigationListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupKeyBindings",
+protocol: 'events',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3;
+($ctx1.supercall = true, globals.HLNavigationListWidget.superclass.fn.prototype._setupKeyBindings.apply(_st(self), []));
+$ctx1.supercall = false;
+_st(_st(self._wrapper())._asJQuery())._keydown_((function(e){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(e)._which();
+$ctx2.sendIdx["which"]=1;
+$1=_st($2).__eq((39));
+$ctx2.sendIdx["="]=1;
+if(smalltalk.assert($1)){
+self._nextFocus();
+};
+$3=_st(_st(e)._which()).__eq((37));
+if(smalltalk.assert($3)){
+return self._previousFocus();
+};
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"setupKeyBindings",{},globals.HLNavigationListWidget)})},
+args: [],
+source: "setupKeyBindings\x0a\x09super setupKeyBindings.\x0a\x0a\x09self wrapper asJQuery keydown: [ :e |\x0a        e which = 39 ifTrue: [ \x0a        \x09self nextFocus ].\x0a\x09\x09e which = 37 ifTrue: [ \x0a        \x09self previousFocus ] ]",
+messageSends: ["setupKeyBindings", "keydown:", "asJQuery", "wrapper", "ifTrue:", "=", "which", "nextFocus", "previousFocus"],
+referencedClasses: []
+}),
+globals.HLNavigationListWidget);
+
+
+
+smalltalk.addClass('HLToolListWidget', globals.HLNavigationListWidget, ['model'], 'Helios-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activateListItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return ($ctx2.supercall = true, globals.HLToolListWidget.superclass.fn.prototype._activateListItem_.apply(_st(self), [anItem]));
+$ctx2.supercall = false;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"activateListItem:",{anItem:anItem},globals.HLToolListWidget)})},
+args: ["anItem"],
+source: "activateListItem: anItem\x0a\x09self model withChangesDo: [ super activateListItem: anItem ]",
+messageSends: ["withChangesDo:", "model", "activateListItem:"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activateNextListItem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return ($ctx2.supercall = true, globals.HLToolListWidget.superclass.fn.prototype._activateNextListItem.apply(_st(self), []));
+$ctx2.supercall = false;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"activateNextListItem",{},globals.HLToolListWidget)})},
+args: [],
+source: "activateNextListItem\x0a\x09self model withChangesDo: [ super activateNextListItem ]",
+messageSends: ["withChangesDo:", "model", "activateNextListItem"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activatePreviousListItem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return ($ctx2.supercall = true, globals.HLToolListWidget.superclass.fn.prototype._activatePreviousListItem.apply(_st(self), []));
+$ctx2.supercall = false;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"activatePreviousListItem",{},globals.HLToolListWidget)})},
+args: [],
+source: "activatePreviousListItem\x0a\x09self model withChangesDo: [ super activatePreviousListItem ]",
+messageSends: ["withChangesDo:", "model", "activatePreviousListItem"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commandCategory",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._label();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commandCategory",{},globals.HLToolListWidget)})},
+args: [],
+source: "commandCategory\x0a\x09^ self label",
+messageSends: ["label"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "List";
+},
+args: [],
+source: "label\x0a\x09^ 'List'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "menuCommands",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLToolCommand(){return globals.HLToolCommand||(typeof HLToolCommand=="undefined"?nil:HLToolCommand)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st(_st(_st(_st($HLToolCommand())._concreteClasses())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$2=self._model();
+$ctx2.sendIdx["model"]=1;
+return _st(each)._isValidFor_($2);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._for_(self._model());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})))._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(_st(each)._category()).__eq(self._commandCategory()))._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(each)._isAction())._and_((function(){
+return smalltalk.withContext(function($ctx4) {
+return _st(each)._isActive();
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)})}));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
+$ctx2.sendIdx["and:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
+$ctx1.sendIdx["select:"]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"menuCommands",{},globals.HLToolListWidget)})},
+args: [],
+source: "menuCommands\x0a\x09\x22Answer a collection of commands to be put in the cog menu\x22\x0a\x09\x0a\x09^ ((HLToolCommand concreteClasses\x0a\x09\x09select: [ :each | each isValidFor: self model ])\x0a\x09\x09\x09collect: [ :each | each for: self model ])\x0a\x09\x09\x09select: [ :each | \x0a\x09\x09\x09\x09each category = self commandCategory and: [ \x0a\x09\x09\x09\x09\x09each isAction and: [ each isActive ] ] ]",
+messageSends: ["select:", "collect:", "concreteClasses", "isValidFor:", "model", "for:", "and:", "=", "category", "commandCategory", "isAction", "isActive"],
+referencedClasses: ["HLToolCommand"]
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@model"];
+return $1;
+},
+args: [],
+source: "model\x0a\x09^ model",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+protocol: 'accessing',
+fn: function (aBrowserModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self["@model"]=aBrowserModel;
+self._observeSystem();
+$1=self._observeModel();
+return self}, function($ctx1) {$ctx1.fill(self,"model:",{aBrowserModel:aBrowserModel},globals.HLToolListWidget)})},
+args: ["aBrowserModel"],
+source: "model: aBrowserModel\x0a\x09model := aBrowserModel.\x0a    \x0a    self \x0a\x09\x09observeSystem;\x0a\x09\x09observeModel",
+messageSends: ["observeSystem", "observeModel"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "observeModel",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeSystem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "observeSystem",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reactivateListItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return ($ctx2.supercall = true, globals.HLToolListWidget.superclass.fn.prototype._reactivateListItem_.apply(_st(self), [anItem]));
+$ctx2.supercall = false;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"reactivateListItem:",{anItem:anItem},globals.HLToolListWidget)})},
+args: ["anItem"],
+source: "reactivateListItem: anItem\x0a\x09self model withChangesDo: [ super reactivateListItem: anItem ]",
+messageSends: ["withChangesDo:", "model", "reactivateListItem:"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._renderHeadOn_(html);
+($ctx1.supercall = true, globals.HLToolListWidget.superclass.fn.prototype._renderContentOn_.apply(_st(self), [html]));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLToolListWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09self renderHeadOn: html.\x09\x0a\x09super renderContentOn: html",
+messageSends: ["renderHeadOn:", "renderContentOn:"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderHeadOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("list-label");
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(html)._with_(self._label());
+return self._renderMenuOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderHeadOn:",{html:html},globals.HLToolListWidget)})},
+args: ["html"],
+source: "renderHeadOn: html\x0a\x09html div \x0a\x09\x09class: 'list-label';\x0a\x09\x09with: [\x0a\x09\x09\x09html with: self label.\x0a\x09\x09\x09self renderMenuOn: html ]",
+messageSends: ["class:", "div", "with:", "label", "renderMenuOn:"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderMenuOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+var commands;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$5,$6,$8,$9,$7,$3;
+commands=self._menuCommands();
+$ctx1.sendIdx["menuCommands"]=1;
+$1=_st(commands)._isEmpty();
+if(smalltalk.assert($1)){
+return self;
+};
+$2=_st(html)._div();
+_st($2)._class_("btn-group cog");
+$ctx1.sendIdx["class:"]=1;
+$3=_st($2)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(html)._a();
+$ctx2.sendIdx["a"]=1;
+_st($4)._class_("btn dropdown-toggle");
+$ctx2.sendIdx["class:"]=2;
+_st($4)._at_put_("data-toggle","dropdown");
+$5=_st($4)._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(html)._tag_("i"))._class_("icon-chevron-down");
+$ctx3.sendIdx["class:"]=3;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+$ctx2.sendIdx["with:"]=2;
+$5;
+$6=_st(html)._ul();
+_st($6)._class_("dropdown-menu pull-right");
+$7=_st($6)._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._menuCommands())._do_((function(each){
+return smalltalk.withContext(function($ctx4) {
+return _st(_st(html)._li())._with_((function(){
+return smalltalk.withContext(function($ctx5) {
+$8=_st(html)._a();
+_st($8)._with_(_st(each)._menuLabel());
+$9=_st($8)._onClick_((function(){
+return smalltalk.withContext(function($ctx6) {
+return self._execute_(each);
+}, function($ctx6) {$ctx6.fillBlock({},$ctx5,7)})}));
+return $9;
+}, function($ctx5) {$ctx5.fillBlock({},$ctx4,6)})}));
+$ctx4.sendIdx["with:"]=4;
+}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,5)})}));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
+$ctx2.sendIdx["with:"]=3;
+return $7;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderMenuOn:",{html:html,commands:commands},globals.HLToolListWidget)})},
+args: ["html"],
+source: "renderMenuOn: html\x0a\x09| commands |\x0a\x09\x0a\x09commands := self menuCommands.\x0a\x09commands isEmpty ifTrue: [ ^ self ].\x0a\x09\x0a\x09html div \x0a\x09\x09class: 'btn-group cog';\x0a\x09\x09with: [\x0a\x09\x09\x09html a\x0a\x09\x09\x09\x09class: 'btn dropdown-toggle';\x0a\x09\x09\x09\x09at: 'data-toggle' put: 'dropdown';\x0a\x09\x09\x09\x09with: [ (html tag: 'i') class: 'icon-chevron-down' ].\x0a\x09\x09html ul \x0a\x09\x09\x09class: 'dropdown-menu pull-right';\x0a\x09\x09\x09with: [ \x0a\x09\x09\x09\x09self menuCommands do: [ :each | \x0a\x09\x09\x09\x09\x09html li with: [ html a \x0a\x09\x09\x09\x09\x09\x09with: each menuLabel;\x0a\x09\x09\x09\x09\x09\x09onClick: [ self execute: each ] ] ] ] ]",
+messageSends: ["menuCommands", "ifTrue:", "isEmpty", "class:", "div", "with:", "a", "at:put:", "tag:", "ul", "do:", "li", "menuLabel", "onClick:", "execute:"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedItem:",
+protocol: 'accessing',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLToolListWidget.superclass.fn.prototype._selectedItem_.apply(_st(self), [anItem]));
+$ctx1.supercall = false;
+self._updateMenu();
+return self}, function($ctx1) {$ctx1.fill(self,"selectedItem:",{anItem:anItem},globals.HLToolListWidget)})},
+args: ["anItem"],
+source: "selectedItem: anItem\x0a\x09\x22Selection changed, update the cog menu\x22\x0a\x09\x0a\x09super selectedItem: anItem.\x0a\x09self updateMenu",
+messageSends: ["selectedItem:", "updateMenu"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+($ctx1.supercall = true, globals.HLToolListWidget.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+$2=self._model();
+$ctx1.sendIdx["model"]=1;
+$1=_st($2)._announcer();
+_st($1)._unsubscribe_(self);
+$ctx1.sendIdx["unsubscribe:"]=1;
+_st(_st(self._model())._systemAnnouncer())._unsubscribe_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLToolListWidget)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x09\x0a\x09self model announcer unsubscribe: self.\x0a\x09self model systemAnnouncer unsubscribe: self",
+messageSends: ["unregister", "unsubscribe:", "announcer", "model", "systemAnnouncer"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "updateMenu",
+protocol: 'updating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self._wrapper();
+$ctx1.sendIdx["wrapper"]=1;
+$2=_st($3)._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+$1=_st($2)._find_(".cog");
+$ctx1.sendIdx["find:"]=1;
+_st($1)._remove();
+_st((function(html){
+return smalltalk.withContext(function($ctx2) {
+return self._renderMenuOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}))._appendToJQuery_(_st(_st(self._wrapper())._asJQuery())._find_(".list-label"));
+return self}, function($ctx1) {$ctx1.fill(self,"updateMenu",{},globals.HLToolListWidget)})},
+args: [],
+source: "updateMenu\x0a\x09(self wrapper asJQuery find: '.cog') remove.\x0a\x09\x0a\x09[ :html | self renderMenuOn: html ] \x0a\x09\x09appendToJQuery: (self wrapper asJQuery find: '.list-label')",
+messageSends: ["remove", "find:", "asJQuery", "wrapper", "appendToJQuery:", "renderMenuOn:"],
+referencedClasses: []
+}),
+globals.HLToolListWidget);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._model_(aModel);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aModel:aModel},globals.HLToolListWidget.klass)})},
+args: ["aModel"],
+source: "on: aModel\x0a\x09^ self new \x0a    \x09model: aModel;\x0a        yourself",
+messageSends: ["model:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLToolListWidget.klass);
+
+
+smalltalk.addClass('HLTabListWidget', globals.HLListWidget, ['callback'], 'Helios-Core');
+globals.HLTabListWidget.comment="I am a widget used to display a list of helios tabs.\x0a\x0aWhen a tab is selected, `callback` is evaluated with the selected tab as argument.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "callback",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@callback"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=(function(){
+});
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"callback",{},globals.HLTabListWidget)})},
+args: [],
+source: "callback\x0a\x09^ callback ifNil: [ [] ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLTabListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "callback:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@callback"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "callback: aBlock\x0a\x09callback := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItemLabel:on:",
+protocol: 'rendering',
+fn: function (aTab,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._span();
+_st($1)._class_(_st(aTab)._cssClass());
+$2=_st($1)._with_(_st(aTab)._label());
+return self}, function($ctx1) {$ctx1.fill(self,"renderItemLabel:on:",{aTab:aTab,html:html},globals.HLTabListWidget)})},
+args: ["aTab", "html"],
+source: "renderItemLabel: aTab on: html\x0a\x09html span\x0a\x09\x09class: aTab cssClass;\x0a\x09\x09with: aTab label",
+messageSends: ["class:", "span", "cssClass", "with:", "label"],
+referencedClasses: []
+}),
+globals.HLTabListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectItem:",
+protocol: 'actions',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLTabListWidget.superclass.fn.prototype._selectItem_.apply(_st(self), [aTab]));
+$ctx1.supercall = false;
+_st(self._callback())._value_(aTab);
+return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aTab:aTab},globals.HLTabListWidget)})},
+args: ["aTab"],
+source: "selectItem: aTab\x0a\x09super selectItem: aTab.\x0a\x09self callback value: aTab",
+messageSends: ["selectItem:", "value:", "callback"],
+referencedClasses: []
+}),
+globals.HLTabListWidget);
+
+
+
+smalltalk.addClass('HLInformationWidget', globals.HLWidget, ['informationString'], 'Helios-Core');
+globals.HLInformationWidget.comment="I display an information dialog.\x0a\x0a## API\x0a\x0a`HLWidget >> #inform:` is a convenience method for creating information dialogs.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "informationString",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@informationString"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"informationString",{},globals.HLInformationWidget)})},
+args: [],
+source: "informationString\x0a\x09^ informationString ifNil: [ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLInformationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "informationString:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@informationString"]=anObject;
+return self},
+args: ["anObject"],
+source: "informationString: anObject\x0a\x09informationString := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInformationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=self._wrapper();
+$ctx2.sendIdx["wrapper"]=1;
+$1=_st($2)._asJQuery();
+$ctx2.sendIdx["asJQuery"]=1;
+_st($1)._fadeOut_((100));
+return _st((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(self._wrapper())._asJQuery())._remove();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((400));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithTimeout_((1500));
+$ctx1.sendIdx["valueWithTimeout:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.HLInformationWidget)})},
+args: [],
+source: "remove\x0a\x09[ \x0a\x09\x09self wrapper asJQuery fadeOut: 100.\x0a\x09\x09[ self wrapper asJQuery remove ]\x0a\x09\x09\x09valueWithTimeout: 400.\x0a\x09]\x0a\x09\x09valueWithTimeout: 1500",
+messageSends: ["valueWithTimeout:", "fadeOut:", "asJQuery", "wrapper", "remove"],
+referencedClasses: []
+}),
+globals.HLInformationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("growl");
+$2=_st($1)._with_(self._informationString());
+self._remove();
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLInformationWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html div \x0a\x09\x09class: 'growl'; \x0a\x09\x09with: self informationString.\x0a\x09\x09\x0a\x09self remove",
+messageSends: ["class:", "div", "with:", "informationString", "remove"],
+referencedClasses: []
+}),
+globals.HLInformationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "show",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._appendToJQuery_("body"._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"show",{},globals.HLInformationWidget)})},
+args: [],
+source: "show\x0a\x09self appendToJQuery: 'body' asJQuery",
+messageSends: ["appendToJQuery:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLInformationWidget);
+
+
+
+smalltalk.addClass('HLManager', globals.HLWidget, ['tabsWidget', 'environment', 'history', 'announcer'], 'Helios-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activate:",
+protocol: 'actions',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._tabsWidget())._activate_(aTab);
+return self}, function($ctx1) {$ctx1.fill(self,"activate:",{aTab:aTab},globals.HLManager)})},
+args: ["aTab"],
+source: "activate: aTab\x0a\x09self tabsWidget activate: aTab",
+messageSends: ["activate:", "tabsWidget"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activeTab",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._tabsWidget())._activeTab();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"activeTab",{},globals.HLManager)})},
+args: [],
+source: "activeTab\x0a\x09^ self tabsWidget activeTab",
+messageSends: ["activeTab", "tabsWidget"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addTab:",
+protocol: 'actions',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._tabsWidget())._addTab_(aTab);
+return self}, function($ctx1) {$ctx1.fill(self,"addTab:",{aTab:aTab},globals.HLManager)})},
+args: ["aTab"],
+source: "addTab: aTab\x0a\x09self tabsWidget addTab: aTab",
+messageSends: ["addTab:", "tabsWidget"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announcer",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@announcer"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@announcer"]=_st($Announcer())._new();
+$1=self["@announcer"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.HLManager)})},
+args: [],
+source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Announcer"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm:ifFalse:",
+protocol: 'actions',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._confirm_ifTrue_ifFalse_(aString,(function(){
+}),aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"confirm:ifFalse:",{aString:aString,aBlock:aBlock},globals.HLManager)})},
+args: ["aString", "aBlock"],
+source: "confirm: aString ifFalse: aBlock\x0a\x09self \x0a\x09\x09confirm: aString\x0a\x09\x09ifTrue: []\x0a\x09\x09ifFalse: aBlock",
+messageSends: ["confirm:ifTrue:ifFalse:"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm:ifTrue:",
+protocol: 'actions',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._confirm_ifTrue_ifFalse_(aString,aBlock,(function(){
+}));
+return self}, function($ctx1) {$ctx1.fill(self,"confirm:ifTrue:",{aString:aString,aBlock:aBlock},globals.HLManager)})},
+args: ["aString", "aBlock"],
+source: "confirm: aString ifTrue: aBlock\x0a\x09self \x0a\x09\x09confirm: aString\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: []",
+messageSends: ["confirm:ifTrue:ifFalse:"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm:ifTrue:ifFalse:",
+protocol: 'actions',
+fn: function (aString,aBlock,anotherBlock){
+var self=this;
+function $HLConfirmationWidget(){return globals.HLConfirmationWidget||(typeof HLConfirmationWidget=="undefined"?nil:HLConfirmationWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLConfirmationWidget())._new();
+_st($1)._confirmationString_(aString);
+_st($1)._actionBlock_(aBlock);
+_st($1)._cancelBlock_(anotherBlock);
+$2=_st($1)._show();
+return self}, function($ctx1) {$ctx1.fill(self,"confirm:ifTrue:ifFalse:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.HLManager)})},
+args: ["aString", "aBlock", "anotherBlock"],
+source: "confirm: aString ifTrue: aBlock ifFalse: anotherBlock\x0a\x09HLConfirmationWidget new\x0a\x09\x09confirmationString: aString;\x0a\x09\x09actionBlock: aBlock;\x0a\x09\x09cancelBlock: anotherBlock;\x0a\x09\x09show",
+messageSends: ["confirmationString:", "new", "actionBlock:", "cancelBlock:", "show"],
+referencedClasses: ["HLConfirmationWidget"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultEnvironment",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+var parent,parentSmalltalkGlobals;
+function $Environment(){return globals.Environment||(typeof Environment=="undefined"?nil:Environment)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$6,$7,$receiver;
+$1=_st(window)._opener();
+if(($receiver = $1) == null || $receiver.isNil){
+parent=_st(window)._parent();
+} else {
+parent=$1;
+};
+$2=parent;
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($Environment())._new();
+$ctx1.sendIdx["new"]=1;
+return $3;
+} else {
+$2;
+};
+$4=_st(parent)._at_("requirejs");
+$ctx1.sendIdx["at:"]=1;
+parentSmalltalkGlobals=_st($4)._value_("amber_vm/globals");
+$5=parentSmalltalkGlobals;
+if(($receiver = $5) == null || $receiver.isNil){
+$6=_st($Environment())._new();
+$ctx1.sendIdx["new"]=2;
+return $6;
+} else {
+$5;
+};
+$7=_st(_st(parentSmalltalkGlobals)._at_("Environment"))._new();
+return $7;
+}, function($ctx1) {$ctx1.fill(self,"defaultEnvironment",{parent:parent,parentSmalltalkGlobals:parentSmalltalkGlobals},globals.HLManager)})},
+args: [],
+source: "defaultEnvironment\x0a\x09\x22If helios is loaded from within a frame, answer the parent window environment\x22\x0a\x09\x0a\x09| parent parentSmalltalkGlobals |\x0a\x09\x0a\x09parent := window opener ifNil: [ window parent ].\x0a\x09parent ifNil: [ ^ Environment new ].\x0a\x09\x0a\x09parentSmalltalkGlobals := (parent at: 'requirejs') value: 'amber_vm/globals'.\x0a\x09parentSmalltalkGlobals ifNil: [ ^ Environment new ].\x0a\x09\x0a\x09^ (parentSmalltalkGlobals at: 'Environment') new",
+messageSends: ["ifNil:", "opener", "parent", "new", "value:", "at:"],
+referencedClasses: ["Environment"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "environment",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@environment"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@environment"]=self._defaultEnvironment();
+$1=self["@environment"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"environment",{},globals.HLManager)})},
+args: [],
+source: "environment\x0a\x09\x22The default environment used by all Helios objects\x22\x0a    \x0a\x09^ environment ifNil: [ environment := self defaultEnvironment ]",
+messageSends: ["ifNil:", "defaultEnvironment"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "environment:",
+protocol: 'accessing',
+fn: function (anEnvironment){
+var self=this;
+self["@environment"]=anEnvironment;
+return self},
+args: ["anEnvironment"],
+source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "history",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@history"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@history"]=_st($OrderedCollection())._new();
+$1=self["@history"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"history",{},globals.HLManager)})},
+args: [],
+source: "history\x0a\x09^ history ifNil: [ history := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "history:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@history"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "history: aCollection\x0a\x09history := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inform:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $HLInformationWidget(){return globals.HLInformationWidget||(typeof HLInformationWidget=="undefined"?nil:HLInformationWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLInformationWidget())._new();
+_st($1)._informationString_(aString);
+$2=_st($1)._show();
+return self}, function($ctx1) {$ctx1.fill(self,"inform:",{aString:aString},globals.HLManager)})},
+args: ["aString"],
+source: "inform: aString\x0a\x09HLInformationWidget new\x0a\x09\x09informationString: aString;\x0a\x09\x09show",
+messageSends: ["informationString:", "new", "show"],
+referencedClasses: ["HLInformationWidget"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyBinder",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLKeyBinder(){return globals.HLKeyBinder||(typeof HLKeyBinder=="undefined"?nil:HLKeyBinder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLKeyBinder())._current();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"keyBinder",{},globals.HLManager)})},
+args: [],
+source: "keyBinder\x0a\x09^ HLKeyBinder current",
+messageSends: ["current"],
+referencedClasses: ["HLKeyBinder"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerErrorHandler",
+protocol: 'services',
+fn: function (){
+var self=this;
+function $HLErrorHandler(){return globals.HLErrorHandler||(typeof HLErrorHandler=="undefined"?nil:HLErrorHandler)}
+function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._environment();
+$2=_st($HLErrorHandler())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._registerErrorHandler_($2);
+_st($ErrorHandler())._register_(_st($HLErrorHandler())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler",{},globals.HLManager)})},
+args: [],
+source: "registerErrorHandler\x0a\x09self environment registerErrorHandler: HLErrorHandler new.\x0a\x09ErrorHandler register: HLErrorHandler new",
+messageSends: ["registerErrorHandler:", "environment", "new", "register:"],
+referencedClasses: ["HLErrorHandler", "ErrorHandler"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerFinder",
+protocol: 'services',
+fn: function (){
+var self=this;
+function $HLFinder(){return globals.HLFinder||(typeof HLFinder=="undefined"?nil:HLFinder)}
+function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._environment();
+$2=_st($HLFinder())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._registerFinder_($2);
+_st($Finder())._register_(_st($HLFinder())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"registerFinder",{},globals.HLManager)})},
+args: [],
+source: "registerFinder\x0a\x09self environment registerFinder: HLFinder new.\x0a\x09Finder register: HLFinder new",
+messageSends: ["registerFinder:", "environment", "new", "register:"],
+referencedClasses: ["HLFinder", "Finder"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerInspector",
+protocol: 'services',
+fn: function (){
+var self=this;
+function $HLInspector(){return globals.HLInspector||(typeof HLInspector=="undefined"?nil:HLInspector)}
+function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._environment())._registerInspector_($HLInspector());
+_st($Inspector())._register_($HLInspector());
+return self}, function($ctx1) {$ctx1.fill(self,"registerInspector",{},globals.HLManager)})},
+args: [],
+source: "registerInspector\x0a\x09self environment registerInspector: HLInspector.\x0a\x09Inspector register: HLInspector",
+messageSends: ["registerInspector:", "environment", "register:"],
+referencedClasses: ["HLInspector", "Inspector"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerProgressHandler",
+protocol: 'services',
+fn: function (){
+var self=this;
+function $HLProgressHandler(){return globals.HLProgressHandler||(typeof HLProgressHandler=="undefined"?nil:HLProgressHandler)}
+function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._environment();
+$2=_st($HLProgressHandler())._new();
+$ctx1.sendIdx["new"]=1;
+_st($1)._registerProgressHandler_($2);
+_st($ProgressHandler())._register_(_st($HLProgressHandler())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler",{},globals.HLManager)})},
+args: [],
+source: "registerProgressHandler\x0a\x09self environment registerProgressHandler: HLProgressHandler new.\x0a\x09ProgressHandler register: HLProgressHandler new",
+messageSends: ["registerProgressHandler:", "environment", "new", "register:"],
+referencedClasses: ["HLProgressHandler", "ProgressHandler"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerServices",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._registerInspector();
+self._registerErrorHandler();
+self._registerProgressHandler();
+self._registerTranscript();
+$1=self._registerFinder();
+return self}, function($ctx1) {$ctx1.fill(self,"registerServices",{},globals.HLManager)})},
+args: [],
+source: "registerServices\x0a\x09self\x0a\x09\x09registerInspector;\x0a\x09\x09registerErrorHandler;\x0a\x09\x09registerProgressHandler;\x0a\x09\x09registerTranscript;\x0a\x09\x09registerFinder",
+messageSends: ["registerInspector", "registerErrorHandler", "registerProgressHandler", "registerTranscript", "registerFinder"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerTranscript",
+protocol: 'services',
+fn: function (){
+var self=this;
+function $HLTranscriptHandler(){return globals.HLTranscriptHandler||(typeof HLTranscriptHandler=="undefined"?nil:HLTranscriptHandler)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._environment())._registerTranscript_($HLTranscriptHandler());
+return self}, function($ctx1) {$ctx1.fill(self,"registerTranscript",{},globals.HLManager)})},
+args: [],
+source: "registerTranscript\x0a\x09self environment registerTranscript: HLTranscriptHandler",
+messageSends: ["registerTranscript:", "environment"],
+referencedClasses: ["HLTranscriptHandler"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeActiveTab",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._tabsWidget())._removeActiveTab();
+return self}, function($ctx1) {$ctx1.fill(self,"removeActiveTab",{},globals.HLManager)})},
+args: [],
+source: "removeActiveTab\x0a\x09self tabsWidget removeActiveTab",
+messageSends: ["removeActiveTab", "tabsWidget"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeTabForWidget:",
+protocol: 'actions',
+fn: function (aWidget){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._tabsWidget())._removeTabForWidget_(aWidget);
+return self}, function($ctx1) {$ctx1.fill(self,"removeTabForWidget:",{aWidget:aWidget},globals.HLManager)})},
+args: ["aWidget"],
+source: "removeTabForWidget: aWidget\x0a\x09self tabsWidget removeTabForWidget: aWidget",
+messageSends: ["removeTabForWidget:", "tabsWidget"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $HLWelcomeWidget(){return globals.HLWelcomeWidget||(typeof HLWelcomeWidget=="undefined"?nil:HLWelcomeWidget)}
+return smalltalk.withContext(function($ctx1) { 
+_st(html)._with_(self._tabsWidget());
+$ctx1.sendIdx["with:"]=1;
+_st(html)._with_(_st($HLWelcomeWidget())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLManager)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html with: self tabsWidget.\x0a\x09html with: HLWelcomeWidget new",
+messageSends: ["with:", "tabsWidget", "new"],
+referencedClasses: ["HLWelcomeWidget"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "request:do:",
+protocol: 'actions',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._request_value_do_(aString,"",aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"request:do:",{aString:aString,aBlock:aBlock},globals.HLManager)})},
+args: ["aString", "aBlock"],
+source: "request: aString do: aBlock\x0a\x09self \x0a\x09\x09request: aString\x0a\x09\x09value: ''\x0a\x09\x09do: aBlock",
+messageSends: ["request:value:do:"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "request:value:do:",
+protocol: 'actions',
+fn: function (aString,valueString,aBlock){
+var self=this;
+function $HLRequestWidget(){return globals.HLRequestWidget||(typeof HLRequestWidget=="undefined"?nil:HLRequestWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLRequestWidget())._new();
+_st($1)._confirmationString_(aString);
+_st($1)._actionBlock_(aBlock);
+_st($1)._value_(valueString);
+$2=_st($1)._show();
+return self}, function($ctx1) {$ctx1.fill(self,"request:value:do:",{aString:aString,valueString:valueString,aBlock:aBlock},globals.HLManager)})},
+args: ["aString", "valueString", "aBlock"],
+source: "request: aString value: valueString do: aBlock\x0a\x09HLRequestWidget new\x0a\x09\x09confirmationString: aString;\x0a\x09\x09actionBlock: aBlock;\x0a\x09\x09value: valueString;\x0a\x09\x09show",
+messageSends: ["confirmationString:", "new", "actionBlock:", "value:", "show"],
+referencedClasses: ["HLRequestWidget"]
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setEditorTheme:",
+protocol: 'accessing',
+fn: function (aTheme){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st("helios.editorTheme"._asSetting())._value_(aTheme);
+return self}, function($ctx1) {$ctx1.fill(self,"setEditorTheme:",{aTheme:aTheme},globals.HLManager)})},
+args: ["aTheme"],
+source: "setEditorTheme: aTheme\x0a\x0a\x09'helios.editorTheme' asSetting value: aTheme",
+messageSends: ["value:", "asSetting"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setTheme:",
+protocol: 'accessing',
+fn: function (aTheme){
+var self=this;
+var currentTheme;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+currentTheme="helios.theme"._asSettingIfAbsent_("default");
+$1="body"._asJQuery();
+_st($1)._removeClass_(_st(currentTheme)._value());
+$2=_st($1)._addClass_(aTheme);
+_st("helios.theme"._asSetting())._value_(aTheme);
+return self}, function($ctx1) {$ctx1.fill(self,"setTheme:",{aTheme:aTheme,currentTheme:currentTheme},globals.HLManager)})},
+args: ["aTheme"],
+source: "setTheme: aTheme\x0a\x09| currentTheme |\x0a\x0a\x09currentTheme := 'helios.theme' asSettingIfAbsent: 'default'.\x0a\x09\x0a\x09'body' asJQuery\x0a\x09\x09removeClass: currentTheme value;\x0a\x09\x09addClass: aTheme.\x0a\x09\x09\x0a\x09\x0a\x09'helios.theme' asSetting value: aTheme",
+messageSends: ["asSettingIfAbsent:", "removeClass:", "asJQuery", "value", "addClass:", "value:", "asSetting"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setup",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._registerServices();
+$1=self._setupEvents();
+$ctx1.sendIdx["setupEvents"]=1;
+_st(self._keyBinder())._setupEvents();
+$ctx1.sendIdx["setupEvents"]=2;
+_st(self._tabsWidget())._setupEvents();
+self._setupTheme();
+_st("#helper"._asJQuery())._fadeOut();
+return self}, function($ctx1) {$ctx1.fill(self,"setup",{},globals.HLManager)})},
+args: [],
+source: "setup\x0a\x09self \x0a\x09\x09registerServices;\x0a\x09\x09setupEvents.\x0a    self keyBinder setupEvents.\x0a\x09self tabsWidget setupEvents.\x0a\x09self setupTheme.\x0a\x09\x0a\x09\x0a\x09'#helper' asJQuery fadeOut",
+messageSends: ["registerServices", "setupEvents", "keyBinder", "tabsWidget", "setupTheme", "fadeOut", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupEvents",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5;
+$1="body"._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($1)._keydown_((function(event){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(event)._ctrlKey();
+if(smalltalk.assert($2)){
+$3="body"._asJQuery();
+$ctx2.sendIdx["asJQuery"]=2;
+return _st($3)._addClass_("navigation");
+};
+}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,1)})}));
+$4="body"._asJQuery();
+$ctx1.sendIdx["asJQuery"]=3;
+_st($4)._keyup_((function(event){
+return smalltalk.withContext(function($ctx2) {
+$5="body"._asJQuery();
+$ctx2.sendIdx["asJQuery"]=4;
+return _st($5)._removeClass_("navigation");
+}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,3)})}));
+_st(_st(window)._asJQuery())._resize_((function(event){
+return smalltalk.withContext(function($ctx2) {
+return self._refresh();
+}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,4)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{},globals.HLManager)})},
+args: [],
+source: "setupEvents\x0a\x09'body' asJQuery keydown: [ :event |\x0a\x09\x09\x09\x0a\x09\x09\x22On ctrl keydown, adds a 'navigation' css class to <body>\x0a\x09\x09for the CodeMirror navigation links. See `HLCodeWidget`.\x22\x0a\x09\x09event ctrlKey ifTrue: [\x0a\x09\x09\x09'body' asJQuery addClass: 'navigation' ] ].\x0a\x09\x09\x09\x0a\x09'body' asJQuery keyup: [ :event |\x0a\x09\x09'body' asJQuery removeClass: 'navigation' ].\x0a\x09\x09\x0a\x09window asJQuery resize: [ :event |\x0a\x09\x09self refresh ]",
+messageSends: ["keydown:", "asJQuery", "ifTrue:", "ctrlKey", "addClass:", "keyup:", "removeClass:", "resize:", "refresh"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupTheme",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._setTheme_("default");
+$1=self._setEditorTheme_("default");
+return self}, function($ctx1) {$ctx1.fill(self,"setupTheme",{},globals.HLManager)})},
+args: [],
+source: "setupTheme\x0a\x09\x22self \x0a\x09\x09setTheme: 'niflheim';\x0a\x09\x09setEditorTheme: 'niflheim'.\x22\x0a\x09\x09\x0a\x09self \x0a\x09\x09setTheme: 'default';\x0a\x09\x09setEditorTheme: 'default'.",
+messageSends: ["setTheme:", "setEditorTheme:"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabWidth",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(_st(window)._asJQuery())._width()).__minus((90))).__slash(_st(self._tabs())._size());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tabWidth",{},globals.HLManager)})},
+args: [],
+source: "tabWidth\x0a\x09^ (window asJQuery width - 90) / self tabs size",
+messageSends: ["/", "-", "width", "asJQuery", "size", "tabs"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabs",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._tabsWidget())._tabs();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tabs",{},globals.HLManager)})},
+args: [],
+source: "tabs\x0a\x09^ self tabsWidget tabs",
+messageSends: ["tabs", "tabsWidget"],
+referencedClasses: []
+}),
+globals.HLManager);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabsWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLTabsWidget(){return globals.HLTabsWidget||(typeof HLTabsWidget=="undefined"?nil:HLTabsWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@tabsWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@tabsWidget"]=_st($HLTabsWidget())._new();
+$1=self["@tabsWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tabsWidget",{},globals.HLManager)})},
+args: [],
+source: "tabsWidget\x0a\x09^ tabsWidget ifNil: [ tabsWidget := HLTabsWidget new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HLTabsWidget"]
+}),
+globals.HLManager);
+
+
+globals.HLManager.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "current",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@current"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@current"]=_st(self._basicNew())._initialize();
+$1=self["@current"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"current",{},globals.HLManager.klass)})},
+args: [],
+source: "current\x0a\x09^ current ifNil: [ current := self basicNew initialize ]",
+messageSends: ["ifNil:", "initialize", "basicNew"],
+referencedClasses: []
+}),
+globals.HLManager.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._shouldNotImplement();
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.HLManager.klass)})},
+args: [],
+source: "new\x0a\x09\x22Use current instead\x22\x0a\x0a\x09self shouldNotImplement",
+messageSends: ["shouldNotImplement"],
+referencedClasses: []
+}),
+globals.HLManager.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setup",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._current();
+_st($1)._setup();
+$2=_st($1)._appendToJQuery_("body"._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"setup",{},globals.HLManager.klass)})},
+args: [],
+source: "setup\x0a\x09self current \x0a\x09\x09setup;\x0a\x09\x09appendToJQuery: 'body' asJQuery",
+messageSends: ["setup", "current", "appendToJQuery:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLManager.klass);
+
+
+smalltalk.addClass('HLModalWidget', globals.HLWidget, [], 'Helios-Core');
+globals.HLModalWidget.comment="I implement an abstract modal widget.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "giveFocusToButton:",
+protocol: 'private',
+fn: function (aButton){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(aButton)._asJQuery())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"giveFocusToButton:",{aButton:aButton},globals.HLModalWidget)})},
+args: ["aButton"],
+source: "giveFocusToButton: aButton\x0a\x09aButton asJQuery focus",
+messageSends: ["focus", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLModalWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hasButtons",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "hasButtons\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLModalWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=".dialog"._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($1)._removeClass_("active");
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+$2="#overlay"._asJQuery();
+$ctx2.sendIdx["asJQuery"]=2;
+_st($2)._remove();
+$ctx2.sendIdx["remove"]=1;
+return _st(_st(self["@wrapper"])._asJQuery())._remove();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithTimeout_((300));
+return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.HLModalWidget)})},
+args: [],
+source: "remove\x0a\x09'.dialog' asJQuery removeClass: 'active'.\x0a\x09[ \x0a\x09\x09'#overlay' asJQuery remove.\x0a\x09\x09wrapper asJQuery remove\x0a\x09] valueWithTimeout: 300",
+messageSends: ["removeClass:", "asJQuery", "valueWithTimeout:", "remove"],
+referencedClasses: []
+}),
+globals.HLModalWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return self},
+args: ["html"],
+source: "renderButtonsOn: html",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLModalWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+var confirmButton;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3;
+$1=_st(html)._div();
+$ctx1.sendIdx["div"]=1;
+_st($1)._id_("overlay");
+$2=_st(html)._div();
+_st($2)._class_("dialog ".__comma(self._cssClass()));
+$3=_st($2)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+self._renderMainOn_(html);
+$4=self._hasButtons();
+if(smalltalk.assert($4)){
+return self._renderButtonsOn_(html);
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+_st(".dialog"._asJQuery())._addClass_("active");
+self._setupKeyBindings();
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html,confirmButton:confirmButton},globals.HLModalWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09| confirmButton |\x0a\x09\x0a\x09html div id: 'overlay'.\x0a\x09\x0a\x09html div \x0a\x09\x09class: 'dialog ', self cssClass;\x0a\x09\x09with: [\x0a\x09\x09\x09self renderMainOn: html.\x0a\x09\x09\x09self hasButtons ifTrue: [ \x0a\x09\x09\x09\x09self renderButtonsOn: html ] ].\x0a\x0a\x09'.dialog' asJQuery addClass: 'active'.\x0a\x09self setupKeyBindings",
+messageSends: ["id:", "div", "class:", ",", "cssClass", "with:", "renderMainOn:", "ifTrue:", "hasButtons", "renderButtonsOn:", "addClass:", "asJQuery", "setupKeyBindings"],
+referencedClasses: []
+}),
+globals.HLModalWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderMainOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return self},
+args: ["html"],
+source: "renderMainOn: html",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLModalWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupKeyBindings",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(".dialog"._asJQuery())._keyup_((function(e){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(_st(e)._keyCode()).__eq(_st(_st($String())._esc())._asciiValue());
+if(smalltalk.assert($1)){
+return self._cancel();
+};
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"setupKeyBindings",{},globals.HLModalWidget)})},
+args: [],
+source: "setupKeyBindings\x0a\x09'.dialog' asJQuery keyup: [ :e |\x0a\x09\x09e keyCode = String esc asciiValue ifTrue: [ self cancel ] ]",
+messageSends: ["keyup:", "asJQuery", "ifTrue:", "=", "keyCode", "asciiValue", "esc", "cancel"],
+referencedClasses: ["String"]
+}),
+globals.HLModalWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "show",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._appendToJQuery_("body"._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"show",{},globals.HLModalWidget)})},
+args: [],
+source: "show\x0a\x09self appendToJQuery: 'body' asJQuery",
+messageSends: ["appendToJQuery:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLModalWidget);
+
+
+
+smalltalk.addClass('HLConfirmationWidget', globals.HLModalWidget, ['cancelButtonLabel', 'confirmButtonLabel', 'confirmationString', 'actionBlock', 'cancelBlock'], 'Helios-Core');
+globals.HLConfirmationWidget.comment="I display confirmation dialog. \x0a\x0a## API\x0a\x0aHLWidget contains convenience methods like `HLWidget >> #confirm:ifTrue:` for creating confirmation dialogs.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "actionBlock",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@actionBlock"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=(function(){
+});
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"actionBlock",{},globals.HLConfirmationWidget)})},
+args: [],
+source: "actionBlock\x0a\x09^ actionBlock ifNil: [ [] ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "actionBlock:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@actionBlock"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "actionBlock: aBlock\x0a\x09actionBlock := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cancel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._cancelBlock())._value();
+self._remove();
+return self}, function($ctx1) {$ctx1.fill(self,"cancel",{},globals.HLConfirmationWidget)})},
+args: [],
+source: "cancel\x0a\x09self cancelBlock value.\x0a\x09self remove",
+messageSends: ["value", "cancelBlock", "remove"],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cancelBlock",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@cancelBlock"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=(function(){
+});
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cancelBlock",{},globals.HLConfirmationWidget)})},
+args: [],
+source: "cancelBlock\x0a\x09^ cancelBlock ifNil: [ [] ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cancelBlock:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@cancelBlock"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "cancelBlock: aBlock\x0a\x09cancelBlock := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cancelButtonLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@cancelButtonLabel"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="Cancel";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cancelButtonLabel",{},globals.HLConfirmationWidget)})},
+args: [],
+source: "cancelButtonLabel\x0a\x09^ cancelButtonLabel ifNil: [ 'Cancel' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cancelButtonLabel:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+var $1;
+self["@cancelButtonLabel"]=aString;
+$1=self["@cancelButtonLabel"];
+return $1;
+},
+args: ["aString"],
+source: "cancelButtonLabel: aString\x0a\x09^ cancelButtonLabel := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._remove();
+_st(self._actionBlock())._value();
+return self}, function($ctx1) {$ctx1.fill(self,"confirm",{},globals.HLConfirmationWidget)})},
+args: [],
+source: "confirm\x0a\x09self remove.\x0a\x09self actionBlock value",
+messageSends: ["remove", "value", "actionBlock"],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirmButtonLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@confirmButtonLabel"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="Confirm";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"confirmButtonLabel",{},globals.HLConfirmationWidget)})},
+args: [],
+source: "confirmButtonLabel\x0a\x09^ confirmButtonLabel ifNil: [ 'Confirm' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirmButtonLabel:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+var $1;
+self["@confirmButtonLabel"]=aString;
+$1=self["@confirmButtonLabel"];
+return $1;
+},
+args: ["aString"],
+source: "confirmButtonLabel: aString\x0a\x09^ confirmButtonLabel := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirmationString",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@confirmationString"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="Confirm";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"confirmationString",{},globals.HLConfirmationWidget)})},
+args: [],
+source: "confirmationString\x0a\x09^ confirmationString ifNil: [ 'Confirm' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirmationString:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@confirmationString"]=aString;
+return self},
+args: ["aString"],
+source: "confirmationString: aString\x0a\x09confirmationString := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+var confirmButton;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$5,$6,$2;
+$1=_st(html)._div();
+_st($1)._class_("buttons");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._button();
+$ctx2.sendIdx["button"]=1;
+_st($3)._class_("button");
+$ctx2.sendIdx["class:"]=2;
+_st($3)._with_(self._cancelButtonLabel());
+$ctx2.sendIdx["with:"]=2;
+$4=_st($3)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._cancel();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["onClick:"]=1;
+$4;
+$5=_st(html)._button();
+_st($5)._class_("button default");
+_st($5)._with_(self._confirmButtonLabel());
+$6=_st($5)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._confirm();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+confirmButton=$6;
+return confirmButton;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+self._giveFocusToButton_(confirmButton);
+return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html,confirmButton:confirmButton},globals.HLConfirmationWidget)})},
+args: ["html"],
+source: "renderButtonsOn: html\x0a\x09| confirmButton |\x0a\x09\x0a\x09html div \x0a\x09\x09class: 'buttons';\x0a\x09\x09with: [\x0a\x09\x09\x09html button\x0a\x09\x09\x09\x09class: 'button';\x0a\x09\x09\x09\x09with: self cancelButtonLabel;\x0a\x09\x09\x09\x09onClick: [ self cancel ].\x0a\x09\x09\x09confirmButton := html button\x0a\x09\x09\x09\x09class: 'button default';\x0a\x09\x09\x09\x09with: self confirmButtonLabel;\x0a\x09\x09\x09\x09onClick: [ self confirm ] ].\x0a\x0a\x09self giveFocusToButton:confirmButton",
+messageSends: ["class:", "div", "with:", "button", "cancelButtonLabel", "onClick:", "cancel", "confirmButtonLabel", "confirm", "giveFocusToButton:"],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderMainOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._span();
+_st($1)._class_("head");
+$2=_st($1)._with_(self._confirmationString());
+return self}, function($ctx1) {$ctx1.fill(self,"renderMainOn:",{html:html},globals.HLConfirmationWidget)})},
+args: ["html"],
+source: "renderMainOn: html\x0a\x09html span \x0a\x09\x09class: 'head'; \x0a\x09\x09with: self confirmationString",
+messageSends: ["class:", "span", "with:", "confirmationString"],
+referencedClasses: []
+}),
+globals.HLConfirmationWidget);
+
+
+
+smalltalk.addClass('HLRequestWidget', globals.HLConfirmationWidget, ['input', 'multiline', 'value'], 'Helios-Core');
+globals.HLRequestWidget.comment="I display a modal window requesting user input.\x0a\x0a## API\x0a\x0a`HLWidget >> #request:do:` and `#request:value:do:` are convenience methods for creating modal request dialogs.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "beMultiline",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+self["@multiline"]=true;
+return self},
+args: [],
+source: "beMultiline\x0a\x09multiline := true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRequestWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "beSingleline",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+self["@multiline"]=false;
+return self},
+args: [],
+source: "beSingleline\x0a\x09multiline := false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRequestWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm",
+protocol: 'actions',
+fn: function (){
+var self=this;
+var val;
+return smalltalk.withContext(function($ctx1) { 
+val=_st(_st(self["@input"])._asJQuery())._val();
+self._remove();
+_st(self._actionBlock())._value_(val);
+return self}, function($ctx1) {$ctx1.fill(self,"confirm",{val:val},globals.HLRequestWidget)})},
+args: [],
+source: "confirm\x0a\x09| val |\x0a\x09val := input asJQuery val.\x0a\x09self remove.\x0a\x09self actionBlock value: val",
+messageSends: ["val", "asJQuery", "remove", "value:", "actionBlock"],
+referencedClasses: []
+}),
+globals.HLRequestWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "large";
+},
+args: [],
+source: "cssClass\x0a\x09^ 'large'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRequestWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "giveFocusToButton:",
+protocol: 'private',
+fn: function (aButton){
+var self=this;
+return self},
+args: ["aButton"],
+source: "giveFocusToButton: aButton",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRequestWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isMultiline",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@multiline"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=true;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isMultiline",{},globals.HLRequestWidget)})},
+args: [],
+source: "isMultiline\x0a\x09^ multiline ifNil: [ true ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLRequestWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderMainOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$6;
+($ctx1.supercall = true, globals.HLRequestWidget.superclass.fn.prototype._renderMainOn_.apply(_st(self), [html]));
+$ctx1.supercall = false;
+$1=self._isMultiline();
+if(smalltalk.assert($1)){
+self["@input"]=_st(html)._textarea();
+self["@input"];
+} else {
+$2=_st(html)._input();
+_st($2)._type_("text");
+_st($2)._onKeyDown_((function(event){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(_st(event)._keyCode()).__eq((13));
+if(smalltalk.assert($3)){
+return self._confirm();
+};
+}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,3)})}));
+$4=_st($2)._yourself();
+self["@input"]=$4;
+self["@input"];
+};
+$5=_st(self["@input"])._asJQuery();
+_st($5)._val_(self._value());
+$6=_st($5)._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"renderMainOn:",{html:html},globals.HLRequestWidget)})},
+args: ["html"],
+source: "renderMainOn: html\x0a\x09super renderMainOn: html.\x0a\x09self isMultiline\x0a\x09\x09ifTrue: [ input := html textarea ]\x0a\x09\x09ifFalse: [ input := html input \x0a\x09\x09\x09type: 'text';\x0a\x09\x09\x09onKeyDown: [ :event |\x0a\x09\x09\x09\x09event keyCode = 13 ifTrue: [\x0a\x09\x09\x09\x09\x09self confirm ] ];\x0a\x09\x09\x09yourself ].\x0a\x09input asJQuery \x0a\x09\x09val: self value;\x0a\x09\x09focus",
+messageSends: ["renderMainOn:", "ifTrue:ifFalse:", "isMultiline", "textarea", "type:", "input", "onKeyDown:", "ifTrue:", "=", "keyCode", "confirm", "yourself", "val:", "asJQuery", "value", "focus"],
+referencedClasses: []
+}),
+globals.HLRequestWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@value"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value",{},globals.HLRequestWidget)})},
+args: [],
+source: "value\x0a\x09^ value ifNil: [ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLRequestWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@value"]=aString;
+return self},
+args: ["aString"],
+source: "value: aString\x0a\x09value := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRequestWidget);
+
+
+
+smalltalk.addClass('HLProgressWidget', globals.HLModalWidget, ['progressBars', 'visible'], 'Helios-Core');
+globals.HLProgressWidget.comment="I am a widget used to display progress modal dialogs.\x0a\x0aMy default instance is accessed with `HLProgressWidget class >> #default`.\x0a\x0aSee `HLProgressHandler` for usage.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addProgressBar:",
+protocol: 'actions',
+fn: function (aProgressBar){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._show();
+_st(self._progressBars())._add_(aProgressBar);
+_st(aProgressBar)._appendToJQuery_(_st(_st(self._wrapper())._asJQuery())._find_(".dialog"));
+return self}, function($ctx1) {$ctx1.fill(self,"addProgressBar:",{aProgressBar:aProgressBar},globals.HLProgressWidget)})},
+args: ["aProgressBar"],
+source: "addProgressBar: aProgressBar\x0a\x09self show.\x0a\x09self progressBars add: aProgressBar.\x0a\x09aProgressBar appendToJQuery: (self wrapper asJQuery find: '.dialog')",
+messageSends: ["show", "add:", "progressBars", "appendToJQuery:", "find:", "asJQuery", "wrapper"],
+referencedClasses: []
+}),
+globals.HLProgressWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:on:displaying:",
+protocol: 'actions',
+fn: function (aBlock,aCollection,aString){
+var self=this;
+var progressBar;
+function $HLProgressBarWidget(){return globals.HLProgressBarWidget||(typeof HLProgressBarWidget=="undefined"?nil:HLProgressBarWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLProgressBarWidget())._new();
+_st($1)._parent_(self);
+_st($1)._label_(aString);
+_st($1)._workBlock_(aBlock);
+_st($1)._collection_(aCollection);
+$2=_st($1)._yourself();
+progressBar=$2;
+self._addProgressBar_(progressBar);
+_st(progressBar)._start();
+return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString,progressBar:progressBar},globals.HLProgressWidget)})},
+args: ["aBlock", "aCollection", "aString"],
+source: "do: aBlock on: aCollection displaying: aString\x0a\x09| progressBar |\x0a\x09\x0a\x09progressBar := HLProgressBarWidget new\x0a\x09\x09parent: self;\x0a\x09\x09label: aString;\x0a\x09\x09workBlock: aBlock;\x0a\x09\x09collection: aCollection;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self addProgressBar: progressBar.\x0a\x09progressBar start",
+messageSends: ["parent:", "new", "label:", "workBlock:", "collection:", "yourself", "addProgressBar:", "start"],
+referencedClasses: ["HLProgressBarWidget"]
+}),
+globals.HLProgressWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "flush",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._progressBars())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._removeProgressBar_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"flush",{},globals.HLProgressWidget)})},
+args: [],
+source: "flush\x0a\x09self progressBars do: [ :each |\x0a\x09\x09self removeProgressBar: each ]",
+messageSends: ["do:", "progressBars", "removeProgressBar:"],
+referencedClasses: []
+}),
+globals.HLProgressWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hasButtons",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "hasButtons\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProgressWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isVisible",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@visible"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isVisible",{},globals.HLProgressWidget)})},
+args: [],
+source: "isVisible\x0a\x09^ visible ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLProgressWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "progressBars",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@progressBars"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@progressBars"]=_st($OrderedCollection())._new();
+$1=self["@progressBars"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"progressBars",{},globals.HLProgressWidget)})},
+args: [],
+source: "progressBars\x0a\x09^ progressBars ifNil: [ progressBars := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLProgressWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._isVisible();
+if(smalltalk.assert($1)){
+self["@visible"]=false;
+self["@visible"];
+($ctx1.supercall = true, globals.HLProgressWidget.superclass.fn.prototype._remove.apply(_st(self), []));
+$ctx1.supercall = false;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.HLProgressWidget)})},
+args: [],
+source: "remove\x0a\x09self isVisible ifTrue: [\x0a\x09\x09visible := false.\x0a\x09\x09super remove ]",
+messageSends: ["ifTrue:", "isVisible", "remove"],
+referencedClasses: []
+}),
+globals.HLProgressWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeProgressBar:",
+protocol: 'actions',
+fn: function (aProgressBar){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._progressBars();
+$ctx1.sendIdx["progressBars"]=1;
+_st($1)._remove_ifAbsent_(aProgressBar,(function(){
+}));
+_st(_st(_st(aProgressBar)._wrapper())._asJQuery())._remove();
+$ctx1.sendIdx["remove"]=1;
+_st(self._progressBars())._ifEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._remove();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"removeProgressBar:",{aProgressBar:aProgressBar},globals.HLProgressWidget)})},
+args: ["aProgressBar"],
+source: "removeProgressBar: aProgressBar\x0a\x09self progressBars remove: aProgressBar ifAbsent: [].\x0a\x09aProgressBar wrapper asJQuery remove.\x0a\x09\x0a\x09self progressBars ifEmpty: [ self remove ]",
+messageSends: ["remove:ifAbsent:", "progressBars", "remove", "asJQuery", "wrapper", "ifEmpty:"],
+referencedClasses: []
+}),
+globals.HLProgressWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderMainOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._progressBars())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(html)._with_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderMainOn:",{html:html},globals.HLProgressWidget)})},
+args: ["html"],
+source: "renderMainOn: html\x0a\x09self progressBars do: [ :each |\x0a\x09\x09html with: each ]",
+messageSends: ["do:", "progressBars", "with:"],
+referencedClasses: []
+}),
+globals.HLProgressWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "show",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._isVisible();
+if(! smalltalk.assert($1)){
+self["@visible"]=true;
+self["@visible"];
+($ctx1.supercall = true, globals.HLProgressWidget.superclass.fn.prototype._show.apply(_st(self), []));
+$ctx1.supercall = false;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"show",{},globals.HLProgressWidget)})},
+args: [],
+source: "show\x0a\x09self isVisible ifFalse: [\x0a\x09\x09visible := true.\x0a\x09\x09super show ]",
+messageSends: ["ifFalse:", "isVisible", "show"],
+referencedClasses: []
+}),
+globals.HLProgressWidget);
+
+
+globals.HLProgressWidget.klass.iVarNames = ['default'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "default",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@default"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@default"]=self._new();
+$1=self["@default"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"default",{},globals.HLProgressWidget.klass)})},
+args: [],
+source: "default\x0a\x09^ default ifNil: [ default := self new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: []
+}),
+globals.HLProgressWidget.klass);
+
+
+smalltalk.addClass('HLTabSelectionWidget', globals.HLModalWidget, ['tabs', 'tabList', 'selectedTab', 'selectCallback', 'cancelCallback', 'confirmCallback'], 'Helios-Core');
+globals.HLTabSelectionWidget.comment="I am a modal window used to select or create tabs.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cancel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._remove();
+_st(self._cancelCallback())._value();
+return self}, function($ctx1) {$ctx1.fill(self,"cancel",{},globals.HLTabSelectionWidget)})},
+args: [],
+source: "cancel\x0a\x09self remove.\x0a\x09self cancelCallback value",
+messageSends: ["remove", "value", "cancelCallback"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cancelCallback",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@cancelCallback"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=(function(){
+});
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cancelCallback",{},globals.HLTabSelectionWidget)})},
+args: [],
+source: "cancelCallback\x0a\x09^ cancelCallback ifNil: [ [] ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cancelCallback:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@cancelCallback"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "cancelCallback: aBlock\x0a\x09cancelCallback := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._remove();
+_st(self._confirmCallback())._value_(self._selectedTab());
+return self}, function($ctx1) {$ctx1.fill(self,"confirm",{},globals.HLTabSelectionWidget)})},
+args: [],
+source: "confirm\x0a\x09self remove.\x0a\x09self confirmCallback value: self selectedTab",
+messageSends: ["remove", "value:", "confirmCallback", "selectedTab"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirmCallback",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@confirmCallback"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=(function(){
+});
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"confirmCallback",{},globals.HLTabSelectionWidget)})},
+args: [],
+source: "confirmCallback\x0a\x09^ confirmCallback ifNil: [ [] ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirmCallback:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@confirmCallback"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "confirmCallback: aBlock\x0a\x09confirmCallback := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+var confirmButton;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$5,$6,$2;
+$1=_st(html)._div();
+_st($1)._class_("buttons");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._button();
+$ctx2.sendIdx["button"]=1;
+_st($3)._class_("button");
+$ctx2.sendIdx["class:"]=2;
+_st($3)._with_("Cancel");
+$ctx2.sendIdx["with:"]=2;
+$4=_st($3)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._cancel();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["onClick:"]=1;
+$4;
+$5=_st(html)._button();
+_st($5)._class_("button default");
+_st($5)._with_("Select tab");
+$6=_st($5)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._confirm();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+confirmButton=$6;
+return confirmButton;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+self._giveFocusToButton_(confirmButton);
+return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html,confirmButton:confirmButton},globals.HLTabSelectionWidget)})},
+args: ["html"],
+source: "renderButtonsOn: html\x0a\x09| confirmButton |\x0a\x09\x0a\x09html div \x0a\x09\x09class: 'buttons';\x0a\x09\x09with: [\x0a\x09\x09\x09html button\x0a\x09\x09\x09\x09class: 'button';\x0a\x09\x09\x09\x09with: 'Cancel';\x0a\x09\x09\x09\x09onClick: [ self cancel ].\x0a\x09\x09\x09confirmButton := html button\x0a\x09\x09\x09\x09class: 'button default';\x0a\x09\x09\x09\x09with: 'Select tab';\x0a\x09\x09\x09\x09onClick: [ self confirm ] ].\x0a\x0a\x09self giveFocusToButton:confirmButton",
+messageSends: ["class:", "div", "with:", "button", "onClick:", "cancel", "confirm", "giveFocusToButton:"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLTabSelectionWidget.superclass.fn.prototype._renderContentOn_.apply(_st(self), [html]));
+$ctx1.supercall = false;
+_st(self._tabList())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLTabSelectionWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09super renderContentOn: html.\x0a\x09self tabList focus",
+messageSends: ["renderContentOn:", "focus", "tabList"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderMainOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("title");
+$2=_st($1)._with_("Tab selection");
+$ctx1.sendIdx["with:"]=1;
+_st(html)._with_(self._tabList());
+return self}, function($ctx1) {$ctx1.fill(self,"renderMainOn:",{html:html},globals.HLTabSelectionWidget)})},
+args: ["html"],
+source: "renderMainOn: html\x0a\x09html div \x0a\x09\x09class: 'title'; \x0a\x09\x09with: 'Tab selection'.\x0a\x09\x0a\x09html with: self tabList",
+messageSends: ["class:", "div", "with:", "tabList"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderTab:on:",
+protocol: 'rendering',
+fn: function (aTab,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._span();
+_st($1)._class_(_st(aTab)._cssClass());
+$2=_st($1)._with_(_st(aTab)._label());
+return self}, function($ctx1) {$ctx1.fill(self,"renderTab:on:",{aTab:aTab,html:html},globals.HLTabSelectionWidget)})},
+args: ["aTab", "html"],
+source: "renderTab: aTab on: html\x0a\x09html \x0a\x09\x09span \x0a\x09\x09\x09class: aTab cssClass;\x0a\x09\x09\x09with: aTab label",
+messageSends: ["class:", "span", "cssClass", "with:", "label"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderTabsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st(self._tabs())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(html)._li())._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+$1=_st(html)._a();
+_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx4) {
+return self._renderTab_on_(each,html);
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})}));
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx4) {
+return self._selectTab_(each);
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
+return $2;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["with:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderTabsOn:",{html:html},globals.HLTabSelectionWidget)})},
+args: ["html"],
+source: "renderTabsOn: html\x0a\x09self tabs do: [ :each |\x0a\x09\x09html li with: [ \x0a\x09\x09\x09html a \x0a\x09\x09\x09\x09with: [ \x0a\x09\x09\x09\x09\x09self renderTab: each on: html ];\x0a\x09\x09\x09\x09onClick: [ self selectTab: each ] ] ]",
+messageSends: ["do:", "tabs", "with:", "li", "a", "renderTab:on:", "onClick:", "selectTab:"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectCallback",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@selectCallback"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=(function(){
+});
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectCallback",{},globals.HLTabSelectionWidget)})},
+args: [],
+source: "selectCallback\x0a\x09^ selectCallback ifNil: [ [] ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectCallback:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@selectCallback"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "selectCallback: aBlock\x0a\x09selectCallback := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectTab:",
+protocol: 'actions',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selectedTab_(aTab);
+_st(self._selectCallback())._value_(aTab);
+return self}, function($ctx1) {$ctx1.fill(self,"selectTab:",{aTab:aTab},globals.HLTabSelectionWidget)})},
+args: ["aTab"],
+source: "selectTab: aTab\x0a\x09self selectedTab: aTab.\x0a\x09self selectCallback value: aTab",
+messageSends: ["selectedTab:", "value:", "selectCallback"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedTab",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selectedTab"];
+return $1;
+},
+args: [],
+source: "selectedTab\x0a\x09^ selectedTab",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedTab:",
+protocol: 'accessing',
+fn: function (aTab){
+var self=this;
+self["@selectedTab"]=aTab;
+return self},
+args: ["aTab"],
+source: "selectedTab: aTab\x0a\x09selectedTab := aTab",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupKeyBindings",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+($ctx1.supercall = true, globals.HLTabSelectionWidget.superclass.fn.prototype._setupKeyBindings.apply(_st(self), []));
+$ctx1.supercall = false;
+_st(".dialog"._asJQuery())._keyup_((function(e){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(_st(e)._keyCode()).__eq(_st(_st($String())._cr())._asciiValue());
+if(smalltalk.assert($1)){
+return self._confirm();
+};
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"setupKeyBindings",{},globals.HLTabSelectionWidget)})},
+args: [],
+source: "setupKeyBindings\x0a\x09super setupKeyBindings.\x0a\x09'.dialog' asJQuery keyup: [ :e |\x0a\x09\x09e keyCode = String cr asciiValue ifTrue: [ self confirm ] ]",
+messageSends: ["setupKeyBindings", "keyup:", "asJQuery", "ifTrue:", "=", "keyCode", "asciiValue", "cr", "confirm"],
+referencedClasses: ["String"]
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabList",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+function $HLTabListWidget(){return globals.HLTabListWidget||(typeof HLTabListWidget=="undefined"?nil:HLTabListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$receiver;
+$1=self["@tabList"];
+if(($receiver = $1) == null || $receiver.isNil){
+self["@tabList"]=_st($HLTabListWidget())._new();
+self["@tabList"];
+$2=self["@tabList"];
+_st($2)._callback_((function(tab){
+return smalltalk.withContext(function($ctx2) {
+self._selectTab_(tab);
+return _st(self["@tabList"])._focus();
+}, function($ctx2) {$ctx2.fillBlock({tab:tab},$ctx1,2)})}));
+_st($2)._selectedItem_(self._selectedTab());
+$3=_st($2)._items_(self._tabs());
+$3;
+} else {
+$1;
+};
+$4=self["@tabList"];
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"tabList",{},globals.HLTabSelectionWidget)})},
+args: [],
+source: "tabList\x0a\x09tabList ifNil: [ \x0a\x09\x09tabList := HLTabListWidget new.\x0a\x09\x09tabList\x0a\x09\x09\x09callback: [ :tab | self selectTab: tab. tabList focus ];\x0a\x09\x09\x09selectedItem: self selectedTab;\x0a\x09\x09\x09items: self tabs ].\x0a\x09\x0a\x09^ tabList",
+messageSends: ["ifNil:", "new", "callback:", "selectTab:", "focus", "selectedItem:", "selectedTab", "items:", "tabs"],
+referencedClasses: ["HLTabListWidget"]
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabs",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@tabs"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=[];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tabs",{},globals.HLTabSelectionWidget)})},
+args: [],
+source: "tabs\x0a\x09^ tabs ifNil: [ #() ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabs:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@tabs"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "tabs: aCollection\x0a\x09tabs := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabSelectionWidget);
+
+
+
+smalltalk.addClass('HLProgressBarWidget', globals.HLWidget, ['label', 'parent', 'workBlock', 'collection', 'bar'], 'Helios-Core');
+globals.HLProgressBarWidget.comment="I am a widget used to display a progress bar while iterating over a collection.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "collection",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@collection"];
+return $1;
+},
+args: [],
+source: "collection\x0a\x09^ collection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "collection:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@collection"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "collection: aCollection\x0a\x09collection := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluateAt:",
+protocol: 'actions',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1,$7,$6,$5;
+$4=self._collection();
+$ctx1.sendIdx["collection"]=1;
+$3=_st($4)._size();
+$ctx1.sendIdx["size"]=1;
+$2=_st(anInteger).__slash($3);
+$1=_st($2).__star((100));
+self._updateProgress_($1);
+$7=self._collection();
+$ctx1.sendIdx["collection"]=2;
+$6=_st($7)._size();
+$5=_st(anInteger).__lt_eq($6);
+if(smalltalk.assert($5)){
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(self._workBlock())._value_(_st(self._collection())._at_(anInteger));
+return self._evaluateAt_(_st(anInteger).__plus((1)));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._valueWithTimeout_((10));
+$ctx1.sendIdx["valueWithTimeout:"]=1;
+} else {
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._remove();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}))._valueWithTimeout_((500));
+};
+return self}, function($ctx1) {$ctx1.fill(self,"evaluateAt:",{anInteger:anInteger},globals.HLProgressBarWidget)})},
+args: ["anInteger"],
+source: "evaluateAt: anInteger\x0a\x09self updateProgress: (anInteger / self collection size) * 100.\x0a\x09anInteger <= self collection size\x0a\x09\x09ifTrue: [ \x0a\x09\x09\x09[ \x0a\x09\x09\x09\x09self workBlock value: (self collection at: anInteger).\x0a\x09\x09\x09\x09self evaluateAt: anInteger + 1 ] valueWithTimeout: 10 ]\x0a\x09\x09ifFalse: [ [ self remove ] valueWithTimeout: 500 ]",
+messageSends: ["updateProgress:", "*", "/", "size", "collection", "ifTrue:ifFalse:", "<=", "valueWithTimeout:", "value:", "workBlock", "at:", "evaluateAt:", "+", "remove"],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@label"];
+return $1;
+},
+args: [],
+source: "label\x0a\x09^ label",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@label"]=aString;
+return self},
+args: ["aString"],
+source: "label: aString\x0a\x09label := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parent",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@parent"];
+return $1;
+},
+args: [],
+source: "parent\x0a\x09^ parent",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parent:",
+protocol: 'accessing',
+fn: function (aProgress){
+var self=this;
+self["@parent"]=aProgress;
+return self},
+args: ["aProgress"],
+source: "parent: aProgress\x0a\x09parent := aProgress",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._parent())._removeProgressBar_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.HLProgressBarWidget)})},
+args: [],
+source: "remove\x0a\x09self parent removeProgressBar: self",
+messageSends: ["removeProgressBar:", "parent"],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2;
+_st(_st(html)._span())._with_(self._label());
+$ctx1.sendIdx["with:"]=1;
+$1=_st(html)._div();
+$ctx1.sendIdx["div"]=1;
+_st($1)._class_("progress");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._div();
+_st($3)._class_("bar");
+$4=_st($3)._style_("width: 0%");
+self["@bar"]=$4;
+return self["@bar"];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLProgressBarWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html span with: self label.\x0a\x09html div \x0a\x09\x09class: 'progress';\x0a\x09\x09with: [\x0a\x09\x09\x09bar := html div \x0a\x09\x09\x09\x09class: 'bar';\x0a\x09\x09\x09\x09style: 'width: 0%' ]",
+messageSends: ["with:", "span", "label", "class:", "div", "style:"],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "start",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._evaluateAt_((1));
+return self}, function($ctx1) {$ctx1.fill(self,"start",{},globals.HLProgressBarWidget)})},
+args: [],
+source: "start\x0a\x09\x22Make sure the UI has some time to update itself between each iteration\x22\x0a\x09\x0a\x09self evaluateAt: 1",
+messageSends: ["evaluateAt:"],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "updateProgress:",
+protocol: 'actions',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self["@bar"])._asJQuery())._css_put_("width",_st(_st(anInteger)._asString()).__comma("%"));
+return self}, function($ctx1) {$ctx1.fill(self,"updateProgress:",{anInteger:anInteger},globals.HLProgressBarWidget)})},
+args: ["anInteger"],
+source: "updateProgress: anInteger\x0a\x09bar asJQuery css: 'width' put: anInteger asString, '%'",
+messageSends: ["css:put:", "asJQuery", ",", "asString"],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "workBlock",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@workBlock"];
+return $1;
+},
+args: [],
+source: "workBlock\x0a\x09^ workBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "workBlock:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@workBlock"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "workBlock: aBlock\x0a\x09workBlock := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget);
+
+
+globals.HLProgressBarWidget.klass.iVarNames = ['default'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "default",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@default"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@default"]=self._new();
+$1=self["@default"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"default",{},globals.HLProgressBarWidget.klass)})},
+args: [],
+source: "default\x0a\x09^ default ifNil: [ default := self new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: []
+}),
+globals.HLProgressBarWidget.klass);
+
+
+smalltalk.addClass('HLTabWidget', globals.HLWidget, ['widget', 'label', 'root'], 'Helios-Core');
+globals.HLTabWidget.comment="I am a widget specialized into building another widget as an Helios tab.\x0a\x0aI should not be used directly, `HLWidget class >> #openAsTab` should be used instead.\x0a\x0a## Example\x0a\x0a    HLWorkspace openAsTab";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activate",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._manager())._activate_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"activate",{},globals.HLTabWidget)})},
+args: [],
+source: "activate\x0a\x09self manager activate: self",
+messageSends: ["activate:", "manager"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "add",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._manager())._addTab_(self);
+self._observeManager();
+return self}, function($ctx1) {$ctx1.fill(self,"add",{},globals.HLTabWidget)})},
+args: [],
+source: "add\x0a\x09self manager addTab: self.\x0a\x09self observeManager",
+messageSends: ["addTab:", "manager", "observeManager"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._widget())._tabClass();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cssClass",{},globals.HLTabWidget)})},
+args: [],
+source: "cssClass\x0a\x09^ self widget tabClass",
+messageSends: ["tabClass", "widget"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._widget();
+$ctx1.sendIdx["widget"]=1;
+$1=_st($2)._canHaveFocus();
+if(smalltalk.assert($1)){
+_st(self._widget())._focus();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLTabWidget)})},
+args: [],
+source: "focus\x0a\x09self widget canHaveFocus ifTrue: [\x0a\x09\x09self widget focus ]",
+messageSends: ["ifTrue:", "canHaveFocus", "widget", "focus"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hide",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self["@root"];
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(_st(self["@root"])._asJQuery())._css_put_("visibility","hidden");
+};
+return self}, function($ctx1) {$ctx1.fill(self,"hide",{},globals.HLTabWidget)})},
+args: [],
+source: "hide\x0a\x09root ifNotNil: [ root asJQuery css: 'visibility' put: 'hidden' ]",
+messageSends: ["ifNotNil:", "css:put:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._manager())._activeTab()).__eq(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLTabWidget)})},
+args: [],
+source: "isActive\x0a\x09^ self manager activeTab = self",
+messageSends: ["=", "activeTab", "manager"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@label"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"label",{},globals.HLTabWidget)})},
+args: [],
+source: "label\x0a\x09^ label ifNil: [ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@label"]=aString;
+return self},
+args: ["aString"],
+source: "label: aString\x0a\x09label := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "manager",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLManager())._current();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"manager",{},globals.HLTabWidget)})},
+args: [],
+source: "manager\x0a\x09^ HLManager current",
+messageSends: ["current"],
+referencedClasses: ["HLManager"]
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeManager",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLTabLabelChanged(){return globals.HLTabLabelChanged||(typeof HLTabLabelChanged=="undefined"?nil:HLTabLabelChanged)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._manager())._announcer())._on_send_to_($HLTabLabelChanged(),"onTabLabelChanged:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeManager",{},globals.HLTabWidget)})},
+args: [],
+source: "observeManager\x0a\x09self manager announcer \x0a\x09\x09on: HLTabLabelChanged\x0a\x09\x09send: #onTabLabelChanged:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "manager"],
+referencedClasses: ["HLTabLabelChanged"]
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onTabLabelChanged:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$4,$5,$3;
+$2=_st(anAnnouncement)._widget();
+$ctx1.sendIdx["widget"]=1;
+$1=_st($2).__eq(self._widget());
+$ctx1.sendIdx["="]=1;
+if(smalltalk.assert($1)){
+$4=self._label();
+$ctx1.sendIdx["label"]=1;
+$5=_st(anAnnouncement)._label();
+$ctx1.sendIdx["label"]=2;
+$3=_st($4).__eq($5);
+if(! smalltalk.assert($3)){
+self._label_(_st(anAnnouncement)._label());
+_st(self._manager())._refresh();
+};
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onTabLabelChanged:",{anAnnouncement:anAnnouncement},globals.HLTabWidget)})},
+args: ["anAnnouncement"],
+source: "onTabLabelChanged: anAnnouncement\x0a\x09anAnnouncement widget = self widget ifTrue: [\x0a\x09\x09self label = anAnnouncement label ifFalse: [\x0a\x09\x09\x09self label: anAnnouncement label.\x0a\x09\x09\x09self manager refresh ] ]",
+messageSends: ["ifTrue:", "=", "widget", "ifFalse:", "label", "label:", "refresh", "manager"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerBindings",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._widget())._registerBindings();
+return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{},globals.HLTabWidget)})},
+args: [],
+source: "registerBindings\x0a\x09self widget registerBindings",
+messageSends: ["registerBindings", "widget"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+self._unregister();
+$ctx1.sendIdx["unregister"]=1;
+_st(self._widget())._unregister();
+$1=self["@root"];
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(_st(self["@root"])._asJQuery())._remove();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.HLTabWidget)})},
+args: [],
+source: "remove\x0a\x09self unregister.\x0a\x09self widget unregister.\x0a\x09root ifNotNil: [ root asJQuery remove ]",
+messageSends: ["unregister", "widget", "ifNotNil:", "remove", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("tab");
+$2=_st($1)._yourself();
+self["@root"]=$2;
+self._renderTab();
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.HLTabWidget)})},
+args: ["html"],
+source: "renderOn: html\x0a\x09root := html div\x0a\x09\x09class: 'tab';\x0a\x09\x09yourself.\x0a\x09self renderTab",
+messageSends: ["class:", "div", "yourself", "renderTab"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderTab",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st(self["@root"])._contents_((function(html){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(html)._div();
+_st($1)._class_("amber_box");
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._widget())._renderOn_(html);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+return $2;
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderTab",{},globals.HLTabWidget)})},
+args: [],
+source: "renderTab\x0a\x09root contents: [ :html |\x0a\x09\x09html div\x0a\x09\x09\x09class: 'amber_box';\x0a\x09\x09\x09with: [ self widget renderOn: html ] ]",
+messageSends: ["contents:", "class:", "div", "with:", "renderOn:", "widget"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "show",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=self["@root"];
+if(($receiver = $1) == null || $receiver.isNil){
+$2="body"._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+self._appendToJQuery_($2);
+} else {
+_st(_st(self["@root"])._asJQuery())._css_put_("visibility","visible");
+};
+return self}, function($ctx1) {$ctx1.fill(self,"show",{},globals.HLTabWidget)})},
+args: [],
+source: "show\x0a\x09root\x0a\x09\x09ifNil: [ self appendToJQuery: 'body' asJQuery ]\x0a\x09\x09ifNotNil: [ root asJQuery css: 'visibility' put: 'visible' ]",
+messageSends: ["ifNil:ifNotNil:", "appendToJQuery:", "asJQuery", "css:put:"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._manager())._announcer())._unsubscribe_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLTabWidget)})},
+args: [],
+source: "unregister\x0a\x09self manager announcer unsubscribe: self",
+messageSends: ["unsubscribe:", "announcer", "manager"],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "widget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@widget"];
+return $1;
+},
+args: [],
+source: "widget\x0a\x09^ widget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "widget:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+self["@widget"]=aWidget;
+return self},
+args: ["aWidget"],
+source: "widget: aWidget\x0a\x09widget := aWidget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabWidget);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:labelled:",
+protocol: 'instance creation',
+fn: function (aWidget,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._widget_(aWidget);
+_st($2)._label_(aString);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:labelled:",{aWidget:aWidget,aString:aString},globals.HLTabWidget.klass)})},
+args: ["aWidget", "aString"],
+source: "on: aWidget labelled: aString\x0a\x09^ self new\x0a\x09\x09widget: aWidget;\x0a\x09\x09label: aString;\x0a\x09\x09yourself",
+messageSends: ["widget:", "new", "label:", "yourself"],
+referencedClasses: []
+}),
+globals.HLTabWidget.klass);
+
+
+smalltalk.addClass('HLTabsWidget', globals.HLWidget, ['tabs', 'activeTab', 'history', 'selectionDisabled'], 'Helios-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activate:",
+protocol: 'actions',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._isSelectionDisabled();
+if(smalltalk.assert($1)){
+return self;
+};
+_st(_st(self._manager())._keyBinder())._flushBindings();
+_st(aTab)._registerBindings();
+self["@activeTab"]=aTab;
+self._refresh();
+self._addToHistory_(aTab);
+$2=self._show_(aTab);
+return self}, function($ctx1) {$ctx1.fill(self,"activate:",{aTab:aTab},globals.HLTabsWidget)})},
+args: ["aTab"],
+source: "activate: aTab\x0a\x09self isSelectionDisabled ifTrue: [ ^ self ].\x0a\x0a\x09self manager keyBinder flushBindings.\x0a\x09aTab registerBindings.\x0a\x09activeTab := aTab.\x0a\x09\x0a\x09self \x0a\x09\x09refresh;\x0a\x09\x09addToHistory: aTab;\x0a\x09\x09show: aTab",
+messageSends: ["ifTrue:", "isSelectionDisabled", "flushBindings", "keyBinder", "manager", "registerBindings", "refresh", "addToHistory:", "show:"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activateNextTab",
+protocol: 'actions',
+fn: function (){
+var self=this;
+var nextTab;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$5,$4,$3;
+var $early={};
+try {
+$1=self._tabs();
+$ctx1.sendIdx["tabs"]=1;
+_st($1)._ifEmpty_((function(){
+throw $early=[self];
+}));
+$2=self._tabs();
+$ctx1.sendIdx["tabs"]=2;
+$5=self._tabs();
+$ctx1.sendIdx["tabs"]=3;
+$4=_st($5)._indexOf_(self._activeTab());
+$3=_st($4).__plus((1));
+nextTab=_st($2)._at_ifAbsent_($3,(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._tabs())._first();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+self._activate_(nextTab);
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"activateNextTab",{nextTab:nextTab},globals.HLTabsWidget)})},
+args: [],
+source: "activateNextTab\x0a\x09| nextTab |\x0a\x09\x0a\x09self tabs ifEmpty: [ ^ self ].\x0a\x09\x0a\x09nextTab := self tabs \x0a\x09\x09at: (self tabs indexOf: self activeTab) + 1 \x0a\x09\x09ifAbsent: [ self tabs first ].\x0a\x09\x09\x0a\x09self activate: nextTab",
+messageSends: ["ifEmpty:", "tabs", "at:ifAbsent:", "+", "indexOf:", "activeTab", "first", "activate:"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activatePreviousTab",
+protocol: 'actions',
+fn: function (){
+var self=this;
+var previousTab;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$5,$4,$3;
+var $early={};
+try {
+$1=self._tabs();
+$ctx1.sendIdx["tabs"]=1;
+_st($1)._ifEmpty_((function(){
+throw $early=[self];
+}));
+$2=self._tabs();
+$ctx1.sendIdx["tabs"]=2;
+$5=self._tabs();
+$ctx1.sendIdx["tabs"]=3;
+$4=_st($5)._indexOf_(self._activeTab());
+$3=_st($4).__minus((1));
+previousTab=_st($2)._at_ifAbsent_($3,(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._tabs())._last();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+self._activate_(previousTab);
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"activatePreviousTab",{previousTab:previousTab},globals.HLTabsWidget)})},
+args: [],
+source: "activatePreviousTab\x0a\x09| previousTab |\x0a\x09\x0a\x09self tabs ifEmpty: [ ^ self ].\x0a\x09\x0a\x09previousTab := self tabs \x0a\x09\x09at: (self tabs indexOf: self activeTab) - 1 \x0a\x09\x09ifAbsent: [ self tabs last ].\x0a\x09\x09\x0a\x09self activate: previousTab",
+messageSends: ["ifEmpty:", "tabs", "at:ifAbsent:", "-", "indexOf:", "activeTab", "last", "activate:"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activeTab",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@activeTab"];
+return $1;
+},
+args: [],
+source: "activeTab\x0a\x09^ activeTab",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addTab:",
+protocol: 'actions',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._tabs())._add_(aTab);
+self._activate_(aTab);
+return self}, function($ctx1) {$ctx1.fill(self,"addTab:",{aTab:aTab},globals.HLTabsWidget)})},
+args: ["aTab"],
+source: "addTab: aTab\x0a\x09self tabs add: aTab.\x0a    self activate: aTab",
+messageSends: ["add:", "tabs", "activate:"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addToHistory:",
+protocol: 'actions',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._removeFromHistory_(aTab);
+_st(self._history())._add_(aTab);
+return self}, function($ctx1) {$ctx1.fill(self,"addToHistory:",{aTab:aTab},globals.HLTabsWidget)})},
+args: ["aTab"],
+source: "addToHistory: aTab\x0a\x09self removeFromHistory: aTab.\x0a\x09self history add: aTab",
+messageSends: ["removeFromHistory:", "add:", "history"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "disableSelection",
+protocol: 'actions',
+fn: function (){
+var self=this;
+self["@selectionDisabled"]=true;
+return self},
+args: [],
+source: "disableSelection\x0a\x09selectionDisabled := true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "enableSelection",
+protocol: 'actions',
+fn: function (){
+var self=this;
+self["@selectionDisabled"]=false;
+return self},
+args: [],
+source: "enableSelection\x0a\x09selectionDisabled := false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "history",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@history"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@history"]=_st($OrderedCollection())._new();
+$1=self["@history"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"history",{},globals.HLTabsWidget)})},
+args: [],
+source: "history\x0a\x09^ history ifNil: [ history := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "history:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@history"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "history: aCollection\x0a\x09history := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSelectionDisabled",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@selectionDisabled"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isSelectionDisabled",{},globals.HLTabsWidget)})},
+args: [],
+source: "isSelectionDisabled\x0a\x09^ selectionDisabled ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeActiveTab",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._removeTab_(self._activeTab());
+return self}, function($ctx1) {$ctx1.fill(self,"removeActiveTab",{},globals.HLTabsWidget)})},
+args: [],
+source: "removeActiveTab\x0a\x09self removeTab: self activeTab",
+messageSends: ["removeTab:", "activeTab"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeFromHistory:",
+protocol: 'actions',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._history_(_st(self._history())._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each).__eq_eq(aTab);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
+return self}, function($ctx1) {$ctx1.fill(self,"removeFromHistory:",{aTab:aTab},globals.HLTabsWidget)})},
+args: ["aTab"],
+source: "removeFromHistory: aTab\x0a\x09self history: (self history reject: [ :each | each == aTab ])",
+messageSends: ["history:", "reject:", "history", "=="],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeTab:",
+protocol: 'actions',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3;
+$2=self._tabs();
+$ctx1.sendIdx["tabs"]=1;
+$1=_st($2)._includes_(aTab);
+if(! smalltalk.assert($1)){
+return self;
+};
+self._removeFromHistory_(aTab);
+_st(self._tabs())._remove_(aTab);
+_st(_st(self._manager())._keyBinder())._flushBindings();
+_st(aTab)._remove();
+self._refresh();
+$3=self._history();
+$ctx1.sendIdx["history"]=1;
+_st($3)._ifNotEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(self._history())._last())._activate();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"removeTab:",{aTab:aTab},globals.HLTabsWidget)})},
+args: ["aTab"],
+source: "removeTab: aTab\x0a\x09(self tabs includes: aTab) ifFalse: [ ^ self ].\x0a\x0a\x09self removeFromHistory: aTab.\x0a\x09self tabs remove: aTab.\x0a\x09self manager keyBinder flushBindings.\x0a\x09aTab remove.\x0a\x09self refresh.\x0a\x09self history ifNotEmpty: [\x0a\x09\x09self history last activate ]",
+messageSends: ["ifFalse:", "includes:", "tabs", "removeFromHistory:", "remove:", "flushBindings", "keyBinder", "manager", "remove", "refresh", "ifNotEmpty:", "history", "activate", "last"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeTabForWidget:",
+protocol: 'actions',
+fn: function (aWidget){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $early={};
+try {
+self._removeTab_(_st(self._tabs())._detect_ifNone_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._widget()).__eq(aWidget);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+throw $early=[self];
+})));
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"removeTabForWidget:",{aWidget:aWidget},globals.HLTabsWidget)})},
+args: ["aWidget"],
+source: "removeTabForWidget: aWidget\x0a\x09self removeTab: (self tabs \x0a\x09\x09detect: [ :each | each widget = aWidget ]\x0a\x09\x09ifNone: [ ^ self ])",
+messageSends: ["removeTab:", "detect:ifNone:", "tabs", "=", "widget"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderAddOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $HLWidget(){return globals.HLWidget||(typeof HLWidget=="undefined"?nil:HLWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$5,$7,$8,$9,$6,$2;
+$1=_st(html)._div();
+_st($1)._class_("dropdown new_tab");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._a();
+$ctx2.sendIdx["a"]=1;
+_st($3)._class_("dropdown-toggle");
+$ctx2.sendIdx["class:"]=2;
+_st($3)._at_put_("data-toggle","dropdown");
+$4=_st($3)._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(html)._tag_("b"))._class_("caret");
+$ctx3.sendIdx["class:"]=3;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["with:"]=2;
+$4;
+$5=_st(html)._ul();
+_st($5)._class_("dropdown-menu");
+$6=_st($5)._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(_st(_st($HLWidget())._withAllSubclasses())._select_((function(each){
+return smalltalk.withContext(function($ctx4) {
+return _st(each)._canBeOpenAsTab();
+}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)})})))._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx4) {
+$7=_st(a)._tabPriority();
+$ctx4.sendIdx["tabPriority"]=1;
+return _st($7).__lt(_st(b)._tabPriority());
+}, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)})})))._do_((function(each){
+return smalltalk.withContext(function($ctx4) {
+return _st(_st(html)._li())._with_((function(){
+return smalltalk.withContext(function($ctx5) {
+$8=_st(html)._a();
+_st($8)._with_(_st(each)._tabLabel());
+$9=_st($8)._onClick_((function(){
+return smalltalk.withContext(function($ctx6) {
+return _st(each)._openAsTab();
+}, function($ctx6) {$ctx6.fillBlock({},$ctx5,8)})}));
+return $9;
+}, function($ctx5) {$ctx5.fillBlock({},$ctx4,7)})}));
+$ctx4.sendIdx["with:"]=4;
+}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)})}));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+$ctx2.sendIdx["with:"]=3;
+return $6;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderAddOn:",{html:html},globals.HLTabsWidget)})},
+args: ["html"],
+source: "renderAddOn: html\x0a    html div \x0a    \x09class: 'dropdown new_tab';\x0a        with: [ \x0a\x09\x09\x09html a \x0a        \x09\x09class: 'dropdown-toggle';\x0a           \x09 \x09at: 'data-toggle' put: 'dropdown';\x0a            \x09with: [\x0a  \x09\x09\x09\x09\x09(html tag: 'b') class: 'caret' ].\x0a           html ul \x0a           \x09\x09class: 'dropdown-menu';\x0a                with: [\x0a                  \x09((HLWidget withAllSubclasses\x0a                    \x09select: [ :each | each canBeOpenAsTab ])\x0a                        sorted: [ :a :b | a tabPriority < b tabPriority ])\x0a                        do: [ :each |\x0a  \x09\x09\x09\x09\x09\x09\x09html li with: [\x0a                      \x09\x09\x09html a \x0a                                \x09with: each tabLabel;\x0a      \x09\x09\x09\x09\x09\x09\x09\x09onClick: [ each openAsTab ] ] ] ] ]",
+messageSends: ["class:", "div", "with:", "a", "at:put:", "tag:", "ul", "do:", "sorted:", "select:", "withAllSubclasses", "canBeOpenAsTab", "<", "tabPriority", "li", "tabLabel", "onClick:", "openAsTab"],
+referencedClasses: ["HLWidget"]
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2;
+$1=_st(html)._div();
+$ctx1.sendIdx["div"]=1;
+_st($1)._class_("navbar navbar-fixed-top");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._div();
+_st($3)._class_("navbar-inner");
+$4=_st($3)._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._renderTabsOn_(html);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+return $4;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+self._renderAddOn_(html);
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLTabsWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html div \x0a\x09\x09class: 'navbar navbar-fixed-top';\x0a\x09\x09with: [ html div \x0a\x09\x09\x09class: 'navbar-inner';\x0a\x09\x09\x09with: [ self renderTabsOn: html ] ].\x0a\x09\x09\x09\x0a\x09self renderAddOn: html",
+messageSends: ["class:", "div", "with:", "renderTabsOn:", "renderAddOn:"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderTab:on:",
+protocol: 'rendering',
+fn: function (aTab,html){
+var self=this;
+var li;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$6,$5,$7,$8,$9,$10,$11,$12;
+$1=_st(html)._li();
+$2=$1;
+$3=_st("width: ".__comma(_st(self._tabWidth())._asString())).__comma("px");
+$ctx1.sendIdx[","]=1;
+_st($2)._style_($3);
+$4=$1;
+$6=_st(aTab)._isActive();
+if(smalltalk.assert($6)){
+$5="tab active";
+} else {
+$5="tab inactive";
+};
+_st($4)._class_($5);
+$ctx1.sendIdx["class:"]=1;
+_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(html)._a())._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+$7=_st(_st(html)._tag_("i"))._class_("close");
+$ctx3.sendIdx["class:"]=2;
+_st($7)._onClick_((function(){
+return smalltalk.withContext(function($ctx4) {
+return self._removeTab_(aTab);
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)})}));
+$ctx3.sendIdx["onClick:"]=1;
+$8=_st(html)._span();
+_st($8)._class_(_st(aTab)._cssClass());
+$9=$8;
+$10=_st(aTab)._label();
+$ctx3.sendIdx["label"]=1;
+_st($9)._title_($10);
+$11=_st($8)._with_(_st(aTab)._label());
+return $11;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
+$ctx2.sendIdx["with:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$ctx1.sendIdx["with:"]=1;
+$12=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aTab)._activate();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
+li=$12;
+_st(_st(_st(li)._asJQuery())._get_((0)))._at_put_("tab-data",aTab);
+return self}, function($ctx1) {$ctx1.fill(self,"renderTab:on:",{aTab:aTab,html:html,li:li},globals.HLTabsWidget)})},
+args: ["aTab", "html"],
+source: "renderTab: aTab on: html\x0a\x09| li |\x0a\x09li := html li \x0a\x09\x09style: 'width: ', self tabWidth asString, 'px';\x0a\x09\x09class: (aTab isActive ifTrue: [ 'tab active' ] ifFalse: [ 'tab inactive' ]);\x0a\x09\x09with: [\x0a\x09\x09\x09html a\x0a\x09\x09\x09with: [\x0a\x09\x09\x09\x09((html tag: 'i') class: 'close')\x0a\x09\x09\x09\x09\x09onClick: [ self removeTab: aTab ].\x0a\x09\x09\x09\x09html span \x0a\x09\x09\x09\x09\x09class: aTab cssClass;\x0a\x09\x09\x09\x09\x09title: aTab label;\x0a\x09\x09\x09\x09\x09with: aTab label ] ];\x0a\x09\x09onClick: [ aTab activate ].\x0a\x09\x0a\x09(li asJQuery get: 0) at: 'tab-data' put: aTab",
+messageSends: ["style:", "li", ",", "asString", "tabWidth", "class:", "ifTrue:ifFalse:", "isActive", "with:", "a", "onClick:", "tag:", "removeTab:", "span", "cssClass", "title:", "label", "activate", "at:put:", "get:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderTabsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+var ul;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._ul();
+_st($1)._class_("nav main-tabs");
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._tabs())._do_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return self._renderTab_on_(each,html);
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+ul=$2;
+_st(_st(ul)._asJQuery())._sortable_(globals.HashedCollection._newFromPairs_(["containment","parent","start",(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._disableSelection();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),"stop",(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._enableSelection();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}))._valueWithTimeout_((300));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),"update",(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._updateTabsOrder();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})})]));
+return self}, function($ctx1) {$ctx1.fill(self,"renderTabsOn:",{html:html,ul:ul},globals.HLTabsWidget)})},
+args: ["html"],
+source: "renderTabsOn: html\x0a\x09| ul |\x0a\x09ul := html ul \x0a\x09\x09class: 'nav main-tabs';\x0a\x09\x09with: [ \x0a        \x09self tabs do: [ :each |\x0a\x09\x09\x09\x09self renderTab: each on: html ] ].\x0a\x09\x09\x0a\x09ul asJQuery sortable: #{\x0a\x09\x09'containment' -> 'parent'.\x0a\x09\x09'start' -> [ self disableSelection ].\x0a\x09\x09'stop' -> [ [ self enableSelection] valueWithTimeout: 300 ].\x0a\x09\x09'update' -> [ self updateTabsOrder ]\x0a\x09}",
+messageSends: ["class:", "ul", "with:", "do:", "tabs", "renderTab:on:", "sortable:", "asJQuery", "disableSelection", "valueWithTimeout:", "enableSelection", "updateTabsOrder"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupEvents",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1,$4;
+_st("body"._asJQuery())._keydown_((function(event){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(event)._ctrlKey();
+$ctx2.sendIdx["ctrlKey"]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+$3=_st(event)._which();
+$ctx3.sendIdx["which"]=1;
+return _st($3).__eq((188));
+$ctx3.sendIdx["="]=1;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["and:"]=1;
+if(smalltalk.assert($1)){
+self._activatePreviousTab();
+_st(event)._preventDefault();
+$ctx2.sendIdx["preventDefault"]=1;
+};
+$4=_st(_st(event)._ctrlKey())._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(event)._which()).__eq((190));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
+if(smalltalk.assert($4)){
+self._activateNextTab();
+return _st(event)._preventDefault();
+};
+}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{},globals.HLTabsWidget)})},
+args: [],
+source: "setupEvents\x0a\x09'body' asJQuery keydown: [ :event |\x0a\x09\x0a\x09\x09\x22ctrl+> and ctrl+<\x22\x0a\x09\x09(event ctrlKey and: [ event which = 188 ]) ifTrue: [\x0a\x09\x09\x09self activatePreviousTab.\x0a\x09\x09\x09event preventDefault ].\x0a\x09\x09(event ctrlKey and: [ event which = 190 ]) ifTrue: [\x0a\x09\x09\x09self activateNextTab.\x0a\x09\x09\x09event preventDefault ] ]",
+messageSends: ["keydown:", "asJQuery", "ifTrue:", "and:", "ctrlKey", "=", "which", "activatePreviousTab", "preventDefault", "activateNextTab"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "show:",
+protocol: 'rendering',
+fn: function (aTab){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(self._tabs())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._hide();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+_st(aTab)._show();
+$1=_st(aTab)._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"show:",{aTab:aTab},globals.HLTabsWidget)})},
+args: ["aTab"],
+source: "show: aTab\x0a\x09self tabs do: [ :each | each hide ].\x0a\x09aTab show; focus",
+messageSends: ["do:", "tabs", "hide", "show", "focus"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabWidth",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(_st(window)._asJQuery())._width()).__minus((90))).__slash(_st(self._tabs())._size());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tabWidth",{},globals.HLTabsWidget)})},
+args: [],
+source: "tabWidth\x0a\x09^ (window asJQuery width - 90) / self tabs size",
+messageSends: ["/", "-", "width", "asJQuery", "size", "tabs"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabs",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@tabs"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@tabs"]=_st($OrderedCollection())._new();
+$1=self["@tabs"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tabs",{},globals.HLTabsWidget)})},
+args: [],
+source: "tabs\x0a\x09^ tabs ifNil: [ tabs := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLTabsWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "updateTabsOrder",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@tabs"]=_st(_st(".main-tabs li"._asJQuery())._toArray())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._at_("tab-data");
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"updateTabsOrder",{},globals.HLTabsWidget)})},
+args: [],
+source: "updateTabsOrder\x0a\x09tabs := '.main-tabs li' asJQuery toArray \x0a\x09\x09collect: [ :each | each at: 'tab-data' ]",
+messageSends: ["collect:", "toArray", "asJQuery", "at:"],
+referencedClasses: []
+}),
+globals.HLTabsWidget);
+
+
+globals.HLTabsWidget.klass.iVarNames = ['current'];
+
+smalltalk.addClass('HLWelcomeWidget', globals.HLWidget, [], 'Helios-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "welcome";
+},
+args: [],
+source: "cssClass\x0a\x09^ 'welcome'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWelcomeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openClassBrowser",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLBrowser(){return globals.HLBrowser||(typeof HLBrowser=="undefined"?nil:HLBrowser)}
+return smalltalk.withContext(function($ctx1) { 
+_st($HLBrowser())._openAsTab();
+return self}, function($ctx1) {$ctx1.fill(self,"openClassBrowser",{},globals.HLWelcomeWidget)})},
+args: [],
+source: "openClassBrowser\x0a\x09HLBrowser openAsTab",
+messageSends: ["openAsTab"],
+referencedClasses: ["HLBrowser"]
+}),
+globals.HLWelcomeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openHelp",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "openHelp",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWelcomeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openTestRunner",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "openTestRunner",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWelcomeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openWorkspace",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLWorkspace(){return globals.HLWorkspace||(typeof HLWorkspace=="undefined"?nil:HLWorkspace)}
+return smalltalk.withContext(function($ctx1) { 
+_st($HLWorkspace())._openAsTab();
+return self}, function($ctx1) {$ctx1.fill(self,"openWorkspace",{},globals.HLWelcomeWidget)})},
+args: [],
+source: "openWorkspace\x0a\x09HLWorkspace openAsTab",
+messageSends: ["openAsTab"],
+referencedClasses: ["HLWorkspace"]
+}),
+globals.HLWelcomeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+$1=_st(html)._button();
+$ctx1.sendIdx["button"]=1;
+_st($1)._class_("button");
+$ctx1.sendIdx["class:"]=1;
+_st($1)._with_("Class Browser");
+$ctx1.sendIdx["with:"]=1;
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._openClassBrowser();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["onClick:"]=1;
+$3=_st(html)._button();
+_st($3)._class_("button");
+_st($3)._with_("Workspace");
+$4=_st($3)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._openWorkspace();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},globals.HLWelcomeWidget)})},
+args: ["html"],
+source: "renderButtonsOn: html\x0a\x09html button\x0a\x09\x09class: 'button';\x0a\x09\x09with: 'Class Browser';\x0a\x09\x09onClick: [ self openClassBrowser ].\x0a\x09html button\x0a\x09\x09class: 'button';\x0a\x09\x09with: 'Workspace';\x0a\x09\x09onClick: [ self openWorkspace ].\x0a\x09\x22html button\x0a\x09\x09class: 'button';\x0a\x09\x09with: 'Test Runner';\x0a\x09\x09onClick: [ self openTestRunner ].\x0a\x09html button\x0a\x09\x09class: 'button';\x0a\x09\x09with: 'Help';\x0a\x09\x09onClick: [ self openHelp ]\x22",
+messageSends: ["class:", "button", "with:", "onClick:", "openClassBrowser", "openWorkspace"],
+referencedClasses: []
+}),
+globals.HLWelcomeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._renderHelpOn_(html);
+$1=self._renderButtonsOn_(html);
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLWelcomeWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09self\x0a\x09\x09renderHelpOn: html;\x0a\x09\x09renderButtonsOn: html",
+messageSends: ["renderHelpOn:", "renderButtonsOn:"],
+referencedClasses: []
+}),
+globals.HLWelcomeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderHelpOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(_st(html)._h2())._with_("No tools are open");
+$ctx1.sendIdx["with:"]=1;
+_st(_st(html)._ul())._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(html)._li();
+$ctx2.sendIdx["li"]=1;
+_st($1)._with_("Perform actions with  ctrl + space");
+$ctx2.sendIdx["with:"]=3;
+return _st(_st(html)._li())._with_("Open one of the common tools:");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=2;
+return self}, function($ctx1) {$ctx1.fill(self,"renderHelpOn:",{html:html},globals.HLWelcomeWidget)})},
+args: ["html"],
+source: "renderHelpOn: html\x0a\x09html h2 with: 'No tools are open'.\x0a\x09html ul with: [\x0a\x09\x09html li with: 'Perform actions with  ctrl + space'.\x0a\x09\x09html li with: 'Open one of the common tools:' ]",
+messageSends: ["with:", "h2", "ul", "li"],
+referencedClasses: []
+}),
+globals.HLWelcomeWidget);
+
+
+});

+ 2336 - 0
src/Helios-Core.st

@@ -0,0 +1,2336 @@
+Smalltalk createPackage: 'Helios-Core'!
+InterfacingObject subclass: #HLModel
+	instanceVariableNames: 'announcer environment'
+	package: 'Helios-Core'!
+!HLModel commentStamp!
+I am the abstract superclass of all models of Helios.
+I am the "Model" part of the MVC pattern implementation in Helios.
+
+I provide access to an `Environment` object and both a local (model-specific) and global (system-specific) announcer.
+
+The `#withChangesDo:` method is handy for performing model changes ensuring that all widgets are aware of the change and can prevent it from happening.
+
+Modifications of the system should be done via commands (see `HLCommand` and subclasses).!
+
+!HLModel methodsFor: 'accessing'!
+
+announcer
+	^ announcer ifNil: [ announcer := Announcer new ]
+!
+
+environment
+	^ environment ifNil: [ self manager environment ]
+!
+
+environment: anEnvironment
+	environment := anEnvironment
+!
+
+manager
+	^ HLManager current
+!
+
+systemAnnouncer
+	^ self environment systemAnnouncer
+! !
+
+!HLModel methodsFor: 'error handling'!
+
+withChangesDo: aBlock
+	[ 
+		self announcer announce: (HLAboutToChange new
+			actionBlock: aBlock;
+			yourself).
+		aBlock value.
+	]
+		on: HLChangeForbidden 
+		do: [ :ex | ]
+! !
+
+!HLModel methodsFor: 'testing'!
+
+isBrowserModel
+	^ false
+!
+
+isReferencesModel
+	^ false
+!
+
+isToolModel
+	^ false
+! !
+
+HLModel subclass: #HLFinder
+	instanceVariableNames: ''
+	package: 'Helios-Core'!
+!HLFinder commentStamp!
+I am the `Finder` service handler of Helios.
+
+Finding a class will open a new class browser, while finding a method will open a references browser.!
+
+!HLFinder methodsFor: 'finding'!
+
+findClass: aClass
+	HLBrowser openAsTab openClassNamed: aClass name
+!
+
+findMethod: aCompiledMethod
+	HLBrowser openAsTab openMethod: aCompiledMethod
+!
+
+findString: aString
+	| foundClass |
+	
+	foundClass := self environment classes 
+		detect: [ :each | each name = aString ]
+		ifNone: [ nil ].
+	
+	foundClass 
+		ifNil: [ HLReferences openAsTab search: aString ]
+		ifNotNil: [ self findClass: foundClass ]
+! !
+
+HLModel subclass: #HLToolModel
+	instanceVariableNames: 'selectedClass selectedPackage selectedProtocol selectedSelector'
+	package: 'Helios-Core'!
+!HLToolModel commentStamp!
+I am a model specific to package and class manipulation. All browsers should either use me or a subclass as their model.
+
+I provide methods for package, class, protocol and method manipulation and access, forwarding to my environment.
+
+I also handle compilation of classes and methods as well as compilation and parsing errors.!
+
+!HLToolModel methodsFor: 'accessing'!
+
+allSelectors
+	^ self environment allSelectors
+!
+
+availableClassNames
+	^ self environment availableClassNames
+!
+
+availablePackageNames
+	^ self environment availablePackageNames
+!
+
+availablePackages
+	^ self environment availablePackageNames
+!
+
+availableProtocols
+	^ self environment availableProtocolsFor: self selectedClass
+!
+
+forceSelectedClass: aClass
+	self withChangesDo: [
+		self 	
+			selectedClass: nil;
+			selectedClass: aClass ]
+!
+
+forceSelectedMethod: aMethod
+	self withChangesDo: [
+		self 	
+			selectedMethod: nil;
+			selectedMethod: aMethod ]
+!
+
+forceSelectedPackage: aPackage
+	self withChangesDo: [
+		self 	
+			selectedPackage: nil;
+			selectedPackage: aPackage ]
+!
+
+forceSelectedProtocol: aProtocol
+	self withChangesDo: [
+		self 	
+			selectedProtocol: nil;
+			selectedProtocol: aProtocol ]
+!
+
+packageToCommit
+	"Answer the package to commit depending on the context:
+	- if a Method is selected, answer its package
+	- else answer the `selectedPackage`"
+	
+	^ self selectedMethod 
+		ifNil: [ self selectedPackage ]
+		ifNotNil: [ :method | method package ]
+!
+
+packages
+	^ self environment packages
+!
+
+selectedClass
+	^ selectedClass
+!
+
+selectedClass: aClass
+	(self selectedClass = aClass and: [ aClass isNil ]) 
+		ifTrue: [ ^ self ].
+	
+	self withChangesDo: [
+		selectedClass = aClass ifTrue: [ 
+			self selectedProtocol: nil ].
+    
+		aClass 
+   			ifNil: [ selectedClass := nil ]
+    		ifNotNil: [
+				self selectedPackage: aClass theNonMetaClass package.
+				self showInstance 
+   					ifTrue: [ selectedClass := aClass theNonMetaClass ]
+     				ifFalse: [ selectedClass := aClass theMetaClass ] ].
+		self selectedProtocol: nil.
+		self announcer announce: (HLClassSelected on: self selectedClass) ]
+!
+
+selectedMethod
+	^ self selectedClass ifNotNil: [ 
+		self selectedClass methodDictionary 
+			at: selectedSelector 
+			ifAbsent: [ nil ] ]
+!
+
+selectedMethod: aCompiledMethod
+	selectedSelector = aCompiledMethod ifTrue: [ ^ self ].
+    
+    self withChangesDo: [
+		aCompiledMethod
+    		ifNil: [ selectedSelector := nil ]
+      		ifNotNil: [
+				selectedClass := aCompiledMethod methodClass.
+				selectedPackage := selectedClass theNonMetaClass package.
+				selectedSelector := aCompiledMethod selector ].
+
+		self announcer announce: (HLMethodSelected on: aCompiledMethod) ]
+!
+
+selectedPackage
+	^ selectedPackage
+!
+
+selectedPackage: aPackage
+	selectedPackage = aPackage ifTrue: [ ^ self ].
+    
+	self withChangesDo: [
+		selectedPackage := aPackage.
+		self selectedClass: nil.
+		self announcer announce: (HLPackageSelected on: aPackage) ]
+!
+
+selectedProtocol
+	^ selectedProtocol
+!
+
+selectedProtocol: aString
+	selectedProtocol = aString ifTrue: [ ^ self ].
+
+	self withChangesDo: [
+		selectedProtocol := aString.
+		self selectedMethod: nil.
+		self announcer announce: (HLProtocolSelected on: aString) ]
+! !
+
+!HLToolModel methodsFor: 'actions'!
+
+addInstVarNamed: aString
+	self environment addInstVarNamed: aString to: self selectedClass.
+	self announcer announce: (HLInstVarAdded new
+		theClass: self selectedClass;
+		variableName: aString;
+		yourself)
+!
+
+save: aString
+	self announcer announce: HLSourceCodeSaved new.
+	
+	(self shouldCompileClassDefinition: aString)
+		ifTrue: [ self compileClassDefinition: aString ]
+		ifFalse: [ self compileMethod: aString ]
+!
+
+saveSourceCode
+	self announcer announce: HLSaveSourceCode new
+! !
+
+!HLToolModel methodsFor: 'commands actions'!
+
+commitPackageOnSuccess: aBlock onError: anotherBlock
+	self environment 
+		commitPackage: self packageToCommit
+		onSuccess: aBlock
+		onError: anotherBlock
+!
+
+copyClassTo: aClassName
+	self withChangesDo: [ 
+		self environment 
+			copyClass: self selectedClass theNonMetaClass
+			to: aClassName ]
+!
+
+moveClassToPackage: aPackageName
+	self withChangesDo: [
+		self environment 
+			moveClass: self selectedClass theNonMetaClass
+			toPackage: aPackageName ]
+!
+
+moveMethodToClass: aClassName
+	self withChangesDo: [
+		self environment 
+			moveMethod: self selectedMethod 
+			toClass: aClassName ]
+!
+
+moveMethodToProtocol: aProtocol
+	self withChangesDo: [
+		self environment 
+			moveMethod: self selectedMethod 
+			toProtocol: aProtocol ]
+!
+
+openClassNamed: aString
+	| class |
+	
+	self withChangesDo: [
+		class := self environment classNamed: aString.
+		self selectedPackage: class package.
+		self selectedClass: class ]
+!
+
+removeClass
+	self withChangesDo: [
+		self manager 
+			confirm: 'Do you REALLY want to remove class ', self selectedClass theNonMetaClass name
+			ifTrue: [ self environment removeClass: self selectedClass theNonMetaClass ] ]
+!
+
+removeMethod
+	self withChangesDo: [
+		self manager 
+			confirm: 'Do you REALLY want to remove method ', self selectedMethod methodClass name,' >> #', self selectedMethod selector
+			ifTrue: [ self environment removeMethod: self selectedMethod ] ]
+!
+
+removeProtocol
+	self withChangesDo: [
+		self manager 
+			confirm: 'Do you REALLY want to remove protocol ', self selectedProtocol
+			ifTrue: [ self environment 
+				removeProtocol: self selectedProtocol 
+				from: self selectedClass ] ]
+!
+
+renameClassTo: aClassName
+	self withChangesDo: [
+		self environment 
+			renameClass: self selectedClass theNonMetaClass
+			to: aClassName ]
+!
+
+renameProtocolTo: aString
+	self withChangesDo: [
+		self environment 
+			renameProtocol: self selectedProtocol
+			to: aString
+			in: self selectedClass ]
+! !
+
+!HLToolModel methodsFor: 'compiling'!
+
+compileClassComment: aString
+	self environment 
+		compileClassComment: aString 
+		for: self selectedClass
+!
+
+compileClassDefinition: aString
+	self environment compileClassDefinition: aString
+!
+
+compileMethod: aString
+	| method |
+	
+	self withCompileErrorHandling: [ 
+		method := self environment 
+			compileMethod: aString 
+			for: self selectedClass
+			protocol: self compilationProtocol.
+
+		self selectedMethod: method ]
+! !
+
+!HLToolModel methodsFor: 'defaults'!
+
+allProtocol
+	^ '-- all --'
+!
+
+unclassifiedProtocol
+	^ 'as yet unclassified'
+! !
+
+!HLToolModel methodsFor: 'error handling'!
+
+handleCompileError: anError
+	self announcer announce: (HLCompileErrorRaised new
+		error: anError;
+		yourself)
+!
+
+handleParseError: anError
+	| split line column messageToInsert |
+	
+	split := anError messageText tokenize: ' : '.
+	messageToInsert := split second.
+
+	"21 = 'Parse error on line ' size + 1"
+	split := split first copyFrom: 21 to: split first size.
+	
+	split := split tokenize: ' column '.
+	line := split first.
+	column := split second.
+	
+	self announcer announce: (HLParseErrorRaised new
+		line: line asNumber;
+		column: column asNumber;
+		message: messageToInsert;
+		error: anError;
+		yourself)
+!
+
+handleUnkownVariableError: anError
+	self announcer announce: (HLUnknownVariableErrorRaised new
+		error: anError;
+		yourself)
+!
+
+withCompileErrorHandling: aBlock
+	self environment
+		evaluate: [
+			self environment 
+			evaluate: [
+				self environment 
+					evaluate: aBlock
+					on: ParseError
+					do: [ :ex | self handleParseError: ex ] ]
+			on: UnknownVariableError
+			do: [ :ex | self handleUnkownVariableError: ex ] ]
+		on: CompilerError
+		do: [ :ex | self handleCompileError: ex ]
+! !
+
+!HLToolModel methodsFor: 'private'!
+
+compilationProtocol
+	| currentProtocol |
+	
+	currentProtocol := self selectedProtocol.
+	currentProtocol ifNil: [ currentProtocol := self unclassifiedProtocol ].
+	self selectedMethod ifNotNil: [ currentProtocol := self selectedMethod protocol ].
+
+	^ currentProtocol = self allProtocol
+		ifTrue: [ self unclassifiedProtocol ]
+		ifFalse: [ currentProtocol ]
+!
+
+withHelperLabelled: aString do: aBlock
+	"TODO: doesn't belong here"
+
+	'#helper' asJQuery remove.
+
+	[ :html |
+		html div 
+			id: 'helper';
+			with: aString ] appendToJQuery: 'body' asJQuery.
+	
+	[
+		aBlock value.
+		'#helper' asJQuery remove
+	] 
+		valueWithTimeout: 10
+! !
+
+!HLToolModel methodsFor: 'testing'!
+
+isToolModel
+	^ true
+!
+
+shouldCompileClassDefinition: aString
+	^ self selectedClass isNil or: [
+		aString match: '^\s*[A-Z]' ]
+! !
+
+!HLToolModel class methodsFor: 'actions'!
+
+on: anEnvironment
+
+	^ self new
+    	environment: anEnvironment;
+        yourself
+! !
+
+Object subclass: #HLProgressHandler
+	instanceVariableNames: ''
+	package: 'Helios-Core'!
+!HLProgressHandler commentStamp!
+I am a specific progress handler for Helios, displaying progresses in a modal window.!
+
+!HLProgressHandler methodsFor: 'progress handling'!
+
+do: aBlock on: aCollection displaying: aString
+	HLProgressWidget default
+		do: aBlock 
+		on: aCollection 
+		displaying: aString
+! !
+
+Widget subclass: #HLWidget
+	instanceVariableNames: 'wrapper'
+	package: 'Helios-Core'!
+!HLWidget commentStamp!
+I am the abstract superclass of all Helios widgets.
+
+I provide common methods, additional behavior to widgets useful for Helios, like dialog creation, command execution and tab creation.
+
+## API
+
+1. Rendering
+
+    Instead of overriding `#renderOn:` as with other Widget subclasses, my subclasses should override `#renderContentOn:`.
+
+2. Refreshing
+
+    To re-render a widget, use `#refresh`.
+
+3. Key bindings registration and tabs
+
+    When displayed as a tab, the widget has a chance to register keybindings with the `#registerBindingsOn:` hook method.
+    
+4. Unregistration
+
+    When a widget has subscribed to announcements or other actions that need to be cleared when closing the tab, the hook method `#unregister` will be called by helios.
+
+5. Tabs
+
+   To enable a widget class to be open as a tab, override the class-side `#canBeOpenAsTab` method to answer `true`. `#tabClass` and `#tabPriority` can be overridden too to respectively change the css class of the tab and the order of tabs in the main menu.
+
+6. Command execution
+
+    An helios command (instance of `HLCommand` or one of its subclass) can be executed with `#execute:`.!
+
+!HLWidget methodsFor: 'accessing'!
+
+cssClass
+	^ 'hl_widget'
+!
+
+manager
+	^ HLManager current
+!
+
+removeTab
+	self manager removeTabForWidget: self
+!
+
+setTabLabel: aString
+	self manager announcer announce: (HLTabLabelChanged new
+		widget: self;
+		label: aString;
+		yourself)
+!
+
+tabClass
+	^ self class tabClass
+!
+
+wrapper
+	^ wrapper
+! !
+
+!HLWidget methodsFor: 'actions'!
+
+confirm: aString ifTrue: aBlock
+	self manager confirm: aString ifTrue: aBlock
+!
+
+confirm: aString ifTrue: aBlock ifFalse: anotherBlock
+	self manager 
+		confirm: aString 
+		ifTrue: aBlock
+		ifFalse: anotherBlock
+!
+
+execute: aCommand
+	HLManager current keyBinder
+		activate;
+		applyBinding: aCommand asBinding
+!
+
+inform: aString
+	self manager inform: aString
+!
+
+openAsTab
+	(HLTabWidget on: self labelled: self defaultTabLabel)
+		add
+!
+
+request: aString do: aBlock
+	self manager request: aString do: aBlock
+!
+
+request: aString value: valueString do: aBlock
+	self manager 
+		request: aString 
+		value: valueString
+		do: aBlock
+!
+
+unregister
+	"This method is called whenever the receiver is closed (as a tab).
+	Widgets subscribing to announcements should unregister there"
+! !
+
+!HLWidget methodsFor: 'defaults'!
+
+defaultTabLabel
+	^ self class tabLabel
+! !
+
+!HLWidget methodsFor: 'keybindings'!
+
+bindKeyDown: keyDownBlock keyUp: keyUpBlock
+	self wrapper asJQuery
+		keydown: keyDownBlock;
+		keyup: keyUpBlock
+!
+
+registerBindings
+	self registerBindingsOn: self manager keyBinder bindings
+!
+
+registerBindingsOn: aBindingGroup
+!
+
+unbindKeyDownKeyUp
+	self wrapper asJQuery
+		unbind: 'keydown';
+		unbind: 'keyup'
+! !
+
+!HLWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+!
+
+renderOn: html
+	wrapper := html div
+		class: self cssClass;
+		yourself.
+    [ :renderer | self renderContentOn: renderer ] appendToJQuery: wrapper asJQuery
+! !
+
+!HLWidget methodsFor: 'testing'!
+
+canHaveFocus
+	^ false
+! !
+
+!HLWidget methodsFor: 'updating'!
+
+refresh
+	self wrapper ifNil: [ ^ self ].
+    
+	self wrapper asJQuery empty.
+    [ :html | self renderContentOn: html ] appendToJQuery: self wrapper asJQuery
+! !
+
+!HLWidget class methodsFor: 'accessing'!
+
+openAsTab
+	| instance |
+	
+	instance := self new.
+	(HLTabWidget 
+		on: instance 
+		labelled: instance defaultTabLabel) add.
+	^ instance
+!
+
+tabClass
+	^ ''
+!
+
+tabLabel
+	^ 'Tab'
+!
+
+tabPriority
+	^ 500
+! !
+
+!HLWidget class methodsFor: 'testing'!
+
+canBeOpenAsTab
+	^ false
+! !
+
+HLWidget subclass: #HLFocusableWidget
+	instanceVariableNames: ''
+	package: 'Helios-Core'!
+!HLFocusableWidget commentStamp!
+I am a widget that can be focused.
+
+## API 
+
+Instead of overriding `#renderOn:` as with other `Widget` subclasses, my subclasses should override `#renderContentOn:`.
+
+To bring the focus to the widget, use the `#focus` method.!
+
+!HLFocusableWidget methodsFor: 'accessing'!
+
+focusClass
+	^ 'focused'
+! !
+
+!HLFocusableWidget methodsFor: 'events'!
+
+blur
+	self wrapper asJQuery blur
+!
+
+focus
+	self wrapper asJQuery focus
+! !
+
+!HLFocusableWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+!
+
+renderOn: html
+    wrapper := html div 
+    	class: self cssClass;
+		yourself.
+		
+       wrapper with: [ self renderContentOn: html ].
+	
+	wrapper
+		at: 'tabindex' put: '0';
+		onBlur: [ self wrapper asJQuery removeClass: self focusClass ];
+        onFocus: [ self wrapper asJQuery addClass: self focusClass ]
+! !
+
+!HLFocusableWidget methodsFor: 'testing'!
+
+canHaveFocus
+	^ true
+!
+
+hasFocus
+	^ self wrapper notNil and: [ self wrapper asJQuery hasClass: self focusClass ]
+! !
+
+HLFocusableWidget subclass: #HLListWidget
+	instanceVariableNames: 'items selectedItem'
+	package: 'Helios-Core'!
+
+!HLListWidget methodsFor: 'accessing'!
+
+cssClassForItem: anObject
+	^ ''
+!
+
+findListItemFor: anObject
+	^ (((wrapper asJQuery find: 'li') 
+		filter: [ :thisArg :otherArg | (thisArg asJQuery data: 'item') = anObject ] currySelf) eq: 0)
+!
+
+items
+	^ items ifNil: [ items := self defaultItems ]
+!
+
+items: aCollection
+	items := aCollection
+!
+
+listCssClassForItem: anObject
+	^ self selectedItem = anObject
+		ifTrue: [ 'active' ]
+		ifFalse: [ 'inactive' ]
+!
+
+positionOf: aListItem
+	<
+    	return aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1
+	>
+!
+
+selectedItem
+	^ selectedItem
+!
+
+selectedItem: anObject
+	selectedItem := anObject
+! !
+
+!HLListWidget methodsFor: 'actions'!
+
+activateFirstListItem
+	self activateListItem: ((wrapper asJQuery find: 'li.inactive') eq: 0)
+!
+
+activateItem: anObject
+	self activateListItem: (self findListItemFor: anObject)
+!
+
+activateListItem: aListItem
+	| item |
+	
+	(aListItem get: 0) ifNil: [ ^ self ].
+	aListItem parent children removeClass: 'active'.
+	aListItem addClass: 'active'.
+    
+	self ensureVisible: aListItem.
+    
+   "Activate the corresponding item"
+   item := aListItem data: 'item'.
+   self selectedItem == item ifFalse: [
+	   self selectItem: item ]
+!
+
+activateNextListItem
+	self activateListItem: (self wrapper asJQuery find: 'li.active') next.
+	
+	"select the first item if none is selected"
+	(self wrapper asJQuery find: ' .active') get ifEmpty: [
+		self activateFirstListItem ]
+!
+
+activatePreviousListItem
+	self activateListItem: (self wrapper asJQuery find: 'li.active') prev
+!
+
+ensureVisible: aListItem	
+	"Move the scrollbar to show the active element"
+	
+	| parent position |
+	(aListItem get: 0) ifNil: [ ^ self ].
+	position := self positionOf: aListItem.
+	parent := aListItem parent.
+	
+    aListItem position top < 0 ifTrue: [
+		(parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem position top - 10) ].
+    aListItem position top + aListItem height > parent height ifTrue: [ 
+		(parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem height - (parent height - aListItem position top)) +10 ]
+!
+
+focus
+	super focus.
+    self items isEmpty ifFalse: [ 
+		self selectedItem ifNil: [ self activateFirstListItem ] ]
+!
+
+reactivateListItem: aListItem
+	self activateListItem: aListItem.
+	self reselectItem: self selectedItem
+!
+
+refresh
+	super refresh.
+	self selectedItem ifNotNil: [self ensureVisible: (self findListItemFor: self selectedItem)].
+!
+
+reselectItem: anObject
+!
+
+selectItem: anObject
+	self selectedItem: anObject
+! !
+
+!HLListWidget methodsFor: 'defaults'!
+
+defaultItems
+	^ #()
+! !
+
+!HLListWidget methodsFor: 'events'!
+
+setupKeyBindings 
+	(HLRepeatedKeyDownHandler on: self)
+		whileKeyDown: 38 do: [ self activatePreviousListItem ];
+		whileKeyDown: 40 do: [ self activateNextListItem ];
+		rebindKeys.
+		
+	self wrapper asJQuery keydown: [ :e |
+        e which = 13 ifTrue: [ 
+        	self reselectItem: self selectedItem ] ]
+! !
+
+!HLListWidget methodsFor: 'rendering'!
+
+renderButtonsOn: html
+!
+
+renderContentOn: html
+	html ul 
+    	class: 'nav nav-pills nav-stacked';
+        with: [ self renderListOn: html ].
+    html div class: 'pane_actions form-actions'; with: [
+      	self renderButtonsOn: html ].
+        
+   self setupKeyBindings
+!
+
+renderItem: anObject on: html
+	| li |
+    
+	li := html li.
+	li asJQuery data: 'item' put: anObject.
+    li
+		class: (self listCssClassForItem: anObject);
+        with: [ 
+        	html a
+            	with: [ 
+            		(html tag: 'i') class: (self cssClassForItem: anObject).
+  					self renderItemLabel: anObject on: html ];
+				onClick: [
+                  	self reactivateListItem: li asJQuery ] ]
+!
+
+renderItemLabel: anObject on: html
+	html with: anObject asString
+!
+
+renderListOn: html
+	self items do: [ :each  | 
+    	self renderItem: each  on: html ]
+! !
+
+HLListWidget subclass: #HLNavigationListWidget
+	instanceVariableNames: 'previous next'
+	package: 'Helios-Core'!
+
+!HLNavigationListWidget methodsFor: 'accessing'!
+
+next
+	^ next
+!
+
+next: aWidget
+	next := aWidget.
+    aWidget previous = self ifFalse: [ aWidget previous: self ]
+!
+
+previous
+	^ previous
+!
+
+previous: aWidget
+	previous := aWidget.
+    aWidget next = self ifFalse: [ aWidget next: self ]
+! !
+
+!HLNavigationListWidget methodsFor: 'actions'!
+
+nextFocus
+	self next ifNotNil: [ self next focus ]
+!
+
+previousFocus
+	self previous ifNotNil: [ self previous focus ]
+! !
+
+!HLNavigationListWidget methodsFor: 'events'!
+
+setupKeyBindings
+	super setupKeyBindings.
+
+	self wrapper asJQuery keydown: [ :e |
+        e which = 39 ifTrue: [ 
+        	self nextFocus ].
+		e which = 37 ifTrue: [ 
+        	self previousFocus ] ]
+! !
+
+HLNavigationListWidget subclass: #HLToolListWidget
+	instanceVariableNames: 'model'
+	package: 'Helios-Core'!
+
+!HLToolListWidget methodsFor: 'accessing'!
+
+commandCategory
+	^ self label
+!
+
+label
+	^ 'List'
+!
+
+menuCommands
+	"Answer a collection of commands to be put in the cog menu"
+	
+	^ ((HLToolCommand concreteClasses
+		select: [ :each | each isValidFor: self model ])
+			collect: [ :each | each for: self model ])
+			select: [ :each | 
+				each category = self commandCategory and: [ 
+					each isAction and: [ each isActive ] ] ]
+!
+
+model
+	^ model
+!
+
+model: aBrowserModel
+	model := aBrowserModel.
+    
+    self 
+		observeSystem;
+		observeModel
+!
+
+selectedItem: anItem
+	"Selection changed, update the cog menu"
+	
+	super selectedItem: anItem.
+	self updateMenu
+! !
+
+!HLToolListWidget methodsFor: 'actions'!
+
+activateListItem: anItem
+	self model withChangesDo: [ super activateListItem: anItem ]
+!
+
+activateNextListItem
+	self model withChangesDo: [ super activateNextListItem ]
+!
+
+activatePreviousListItem
+	self model withChangesDo: [ super activatePreviousListItem ]
+!
+
+observeModel
+!
+
+observeSystem
+!
+
+reactivateListItem: anItem
+	self model withChangesDo: [ super reactivateListItem: anItem ]
+!
+
+unregister
+	super unregister.
+	
+	self model announcer unsubscribe: self.
+	self model systemAnnouncer unsubscribe: self
+! !
+
+!HLToolListWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+	self renderHeadOn: html.	
+	super renderContentOn: html
+!
+
+renderHeadOn: html
+	html div 
+		class: 'list-label';
+		with: [
+			html with: self label.
+			self renderMenuOn: html ]
+!
+
+renderMenuOn: html
+	| commands |
+	
+	commands := self menuCommands.
+	commands isEmpty ifTrue: [ ^ self ].
+	
+	html div 
+		class: 'btn-group cog';
+		with: [
+			html a
+				class: 'btn dropdown-toggle';
+				at: 'data-toggle' put: 'dropdown';
+				with: [ (html tag: 'i') class: 'icon-chevron-down' ].
+		html ul 
+			class: 'dropdown-menu pull-right';
+			with: [ 
+				self menuCommands do: [ :each | 
+					html li with: [ html a 
+						with: each menuLabel;
+						onClick: [ self execute: each ] ] ] ] ]
+! !
+
+!HLToolListWidget methodsFor: 'updating'!
+
+updateMenu
+	(self wrapper asJQuery find: '.cog') remove.
+	
+	[ :html | self renderMenuOn: html ] 
+		appendToJQuery: (self wrapper asJQuery find: '.list-label')
+! !
+
+!HLToolListWidget class methodsFor: 'instance creation'!
+
+on: aModel
+	^ self new 
+    	model: aModel;
+        yourself
+! !
+
+HLListWidget subclass: #HLTabListWidget
+	instanceVariableNames: 'callback'
+	package: 'Helios-Core'!
+!HLTabListWidget commentStamp!
+I am a widget used to display a list of helios tabs.
+
+When a tab is selected, `callback` is evaluated with the selected tab as argument.!
+
+!HLTabListWidget methodsFor: 'accessing'!
+
+callback
+	^ callback ifNil: [ [] ]
+!
+
+callback: aBlock
+	callback := aBlock
+! !
+
+!HLTabListWidget methodsFor: 'actions'!
+
+selectItem: aTab
+	super selectItem: aTab.
+	self callback value: aTab
+! !
+
+!HLTabListWidget methodsFor: 'rendering'!
+
+renderItemLabel: aTab on: html
+	html span
+		class: aTab cssClass;
+		with: aTab label
+! !
+
+HLWidget subclass: #HLInformationWidget
+	instanceVariableNames: 'informationString'
+	package: 'Helios-Core'!
+!HLInformationWidget commentStamp!
+I display an information dialog.
+
+## API
+
+`HLWidget >> #inform:` is a convenience method for creating information dialogs.!
+
+!HLInformationWidget methodsFor: 'accessing'!
+
+informationString
+	^ informationString ifNil: [ '' ]
+!
+
+informationString: anObject
+	informationString := anObject
+! !
+
+!HLInformationWidget methodsFor: 'actions'!
+
+remove
+	[ 
+		self wrapper asJQuery fadeOut: 100.
+		[ self wrapper asJQuery remove ]
+			valueWithTimeout: 400.
+	]
+		valueWithTimeout: 1500
+!
+
+show
+	self appendToJQuery: 'body' asJQuery
+! !
+
+!HLInformationWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+	html div 
+		class: 'growl'; 
+		with: self informationString.
+		
+	self remove
+! !
+
+HLWidget subclass: #HLManager
+	instanceVariableNames: 'tabsWidget environment history announcer'
+	package: 'Helios-Core'!
+
+!HLManager methodsFor: 'accessing'!
+
+activeTab
+	^ self tabsWidget activeTab
+!
+
+announcer
+	^ announcer ifNil: [ announcer := Announcer new ]
+!
+
+environment
+	"The default environment used by all Helios objects"
+    
+	^ environment ifNil: [ environment := self defaultEnvironment ]
+!
+
+environment: anEnvironment
+	environment := anEnvironment
+!
+
+history
+	^ history ifNil: [ history := OrderedCollection new ]
+!
+
+history: aCollection
+	history := aCollection
+!
+
+keyBinder
+	^ HLKeyBinder current
+!
+
+setEditorTheme: aTheme
+
+	'helios.editorTheme' asSetting value: aTheme
+!
+
+setTheme: aTheme
+	| currentTheme |
+
+	currentTheme := 'helios.theme' asSettingIfAbsent: 'default'.
+	
+	'body' asJQuery
+		removeClass: currentTheme value;
+		addClass: aTheme.
+		
+	
+	'helios.theme' asSetting value: aTheme
+!
+
+tabWidth
+	^ (window asJQuery width - 90) / self tabs size
+!
+
+tabs
+	^ self tabsWidget tabs
+!
+
+tabsWidget
+	^ tabsWidget ifNil: [ tabsWidget := HLTabsWidget new ]
+! !
+
+!HLManager methodsFor: 'actions'!
+
+activate: aTab
+	self tabsWidget activate: aTab
+!
+
+addTab: aTab
+	self tabsWidget addTab: aTab
+!
+
+confirm: aString ifFalse: aBlock
+	self 
+		confirm: aString
+		ifTrue: []
+		ifFalse: aBlock
+!
+
+confirm: aString ifTrue: aBlock
+	self 
+		confirm: aString
+		ifTrue: aBlock
+		ifFalse: []
+!
+
+confirm: aString ifTrue: aBlock ifFalse: anotherBlock
+	HLConfirmationWidget new
+		confirmationString: aString;
+		actionBlock: aBlock;
+		cancelBlock: anotherBlock;
+		show
+!
+
+inform: aString
+	HLInformationWidget new
+		informationString: aString;
+		show
+!
+
+removeActiveTab
+	self tabsWidget removeActiveTab
+!
+
+removeTabForWidget: aWidget
+	self tabsWidget removeTabForWidget: aWidget
+!
+
+request: aString do: aBlock
+	self 
+		request: aString
+		value: ''
+		do: aBlock
+!
+
+request: aString value: valueString do: aBlock
+	HLRequestWidget new
+		confirmationString: aString;
+		actionBlock: aBlock;
+		value: valueString;
+		show
+! !
+
+!HLManager methodsFor: 'defaults'!
+
+defaultEnvironment
+	"If helios is loaded from within a frame, answer the parent window environment"
+	
+	| parent parentSmalltalkGlobals |
+	
+	parent := window opener ifNil: [ window parent ].
+	parent ifNil: [ ^ Environment new ].
+	
+	parentSmalltalkGlobals := (parent at: 'requirejs') value: 'amber_vm/globals'.
+	parentSmalltalkGlobals ifNil: [ ^ Environment new ].
+	
+	^ (parentSmalltalkGlobals at: 'Environment') new
+! !
+
+!HLManager methodsFor: 'initialization'!
+
+setup
+	self 
+		registerServices;
+		setupEvents.
+    self keyBinder setupEvents.
+	self tabsWidget setupEvents.
+	self setupTheme.
+	
+	
+	'#helper' asJQuery fadeOut
+! !
+
+!HLManager methodsFor: 'private'!
+
+registerServices
+	self
+		registerInspector;
+		registerErrorHandler;
+		registerProgressHandler;
+		registerTranscript;
+		registerFinder
+!
+
+setupEvents
+	'body' asJQuery keydown: [ :event |
+			
+		"On ctrl keydown, adds a 'navigation' css class to <body>
+		for the CodeMirror navigation links. See `HLCodeWidget`."
+		event ctrlKey ifTrue: [
+			'body' asJQuery addClass: 'navigation' ] ].
+			
+	'body' asJQuery keyup: [ :event |
+		'body' asJQuery removeClass: 'navigation' ].
+		
+	window asJQuery resize: [ :event |
+		self refresh ]
+!
+
+setupTheme
+	"self 
+		setTheme: 'niflheim';
+		setEditorTheme: 'niflheim'."
+		
+	self 
+		setTheme: 'default';
+		setEditorTheme: 'default'.
+! !
+
+!HLManager methodsFor: 'rendering'!
+
+renderContentOn: html
+	html with: self tabsWidget.
+	html with: HLWelcomeWidget new
+! !
+
+!HLManager methodsFor: 'services'!
+
+registerErrorHandler
+	self environment registerErrorHandler: HLErrorHandler new.
+	ErrorHandler register: HLErrorHandler new
+!
+
+registerFinder
+	self environment registerFinder: HLFinder new.
+	Finder register: HLFinder new
+!
+
+registerInspector
+	self environment registerInspector: HLInspector.
+	Inspector register: HLInspector
+!
+
+registerProgressHandler
+	self environment registerProgressHandler: HLProgressHandler new.
+	ProgressHandler register: HLProgressHandler new
+!
+
+registerTranscript
+	self environment registerTranscript: HLTranscriptHandler
+! !
+
+HLManager class instanceVariableNames: 'current'!
+
+!HLManager class methodsFor: 'accessing'!
+
+current
+	^ current ifNil: [ current := self basicNew initialize ]
+! !
+
+!HLManager class methodsFor: 'initialization'!
+
+setup
+	self current 
+		setup;
+		appendToJQuery: 'body' asJQuery
+! !
+
+!HLManager class methodsFor: 'instance creation'!
+
+new
+	"Use current instead"
+
+	self shouldNotImplement
+! !
+
+HLWidget subclass: #HLModalWidget
+	instanceVariableNames: ''
+	package: 'Helios-Core'!
+!HLModalWidget commentStamp!
+I implement an abstract modal widget.!
+
+!HLModalWidget methodsFor: 'actions'!
+
+remove
+	'.dialog' asJQuery removeClass: 'active'.
+	[ 
+		'#overlay' asJQuery remove.
+		wrapper asJQuery remove
+	] valueWithTimeout: 300
+!
+
+show
+	self appendToJQuery: 'body' asJQuery
+! !
+
+!HLModalWidget methodsFor: 'private'!
+
+giveFocusToButton: aButton
+	aButton asJQuery focus
+! !
+
+!HLModalWidget methodsFor: 'rendering'!
+
+hasButtons
+	^ true
+!
+
+renderButtonsOn: html
+!
+
+renderContentOn: html
+	| confirmButton |
+	
+	html div id: 'overlay'.
+	
+	html div 
+		class: 'dialog ', self cssClass;
+		with: [
+			self renderMainOn: html.
+			self hasButtons ifTrue: [ 
+				self renderButtonsOn: html ] ].
+
+	'.dialog' asJQuery addClass: 'active'.
+	self setupKeyBindings
+!
+
+renderMainOn: html
+!
+
+setupKeyBindings
+	'.dialog' asJQuery keyup: [ :e |
+		e keyCode = String esc asciiValue ifTrue: [ self cancel ] ]
+! !
+
+HLModalWidget subclass: #HLConfirmationWidget
+	instanceVariableNames: 'cancelButtonLabel confirmButtonLabel confirmationString actionBlock cancelBlock'
+	package: 'Helios-Core'!
+!HLConfirmationWidget commentStamp!
+I display confirmation dialog. 
+
+## API
+
+HLWidget contains convenience methods like `HLWidget >> #confirm:ifTrue:` for creating confirmation dialogs.!
+
+!HLConfirmationWidget methodsFor: 'accessing'!
+
+actionBlock
+	^ actionBlock ifNil: [ [] ]
+!
+
+actionBlock: aBlock
+	actionBlock := aBlock
+!
+
+cancelBlock
+	^ cancelBlock ifNil: [ [] ]
+!
+
+cancelBlock: aBlock
+	cancelBlock := aBlock
+!
+
+cancelButtonLabel
+	^ cancelButtonLabel ifNil: [ 'Cancel' ]
+!
+
+cancelButtonLabel: aString
+	^ cancelButtonLabel := aString
+!
+
+confirmButtonLabel
+	^ confirmButtonLabel ifNil: [ 'Confirm' ]
+!
+
+confirmButtonLabel: aString
+	^ confirmButtonLabel := aString
+!
+
+confirmationString
+	^ confirmationString ifNil: [ 'Confirm' ]
+!
+
+confirmationString: aString
+	confirmationString := aString
+! !
+
+!HLConfirmationWidget methodsFor: 'actions'!
+
+cancel
+	self cancelBlock value.
+	self remove
+!
+
+confirm
+	self remove.
+	self actionBlock value
+! !
+
+!HLConfirmationWidget methodsFor: 'rendering'!
+
+renderButtonsOn: html
+	| confirmButton |
+	
+	html div 
+		class: 'buttons';
+		with: [
+			html button
+				class: 'button';
+				with: self cancelButtonLabel;
+				onClick: [ self cancel ].
+			confirmButton := html button
+				class: 'button default';
+				with: self confirmButtonLabel;
+				onClick: [ self confirm ] ].
+
+	self giveFocusToButton:confirmButton
+!
+
+renderMainOn: html
+	html span 
+		class: 'head'; 
+		with: self confirmationString
+! !
+
+HLConfirmationWidget subclass: #HLRequestWidget
+	instanceVariableNames: 'input multiline value'
+	package: 'Helios-Core'!
+!HLRequestWidget commentStamp!
+I display a modal window requesting user input.
+
+## API
+
+`HLWidget >> #request:do:` and `#request:value:do:` are convenience methods for creating modal request dialogs.!
+
+!HLRequestWidget methodsFor: 'accessing'!
+
+beMultiline
+	multiline := true
+!
+
+beSingleline
+	multiline := false
+!
+
+cssClass
+	^ 'large'
+!
+
+value
+	^ value ifNil: [ '' ]
+!
+
+value: aString
+	value := aString
+! !
+
+!HLRequestWidget methodsFor: 'actions'!
+
+confirm
+	| val |
+	val := input asJQuery val.
+	self remove.
+	self actionBlock value: val
+! !
+
+!HLRequestWidget methodsFor: 'private'!
+
+giveFocusToButton: aButton
+! !
+
+!HLRequestWidget methodsFor: 'rendering'!
+
+renderMainOn: html
+	super renderMainOn: html.
+	self isMultiline
+		ifTrue: [ input := html textarea ]
+		ifFalse: [ input := html input 
+			type: 'text';
+			onKeyDown: [ :event |
+				event keyCode = 13 ifTrue: [
+					self confirm ] ];
+			yourself ].
+	input asJQuery 
+		val: self value;
+		focus
+! !
+
+!HLRequestWidget methodsFor: 'testing'!
+
+isMultiline
+	^ multiline ifNil: [ true ]
+! !
+
+HLModalWidget subclass: #HLProgressWidget
+	instanceVariableNames: 'progressBars visible'
+	package: 'Helios-Core'!
+!HLProgressWidget commentStamp!
+I am a widget used to display progress modal dialogs.
+
+My default instance is accessed with `HLProgressWidget class >> #default`.
+
+See `HLProgressHandler` for usage.!
+
+!HLProgressWidget methodsFor: 'accessing'!
+
+progressBars
+	^ progressBars ifNil: [ progressBars := OrderedCollection new ]
+! !
+
+!HLProgressWidget methodsFor: 'actions'!
+
+addProgressBar: aProgressBar
+	self show.
+	self progressBars add: aProgressBar.
+	aProgressBar appendToJQuery: (self wrapper asJQuery find: '.dialog')
+!
+
+do: aBlock on: aCollection displaying: aString
+	| progressBar |
+	
+	progressBar := HLProgressBarWidget new
+		parent: self;
+		label: aString;
+		workBlock: aBlock;
+		collection: aCollection;
+		yourself.
+	
+	self addProgressBar: progressBar.
+	progressBar start
+!
+
+flush
+	self progressBars do: [ :each |
+		self removeProgressBar: each ]
+!
+
+remove
+	self isVisible ifTrue: [
+		visible := false.
+		super remove ]
+!
+
+removeProgressBar: aProgressBar
+	self progressBars remove: aProgressBar ifAbsent: [].
+	aProgressBar wrapper asJQuery remove.
+	
+	self progressBars ifEmpty: [ self remove ]
+!
+
+show
+	self isVisible ifFalse: [
+		visible := true.
+		super show ]
+! !
+
+!HLProgressWidget methodsFor: 'rendering'!
+
+renderMainOn: html
+	self progressBars do: [ :each |
+		html with: each ]
+! !
+
+!HLProgressWidget methodsFor: 'testing'!
+
+hasButtons
+	^ false
+!
+
+isVisible
+	^ visible ifNil: [ false ]
+! !
+
+HLProgressWidget class instanceVariableNames: 'default'!
+
+!HLProgressWidget class methodsFor: 'accessing'!
+
+default
+	^ default ifNil: [ default := self new ]
+! !
+
+HLModalWidget subclass: #HLTabSelectionWidget
+	instanceVariableNames: 'tabs tabList selectedTab selectCallback cancelCallback confirmCallback'
+	package: 'Helios-Core'!
+!HLTabSelectionWidget commentStamp!
+I am a modal window used to select or create tabs.!
+
+!HLTabSelectionWidget methodsFor: 'accessing'!
+
+cancelCallback
+	^ cancelCallback ifNil: [ [] ]
+!
+
+cancelCallback: aBlock
+	cancelCallback := aBlock
+!
+
+confirmCallback
+	^ confirmCallback ifNil: [ [] ]
+!
+
+confirmCallback: aBlock
+	confirmCallback := aBlock
+!
+
+selectCallback
+	^ selectCallback ifNil: [ [] ]
+!
+
+selectCallback: aBlock
+	selectCallback := aBlock
+!
+
+selectedTab
+	^ selectedTab
+!
+
+selectedTab: aTab
+	selectedTab := aTab
+!
+
+tabs
+	^ tabs ifNil: [ #() ]
+!
+
+tabs: aCollection
+	tabs := aCollection
+! !
+
+!HLTabSelectionWidget methodsFor: 'actions'!
+
+cancel
+	self remove.
+	self cancelCallback value
+!
+
+confirm
+	self remove.
+	self confirmCallback value: self selectedTab
+!
+
+selectTab: aTab
+	self selectedTab: aTab.
+	self selectCallback value: aTab
+!
+
+setupKeyBindings
+	super setupKeyBindings.
+	'.dialog' asJQuery keyup: [ :e |
+		e keyCode = String cr asciiValue ifTrue: [ self confirm ] ]
+! !
+
+!HLTabSelectionWidget methodsFor: 'rendering'!
+
+renderButtonsOn: html
+	| confirmButton |
+	
+	html div 
+		class: 'buttons';
+		with: [
+			html button
+				class: 'button';
+				with: 'Cancel';
+				onClick: [ self cancel ].
+			confirmButton := html button
+				class: 'button default';
+				with: 'Select tab';
+				onClick: [ self confirm ] ].
+
+	self giveFocusToButton:confirmButton
+!
+
+renderContentOn: html
+	super renderContentOn: html.
+	self tabList focus
+!
+
+renderMainOn: html
+	html div 
+		class: 'title'; 
+		with: 'Tab selection'.
+	
+	html with: self tabList
+!
+
+renderTab: aTab on: html
+	html 
+		span 
+			class: aTab cssClass;
+			with: aTab label
+!
+
+renderTabsOn: html
+	self tabs do: [ :each |
+		html li with: [ 
+			html a 
+				with: [ 
+					self renderTab: each on: html ];
+				onClick: [ self selectTab: each ] ] ]
+!
+
+tabList
+	tabList ifNil: [ 
+		tabList := HLTabListWidget new.
+		tabList
+			callback: [ :tab | self selectTab: tab. tabList focus ];
+			selectedItem: self selectedTab;
+			items: self tabs ].
+	
+	^ tabList
+! !
+
+HLWidget subclass: #HLProgressBarWidget
+	instanceVariableNames: 'label parent workBlock collection bar'
+	package: 'Helios-Core'!
+!HLProgressBarWidget commentStamp!
+I am a widget used to display a progress bar while iterating over a collection.!
+
+!HLProgressBarWidget methodsFor: 'accessing'!
+
+collection
+	^ collection
+!
+
+collection: aCollection
+	collection := aCollection
+!
+
+label
+	^ label
+!
+
+label: aString
+	label := aString
+!
+
+parent
+	^ parent
+!
+
+parent: aProgress
+	parent := aProgress
+!
+
+workBlock
+	^ workBlock
+!
+
+workBlock: aBlock
+	workBlock := aBlock
+! !
+
+!HLProgressBarWidget methodsFor: 'actions'!
+
+evaluateAt: anInteger
+	self updateProgress: (anInteger / self collection size) * 100.
+	anInteger <= self collection size
+		ifTrue: [ 
+			[ 
+				self workBlock value: (self collection at: anInteger).
+				self evaluateAt: anInteger + 1 ] valueWithTimeout: 10 ]
+		ifFalse: [ [ self remove ] valueWithTimeout: 500 ]
+!
+
+remove
+	self parent removeProgressBar: self
+!
+
+start
+	"Make sure the UI has some time to update itself between each iteration"
+	
+	self evaluateAt: 1
+!
+
+updateProgress: anInteger
+	bar asJQuery css: 'width' put: anInteger asString, '%'
+! !
+
+!HLProgressBarWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+	html span with: self label.
+	html div 
+		class: 'progress';
+		with: [
+			bar := html div 
+				class: 'bar';
+				style: 'width: 0%' ]
+! !
+
+HLProgressBarWidget class instanceVariableNames: 'default'!
+
+!HLProgressBarWidget class methodsFor: 'accessing'!
+
+default
+	^ default ifNil: [ default := self new ]
+! !
+
+HLWidget subclass: #HLTabWidget
+	instanceVariableNames: 'widget label root'
+	package: 'Helios-Core'!
+!HLTabWidget commentStamp!
+I am a widget specialized into building another widget as an Helios tab.
+
+I should not be used directly, `HLWidget class >> #openAsTab` should be used instead.
+
+## Example
+
+    HLWorkspace openAsTab!
+
+!HLTabWidget methodsFor: 'accessing'!
+
+activate
+	self manager activate: self
+!
+
+cssClass
+	^ self widget tabClass
+!
+
+focus
+	self widget canHaveFocus ifTrue: [
+		self widget focus ]
+!
+
+label
+	^ label ifNil: [ '' ]
+!
+
+label: aString
+	label := aString
+!
+
+manager
+	^ HLManager current
+!
+
+widget
+	^ widget
+!
+
+widget: aWidget
+	widget := aWidget
+! !
+
+!HLTabWidget methodsFor: 'actions'!
+
+add
+	self manager addTab: self.
+	self observeManager
+!
+
+hide
+	root ifNotNil: [ root asJQuery css: 'visibility' put: 'hidden' ]
+!
+
+observeManager
+	self manager announcer 
+		on: HLTabLabelChanged
+		send: #onTabLabelChanged:
+		to: self
+!
+
+registerBindings
+	self widget registerBindings
+!
+
+remove
+	self unregister.
+	self widget unregister.
+	root ifNotNil: [ root asJQuery remove ]
+!
+
+show
+	root
+		ifNil: [ self appendToJQuery: 'body' asJQuery ]
+		ifNotNil: [ root asJQuery css: 'visibility' put: 'visible' ]
+!
+
+unregister
+	self manager announcer unsubscribe: self
+! !
+
+!HLTabWidget methodsFor: 'reactions'!
+
+onTabLabelChanged: anAnnouncement
+	anAnnouncement widget = self widget ifTrue: [
+		self label = anAnnouncement label ifFalse: [
+			self label: anAnnouncement label.
+			self manager refresh ] ]
+! !
+
+!HLTabWidget methodsFor: 'rendering'!
+
+renderOn: html
+	root := html div
+		class: 'tab';
+		yourself.
+	self renderTab
+!
+
+renderTab
+	root contents: [ :html |
+		html div
+			class: 'amber_box';
+			with: [ self widget renderOn: html ] ]
+! !
+
+!HLTabWidget methodsFor: 'testing'!
+
+isActive
+	^ self manager activeTab = self
+! !
+
+!HLTabWidget class methodsFor: 'instance creation'!
+
+on: aWidget labelled: aString
+	^ self new
+		widget: aWidget;
+		label: aString;
+		yourself
+! !
+
+HLWidget subclass: #HLTabsWidget
+	instanceVariableNames: 'tabs activeTab history selectionDisabled'
+	package: 'Helios-Core'!
+
+!HLTabsWidget methodsFor: 'accessing'!
+
+activeTab
+	^ activeTab
+!
+
+history
+	^ history ifNil: [ history := OrderedCollection new ]
+!
+
+history: aCollection
+	history := aCollection
+!
+
+tabWidth
+	^ (window asJQuery width - 90) / self tabs size
+!
+
+tabs
+	^ tabs ifNil: [ tabs := OrderedCollection new ]
+! !
+
+!HLTabsWidget methodsFor: 'actions'!
+
+activate: aTab
+	self isSelectionDisabled ifTrue: [ ^ self ].
+
+	self manager keyBinder flushBindings.
+	aTab registerBindings.
+	activeTab := aTab.
+	
+	self 
+		refresh;
+		addToHistory: aTab;
+		show: aTab
+!
+
+activateNextTab
+	| nextTab |
+	
+	self tabs ifEmpty: [ ^ self ].
+	
+	nextTab := self tabs 
+		at: (self tabs indexOf: self activeTab) + 1 
+		ifAbsent: [ self tabs first ].
+		
+	self activate: nextTab
+!
+
+activatePreviousTab
+	| previousTab |
+	
+	self tabs ifEmpty: [ ^ self ].
+	
+	previousTab := self tabs 
+		at: (self tabs indexOf: self activeTab) - 1 
+		ifAbsent: [ self tabs last ].
+		
+	self activate: previousTab
+!
+
+addTab: aTab
+	self tabs add: aTab.
+    self activate: aTab
+!
+
+addToHistory: aTab
+	self removeFromHistory: aTab.
+	self history add: aTab
+!
+
+disableSelection
+	selectionDisabled := true
+!
+
+enableSelection
+	selectionDisabled := false
+!
+
+removeActiveTab
+	self removeTab: self activeTab
+!
+
+removeFromHistory: aTab
+	self history: (self history reject: [ :each | each == aTab ])
+!
+
+removeTab: aTab
+	(self tabs includes: aTab) ifFalse: [ ^ self ].
+
+	self removeFromHistory: aTab.
+	self tabs remove: aTab.
+	self manager keyBinder flushBindings.
+	aTab remove.
+	self refresh.
+	self history ifNotEmpty: [
+		self history last activate ]
+!
+
+removeTabForWidget: aWidget
+	self removeTab: (self tabs 
+		detect: [ :each | each widget = aWidget ]
+		ifNone: [ ^ self ])
+!
+
+updateTabsOrder
+	tabs := '.main-tabs li' asJQuery toArray 
+		collect: [ :each | each at: 'tab-data' ]
+! !
+
+!HLTabsWidget methodsFor: 'private'!
+
+setupEvents
+	'body' asJQuery keydown: [ :event |
+	
+		"ctrl+> and ctrl+<"
+		(event ctrlKey and: [ event which = 188 ]) ifTrue: [
+			self activatePreviousTab.
+			event preventDefault ].
+		(event ctrlKey and: [ event which = 190 ]) ifTrue: [
+			self activateNextTab.
+			event preventDefault ] ]
+! !
+
+!HLTabsWidget methodsFor: 'rendering'!
+
+renderAddOn: html
+    html div 
+    	class: 'dropdown new_tab';
+        with: [ 
+			html a 
+        		class: 'dropdown-toggle';
+           	 	at: 'data-toggle' put: 'dropdown';
+            	with: [
+  					(html tag: 'b') class: 'caret' ].
+           html ul 
+           		class: 'dropdown-menu';
+                with: [
+                  	((HLWidget withAllSubclasses
+                    	select: [ :each | each canBeOpenAsTab ])
+                        sorted: [ :a :b | a tabPriority < b tabPriority ])
+                        do: [ :each |
+  							html li with: [
+                      			html a 
+                                	with: each tabLabel;
+      								onClick: [ each openAsTab ] ] ] ] ]
+!
+
+renderContentOn: html
+	html div 
+		class: 'navbar navbar-fixed-top';
+		with: [ html div 
+			class: 'navbar-inner';
+			with: [ self renderTabsOn: html ] ].
+			
+	self renderAddOn: html
+!
+
+renderTab: aTab on: html
+	| li |
+	li := html li 
+		style: 'width: ', self tabWidth asString, 'px';
+		class: (aTab isActive ifTrue: [ 'tab active' ] ifFalse: [ 'tab inactive' ]);
+		with: [
+			html a
+			with: [
+				((html tag: 'i') class: 'close')
+					onClick: [ self removeTab: aTab ].
+				html span 
+					class: aTab cssClass;
+					title: aTab label;
+					with: aTab label ] ];
+		onClick: [ aTab activate ].
+	
+	(li asJQuery get: 0) at: 'tab-data' put: aTab
+!
+
+renderTabsOn: html
+	| ul |
+	ul := html ul 
+		class: 'nav main-tabs';
+		with: [ 
+        	self tabs do: [ :each |
+				self renderTab: each on: html ] ].
+		
+	ul asJQuery sortable: #{
+		'containment' -> 'parent'.
+		'start' -> [ self disableSelection ].
+		'stop' -> [ [ self enableSelection] valueWithTimeout: 300 ].
+		'update' -> [ self updateTabsOrder ]
+	}
+!
+
+show: aTab
+	self tabs do: [ :each | each hide ].
+	aTab show; focus
+! !
+
+!HLTabsWidget methodsFor: 'testing'!
+
+isSelectionDisabled
+	^ selectionDisabled ifNil: [ false ]
+! !
+
+HLTabsWidget class instanceVariableNames: 'current'!
+
+HLWidget subclass: #HLWelcomeWidget
+	instanceVariableNames: ''
+	package: 'Helios-Core'!
+
+!HLWelcomeWidget methodsFor: 'accessing'!
+
+cssClass
+	^ 'welcome'
+! !
+
+!HLWelcomeWidget methodsFor: 'actions'!
+
+openClassBrowser
+	HLBrowser openAsTab
+!
+
+openHelp
+!
+
+openTestRunner
+!
+
+openWorkspace
+	HLWorkspace openAsTab
+! !
+
+!HLWelcomeWidget methodsFor: 'rendering'!
+
+renderButtonsOn: html
+	html button
+		class: 'button';
+		with: 'Class Browser';
+		onClick: [ self openClassBrowser ].
+	html button
+		class: 'button';
+		with: 'Workspace';
+		onClick: [ self openWorkspace ].
+	"html button
+		class: 'button';
+		with: 'Test Runner';
+		onClick: [ self openTestRunner ].
+	html button
+		class: 'button';
+		with: 'Help';
+		onClick: [ self openHelp ]"
+!
+
+renderContentOn: html
+	self
+		renderHelpOn: html;
+		renderButtonsOn: html
+!
+
+renderHelpOn: html
+	html h2 with: 'No tools are open'.
+	html ul with: [
+		html li with: 'Perform actions with  ctrl + space'.
+		html li with: 'Open one of the common tools:' ]
+! !
+

+ 1483 - 0
src/Helios-Debugger.js

@@ -0,0 +1,1483 @@
+define("helios/Helios-Debugger", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "helios/Helios-Core", "helios/Helios-Workspace"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Debugger');
+smalltalk.packages["Helios-Debugger"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLContextInspectorDecorator', globals.Object, ['context'], 'Helios-Debugger');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@context"];
+return $1;
+},
+args: [],
+source: "context\x0a\x09^ context",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLContextInspectorDecorator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:on:",
+protocol: 'evaluating',
+fn: function (aString,anEvaluator){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._context())._evaluate_on_(aString,anEvaluator);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},globals.HLContextInspectorDecorator)})},
+args: ["aString", "anEvaluator"],
+source: "evaluate: aString on: anEvaluator\x0a\x09^ self context evaluate: aString on: anEvaluator",
+messageSends: ["evaluate:on:", "context"],
+referencedClasses: []
+}),
+globals.HLContextInspectorDecorator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeFromContext:",
+protocol: 'initialization',
+fn: function (aContext){
+var self=this;
+self["@context"]=aContext;
+return self},
+args: ["aContext"],
+source: "initializeFromContext: aContext\x0a\x09context := aContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLContextInspectorDecorator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectOn:",
+protocol: 'inspecting',
+fn: function (anInspector){
+var self=this;
+var variables,inspectedContext;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$receiver;
+variables=_st($Dictionary())._new();
+inspectedContext=self._context();
+$1=variables;
+$2=_st(inspectedContext)._locals();
+$ctx1.sendIdx["locals"]=1;
+_st($1)._addAll_($2);
+$ctx1.sendIdx["addAll:"]=1;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(inspectedContext)._notNil())._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(inspectedContext)._isBlockContext();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+inspectedContext=_st(inspectedContext)._outerContext();
+inspectedContext;
+$3=inspectedContext;
+if(($receiver = $3) == null || $receiver.isNil){
+return $3;
+} else {
+return _st(variables)._addAll_(_st(inspectedContext)._locals());
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+_st(anInspector)._setLabel_("Context");
+$4=_st(anInspector)._setVariables_(variables);
+return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,inspectedContext:inspectedContext},globals.HLContextInspectorDecorator)})},
+args: ["anInspector"],
+source: "inspectOn: anInspector\x0a\x09| variables inspectedContext |\x0a\x09\x0a\x09variables := Dictionary new.\x0a\x09inspectedContext := self context.\x0a\x09\x0a\x09variables addAll: inspectedContext locals.\x0a\x09\x0a\x09[ inspectedContext notNil and: [ inspectedContext isBlockContext ] ] whileTrue: [\x0a\x09\x09inspectedContext := inspectedContext outerContext.\x0a\x09\x09inspectedContext ifNotNil: [\x0a\x09\x09\x09variables addAll: inspectedContext locals ] ].\x0a\x09\x0a\x09anInspector\x0a\x09\x09setLabel: 'Context';\x0a\x09\x09setVariables: variables",
+messageSends: ["new", "context", "addAll:", "locals", "whileTrue:", "and:", "notNil", "isBlockContext", "outerContext", "ifNotNil:", "setLabel:", "setVariables:"],
+referencedClasses: ["Dictionary"]
+}),
+globals.HLContextInspectorDecorator);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._initializeFromContext_(aContext);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aContext:aContext},globals.HLContextInspectorDecorator.klass)})},
+args: ["aContext"],
+source: "on: aContext\x0a\x09^ self new\x0a\x09\x09initializeFromContext: aContext;\x0a\x09\x09yourself",
+messageSends: ["initializeFromContext:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLContextInspectorDecorator.klass);
+
+
+smalltalk.addClass('HLDebugger', globals.HLFocusableWidget, ['model', 'stackListWidget', 'codeWidget', 'inspectorWidget'], 'Helios-Debugger');
+globals.HLDebugger.comment="I am the main widget for the Helios debugger.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "codeWidget",
+protocol: 'widgets',
+fn: function (){
+var self=this;
+function $HLDebuggerCodeWidget(){return globals.HLDebuggerCodeWidget||(typeof HLDebuggerCodeWidget=="undefined"?nil:HLDebuggerCodeWidget)}
+function $HLDebuggerCodeModel(){return globals.HLDebuggerCodeModel||(typeof HLDebuggerCodeModel=="undefined"?nil:HLDebuggerCodeModel)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$6,$7,$8,$9,$5,$10,$1,$receiver;
+$2=self["@codeWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($HLDebuggerCodeWidget())._new();
+$ctx1.sendIdx["new"]=1;
+$4=$3;
+$6=_st($HLDebuggerCodeModel())._new();
+$7=$6;
+$8=self._model();
+$ctx1.sendIdx["model"]=1;
+_st($7)._debuggerModel_($8);
+$9=_st($6)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+$5=$9;
+_st($4)._model_($5);
+_st($3)._browserModel_(self._model());
+$10=_st($3)._yourself();
+self["@codeWidget"]=$10;
+$1=self["@codeWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"codeWidget",{},globals.HLDebugger)})},
+args: [],
+source: "codeWidget\x0a\x09^ codeWidget ifNil: [ codeWidget := HLDebuggerCodeWidget new\x0a\x09\x09model: (HLDebuggerCodeModel new\x0a\x09\x09\x09debuggerModel: self model;\x0a\x09\x09\x09yourself);\x0a\x09\x09browserModel: self model;\x0a\x09\x09yourself ]",
+messageSends: ["ifNil:", "model:", "new", "debuggerModel:", "model", "yourself", "browserModel:"],
+referencedClasses: ["HLDebuggerCodeWidget", "HLDebuggerCodeModel"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=($ctx1.supercall = true, globals.HLDebugger.superclass.fn.prototype._cssClass.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st($2).__comma(" hl_debugger");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cssClass",{},globals.HLDebugger)})},
+args: [],
+source: "cssClass\x0a\x09^ super cssClass, ' hl_debugger'",
+messageSends: [",", "cssClass"],
+referencedClasses: []
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._stackListWidget())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLDebugger)})},
+args: [],
+source: "focus\x0a\x09self stackListWidget focus",
+messageSends: ["focus", "stackListWidget"],
+referencedClasses: []
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeFromError:",
+protocol: 'initialization',
+fn: function (anError){
+var self=this;
+function $HLDebuggerModel(){return globals.HLDebuggerModel||(typeof HLDebuggerModel=="undefined"?nil:HLDebuggerModel)}
+return smalltalk.withContext(function($ctx1) { 
+self["@model"]=_st($HLDebuggerModel())._on_(anError);
+self._observeModel();
+return self}, function($ctx1) {$ctx1.fill(self,"initializeFromError:",{anError:anError},globals.HLDebugger)})},
+args: ["anError"],
+source: "initializeFromError: anError\x0a\x09model := HLDebuggerModel on: anError.\x0a\x09self observeModel",
+messageSends: ["on:", "observeModel"],
+referencedClasses: ["HLDebuggerModel"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectorWidget",
+protocol: 'widgets',
+fn: function (){
+var self=this;
+function $HLInspectorWidget(){return globals.HLInspectorWidget||(typeof HLInspectorWidget=="undefined"?nil:HLInspectorWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@inspectorWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@inspectorWidget"]=_st($HLInspectorWidget())._new();
+$1=self["@inspectorWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inspectorWidget",{},globals.HLDebugger)})},
+args: [],
+source: "inspectorWidget\x0a\x09^ inspectorWidget ifNil: [ \x0a\x09\x09inspectorWidget := HLInspectorWidget new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HLInspectorWidget"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLDebuggerModel(){return globals.HLDebuggerModel||(typeof HLDebuggerModel=="undefined"?nil:HLDebuggerModel)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@model"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@model"]=_st($HLDebuggerModel())._new();
+$1=self["@model"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},globals.HLDebugger)})},
+args: [],
+source: "model\x0a\x09^ model ifNil: [ model := HLDebuggerModel new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HLDebuggerModel"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDebuggerContextSelected(){return globals.HLDebuggerContextSelected||(typeof HLDebuggerContextSelected=="undefined"?nil:HLDebuggerContextSelected)}
+function $HLDebuggerStepped(){return globals.HLDebuggerStepped||(typeof HLDebuggerStepped=="undefined"?nil:HLDebuggerStepped)}
+function $HLDebuggerProceeded(){return globals.HLDebuggerProceeded||(typeof HLDebuggerProceeded=="undefined"?nil:HLDebuggerProceeded)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._announcer();
+_st($1)._on_send_to_($HLDebuggerContextSelected(),"onContextSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st($1)._on_send_to_($HLDebuggerStepped(),"onDebuggerStepped:",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+$2=_st($1)._on_send_to_($HLDebuggerProceeded(),"onDebuggerProceeded",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLDebugger)})},
+args: [],
+source: "observeModel\x0a\x09self model announcer \x0a\x09\x09on: HLDebuggerContextSelected\x0a\x09\x09send: #onContextSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLDebuggerStepped\x0a\x09\x09send: #onDebuggerStepped:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLDebuggerProceeded\x0a\x09\x09send: #onDebuggerProceeded\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "model"],
+referencedClasses: ["HLDebuggerContextSelected", "HLDebuggerStepped", "HLDebuggerProceeded"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onContextSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+function $HLContextInspectorDecorator(){return globals.HLContextInspectorDecorator||(typeof HLContextInspectorDecorator=="undefined"?nil:HLContextInspectorDecorator)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._inspectorWidget())._inspect_(_st($HLContextInspectorDecorator())._on_(_st(anAnnouncement)._context()));
+return self}, function($ctx1) {$ctx1.fill(self,"onContextSelected:",{anAnnouncement:anAnnouncement},globals.HLDebugger)})},
+args: ["anAnnouncement"],
+source: "onContextSelected: anAnnouncement\x0a\x09self inspectorWidget inspect: (HLContextInspectorDecorator on: anAnnouncement context)",
+messageSends: ["inspect:", "inspectorWidget", "on:", "context"],
+referencedClasses: ["HLContextInspectorDecorator"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onDebuggerProceeded",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._removeTab();
+return self}, function($ctx1) {$ctx1.fill(self,"onDebuggerProceeded",{},globals.HLDebugger)})},
+args: [],
+source: "onDebuggerProceeded\x0a\x09self removeTab",
+messageSends: ["removeTab"],
+referencedClasses: []
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onDebuggerStepped:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+function $HLContextInspectorDecorator(){return globals.HLContextInspectorDecorator||(typeof HLContextInspectorDecorator=="undefined"?nil:HLContextInspectorDecorator)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._atEnd();
+if(smalltalk.assert($1)){
+self._removeTab();
+};
+_st(self._inspectorWidget())._inspect_(_st($HLContextInspectorDecorator())._on_(_st(anAnnouncement)._context()));
+_st(self._stackListWidget())._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onDebuggerStepped:",{anAnnouncement:anAnnouncement},globals.HLDebugger)})},
+args: ["anAnnouncement"],
+source: "onDebuggerStepped: anAnnouncement\x0a\x09self model atEnd ifTrue: [ self removeTab ].\x0a\x09\x0a\x09self inspectorWidget inspect: (HLContextInspectorDecorator on: anAnnouncement context).\x0a\x09self stackListWidget refresh",
+messageSends: ["ifTrue:", "atEnd", "model", "removeTab", "inspect:", "inspectorWidget", "on:", "context", "refresh", "stackListWidget"],
+referencedClasses: ["HLContextInspectorDecorator"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerBindingsOn:",
+protocol: 'keybindings',
+fn: function (aBindingGroup){
+var self=this;
+function $HLToolCommand(){return globals.HLToolCommand||(typeof HLToolCommand=="undefined"?nil:HLToolCommand)}
+return smalltalk.withContext(function($ctx1) { 
+_st($HLToolCommand())._registerConcreteClassesOn_for_(aBindingGroup,self._model());
+return self}, function($ctx1) {$ctx1.fill(self,"registerBindingsOn:",{aBindingGroup:aBindingGroup},globals.HLDebugger)})},
+args: ["aBindingGroup"],
+source: "registerBindingsOn: aBindingGroup\x0a\x09HLToolCommand \x0a\x09\x09registerConcreteClassesOn: aBindingGroup \x0a\x09\x09for: self model",
+messageSends: ["registerConcreteClassesOn:for:", "model"],
+referencedClasses: ["HLToolCommand"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $HLContainer(){return globals.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
+function $HLVerticalSplitter(){return globals.HLVerticalSplitter||(typeof HLVerticalSplitter=="undefined"?nil:HLVerticalSplitter)}
+function $HLHorizontalSplitter(){return globals.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+self._renderHeadOn_(html);
+$2=_st($HLVerticalSplitter())._with_with_(self._codeWidget(),_st($HLHorizontalSplitter())._with_with_(self._stackListWidget(),self._inspectorWidget()));
+$ctx1.sendIdx["with:with:"]=1;
+$1=_st($HLContainer())._with_($2);
+_st(html)._with_($1);
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLDebugger)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09self renderHeadOn: html.\x0a\x09html with: (HLContainer with: (HLVerticalSplitter\x0a\x09\x09with: self codeWidget\x0a\x09\x09with: (HLHorizontalSplitter\x0a\x09\x09\x09with: self stackListWidget\x0a\x09\x09\x09with: self inspectorWidget)))",
+messageSends: ["renderHeadOn:", "with:", "with:with:", "codeWidget", "stackListWidget", "inspectorWidget"],
+referencedClasses: ["HLContainer", "HLVerticalSplitter", "HLHorizontalSplitter"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderHeadOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("head");
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(html)._h2())._with_(_st(_st(self._model())._error())._messageText());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderHeadOn:",{html:html},globals.HLDebugger)})},
+args: ["html"],
+source: "renderHeadOn: html\x0a\x09html div \x0a\x09\x09class: 'head'; \x0a\x09\x09with: [ html h2 with: self model error messageText ]",
+messageSends: ["class:", "div", "with:", "h2", "messageText", "error", "model"],
+referencedClasses: []
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stackListWidget",
+protocol: 'widgets',
+fn: function (){
+var self=this;
+function $HLStackListWidget(){return globals.HLStackListWidget||(typeof HLStackListWidget=="undefined"?nil:HLStackListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+$2=self["@stackListWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($HLStackListWidget())._on_(self._model());
+_st($3)._next_(self._codeWidget());
+$4=_st($3)._yourself();
+self["@stackListWidget"]=$4;
+$1=self["@stackListWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"stackListWidget",{},globals.HLDebugger)})},
+args: [],
+source: "stackListWidget\x0a\x09^ stackListWidget ifNil: [ \x0a\x09\x09stackListWidget := (HLStackListWidget on: self model)\x0a\x09\x09\x09next: self codeWidget;\x0a\x09\x09\x09yourself ]",
+messageSends: ["ifNil:", "next:", "on:", "model", "codeWidget", "yourself"],
+referencedClasses: ["HLStackListWidget"]
+}),
+globals.HLDebugger);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLDebugger.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+$ctx1.sendIdx["unregister"]=1;
+_st(self._inspectorWidget())._unregister();
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLDebugger)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x09self inspectorWidget unregister",
+messageSends: ["unregister", "inspectorWidget"],
+referencedClasses: []
+}),
+globals.HLDebugger);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._initializeFromError_(anError);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{anError:anError},globals.HLDebugger.klass)})},
+args: ["anError"],
+source: "on: anError\x0a\x09^ self new\x0a\x09\x09initializeFromError: anError;\x0a\x09\x09yourself",
+messageSends: ["initializeFromError:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLDebugger.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "debugger";
+},
+args: [],
+source: "tabClass\x0a\x09^ 'debugger'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebugger.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Debugger";
+},
+args: [],
+source: "tabLabel\x0a\x09^ 'Debugger'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebugger.klass);
+
+
+smalltalk.addClass('HLDebuggerCodeModel', globals.HLCodeModel, ['debuggerModel'], 'Helios-Debugger');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "debuggerModel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@debuggerModel"];
+return $1;
+},
+args: [],
+source: "debuggerModel\x0a\x09^ debuggerModel",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "debuggerModel:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@debuggerModel"]=anObject;
+return self},
+args: ["anObject"],
+source: "debuggerModel: anObject\x0a\x09debuggerModel := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doIt:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._debuggerModel())._evaluate_(aString);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._tryCatch_((function(e){
+return smalltalk.withContext(function($ctx2) {
+_st($ErrorHandler())._handleError_(e);
+return nil;
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"doIt:",{aString:aString},globals.HLDebuggerCodeModel)})},
+args: ["aString"],
+source: "doIt: aString\x0a\x09^ [ self debuggerModel evaluate: aString ]\x0a\x09\x09tryCatch: [ :e | \x0a\x09\x09\x09ErrorHandler handleError: e.\x0a\x09\x09\x09nil ]",
+messageSends: ["tryCatch:", "evaluate:", "debuggerModel", "handleError:"],
+referencedClasses: ["ErrorHandler"]
+}),
+globals.HLDebuggerCodeModel);
+
+
+
+smalltalk.addClass('HLDebuggerCodeWidget', globals.HLBrowserCodeWidget, [], 'Helios-Debugger');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addStopAt:",
+protocol: 'actions',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@editor"])._setGutterMarker_gutter_value_(anInteger,"stops",_st(_st("<div class=\x22stop\x22></stop>"._asJQuery())._toArray())._first());
+return self}, function($ctx1) {$ctx1.fill(self,"addStopAt:",{anInteger:anInteger},globals.HLDebuggerCodeWidget)})},
+args: ["anInteger"],
+source: "addStopAt: anInteger\x0a\x09editor\x0a\x09\x09setGutterMarker: anInteger\x0a\x09\x09gutter: 'stops'\x0a\x09\x09value: '<div class=\x22stop\x22></stop>' asJQuery toArray first",
+messageSends: ["setGutterMarker:gutter:value:", "first", "toArray", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "clearHighlight",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._editor())._clearGutter_("stops");
+return self}, function($ctx1) {$ctx1.fill(self,"clearHighlight",{},globals.HLDebuggerCodeWidget)})},
+args: [],
+source: "clearHighlight\x0a\x09self editor clearGutter: 'stops'",
+messageSends: ["clearGutter:", "editor"],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contents:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._clearHighlight();
+($ctx1.supercall = true, globals.HLDebuggerCodeWidget.superclass.fn.prototype._contents_.apply(_st(self), [aString]));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},globals.HLDebuggerCodeWidget)})},
+args: ["aString"],
+source: "contents: aString\x0a\x09self clearHighlight.\x0a\x09super contents: aString",
+messageSends: ["clearHighlight", "contents:"],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "editorOptions",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=($ctx1.supercall = true, globals.HLDebuggerCodeWidget.superclass.fn.prototype._editorOptions.apply(_st(self), []));
+$ctx1.supercall = false;
+_st($2)._at_put_("gutters",["CodeMirror-linenumbers", "stops"]);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"editorOptions",{},globals.HLDebuggerCodeWidget)})},
+args: [],
+source: "editorOptions\x0a\x09^ super editorOptions\x0a\x09\x09at: 'gutters' put: #('CodeMirror-linenumbers' 'stops');\x0a\x09\x09yourself",
+messageSends: ["at:put:", "editorOptions", "yourself"],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "highlight",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(self._browserModel())._nextNode();
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+var node;
+node=$receiver;
+self._highlightNode_(node);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"highlight",{},globals.HLDebuggerCodeWidget)})},
+args: [],
+source: "highlight\x0a\x09self browserModel nextNode ifNotNil: [ :node |\x0a\x09\x09self highlightNode: node ]",
+messageSends: ["ifNotNil:", "nextNode", "browserModel", "highlightNode:"],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "highlightNode:",
+protocol: 'actions',
+fn: function (aNode){
+var self=this;
+var token;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1,$5,$9,$8,$7,$11,$10,$6,$15,$14,$13,$12,$receiver;
+if(($receiver = aNode) == null || $receiver.isNil){
+aNode;
+} else {
+self._clearHighlight();
+$4=_st(aNode)._positionStart();
+$ctx1.sendIdx["positionStart"]=1;
+$3=_st($4)._x();
+$ctx1.sendIdx["x"]=1;
+$2=_st($3).__minus((1));
+$ctx1.sendIdx["-"]=1;
+$1=self._addStopAt_($2);
+$1;
+$5=self._editor();
+$9=_st(aNode)._positionStart();
+$ctx1.sendIdx["positionStart"]=2;
+$8=_st($9)._x();
+$ctx1.sendIdx["x"]=2;
+$7=_st($8).__minus((1));
+$ctx1.sendIdx["-"]=2;
+$11=_st(_st(aNode)._positionStart())._y();
+$ctx1.sendIdx["y"]=1;
+$10=_st($11).__minus((1));
+$ctx1.sendIdx["-"]=3;
+$6=globals.HashedCollection._newFromPairs_(["line",$7,"ch",$10]);
+$15=_st(aNode)._positionEnd();
+$ctx1.sendIdx["positionEnd"]=1;
+$14=_st($15)._x();
+$13=_st($14).__minus((1));
+$12=globals.HashedCollection._newFromPairs_(["line",$13,"ch",_st(_st(aNode)._positionEnd())._y()]);
+_st($5)._setSelection_to_($6,$12);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"highlightNode:",{aNode:aNode,token:token},globals.HLDebuggerCodeWidget)})},
+args: ["aNode"],
+source: "highlightNode: aNode\x0a\x09| token |\x0a\x09\x0a\x09aNode ifNotNil: [\x0a\x09\x09self\x0a\x09\x09\x09clearHighlight;\x0a\x09\x09\x09addStopAt: aNode positionStart x - 1.\x0a\x0a\x09\x09self editor \x0a\x09\x09\x09setSelection: #{ 'line' -> (aNode positionStart x - 1). 'ch' -> (aNode positionStart y - 1) }\x0a\x09\x09\x09to: #{ 'line' -> (aNode positionEnd x - 1). 'ch' -> (aNode positionEnd y) } ]",
+messageSends: ["ifNotNil:", "clearHighlight", "addStopAt:", "-", "x", "positionStart", "setSelection:to:", "editor", "y", "positionEnd"],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeBrowserModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDebuggerContextSelected(){return globals.HLDebuggerContextSelected||(typeof HLDebuggerContextSelected=="undefined"?nil:HLDebuggerContextSelected)}
+function $HLDebuggerStepped(){return globals.HLDebuggerStepped||(typeof HLDebuggerStepped=="undefined"?nil:HLDebuggerStepped)}
+function $HLDebuggerWhere(){return globals.HLDebuggerWhere||(typeof HLDebuggerWhere=="undefined"?nil:HLDebuggerWhere)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$4,$3;
+($ctx1.supercall = true, globals.HLDebuggerCodeWidget.superclass.fn.prototype._observeBrowserModel.apply(_st(self), []));
+$ctx1.supercall = false;
+$2=self._browserModel();
+$ctx1.sendIdx["browserModel"]=1;
+$1=_st($2)._announcer();
+$ctx1.sendIdx["announcer"]=1;
+_st($1)._on_send_to_($HLDebuggerContextSelected(),"onContextSelected",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+$4=self._browserModel();
+$ctx1.sendIdx["browserModel"]=2;
+$3=_st($4)._announcer();
+$ctx1.sendIdx["announcer"]=2;
+_st($3)._on_send_to_($HLDebuggerStepped(),"onContextSelected",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+_st(_st(self._browserModel())._announcer())._on_send_to_($HLDebuggerWhere(),"onContextSelected",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{},globals.HLDebuggerCodeWidget)})},
+args: [],
+source: "observeBrowserModel\x0a\x09super observeBrowserModel.\x0a\x09\x0a\x09self browserModel announcer \x0a\x09\x09on: HLDebuggerContextSelected\x0a\x09\x09send: #onContextSelected\x0a\x09\x09to: self.\x0a\x09\x0a\x09self browserModel announcer \x0a\x09\x09on: HLDebuggerStepped\x0a\x09\x09send: #onContextSelected\x0a\x09\x09to: self.\x0a\x09\x0a\x09self browserModel announcer \x0a\x09\x09on: HLDebuggerWhere\x0a\x09\x09send: #onContextSelected\x0a\x09\x09to: self",
+messageSends: ["observeBrowserModel", "on:send:to:", "announcer", "browserModel"],
+referencedClasses: ["HLDebuggerContextSelected", "HLDebuggerStepped", "HLDebuggerWhere"]
+}),
+globals.HLDebuggerCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onContextSelected",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._highlight();
+return self}, function($ctx1) {$ctx1.fill(self,"onContextSelected",{},globals.HLDebuggerCodeWidget)})},
+args: [],
+source: "onContextSelected\x0a\x09self highlight",
+messageSends: ["highlight"],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLDebuggerCodeWidget.superclass.fn.prototype._renderOn_.apply(_st(self), [html]));
+$ctx1.supercall = false;
+self._contents_(_st(_st(self._browserModel())._selectedMethod())._source());
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.HLDebuggerCodeWidget)})},
+args: ["html"],
+source: "renderOn: html\x0a\x09super renderOn: html.\x0a\x09self contents: self browserModel selectedMethod source",
+messageSends: ["renderOn:", "contents:", "source", "selectedMethod", "browserModel"],
+referencedClasses: []
+}),
+globals.HLDebuggerCodeWidget);
+
+
+
+smalltalk.addClass('HLDebuggerModel', globals.HLToolModel, ['rootContext', 'debugger', 'error'], 'Helios-Debugger');
+globals.HLDebuggerModel.comment="I am a model for debugging Amber code in Helios.\x0a\x0aMy instances hold a reference to an `ASTDebugger` instance, itself referencing the current `context`. The context should be the root of the context stack.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "atEnd",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._debugger())._atEnd();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.HLDebuggerModel)})},
+args: [],
+source: "atEnd\x0a\x09^ self debugger atEnd",
+messageSends: ["atEnd", "debugger"],
+referencedClasses: []
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contexts",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var contexts,context;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+contexts=_st($OrderedCollection())._new();
+context=self._rootContext();
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(context)._notNil();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(contexts)._add_(context);
+context=_st(context)._outerContext();
+return context;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$1=contexts;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"contexts",{contexts:contexts,context:context},globals.HLDebuggerModel)})},
+args: [],
+source: "contexts\x0a\x09| contexts context |\x0a\x09\x0a\x09contexts := OrderedCollection new.\x0a\x09context := self rootContext.\x0a\x09\x0a\x09[ context notNil ] whileTrue: [\x0a\x09\x09contexts add: context.\x0a\x09\x09context := context outerContext ].\x0a\x09\x09\x0a\x09^ contexts",
+messageSends: ["new", "rootContext", "whileTrue:", "notNil", "add:", "outerContext"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentContext",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._debugger())._context();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"currentContext",{},globals.HLDebuggerModel)})},
+args: [],
+source: "currentContext\x0a\x09^ self debugger context",
+messageSends: ["context", "debugger"],
+referencedClasses: []
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentContext:",
+protocol: 'accessing',
+fn: function (aContext){
+var self=this;
+function $HLDebuggerContextSelected(){return globals.HLDebuggerContextSelected||(typeof HLDebuggerContextSelected=="undefined"?nil:HLDebuggerContextSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+self._selectedMethod_(_st(aContext)._method());
+_st(self._debugger())._context_(aContext);
+$ctx2.sendIdx["context:"]=1;
+$1=_st($HLDebuggerContextSelected())._new();
+_st($1)._context_(aContext);
+$2=_st($1)._yourself();
+return _st(self._announcer())._announce_($2);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"currentContext:",{aContext:aContext},globals.HLDebuggerModel)})},
+args: ["aContext"],
+source: "currentContext: aContext\x0a\x09self withChangesDo: [ \x0a\x09\x09self selectedMethod: aContext method.\x0a\x09\x09self debugger context: aContext.\x0a\x09\x09self announcer announce: (HLDebuggerContextSelected new\x0a\x09\x09\x09context: aContext;\x0a\x09\x09\x09yourself) ]",
+messageSends: ["withChangesDo:", "selectedMethod:", "method", "context:", "debugger", "announce:", "announcer", "new", "yourself"],
+referencedClasses: ["HLDebuggerContextSelected"]
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "debugger",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $ASTDebugger(){return globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@debugger"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@debugger"]=_st($ASTDebugger())._new();
+$1=self["@debugger"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"debugger",{},globals.HLDebuggerModel)})},
+args: [],
+source: "debugger\x0a\x09^ debugger ifNil: [ debugger := ASTDebugger new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["ASTDebugger"]
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "error",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@error"];
+return $1;
+},
+args: [],
+source: "error\x0a\x09^ error",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:",
+protocol: 'evaluating',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._environment())._evaluate_for_(aString,self._currentContext());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"evaluate:",{aString:aString},globals.HLDebuggerModel)})},
+args: ["aString"],
+source: "evaluate: aString\x0a\x09^ self environment \x0a\x09\x09evaluate: aString \x0a\x09\x09for: self currentContext",
+messageSends: ["evaluate:for:", "environment", "currentContext"],
+referencedClasses: []
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "flushInnerContexts",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._currentContext();
+$ctx1.sendIdx["currentContext"]=1;
+_st($1)._innerContext_(nil);
+self["@rootContext"]=self._currentContext();
+self._initializeContexts();
+return self}, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},globals.HLDebuggerModel)})},
+args: [],
+source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self currentContext innerContext: nil.\x0a\x09rootContext := self currentContext.\x0a\x09self initializeContexts",
+messageSends: ["innerContext:", "currentContext", "initializeContexts"],
+referencedClasses: []
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeFromError:",
+protocol: 'initialization',
+fn: function (anError){
+var self=this;
+var errorContext;
+function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
+return smalltalk.withContext(function($ctx1) { 
+self["@error"]=anError;
+errorContext=_st($AIContext())._fromMethodContext_(_st(self["@error"])._context());
+self["@rootContext"]=_st(self["@error"])._signalerContextFrom_(errorContext);
+self._selectedMethod_(_st(self["@rootContext"])._method());
+return self}, function($ctx1) {$ctx1.fill(self,"initializeFromError:",{anError:anError,errorContext:errorContext},globals.HLDebuggerModel)})},
+args: ["anError"],
+source: "initializeFromError: anError\x0a\x09| errorContext |\x0a\x09\x0a\x09error := anError.\x0a\x09errorContext := (AIContext fromMethodContext: error context).\x0a\x09rootContext := error signalerContextFrom: errorContext.\x0a\x09self selectedMethod: rootContext method",
+messageSends: ["fromMethodContext:", "context", "signalerContextFrom:", "selectedMethod:", "method"],
+referencedClasses: ["AIContext"]
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextNode",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._debugger())._node();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"nextNode",{},globals.HLDebuggerModel)})},
+args: [],
+source: "nextNode\x0a\x09^ self debugger node",
+messageSends: ["node", "debugger"],
+referencedClasses: []
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onStep",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+function $HLDebuggerContextSelected(){return globals.HLDebuggerContextSelected||(typeof HLDebuggerContextSelected=="undefined"?nil:HLDebuggerContextSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$4;
+self["@rootContext"]=self._currentContext();
+$ctx1.sendIdx["currentContext"]=1;
+$2=self._currentContext();
+$ctx1.sendIdx["currentContext"]=2;
+$1=_st($2)._method();
+self._selectedMethod_($1);
+$3=_st($HLDebuggerContextSelected())._new();
+_st($3)._context_(self._currentContext());
+$4=_st($3)._yourself();
+_st(self._announcer())._announce_($4);
+return self}, function($ctx1) {$ctx1.fill(self,"onStep",{},globals.HLDebuggerModel)})},
+args: [],
+source: "onStep\x0a\x09rootContext := self currentContext.\x0a\x09\x0a\x09\x22Force a refresh of the context list and code widget\x22\x0a\x09self selectedMethod: self currentContext method.\x0a\x09self announcer announce: (HLDebuggerContextSelected new\x0a\x09\x09context: self currentContext;\x0a\x09\x09yourself)",
+messageSends: ["currentContext", "selectedMethod:", "method", "announce:", "announcer", "context:", "new", "yourself"],
+referencedClasses: ["HLDebuggerContextSelected"]
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "proceed",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDebuggerProceeded(){return globals.HLDebuggerProceeded||(typeof HLDebuggerProceeded=="undefined"?nil:HLDebuggerProceeded)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._debugger())._proceed();
+_st(self._announcer())._announce_(_st($HLDebuggerProceeded())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.HLDebuggerModel)})},
+args: [],
+source: "proceed\x0a\x09self debugger proceed.\x0a\x09\x0a\x09self announcer announce: HLDebuggerProceeded new",
+messageSends: ["proceed", "debugger", "announce:", "announcer", "new"],
+referencedClasses: ["HLDebuggerProceeded"]
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "restart",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDebuggerStepped(){return globals.HLDebuggerStepped||(typeof HLDebuggerStepped=="undefined"?nil:HLDebuggerStepped)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st(self._debugger())._restart();
+self._onStep();
+$1=_st($HLDebuggerStepped())._new();
+_st($1)._context_(self._currentContext());
+$2=_st($1)._yourself();
+_st(self._announcer())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"restart",{},globals.HLDebuggerModel)})},
+args: [],
+source: "restart\x0a\x09self debugger restart.\x0a\x09self onStep.\x0a\x09\x0a\x09self announcer announce: (HLDebuggerStepped new\x0a\x09\x09context: self currentContext;\x0a\x09\x09yourself)",
+messageSends: ["restart", "debugger", "onStep", "announce:", "announcer", "context:", "new", "currentContext", "yourself"],
+referencedClasses: ["HLDebuggerStepped"]
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "rootContext",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@rootContext"];
+return $1;
+},
+args: [],
+source: "rootContext\x0a\x09^ rootContext",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stepOver",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDebuggerStepped(){return globals.HLDebuggerStepped||(typeof HLDebuggerStepped=="undefined"?nil:HLDebuggerStepped)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st(self._debugger())._stepOver();
+self._onStep();
+$1=_st($HLDebuggerStepped())._new();
+_st($1)._context_(self._currentContext());
+$2=_st($1)._yourself();
+_st(self._announcer())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.HLDebuggerModel)})},
+args: [],
+source: "stepOver\x0a\x09self debugger stepOver.\x0a\x09self onStep.\x0a\x09\x0a\x09self announcer announce: (HLDebuggerStepped new\x0a\x09\x09context: self currentContext;\x0a\x09\x09yourself)",
+messageSends: ["stepOver", "debugger", "onStep", "announce:", "announcer", "context:", "new", "currentContext", "yourself"],
+referencedClasses: ["HLDebuggerStepped"]
+}),
+globals.HLDebuggerModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "where",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDebuggerWhere(){return globals.HLDebuggerWhere||(typeof HLDebuggerWhere=="undefined"?nil:HLDebuggerWhere)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLDebuggerWhere())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"where",{},globals.HLDebuggerModel)})},
+args: [],
+source: "where\x0a\x09self announcer announce: HLDebuggerWhere new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLDebuggerWhere"]
+}),
+globals.HLDebuggerModel);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._initializeFromError_(anError);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{anError:anError},globals.HLDebuggerModel.klass)})},
+args: ["anError"],
+source: "on: anError\x0a\x09^ self new\x0a\x09\x09initializeFromError: anError;\x0a\x09\x09yourself",
+messageSends: ["initializeFromError:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLDebuggerModel.klass);
+
+
+smalltalk.addClass('HLErrorHandler', globals.Object, [], 'Helios-Debugger');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirmDebugError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+function $HLConfirmationWidget(){return globals.HLConfirmationWidget||(typeof HLConfirmationWidget=="undefined"?nil:HLConfirmationWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLConfirmationWidget())._new();
+_st($1)._confirmationString_(_st(anError)._messageText());
+_st($1)._actionBlock_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._debugError_(anError);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+_st($1)._cancelButtonLabel_("Abandon");
+_st($1)._confirmButtonLabel_("Debug");
+$2=_st($1)._show();
+return self}, function($ctx1) {$ctx1.fill(self,"confirmDebugError:",{anError:anError},globals.HLErrorHandler)})},
+args: ["anError"],
+source: "confirmDebugError: anError\x0a\x09HLConfirmationWidget new\x0a\x09\x09confirmationString: anError messageText;\x0a\x09\x09actionBlock: [ self debugError: anError ];\x0a\x09\x09cancelButtonLabel: 'Abandon';\x0a\x09\x09confirmButtonLabel: 'Debug';\x0a\x09\x09show",
+messageSends: ["confirmationString:", "new", "messageText", "actionBlock:", "debugError:", "cancelButtonLabel:", "confirmButtonLabel:", "show"],
+referencedClasses: ["HLConfirmationWidget"]
+}),
+globals.HLErrorHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "debugError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+function $HLDebugger(){return globals.HLDebugger||(typeof HLDebugger=="undefined"?nil:HLDebugger)}
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+function $ConsoleErrorHandler(){return globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
+return smalltalk.withContext(function($ctx1) { 
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($HLDebugger())._on_(anError))._openAsTab();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($ConsoleErrorHandler())._new())._handleError_(error);
+}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"debugError:",{anError:anError},globals.HLErrorHandler)})},
+args: ["anError"],
+source: "debugError: anError\x0a\x0a\x09[ \x0a\x09\x09(HLDebugger on: anError) openAsTab \x0a\x09] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :error | ConsoleErrorHandler new handleError: error ]",
+messageSends: ["on:do:", "openAsTab", "on:", "handleError:", "new"],
+referencedClasses: ["HLDebugger", "Error", "ConsoleErrorHandler"]
+}),
+globals.HLErrorHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._confirmDebugError_(anError);
+return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.HLErrorHandler)})},
+args: ["anError"],
+source: "handleError: anError\x0a\x09self confirmDebugError: anError",
+messageSends: ["confirmDebugError:"],
+referencedClasses: []
+}),
+globals.HLErrorHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onErrorHandled",
+protocol: 'error handling',
+fn: function (){
+var self=this;
+function $HLProgressWidget(){return globals.HLProgressWidget||(typeof HLProgressWidget=="undefined"?nil:HLProgressWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLProgressWidget())._default();
+_st($1)._flush();
+$2=_st($1)._remove();
+return self}, function($ctx1) {$ctx1.fill(self,"onErrorHandled",{},globals.HLErrorHandler)})},
+args: [],
+source: "onErrorHandled\x0a\x09\x22when an error is handled, we need to make sure that\x0a\x09any progress bar widget gets removed. Because HLProgressBarWidget is asynchronous,\x0a\x09it has to be done here.\x22\x0a\x09\x0a\x09HLProgressWidget default \x0a\x09\x09flush; \x0a\x09\x09remove",
+messageSends: ["flush", "default", "remove"],
+referencedClasses: ["HLProgressWidget"]
+}),
+globals.HLErrorHandler);
+
+
+
+smalltalk.addClass('HLStackListWidget', globals.HLToolListWidget, [], 'Helios-Debugger');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "items",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._contexts();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"items",{},globals.HLStackListWidget)})},
+args: [],
+source: "items\x0a\x09^ self model contexts",
+messageSends: ["contexts", "model"],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Call stack";
+},
+args: [],
+source: "label\x0a\x09^ 'Call stack'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDebuggerStepped(){return globals.HLDebuggerStepped||(typeof HLDebuggerStepped=="undefined"?nil:HLDebuggerStepped)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLStackListWidget.superclass.fn.prototype._observeModel.apply(_st(self), []));
+$ctx1.supercall = false;
+_st(_st(self._model())._announcer())._on_send_to_($HLDebuggerStepped(),"onDebuggerStepped:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLStackListWidget)})},
+args: [],
+source: "observeModel\x0a\x09super observeModel.\x0a\x09\x0a\x09self model announcer \x0a\x09\x09on: HLDebuggerStepped\x0a\x09\x09send: #onDebuggerStepped:\x0a\x09\x09to: self",
+messageSends: ["observeModel", "on:send:to:", "announcer", "model"],
+referencedClasses: ["HLDebuggerStepped"]
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onDebuggerStepped:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@items"]=nil;
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onDebuggerStepped:",{anAnnouncement:anAnnouncement},globals.HLStackListWidget)})},
+args: ["anAnnouncement"],
+source: "onDebuggerStepped: anAnnouncement\x0a\x09items := nil.\x0a\x09self refresh",
+messageSends: ["refresh"],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "proceed",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._proceed();
+return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.HLStackListWidget)})},
+args: [],
+source: "proceed\x0a\x09self model proceed",
+messageSends: ["proceed", "model"],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$5,$6,$7,$8,$9,$10,$2;
+$1=_st(html)._div();
+_st($1)._class_("debugger_bar");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._button();
+$ctx2.sendIdx["button"]=1;
+_st($3)._class_("btn restart");
+$ctx2.sendIdx["class:"]=2;
+_st($3)._with_("Restart");
+$ctx2.sendIdx["with:"]=2;
+$4=_st($3)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._restart();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["onClick:"]=1;
+$4;
+$5=_st(html)._button();
+$ctx2.sendIdx["button"]=2;
+_st($5)._class_("btn where");
+$ctx2.sendIdx["class:"]=3;
+_st($5)._with_("Where");
+$ctx2.sendIdx["with:"]=3;
+$6=_st($5)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._where();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+$ctx2.sendIdx["onClick:"]=2;
+$6;
+$7=_st(html)._button();
+$ctx2.sendIdx["button"]=3;
+_st($7)._class_("btn stepOver");
+$ctx2.sendIdx["class:"]=4;
+_st($7)._with_("Step over");
+$ctx2.sendIdx["with:"]=4;
+$8=_st($7)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._stepOver();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
+$ctx2.sendIdx["onClick:"]=3;
+$8;
+$9=_st(html)._button();
+_st($9)._class_("btn proceed");
+_st($9)._with_("Proceed");
+$10=_st($9)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._proceed();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
+return $10;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},globals.HLStackListWidget)})},
+args: ["html"],
+source: "renderButtonsOn: html\x0a\x09html div \x0a\x09\x09class: 'debugger_bar'; \x0a\x09\x09with: [\x0a\x09\x09\x09html button \x0a\x09\x09\x09\x09class: 'btn restart';\x0a\x09\x09\x09\x09with: 'Restart';\x0a\x09\x09\x09\x09onClick: [ self restart ].\x0a\x09\x09\x09html button \x0a\x09\x09\x09\x09class: 'btn where';\x0a\x09\x09\x09\x09with: 'Where';\x0a\x09\x09\x09\x09onClick: [ self where ].\x0a\x09\x09\x09html button \x0a\x09\x09\x09\x09class: 'btn stepOver';\x0a\x09\x09\x09\x09with: 'Step over';\x0a\x09\x09\x09\x09onClick: [ self stepOver ].\x0a\x09\x09\x09html button \x0a\x09\x09\x09\x09class: 'btn proceed';\x0a\x09\x09\x09\x09with: 'Proceed';\x0a\x09\x09\x09\x09onClick: [ self proceed ] ]",
+messageSends: ["class:", "div", "with:", "button", "onClick:", "restart", "where", "stepOver", "proceed"],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "restart",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._restart();
+return self}, function($ctx1) {$ctx1.fill(self,"restart",{},globals.HLStackListWidget)})},
+args: [],
+source: "restart\x0a\x09self model restart",
+messageSends: ["restart", "model"],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectItem:",
+protocol: 'actions',
+fn: function (aContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._currentContext_(aContext);
+($ctx1.supercall = true, globals.HLStackListWidget.superclass.fn.prototype._selectItem_.apply(_st(self), [aContext]));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aContext:aContext},globals.HLStackListWidget)})},
+args: ["aContext"],
+source: "selectItem: aContext\x0a   \x09self model currentContext: aContext.\x0a\x09super selectItem: aContext",
+messageSends: ["currentContext:", "model", "selectItem:"],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedItem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._currentContext();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectedItem",{},globals.HLStackListWidget)})},
+args: [],
+source: "selectedItem\x0a   \x09^ self model currentContext",
+messageSends: ["currentContext", "model"],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stepOver",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._stepOver();
+return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.HLStackListWidget)})},
+args: [],
+source: "stepOver\x0a\x09self model stepOver",
+messageSends: ["stepOver", "model"],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "where",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._where();
+return self}, function($ctx1) {$ctx1.fill(self,"where",{},globals.HLStackListWidget)})},
+args: [],
+source: "where\x0a\x09self model where",
+messageSends: ["where", "model"],
+referencedClasses: []
+}),
+globals.HLStackListWidget);
+
+
+});

+ 543 - 0
src/Helios-Debugger.st

@@ -0,0 +1,543 @@
+Smalltalk createPackage: 'Helios-Debugger'!
+Object subclass: #HLContextInspectorDecorator
+	instanceVariableNames: 'context'
+	package: 'Helios-Debugger'!
+
+!HLContextInspectorDecorator methodsFor: 'accessing'!
+
+context
+	^ context
+! !
+
+!HLContextInspectorDecorator methodsFor: 'evaluating'!
+
+evaluate: aString on: anEvaluator
+	^ self context evaluate: aString on: anEvaluator
+! !
+
+!HLContextInspectorDecorator methodsFor: 'initialization'!
+
+initializeFromContext: aContext
+	context := aContext
+! !
+
+!HLContextInspectorDecorator methodsFor: 'inspecting'!
+
+inspectOn: anInspector
+	| variables inspectedContext |
+	
+	variables := Dictionary new.
+	inspectedContext := self context.
+	
+	variables addAll: inspectedContext locals.
+	
+	[ inspectedContext notNil and: [ inspectedContext isBlockContext ] ] whileTrue: [
+		inspectedContext := inspectedContext outerContext.
+		inspectedContext ifNotNil: [
+			variables addAll: inspectedContext locals ] ].
+	
+	anInspector
+		setLabel: 'Context';
+		setVariables: variables
+! !
+
+!HLContextInspectorDecorator class methodsFor: 'instance creation'!
+
+on: aContext
+	^ self new
+		initializeFromContext: aContext;
+		yourself
+! !
+
+HLFocusableWidget subclass: #HLDebugger
+	instanceVariableNames: 'model stackListWidget codeWidget inspectorWidget'
+	package: 'Helios-Debugger'!
+!HLDebugger commentStamp!
+I am the main widget for the Helios debugger.!
+
+!HLDebugger methodsFor: 'accessing'!
+
+cssClass
+	^ super cssClass, ' hl_debugger'
+!
+
+model
+	^ model ifNil: [ model := HLDebuggerModel new ]
+! !
+
+!HLDebugger methodsFor: 'actions'!
+
+focus
+	self stackListWidget focus
+!
+
+observeModel
+	self model announcer 
+		on: HLDebuggerContextSelected
+		send: #onContextSelected:
+		to: self;
+		
+		on: HLDebuggerStepped
+		send: #onDebuggerStepped:
+		to: self;
+		
+		on: HLDebuggerProceeded
+		send: #onDebuggerProceeded
+		to: self
+!
+
+unregister
+	super unregister.
+	self inspectorWidget unregister
+! !
+
+!HLDebugger methodsFor: 'initialization'!
+
+initializeFromError: anError
+	model := HLDebuggerModel on: anError.
+	self observeModel
+! !
+
+!HLDebugger methodsFor: 'keybindings'!
+
+registerBindingsOn: aBindingGroup
+	HLToolCommand 
+		registerConcreteClassesOn: aBindingGroup 
+		for: self model
+! !
+
+!HLDebugger methodsFor: 'reactions'!
+
+onContextSelected: anAnnouncement
+	self inspectorWidget inspect: (HLContextInspectorDecorator on: anAnnouncement context)
+!
+
+onDebuggerProceeded
+	self removeTab
+!
+
+onDebuggerStepped: anAnnouncement
+	self model atEnd ifTrue: [ self removeTab ].
+	
+	self inspectorWidget inspect: (HLContextInspectorDecorator on: anAnnouncement context).
+	self stackListWidget refresh
+! !
+
+!HLDebugger methodsFor: 'rendering'!
+
+renderContentOn: html
+	self renderHeadOn: html.
+	html with: (HLContainer with: (HLVerticalSplitter
+		with: self codeWidget
+		with: (HLHorizontalSplitter
+			with: self stackListWidget
+			with: self inspectorWidget)))
+!
+
+renderHeadOn: html
+	html div 
+		class: 'head'; 
+		with: [ html h2 with: self model error messageText ]
+! !
+
+!HLDebugger methodsFor: 'widgets'!
+
+codeWidget
+	^ codeWidget ifNil: [ codeWidget := HLDebuggerCodeWidget new
+		model: (HLDebuggerCodeModel new
+			debuggerModel: self model;
+			yourself);
+		browserModel: self model;
+		yourself ]
+!
+
+inspectorWidget
+	^ inspectorWidget ifNil: [ 
+		inspectorWidget := HLInspectorWidget new ]
+!
+
+stackListWidget
+	^ stackListWidget ifNil: [ 
+		stackListWidget := (HLStackListWidget on: self model)
+			next: self codeWidget;
+			yourself ]
+! !
+
+!HLDebugger class methodsFor: 'accessing'!
+
+tabClass
+	^ 'debugger'
+!
+
+tabLabel
+	^ 'Debugger'
+! !
+
+!HLDebugger class methodsFor: 'instance creation'!
+
+on: anError
+	^ self new
+		initializeFromError: anError;
+		yourself
+! !
+
+HLCodeModel subclass: #HLDebuggerCodeModel
+	instanceVariableNames: 'debuggerModel'
+	package: 'Helios-Debugger'!
+
+!HLDebuggerCodeModel methodsFor: 'accessing'!
+
+debuggerModel
+	^ debuggerModel
+!
+
+debuggerModel: anObject
+	debuggerModel := anObject
+! !
+
+!HLDebuggerCodeModel methodsFor: 'actions'!
+
+doIt: aString
+	^ [ self debuggerModel evaluate: aString ]
+		tryCatch: [ :e | 
+			ErrorHandler handleError: e.
+			nil ]
+! !
+
+HLBrowserCodeWidget subclass: #HLDebuggerCodeWidget
+	instanceVariableNames: ''
+	package: 'Helios-Debugger'!
+
+!HLDebuggerCodeWidget methodsFor: 'accessing'!
+
+contents: aString
+	self clearHighlight.
+	super contents: aString
+!
+
+editorOptions
+	^ super editorOptions
+		at: 'gutters' put: #('CodeMirror-linenumbers' 'stops');
+		yourself
+! !
+
+!HLDebuggerCodeWidget methodsFor: 'actions'!
+
+addStopAt: anInteger
+	editor
+		setGutterMarker: anInteger
+		gutter: 'stops'
+		value: '<div class="stop"></stop>' asJQuery toArray first
+!
+
+clearHighlight
+	self editor clearGutter: 'stops'
+!
+
+highlight
+	self browserModel nextNode ifNotNil: [ :node |
+		self highlightNode: node ]
+!
+
+highlightNode: aNode
+	| token |
+	
+	aNode ifNotNil: [
+		self
+			clearHighlight;
+			addStopAt: aNode positionStart x - 1.
+
+		self editor 
+			setSelection: #{ 'line' -> (aNode positionStart x - 1). 'ch' -> (aNode positionStart y - 1) }
+			to: #{ 'line' -> (aNode positionEnd x - 1). 'ch' -> (aNode positionEnd y) } ]
+!
+
+observeBrowserModel
+	super observeBrowserModel.
+	
+	self browserModel announcer 
+		on: HLDebuggerContextSelected
+		send: #onContextSelected
+		to: self.
+	
+	self browserModel announcer 
+		on: HLDebuggerStepped
+		send: #onContextSelected
+		to: self.
+	
+	self browserModel announcer 
+		on: HLDebuggerWhere
+		send: #onContextSelected
+		to: self
+! !
+
+!HLDebuggerCodeWidget methodsFor: 'reactions'!
+
+onContextSelected
+	self highlight
+! !
+
+!HLDebuggerCodeWidget methodsFor: 'rendering'!
+
+renderOn: html
+	super renderOn: html.
+	self contents: self browserModel selectedMethod source
+! !
+
+HLToolModel subclass: #HLDebuggerModel
+	instanceVariableNames: 'rootContext debugger error'
+	package: 'Helios-Debugger'!
+!HLDebuggerModel commentStamp!
+I am a model for debugging Amber code in Helios.
+
+My instances hold a reference to an `ASTDebugger` instance, itself referencing the current `context`. The context should be the root of the context stack.!
+
+!HLDebuggerModel methodsFor: 'accessing'!
+
+contexts
+	| contexts context |
+	
+	contexts := OrderedCollection new.
+	context := self rootContext.
+	
+	[ context notNil ] whileTrue: [
+		contexts add: context.
+		context := context outerContext ].
+		
+	^ contexts
+!
+
+currentContext
+	^ self debugger context
+!
+
+currentContext: aContext
+	self withChangesDo: [ 
+		self selectedMethod: aContext method.
+		self debugger context: aContext.
+		self announcer announce: (HLDebuggerContextSelected new
+			context: aContext;
+			yourself) ]
+!
+
+debugger
+	^ debugger ifNil: [ debugger := ASTDebugger new ]
+!
+
+error
+	^ error
+!
+
+nextNode
+	^ self debugger node
+!
+
+rootContext
+	^ rootContext
+! !
+
+!HLDebuggerModel methodsFor: 'actions'!
+
+proceed
+	self debugger proceed.
+	
+	self announcer announce: HLDebuggerProceeded new
+!
+
+restart
+	self debugger restart.
+	self onStep.
+	
+	self announcer announce: (HLDebuggerStepped new
+		context: self currentContext;
+		yourself)
+!
+
+stepOver
+	self debugger stepOver.
+	self onStep.
+	
+	self announcer announce: (HLDebuggerStepped new
+		context: self currentContext;
+		yourself)
+!
+
+where
+	self announcer announce: HLDebuggerWhere new
+! !
+
+!HLDebuggerModel methodsFor: 'evaluating'!
+
+evaluate: aString
+	^ self environment 
+		evaluate: aString 
+		for: self currentContext
+! !
+
+!HLDebuggerModel methodsFor: 'initialization'!
+
+initializeFromError: anError
+	| errorContext |
+	
+	error := anError.
+	errorContext := (AIContext fromMethodContext: error context).
+	rootContext := error signalerContextFrom: errorContext.
+	self selectedMethod: rootContext method
+! !
+
+!HLDebuggerModel methodsFor: 'private'!
+
+flushInnerContexts
+	"When stepping, the inner contexts are not relevent anymore,
+	and can be flushed"
+	
+	self currentContext innerContext: nil.
+	rootContext := self currentContext.
+	self initializeContexts
+! !
+
+!HLDebuggerModel methodsFor: 'reactions'!
+
+onStep
+	rootContext := self currentContext.
+	
+	"Force a refresh of the context list and code widget"
+	self selectedMethod: self currentContext method.
+	self announcer announce: (HLDebuggerContextSelected new
+		context: self currentContext;
+		yourself)
+! !
+
+!HLDebuggerModel methodsFor: 'testing'!
+
+atEnd
+	^ self debugger atEnd
+! !
+
+!HLDebuggerModel class methodsFor: 'instance creation'!
+
+on: anError
+	^ self new
+		initializeFromError: anError;
+		yourself
+! !
+
+Object subclass: #HLErrorHandler
+	instanceVariableNames: ''
+	package: 'Helios-Debugger'!
+
+!HLErrorHandler methodsFor: 'error handling'!
+
+confirmDebugError: anError
+	HLConfirmationWidget new
+		confirmationString: anError messageText;
+		actionBlock: [ self debugError: anError ];
+		cancelButtonLabel: 'Abandon';
+		confirmButtonLabel: 'Debug';
+		show
+!
+
+debugError: anError
+
+	[ 
+		(HLDebugger on: anError) openAsTab 
+	] 
+		on: Error 
+		do: [ :error | ConsoleErrorHandler new handleError: error ]
+!
+
+handleError: anError
+	self confirmDebugError: anError
+!
+
+onErrorHandled
+	"when an error is handled, we need to make sure that
+	any progress bar widget gets removed. Because HLProgressBarWidget is asynchronous,
+	it has to be done here."
+	
+	HLProgressWidget default 
+		flush; 
+		remove
+! !
+
+HLToolListWidget subclass: #HLStackListWidget
+	instanceVariableNames: ''
+	package: 'Helios-Debugger'!
+
+!HLStackListWidget methodsFor: 'accessing'!
+
+items
+	^ self model contexts
+!
+
+label
+	^ 'Call stack'
+! !
+
+!HLStackListWidget methodsFor: 'actions'!
+
+observeModel
+	super observeModel.
+	
+	self model announcer 
+		on: HLDebuggerStepped
+		send: #onDebuggerStepped:
+		to: self
+!
+
+proceed
+	self model proceed
+!
+
+restart
+	self model restart
+!
+
+selectItem: aContext
+   	self model currentContext: aContext.
+	super selectItem: aContext
+!
+
+selectedItem
+   	^ self model currentContext
+!
+
+stepOver
+	self model stepOver
+!
+
+where
+	self model where
+! !
+
+!HLStackListWidget methodsFor: 'reactions'!
+
+onDebuggerStepped: anAnnouncement
+	items := nil.
+	self refresh
+! !
+
+!HLStackListWidget methodsFor: 'rendering'!
+
+renderButtonsOn: html
+	html div 
+		class: 'debugger_bar'; 
+		with: [
+			html button 
+				class: 'btn restart';
+				with: 'Restart';
+				onClick: [ self restart ].
+			html button 
+				class: 'btn where';
+				with: 'Where';
+				onClick: [ self where ].
+			html button 
+				class: 'btn stepOver';
+				with: 'Step over';
+				onClick: [ self stepOver ].
+			html button 
+				class: 'btn proceed';
+				with: 'Proceed';
+				onClick: [ self proceed ] ]
+! !
+

+ 16 - 0
src/Helios-Exceptions.js

@@ -0,0 +1,16 @@
+define("helios/Helios-Exceptions", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Exceptions"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Exceptions');
+smalltalk.packages["Helios-Exceptions"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLError', globals.Error, [], 'Helios-Exceptions');
+globals.HLError.comment="I am the abstract superclass of all Helios-specific errors.";
+
+
+smalltalk.addClass('HLChangeForbidden', globals.HLError, [], 'Helios-Exceptions');
+globals.HLChangeForbidden.comment="I get signaled when a (often user) requested change is forbidden. A confirmation message can then be displayed to the user.\x0a\x0aSee `HLModel >> withChangesDo:`.";
+
+
+smalltalk.addClass('HLListItemNotFound', globals.HLError, [], 'Helios-Exceptions');
+globals.HLListItemNotFound.comment="I get signaled by a `HLListWidget` when a non-existing item in the list is activated.";
+
+});

+ 21 - 0
src/Helios-Exceptions.st

@@ -0,0 +1,21 @@
+Smalltalk createPackage: 'Helios-Exceptions'!
+Error subclass: #HLError
+	instanceVariableNames: ''
+	package: 'Helios-Exceptions'!
+!HLError commentStamp!
+I am the abstract superclass of all Helios-specific errors.!
+
+HLError subclass: #HLChangeForbidden
+	instanceVariableNames: ''
+	package: 'Helios-Exceptions'!
+!HLChangeForbidden commentStamp!
+I get signaled when a (often user) requested change is forbidden. A confirmation message can then be displayed to the user.
+
+See `HLModel >> withChangesDo:`.!
+
+HLError subclass: #HLListItemNotFound
+	instanceVariableNames: ''
+	package: 'Helios-Exceptions'!
+!HLListItemNotFound commentStamp!
+I get signaled by a `HLListWidget` when a non-existing item in the list is activated.!
+

+ 1221 - 0
src/Helios-Helpers.js

@@ -0,0 +1,1221 @@
+define("helios/Helios-Helpers", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Helpers');
+smalltalk.packages["Helios-Helpers"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLClassifier', globals.Object, ['next', 'method'], 'Helios-Helpers');
+globals.HLClassifier.comment="I am an abstract class implementing a link in a `chain of responsibility` pattern.\x0a\x0aSubclasses are in charge of classifying a method according to multiple strategies.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classify",
+protocol: 'protocol',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$receiver;
+$1=self._next();
+$ctx1.sendIdx["next"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return false;
+} else {
+$1;
+};
+$3=self._doClassify();
+if(smalltalk.assert($3)){
+$2=true;
+} else {
+$2=_st(self._next())._classify();
+};
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"classify",{},globals.HLClassifier)})},
+args: [],
+source: "classify\x0a\x09self next ifNil: [ ^ false ].\x0a\x09\x0a\x09^ self doClassify\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self next classify ]",
+messageSends: ["ifNil:", "next", "ifTrue:ifFalse:", "doClassify", "classify"],
+referencedClasses: []
+}),
+globals.HLClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doClassify",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"doClassify",{},globals.HLClassifier)})},
+args: [],
+source: "doClassify\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.HLClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@method"];
+return $1;
+},
+args: [],
+source: "method\x0a\x09^ method",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+self["@method"]=anObject;
+$1=self._next();
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+var nextLink;
+nextLink=$receiver;
+_st(nextLink)._method_(anObject);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"method:",{anObject:anObject},globals.HLClassifier)})},
+args: ["anObject"],
+source: "method: anObject\x0a\x09method := anObject.\x0a\x09self next\x0a\x09\x09ifNotNil: [ :nextLink | nextLink method: anObject ]",
+messageSends: ["ifNotNil:", "next", "method:"],
+referencedClasses: []
+}),
+globals.HLClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@next"];
+return $1;
+},
+args: [],
+source: "next\x0a\x09^ next",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@next"]=anObject;
+return self},
+args: ["anObject"],
+source: "next: anObject\x0a\x09next := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLClassifier);
+
+
+
+smalltalk.addClass('HLAccessorClassifier', globals.HLClassifier, [], 'Helios-Helpers');
+globals.HLAccessorClassifier.comment="I am a classifier checking the method selector matches an instance variable name.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doClassify",
+protocol: 'private',
+fn: function (){
+var self=this;
+var names,selector;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+names=_st(_st(self["@method"])._methodClass())._allInstanceVariableNames();
+selector=_st(self["@method"])._selector();
+$1=_st(_st(selector)._last()).__eq(":");
+if(smalltalk.assert($1)){
+selector=_st(selector)._allButLast();
+selector;
+};
+$2=_st(names)._includes_(selector);
+if(! smalltalk.assert($2)){
+return false;
+};
+_st(self["@method"])._protocol_("accessing");
+return true;
+}, function($ctx1) {$ctx1.fill(self,"doClassify",{names:names,selector:selector},globals.HLAccessorClassifier)})},
+args: [],
+source: "doClassify\x0a\x09| names selector |\x0a\x09\x0a\x09names := method methodClass allInstanceVariableNames.\x0a\x09selector := method selector.\x0a\x09\x0a\x09(selector last = ':')\x0a\x09\x09ifTrue: [ \x22selector might be a setter\x22\x0a\x09\x09\x09selector := selector allButLast ].\x0a\x09\x0a\x09(names includes: selector)\x0a\x09\x09ifFalse: [ ^ false ].\x0a\x09\x09\x0a\x09method protocol: 'accessing'.\x0a\x09^ true.",
+messageSends: ["allInstanceVariableNames", "methodClass", "selector", "ifTrue:", "=", "last", "allButLast", "ifFalse:", "includes:", "protocol:"],
+referencedClasses: []
+}),
+globals.HLAccessorClassifier);
+
+
+
+smalltalk.addClass('HLImplementorClassifier', globals.HLClassifier, [], 'Helios-Helpers');
+globals.HLImplementorClassifier.comment="I am a classifier checking the other implementations of the same selector and choose the protocol the most populated.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doClassify",
+protocol: 'private',
+fn: function (){
+var self=this;
+var currentClass;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2;
+var $early={};
+try {
+currentClass=_st(self["@method"])._methodClass();
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(currentClass)._superclass();
+$ctx2.sendIdx["superclass"]=1;
+return _st($1)._isNil();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+currentClass=_st(currentClass)._superclass();
+currentClass;
+$3=currentClass;
+$4=_st(self["@method"])._selector();
+$ctx2.sendIdx["selector"]=1;
+$2=_st($3)._includesSelector_($4);
+if(smalltalk.assert($2)){
+_st(self["@method"])._protocol_(_st(_st(currentClass).__gt_gt(_st(self["@method"])._selector()))._protocol());
+throw $early=[true];
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return false;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"doClassify",{currentClass:currentClass},globals.HLImplementorClassifier)})},
+args: [],
+source: "doClassify\x0a\x09| currentClass |\x0a\x09currentClass := method methodClass.\x0a\x09\x0a\x09[ currentClass superclass isNil ] whileFalse: [\x0a\x09\x09currentClass := currentClass superclass.\x0a\x09\x09(currentClass includesSelector: method selector)\x0a\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09method protocol: (currentClass >> method selector) protocol.\x0a\x09\x09\x09\x09^ true ]].\x0a\x09\x0a\x09^ false.",
+messageSends: ["methodClass", "whileFalse:", "isNil", "superclass", "ifTrue:", "includesSelector:", "selector", "protocol:", "protocol", ">>"],
+referencedClasses: []
+}),
+globals.HLImplementorClassifier);
+
+
+
+smalltalk.addClass('HLPrefixClassifier', globals.HLClassifier, ['prefixMapping'], 'Helios-Helpers');
+globals.HLPrefixClassifier.comment="I am classifier checking the method selector to know if it begins with a known prefix.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "buildPrefixDictionary",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self["@prefixMapping"]=_st($Dictionary())._new();
+$1=self["@prefixMapping"];
+_st($1)._at_put_("test","tests");
+$ctx1.sendIdx["at:put:"]=1;
+_st($1)._at_put_("bench","benchmarking");
+$ctx1.sendIdx["at:put:"]=2;
+_st($1)._at_put_("copy","copying");
+$ctx1.sendIdx["at:put:"]=3;
+_st($1)._at_put_("initialize","initialization");
+$ctx1.sendIdx["at:put:"]=4;
+_st($1)._at_put_("accept","visitor");
+$ctx1.sendIdx["at:put:"]=5;
+_st($1)._at_put_("visit","visitor");
+$ctx1.sendIdx["at:put:"]=6;
+_st($1)._at_put_("signal","signalling");
+$ctx1.sendIdx["at:put:"]=7;
+_st($1)._at_put_("parse","parsing");
+$ctx1.sendIdx["at:put:"]=8;
+_st($1)._at_put_("add","adding");
+$ctx1.sendIdx["at:put:"]=9;
+_st($1)._at_put_("is","testing");
+$ctx1.sendIdx["at:put:"]=10;
+_st($1)._at_put_("as","converting");
+$ctx1.sendIdx["at:put:"]=11;
+$2=_st($1)._at_put_("new","instance creation");
+return self}, function($ctx1) {$ctx1.fill(self,"buildPrefixDictionary",{},globals.HLPrefixClassifier)})},
+args: [],
+source: "buildPrefixDictionary\x0a\x09prefixMapping := Dictionary new.\x0a\x09prefixMapping \x0a\x09\x09at: 'test' put: 'tests';\x0a\x09 \x09at: 'bench' put: 'benchmarking';\x0a\x09 \x09at: 'copy' put: 'copying';\x0a\x09\x09at: 'initialize' put: 'initialization';\x0a\x09\x09at: 'accept' put: 'visitor';\x0a\x09\x09at: 'visit' put: 'visitor';\x0a\x09\x09at: 'signal' put: 'signalling';\x0a\x09\x09at: 'parse' put: 'parsing';\x0a\x09\x09at: 'add' put: 'adding';\x0a\x09\x09at: 'is' put: 'testing';\x0a\x09\x09at: 'as' put: 'converting';\x0a\x09\x09at: 'new' put: 'instance creation'.",
+messageSends: ["new", "at:put:"],
+referencedClasses: ["Dictionary"]
+}),
+globals.HLPrefixClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doClassify",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+var $early={};
+try {
+_st(self["@prefixMapping"])._keysAndValuesDo_((function(prefix,protocol){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(_st(self["@method"])._selector())._beginsWith_(prefix);
+if(smalltalk.assert($1)){
+_st(self["@method"])._protocol_(protocol);
+throw $early=[true];
+};
+}, function($ctx2) {$ctx2.fillBlock({prefix:prefix,protocol:protocol},$ctx1,1)})}));
+return false;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"doClassify",{},globals.HLPrefixClassifier)})},
+args: [],
+source: "doClassify\x0a\x09prefixMapping keysAndValuesDo: [ :prefix :protocol |\x0a\x09\x09(method selector beginsWith: prefix)\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09method protocol: protocol.\x0a\x09\x09\x09\x09^ true ]].\x0a\x09^ false.",
+messageSends: ["keysAndValuesDo:", "ifTrue:", "beginsWith:", "selector", "protocol:"],
+referencedClasses: []
+}),
+globals.HLPrefixClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLPrefixClassifier.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self._buildPrefixDictionary();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLPrefixClassifier)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x0a\x09self buildPrefixDictionary",
+messageSends: ["initialize", "buildPrefixDictionary"],
+referencedClasses: []
+}),
+globals.HLPrefixClassifier);
+
+
+
+smalltalk.addClass('HLSuperclassClassifier', globals.HLClassifier, [], 'Helios-Helpers');
+globals.HLSuperclassClassifier.comment="I am a classifier checking the superclass chain to find a matching selector.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doClassify",
+protocol: 'private',
+fn: function (){
+var self=this;
+var protocolBag,methods,protocolToUse,counter;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+function $HLReferencesModel(){return globals.HLReferencesModel||(typeof HLReferencesModel=="undefined"?nil:HLReferencesModel)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$4,$3,$5;
+var $early={};
+try {
+protocolBag=_st($Dictionary())._new();
+$ctx1.sendIdx["new"]=1;
+methods=_st(_st($HLReferencesModel())._new())._implementorsOf_(_st(self["@method"])._selector());
+_st(methods)._ifEmpty_ifNotEmpty_((function(){
+throw $early=[false];
+}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(methods)._do_((function(aMethod){
+var protocol;
+return smalltalk.withContext(function($ctx3) {
+protocol=_st(_st(aMethod)._method())._protocol();
+protocol;
+$2=_st(self["@method"])._methodClass();
+$ctx3.sendIdx["methodClass"]=1;
+$1=_st($2).__eq(_st(aMethod)._methodClass());
+$ctx3.sendIdx["="]=1;
+if(! smalltalk.assert($1)){
+$4=_st(_st(protocol)._first()).__eq("*");
+$ctx3.sendIdx["="]=2;
+$3=_st($4)._or_((function(){
+return smalltalk.withContext(function($ctx4) {
+return _st(protocol).__eq(_st(self["@method"])._defaultProtocol());
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)})}));
+if(! smalltalk.assert($3)){
+return _st(protocolBag)._at_put_(protocol,_st(_st(protocolBag)._at_ifAbsent_(protocol,(function(){
+return (0);
+}))).__plus((1)));
+};
+};
+}, function($ctx3) {$ctx3.fillBlock({aMethod:aMethod,protocol:protocol},$ctx2,3)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(protocolBag)._ifEmpty_((function(){
+throw $early=[false];
+}));
+protocolToUse=nil;
+counter=(0);
+_st(protocolBag)._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+$5=_st(value).__gt(counter);
+if(smalltalk.assert($5)){
+counter=value;
+counter;
+protocolToUse=key;
+return protocolToUse;
+};
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,9)})}));
+_st(self["@method"])._protocol_(protocolToUse);
+return true;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"doClassify",{protocolBag:protocolBag,methods:methods,protocolToUse:protocolToUse,counter:counter},globals.HLSuperclassClassifier)})},
+args: [],
+source: "doClassify\x0a\x09| protocolBag methods protocolToUse counter |\x0a\x09\x0a\x09protocolBag := Dictionary new.\x0a\x09methods := HLReferencesModel new implementorsOf: method selector.\x0a\x09methods\x0a\x09\x09ifEmpty: [ ^ false ]\x0a\x09\x09ifNotEmpty: [\x0a\x09\x09\x09methods \x0a\x09\x09\x09\x09do: [ :aMethod || protocol |\x0a\x09\x09\x09\x09\x09protocol := aMethod method protocol.\x0a\x09\x09\x09\x09\x09(method methodClass = aMethod methodClass)\x0a\x09\x09\x09\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09\x09\x09((protocol first = '*') or: [ protocol = method defaultProtocol ])\x0a\x09\x09\x09\x09\x09\x09\x09ifFalse: [ \x0a\x09\x09\x09\x09\x09\x09\x09\x09protocolBag \x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09at: protocol \x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09put: (protocolBag at: protocol ifAbsent: [ 0 ]) + 1 ] ] ] ].\x0a\x09\x09\x09\x0a\x09protocolBag ifEmpty: [ ^ false ].\x0a\x09protocolToUse := nil.\x0a\x09counter := 0.\x0a\x09protocolBag keysAndValuesDo: [ :key :value | value > counter \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09counter := value.\x0a\x09\x09\x09protocolToUse := key ] ].\x0a\x09method protocol: protocolToUse.\x0a\x09^ true",
+messageSends: ["new", "implementorsOf:", "selector", "ifEmpty:ifNotEmpty:", "do:", "protocol", "method", "ifFalse:", "=", "methodClass", "or:", "first", "defaultProtocol", "at:put:", "+", "at:ifAbsent:", "ifEmpty:", "keysAndValuesDo:", "ifTrue:", ">", "protocol:"],
+referencedClasses: ["Dictionary", "HLReferencesModel"]
+}),
+globals.HLSuperclassClassifier);
+
+
+
+smalltalk.addClass('HLGenerationOutput', globals.Object, ['sourceCodes', 'protocol', 'targetClass'], 'Helios-Helpers');
+globals.HLGenerationOutput.comment="I am a simple data object used to store the result of a generation process.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addSourceCode:",
+protocol: 'protocol',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@sourceCodes"])._add_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"addSourceCode:",{aString:aString},globals.HLGenerationOutput)})},
+args: ["aString"],
+source: "addSourceCode: aString\x0a\x09sourceCodes add: aString",
+messageSends: ["add:"],
+referencedClasses: []
+}),
+globals.HLGenerationOutput);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compile",
+protocol: 'protocol',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(self["@sourceCodes"])._do_((function(methodSourceCode){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(self["@targetClass"])._includesSelector_(_st(methodSourceCode)._selector());
+if(! smalltalk.assert($1)){
+return _st(self["@targetClass"])._compile_protocol_(_st(methodSourceCode)._sourceCode(),self["@protocol"]);
+};
+}, function($ctx2) {$ctx2.fillBlock({methodSourceCode:methodSourceCode},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"compile",{},globals.HLGenerationOutput)})},
+args: [],
+source: "compile\x0a\x09sourceCodes do: [ :methodSourceCode |\x0a\x09\x09(targetClass includesSelector: methodSourceCode selector)\x0a\x09\x09\x09ifFalse: [ \x0a\x09\x09\x09\x09targetClass \x0a\x09\x09\x09\x09\x09compile: methodSourceCode sourceCode\x0a\x09\x09\x09\x09\x09protocol: protocol ] ]",
+messageSends: ["do:", "ifFalse:", "includesSelector:", "selector", "compile:protocol:", "sourceCode"],
+referencedClasses: []
+}),
+globals.HLGenerationOutput);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLGenerationOutput.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@sourceCodes"]=_st($OrderedCollection())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLGenerationOutput)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09sourceCodes := OrderedCollection new",
+messageSends: ["initialize", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLGenerationOutput);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "protocol",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@protocol"];
+return $1;
+},
+args: [],
+source: "protocol\x0a\x09^ protocol",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerationOutput);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "protocol:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@protocol"]=aString;
+return self},
+args: ["aString"],
+source: "protocol: aString\x0a\x09protocol := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerationOutput);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sourceCodes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@sourceCodes"];
+return $1;
+},
+args: [],
+source: "sourceCodes\x0a\x09^ sourceCodes",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerationOutput);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sourceCodes:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@sourceCodes"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "sourceCodes: aCollection\x0a\x09sourceCodes := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerationOutput);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "targetClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@targetClass"];
+return $1;
+},
+args: [],
+source: "targetClass\x0a\x09^ targetClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerationOutput);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "targetClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@targetClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "targetClass: aClass\x0a\x09targetClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLGenerationOutput);
+
+
+
+smalltalk.addClass('HLMethodClassifier', globals.Object, ['firstClassifier'], 'Helios-Helpers');
+globals.HLMethodClassifier.comment="I am in charge of categorizing methods following this strategy:\x0a\x0a- is it an accessor?\x0a- is it overriding a superclass method?\x0a- is it starting with a know prefix?\x0a- how are categorized the other implementations?";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addClassifier:",
+protocol: 'private',
+fn: function (aClassifier){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aClassifier)._next_(self["@firstClassifier"]);
+self["@firstClassifier"]=aClassifier;
+return self}, function($ctx1) {$ctx1.fill(self,"addClassifier:",{aClassifier:aClassifier},globals.HLMethodClassifier)})},
+args: ["aClassifier"],
+source: "addClassifier: aClassifier\x0a\x09aClassifier next: firstClassifier.\x0a\x09firstClassifier := aClassifier",
+messageSends: ["next:"],
+referencedClasses: []
+}),
+globals.HLMethodClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classify:",
+protocol: 'protocol',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self["@firstClassifier"];
+_st($1)._method_(aMethod);
+$2=_st($1)._classify();
+return self}, function($ctx1) {$ctx1.fill(self,"classify:",{aMethod:aMethod},globals.HLMethodClassifier)})},
+args: ["aMethod"],
+source: "classify: aMethod\x0a\x09firstClassifier\x0a\x09\x09method: aMethod;\x0a\x09\x09classify",
+messageSends: ["method:", "classify"],
+referencedClasses: []
+}),
+globals.HLMethodClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classifyAll:",
+protocol: 'protocol',
+fn: function (aCollectionOfMethods){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aCollectionOfMethods)._do_((function(method){
+return smalltalk.withContext(function($ctx2) {
+return self._classify_(method);
+}, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"classifyAll:",{aCollectionOfMethods:aCollectionOfMethods},globals.HLMethodClassifier)})},
+args: ["aCollectionOfMethods"],
+source: "classifyAll: aCollectionOfMethods\x0a\x09aCollectionOfMethods do: [ :method |\x0a\x09\x09self classify: method ]",
+messageSends: ["do:", "classify:"],
+referencedClasses: []
+}),
+globals.HLMethodClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLMethodClassifier.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self._setupClassifiers();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLMethodClassifier)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09self setupClassifiers",
+messageSends: ["initialize", "setupClassifiers"],
+referencedClasses: []
+}),
+globals.HLMethodClassifier);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupClassifiers",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $HLImplementorClassifier(){return globals.HLImplementorClassifier||(typeof HLImplementorClassifier=="undefined"?nil:HLImplementorClassifier)}
+function $HLPrefixClassifier(){return globals.HLPrefixClassifier||(typeof HLPrefixClassifier=="undefined"?nil:HLPrefixClassifier)}
+function $HLSuperclassClassifier(){return globals.HLSuperclassClassifier||(typeof HLSuperclassClassifier=="undefined"?nil:HLSuperclassClassifier)}
+function $HLAccessorClassifier(){return globals.HLAccessorClassifier||(typeof HLAccessorClassifier=="undefined"?nil:HLAccessorClassifier)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=_st($HLImplementorClassifier())._new();
+$ctx1.sendIdx["new"]=1;
+self._addClassifier_($1);
+$ctx1.sendIdx["addClassifier:"]=1;
+$2=_st($HLPrefixClassifier())._new();
+$ctx1.sendIdx["new"]=2;
+self._addClassifier_($2);
+$ctx1.sendIdx["addClassifier:"]=2;
+$3=_st($HLSuperclassClassifier())._new();
+$ctx1.sendIdx["new"]=3;
+self._addClassifier_($3);
+$ctx1.sendIdx["addClassifier:"]=3;
+self._addClassifier_(_st($HLAccessorClassifier())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"setupClassifiers",{},globals.HLMethodClassifier)})},
+args: [],
+source: "setupClassifiers\x0a\x09self addClassifier: HLImplementorClassifier new.\x0a\x09self addClassifier: HLPrefixClassifier new.\x0a\x09self addClassifier: HLSuperclassClassifier new.\x0a\x09self addClassifier: HLAccessorClassifier new",
+messageSends: ["addClassifier:", "new"],
+referencedClasses: ["HLImplementorClassifier", "HLPrefixClassifier", "HLSuperclassClassifier", "HLAccessorClassifier"]
+}),
+globals.HLMethodClassifier);
+
+
+
+smalltalk.addClass('HLMethodGenerator', globals.Object, ['output'], 'Helios-Helpers');
+globals.HLMethodGenerator.comment="I am the abstract super class of the method generators.\x0a\x0aMy main method is `generate` which produces an `output` object accessed with `#output`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "class:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@output"])._targetClass_(aClass);
+return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},globals.HLMethodGenerator)})},
+args: ["aClass"],
+source: "class: aClass\x0a\x09output targetClass: aClass",
+messageSends: ["targetClass:"],
+referencedClasses: []
+}),
+globals.HLMethodGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "generate",
+protocol: 'protocol',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(self["@output"])._targetClass();
+if(($receiver = $1) == null || $receiver.isNil){
+self._error_("class should not be nil");
+} else {
+$1;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"generate",{},globals.HLMethodGenerator)})},
+args: [],
+source: "generate\x0a\x09output targetClass ifNil: [ self error: 'class should not be nil'].",
+messageSends: ["ifNil:", "targetClass", "error:"],
+referencedClasses: []
+}),
+globals.HLMethodGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $HLGenerationOutput(){return globals.HLGenerationOutput||(typeof HLGenerationOutput=="undefined"?nil:HLGenerationOutput)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLMethodGenerator.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@output"]=_st($HLGenerationOutput())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLMethodGenerator)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09output := HLGenerationOutput new",
+messageSends: ["initialize", "new"],
+referencedClasses: ["HLGenerationOutput"]
+}),
+globals.HLMethodGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "output",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@output"];
+return $1;
+},
+args: [],
+source: "output\x0a\x09^ output",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodGenerator);
+
+
+
+smalltalk.addClass('HLAccessorsGenerator', globals.HLMethodGenerator, [], 'Helios-Helpers');
+globals.HLAccessorsGenerator.comment="I am a generator used to compile the getters/setters of a class.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accessorProtocolForObject",
+protocol: 'double-dispatch',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@output"])._protocol_("accessing");
+return self}, function($ctx1) {$ctx1.fill(self,"accessorProtocolForObject",{},globals.HLAccessorsGenerator)})},
+args: [],
+source: "accessorProtocolForObject\x0a\x09output protocol: 'accessing'",
+messageSends: ["protocol:"],
+referencedClasses: []
+}),
+globals.HLAccessorsGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accessorsForObject",
+protocol: 'double-dispatch',
+fn: function (){
+var self=this;
+var sources;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+sources=_st($OrderedCollection())._new();
+_st(_st(_st(_st(self["@output"])._targetClass())._instanceVariableNames())._sorted())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=sources;
+_st($1)._add_(self._getterFor_(each));
+$ctx2.sendIdx["add:"]=1;
+$2=_st($1)._add_(self._setterFor_(each));
+return $2;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+_st(self["@output"])._sourceCodes_(sources);
+return self}, function($ctx1) {$ctx1.fill(self,"accessorsForObject",{sources:sources},globals.HLAccessorsGenerator)})},
+args: [],
+source: "accessorsForObject\x0a\x09| sources |\x0a\x09\x0a\x09sources := OrderedCollection new.\x0a\x09output targetClass instanceVariableNames sorted do: [ :each | \x0a\x09\x09sources \x0a\x09\x09\x09add: (self getterFor: each);\x0a\x09\x09\x09add: (self setterFor: each) ].\x0a\x09output sourceCodes: sources",
+messageSends: ["new", "do:", "sorted", "instanceVariableNames", "targetClass", "add:", "getterFor:", "setterFor:", "sourceCodes:"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLAccessorsGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "generate",
+protocol: 'protocol',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+($ctx1.supercall = true, globals.HLAccessorsGenerator.superclass.fn.prototype._generate.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st(self["@output"])._targetClass();
+_st($1)._accessorsSourceCodesWith_(self);
+$2=_st($1)._accessorProtocolWith_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"generate",{},globals.HLAccessorsGenerator)})},
+args: [],
+source: "generate\x0a\x09super generate.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09accessorsSourceCodesWith: self;\x0a\x09\x09accessorProtocolWith: self",
+messageSends: ["generate", "accessorsSourceCodesWith:", "targetClass", "accessorProtocolWith:"],
+referencedClasses: []
+}),
+globals.HLAccessorsGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "getterFor:",
+protocol: 'private',
+fn: function (anInstanceVariable){
+var self=this;
+function $HLMethodSourceCode(){return globals.HLMethodSourceCode||(typeof HLMethodSourceCode=="undefined"?nil:HLMethodSourceCode)}
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($HLMethodSourceCode())._new();
+_st($2)._selector_(anInstanceVariable);
+$3=_st($2)._sourceCode_(_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+_st(stream).__lt_lt(anInstanceVariable);
+$ctx2.sendIdx["<<"]=1;
+_st(_st(stream)._cr())._tab();
+return _st(_st(stream).__lt_lt("^ ")).__lt_lt(anInstanceVariable);
+$ctx2.sendIdx["<<"]=2;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})})));
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"getterFor:",{anInstanceVariable:anInstanceVariable},globals.HLAccessorsGenerator)})},
+args: ["anInstanceVariable"],
+source: "getterFor: anInstanceVariable\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector:anInstanceVariable;\x0a\x09\x09sourceCode: (String streamContents: [ :stream |\x0a\x09\x09stream << anInstanceVariable.\x0a\x09\x09stream cr tab.\x0a\x09\x09stream << '^ ' << anInstanceVariable ])",
+messageSends: ["selector:", "new", "sourceCode:", "streamContents:", "<<", "tab", "cr"],
+referencedClasses: ["HLMethodSourceCode", "String"]
+}),
+globals.HLAccessorsGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setterFor:",
+protocol: 'private',
+fn: function (anInstanceVariable){
+var self=this;
+function $HLMethodSourceCode(){return globals.HLMethodSourceCode||(typeof HLMethodSourceCode=="undefined"?nil:HLMethodSourceCode)}
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$4,$3,$1;
+$2=_st($HLMethodSourceCode())._new();
+_st($2)._selector_(_st(anInstanceVariable).__comma(":"));
+$3=_st($2)._sourceCode_(_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(stream).__lt_lt(anInstanceVariable);
+$ctx2.sendIdx["<<"]=2;
+_st($4).__lt_lt(": anObject");
+$ctx2.sendIdx["<<"]=1;
+_st(_st(stream)._cr())._tab();
+return _st(_st(stream).__lt_lt(anInstanceVariable)).__lt_lt(" := anObject");
+$ctx2.sendIdx["<<"]=3;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})})));
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"setterFor:",{anInstanceVariable:anInstanceVariable},globals.HLAccessorsGenerator)})},
+args: ["anInstanceVariable"],
+source: "setterFor: anInstanceVariable\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector: anInstanceVariable, ':';\x0a\x09\x09sourceCode: (String streamContents: [ :stream |\x0a\x09\x09stream << anInstanceVariable << ': anObject'.\x0a\x09\x09stream cr tab.\x0a\x09\x09stream << anInstanceVariable << ' := anObject' ])",
+messageSends: ["selector:", "new", ",", "sourceCode:", "streamContents:", "<<", "tab", "cr"],
+referencedClasses: ["HLMethodSourceCode", "String"]
+}),
+globals.HLAccessorsGenerator);
+
+
+
+smalltalk.addClass('HLInitializeGenerator', globals.HLMethodGenerator, [], 'Helios-Helpers');
+globals.HLInitializeGenerator.comment="I am used to double-dispatch the `initialize` method(s) generation. I am a disposable object.\x0a\x0a## Usage\x0a\x0a    ^ HLInitializeGenerator new\x0a        class: aClass;\x0a        generate;\x0a        output";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "generate",
+protocol: 'protocol',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+($ctx1.supercall = true, globals.HLInitializeGenerator.superclass.fn.prototype._generate.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st(self["@output"])._targetClass();
+_st($1)._initializeSourceCodesWith_(self);
+$2=_st($1)._initializeProtocolWith_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"generate",{},globals.HLInitializeGenerator)})},
+args: [],
+source: "generate\x0a\x09super generate.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09initializeSourceCodesWith: self;\x0a\x09\x09initializeProtocolWith: self",
+messageSends: ["generate", "initializeSourceCodesWith:", "targetClass", "initializeProtocolWith:"],
+referencedClasses: []
+}),
+globals.HLInitializeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "generateInitializeCodeForObject",
+protocol: 'private',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$4,$5,$6,$7,$8,$1;
+$1=_st($String())._streamContents_((function(str){
+var instVars,size;
+return smalltalk.withContext(function($ctx2) {
+instVars=_st(_st(_st(self["@output"])._targetClass())._instanceVariableNames())._sorted();
+instVars;
+size=_st(instVars)._size();
+size;
+_st(str).__lt_lt("initialize");
+$ctx2.sendIdx["<<"]=1;
+$3=_st(str)._cr();
+$ctx2.sendIdx["cr"]=1;
+$2=_st($3)._tab();
+$ctx2.sendIdx["tab"]=1;
+_st($2).__lt_lt("super initialize.");
+$ctx2.sendIdx["<<"]=2;
+$4=_st($2)._cr();
+$ctx2.sendIdx["cr"]=2;
+$4;
+$5=_st(str)._cr();
+$ctx2.sendIdx["cr"]=3;
+_st($5)._tab();
+$ctx2.sendIdx["tab"]=2;
+return _st(instVars)._withIndexDo_((function(name,index){
+return smalltalk.withContext(function($ctx3) {
+$6=_st(index).__tild_eq((1));
+$ctx3.sendIdx["~="]=1;
+if(smalltalk.assert($6)){
+_st(_st(str)._cr())._tab();
+};
+$7=_st(str).__lt_lt(name);
+$ctx3.sendIdx["<<"]=4;
+_st($7).__lt_lt(" := nil");
+$ctx3.sendIdx["<<"]=3;
+$8=_st(index).__tild_eq(size);
+if(smalltalk.assert($8)){
+return _st(str).__lt_lt(".");
+};
+}, function($ctx3) {$ctx3.fillBlock({name:name,index:index},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({str:str,instVars:instVars,size:size},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"generateInitializeCodeForObject",{},globals.HLInitializeGenerator)})},
+args: [],
+source: "generateInitializeCodeForObject\x09\x0a\x09^ String streamContents: [ :str || instVars size |\x0a\x09\x09instVars := output targetClass instanceVariableNames sorted.\x0a\x09\x09size := instVars size.\x0a\x09\x09str << 'initialize'.\x0a\x09\x09str cr tab << 'super initialize.';cr.\x0a\x09\x09str cr tab.\x0a\x09\x09instVars withIndexDo: [ :name :index |\x0a\x09\x09\x09index ~= 1 ifTrue: [ str cr tab ].\x0a\x09\x09\x09str << name << ' := nil'.\x0a\x09\x09\x09index ~= size ifTrue: [ str << '.' ] ] ].",
+messageSends: ["streamContents:", "sorted", "instanceVariableNames", "targetClass", "size", "<<", "tab", "cr", "withIndexDo:", "ifTrue:", "~="],
+referencedClasses: ["String"]
+}),
+globals.HLInitializeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeForObject",
+protocol: 'double-dispatch',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@output"])._addSourceCode_(self._initializeMethodForObject());
+return self}, function($ctx1) {$ctx1.fill(self,"initializeForObject",{},globals.HLInitializeGenerator)})},
+args: [],
+source: "initializeForObject\x0a\x09output addSourceCode: self initializeMethodForObject",
+messageSends: ["addSourceCode:", "initializeMethodForObject"],
+referencedClasses: []
+}),
+globals.HLInitializeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeMethodForObject",
+protocol: 'private',
+fn: function (){
+var self=this;
+function $HLMethodSourceCode(){return globals.HLMethodSourceCode||(typeof HLMethodSourceCode=="undefined"?nil:HLMethodSourceCode)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($HLMethodSourceCode())._new();
+_st($2)._selector_("initialize");
+_st($2)._sourceCode_(self._generateInitializeCodeForObject());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"initializeMethodForObject",{},globals.HLInitializeGenerator)})},
+args: [],
+source: "initializeMethodForObject\x09\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector: 'initialize';\x0a\x09\x09sourceCode: self generateInitializeCodeForObject;\x0a\x09\x09yourself",
+messageSends: ["selector:", "new", "sourceCode:", "generateInitializeCodeForObject", "yourself"],
+referencedClasses: ["HLMethodSourceCode"]
+}),
+globals.HLInitializeGenerator);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeProtocolForObject",
+protocol: 'double-dispatch',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@output"])._protocol_("initialization");
+return self}, function($ctx1) {$ctx1.fill(self,"initializeProtocolForObject",{},globals.HLInitializeGenerator)})},
+args: [],
+source: "initializeProtocolForObject\x0a\x09output protocol: 'initialization'",
+messageSends: ["protocol:"],
+referencedClasses: []
+}),
+globals.HLInitializeGenerator);
+
+
+
+smalltalk.addClass('HLMethodSourceCode', globals.Object, ['selector', 'sourceCode'], 'Helios-Helpers');
+globals.HLMethodSourceCode.comment="I am a simple data object keeping track of the information about a method that will be compiled at the end of the generation process.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selector"];
+return $1;
+},
+args: [],
+source: "selector\x0a\x09^ selector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodSourceCode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aSelector){
+var self=this;
+self["@selector"]=aSelector;
+return self},
+args: ["aSelector"],
+source: "selector: aSelector\x0a\x09selector := aSelector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodSourceCode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sourceCode",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@sourceCode"];
+return $1;
+},
+args: [],
+source: "sourceCode\x0a\x09^ sourceCode",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodSourceCode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sourceCode:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@sourceCode"]=aString;
+return self},
+args: ["aString"],
+source: "sourceCode: aString\x0a\x09sourceCode := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodSourceCode);
+
+
+
+smalltalk.addClass('HLPackageCommitErrorHelper', globals.Object, ['model'], 'Helios-Helpers');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPackage",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLCommitPackageCommand(){return globals.HLCommitPackageCommand||(typeof HLCommitPackageCommand=="undefined"?nil:HLCommitPackageCommand)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($HLCommitPackageCommand())._for_(self._model()))._execute();
+return self}, function($ctx1) {$ctx1.fill(self,"commitPackage",{},globals.HLPackageCommitErrorHelper)})},
+args: [],
+source: "commitPackage\x0a\x09(HLCommitPackageCommand for: self model)\x0a\x09\x09execute",
+messageSends: ["execute", "for:", "model"],
+referencedClasses: ["HLCommitPackageCommand"]
+}),
+globals.HLPackageCommitErrorHelper);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitToPath:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._package())._transport())._setPath_(aString);
+self._commitPackage();
+return self}, function($ctx1) {$ctx1.fill(self,"commitToPath:",{aString:aString},globals.HLPackageCommitErrorHelper)})},
+args: ["aString"],
+source: "commitToPath: aString\x0a\x09\x22We only take AMD package transport into account for now\x22\x0a\x09\x0a\x09self package transport setPath: aString.\x0a\x09\x0a\x09self commitPackage",
+messageSends: ["setPath:", "transport", "package", "commitPackage"],
+referencedClasses: []
+}),
+globals.HLPackageCommitErrorHelper);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@model"];
+return $1;
+},
+args: [],
+source: "model\x0a\x09^ model",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLPackageCommitErrorHelper);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+protocol: 'accessing',
+fn: function (aToolModel){
+var self=this;
+self["@model"]=aToolModel;
+return self},
+args: ["aToolModel"],
+source: "model: aToolModel\x0a\x09model := aToolModel",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLPackageCommitErrorHelper);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "package",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._packageToCommit();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"package",{},globals.HLPackageCommitErrorHelper)})},
+args: [],
+source: "package\x0a\x09^ self model packageToCommit",
+messageSends: ["packageToCommit", "model"],
+referencedClasses: []
+}),
+globals.HLPackageCommitErrorHelper);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showHelp",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLConfirmationWidget(){return globals.HLConfirmationWidget||(typeof HLConfirmationWidget=="undefined"?nil:HLConfirmationWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+$1=_st($HLConfirmationWidget())._new();
+$2=$1;
+$3=_st("Commit failed for namespace \x22".__comma(_st(_st(self._package())._transport())._namespace())).__comma("\x22. Do you want to commit to another path?");
+$ctx1.sendIdx[","]=1;
+_st($2)._confirmationString_($3);
+_st($1)._actionBlock_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._showNewCommitPath();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+_st($1)._cancelButtonLabel_("Abandon");
+_st($1)._confirmButtonLabel_("Set path");
+$4=_st($1)._show();
+return self}, function($ctx1) {$ctx1.fill(self,"showHelp",{},globals.HLPackageCommitErrorHelper)})},
+args: [],
+source: "showHelp\x0a\x09HLConfirmationWidget new\x0a\x09\x09confirmationString: 'Commit failed for namespace \x22', self package transport namespace, '\x22. Do you want to commit to another path?';\x0a\x09\x09actionBlock: [ self showNewCommitPath ];\x0a\x09\x09cancelButtonLabel: 'Abandon';\x0a\x09\x09confirmButtonLabel: 'Set path';\x0a\x09\x09show\x0a\x09",
+messageSends: ["confirmationString:", "new", ",", "namespace", "transport", "package", "actionBlock:", "showNewCommitPath", "cancelButtonLabel:", "confirmButtonLabel:", "show"],
+referencedClasses: ["HLConfirmationWidget"]
+}),
+globals.HLPackageCommitErrorHelper);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showNewCommitPath",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLRequestWidget(){return globals.HLRequestWidget||(typeof HLRequestWidget=="undefined"?nil:HLRequestWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLRequestWidget())._new();
+_st($1)._beSingleline();
+_st($1)._confirmationString_("Set commit path");
+_st($1)._actionBlock_((function(url){
+return smalltalk.withContext(function($ctx2) {
+return self._commitToPath_(url);
+}, function($ctx2) {$ctx2.fillBlock({url:url},$ctx1,1)})}));
+_st($1)._confirmButtonLabel_("Commit with new path");
+_st($1)._value_("/src");
+$2=_st($1)._show();
+return self}, function($ctx1) {$ctx1.fill(self,"showNewCommitPath",{},globals.HLPackageCommitErrorHelper)})},
+args: [],
+source: "showNewCommitPath\x0a\x09HLRequestWidget new\x0a\x09\x09beSingleline;\x0a\x09\x09confirmationString: 'Set commit path';\x0a\x09\x09actionBlock: [ :url | self commitToPath: url ];\x0a\x09\x09confirmButtonLabel: 'Commit with new path';\x0a\x09\x09value: '/src';\x0a\x09\x09show",
+messageSends: ["beSingleline", "new", "confirmationString:", "actionBlock:", "commitToPath:", "confirmButtonLabel:", "value:", "show"],
+referencedClasses: ["HLRequestWidget"]
+}),
+globals.HLPackageCommitErrorHelper);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aToolModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._model_(aToolModel);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aToolModel:aToolModel},globals.HLPackageCommitErrorHelper.klass)})},
+args: ["aToolModel"],
+source: "on: aToolModel\x0a\x09^ self new\x0a\x09\x09model: aToolModel;\x0a\x09\x09yourself",
+messageSends: ["model:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLPackageCommitErrorHelper.klass);
+
+});

+ 497 - 0
src/Helios-Helpers.st

@@ -0,0 +1,497 @@
+Smalltalk createPackage: 'Helios-Helpers'!
+Object subclass: #HLClassifier
+	instanceVariableNames: 'next method'
+	package: 'Helios-Helpers'!
+!HLClassifier commentStamp!
+I am an abstract class implementing a link in a `chain of responsibility` pattern.
+
+Subclasses are in charge of classifying a method according to multiple strategies.!
+
+!HLClassifier methodsFor: 'accessing'!
+
+method
+	^ method
+!
+
+method: anObject
+	method := anObject.
+	self next
+		ifNotNil: [ :nextLink | nextLink method: anObject ]
+!
+
+next
+	^ next
+!
+
+next: anObject
+	next := anObject
+! !
+
+!HLClassifier methodsFor: 'private'!
+
+doClassify
+	self subclassResponsibility
+! !
+
+!HLClassifier methodsFor: 'protocol'!
+
+classify
+	self next ifNil: [ ^ false ].
+	
+	^ self doClassify
+		ifTrue: [ true ]
+		ifFalse: [ self next classify ]
+! !
+
+HLClassifier subclass: #HLAccessorClassifier
+	instanceVariableNames: ''
+	package: 'Helios-Helpers'!
+!HLAccessorClassifier commentStamp!
+I am a classifier checking the method selector matches an instance variable name.!
+
+!HLAccessorClassifier methodsFor: 'private'!
+
+doClassify
+	| names selector |
+	
+	names := method methodClass allInstanceVariableNames.
+	selector := method selector.
+	
+	(selector last = ':')
+		ifTrue: [ "selector might be a setter"
+			selector := selector allButLast ].
+	
+	(names includes: selector)
+		ifFalse: [ ^ false ].
+		
+	method protocol: 'accessing'.
+	^ true.
+! !
+
+HLClassifier subclass: #HLImplementorClassifier
+	instanceVariableNames: ''
+	package: 'Helios-Helpers'!
+!HLImplementorClassifier commentStamp!
+I am a classifier checking the other implementations of the same selector and choose the protocol the most populated.!
+
+!HLImplementorClassifier methodsFor: 'private'!
+
+doClassify
+	| currentClass |
+	currentClass := method methodClass.
+	
+	[ currentClass superclass isNil ] whileFalse: [
+		currentClass := currentClass superclass.
+		(currentClass includesSelector: method selector)
+			ifTrue: [ 
+				method protocol: (currentClass >> method selector) protocol.
+				^ true ]].
+	
+	^ false.
+! !
+
+HLClassifier subclass: #HLPrefixClassifier
+	instanceVariableNames: 'prefixMapping'
+	package: 'Helios-Helpers'!
+!HLPrefixClassifier commentStamp!
+I am classifier checking the method selector to know if it begins with a known prefix.!
+
+!HLPrefixClassifier methodsFor: 'initialization'!
+
+buildPrefixDictionary
+	prefixMapping := Dictionary new.
+	prefixMapping 
+		at: 'test' put: 'tests';
+	 	at: 'bench' put: 'benchmarking';
+	 	at: 'copy' put: 'copying';
+		at: 'initialize' put: 'initialization';
+		at: 'accept' put: 'visitor';
+		at: 'visit' put: 'visitor';
+		at: 'signal' put: 'signalling';
+		at: 'parse' put: 'parsing';
+		at: 'add' put: 'adding';
+		at: 'is' put: 'testing';
+		at: 'as' put: 'converting';
+		at: 'new' put: 'instance creation'.
+!
+
+initialize
+	super initialize.
+
+	self buildPrefixDictionary
+! !
+
+!HLPrefixClassifier methodsFor: 'private'!
+
+doClassify
+	prefixMapping keysAndValuesDo: [ :prefix :protocol |
+		(method selector beginsWith: prefix)
+			ifTrue: [
+				method protocol: protocol.
+				^ true ]].
+	^ false.
+! !
+
+HLClassifier subclass: #HLSuperclassClassifier
+	instanceVariableNames: ''
+	package: 'Helios-Helpers'!
+!HLSuperclassClassifier commentStamp!
+I am a classifier checking the superclass chain to find a matching selector.!
+
+!HLSuperclassClassifier methodsFor: 'private'!
+
+doClassify
+	| protocolBag methods protocolToUse counter |
+	
+	protocolBag := Dictionary new.
+	methods := HLReferencesModel new implementorsOf: method selector.
+	methods
+		ifEmpty: [ ^ false ]
+		ifNotEmpty: [
+			methods 
+				do: [ :aMethod || protocol |
+					protocol := aMethod method protocol.
+					(method methodClass = aMethod methodClass)
+						ifFalse: [
+						((protocol first = '*') or: [ protocol = method defaultProtocol ])
+							ifFalse: [ 
+								protocolBag 
+									at: protocol 
+									put: (protocolBag at: protocol ifAbsent: [ 0 ]) + 1 ] ] ] ].
+			
+	protocolBag ifEmpty: [ ^ false ].
+	protocolToUse := nil.
+	counter := 0.
+	protocolBag keysAndValuesDo: [ :key :value | value > counter 
+		ifTrue: [
+			counter := value.
+			protocolToUse := key ] ].
+	method protocol: protocolToUse.
+	^ true
+! !
+
+Object subclass: #HLGenerationOutput
+	instanceVariableNames: 'sourceCodes protocol targetClass'
+	package: 'Helios-Helpers'!
+!HLGenerationOutput commentStamp!
+I am a simple data object used to store the result of a generation process.!
+
+!HLGenerationOutput methodsFor: 'accessing'!
+
+protocol
+	^ protocol
+!
+
+protocol: aString
+	protocol := aString
+!
+
+sourceCodes
+	^ sourceCodes
+!
+
+sourceCodes: aCollection
+	sourceCodes := aCollection
+!
+
+targetClass
+	^ targetClass
+!
+
+targetClass: aClass
+	targetClass := aClass
+! !
+
+!HLGenerationOutput methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	
+	sourceCodes := OrderedCollection new
+! !
+
+!HLGenerationOutput methodsFor: 'protocol'!
+
+addSourceCode: aString
+	sourceCodes add: aString
+!
+
+compile
+	sourceCodes do: [ :methodSourceCode |
+		(targetClass includesSelector: methodSourceCode selector)
+			ifFalse: [ 
+				targetClass 
+					compile: methodSourceCode sourceCode
+					protocol: protocol ] ]
+! !
+
+Object subclass: #HLMethodClassifier
+	instanceVariableNames: 'firstClassifier'
+	package: 'Helios-Helpers'!
+!HLMethodClassifier commentStamp!
+I am in charge of categorizing methods following this strategy:
+
+- is it an accessor?
+- is it overriding a superclass method?
+- is it starting with a know prefix?
+- how are categorized the other implementations?!
+
+!HLMethodClassifier methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	
+	self setupClassifiers
+!
+
+setupClassifiers
+	self addClassifier: HLImplementorClassifier new.
+	self addClassifier: HLPrefixClassifier new.
+	self addClassifier: HLSuperclassClassifier new.
+	self addClassifier: HLAccessorClassifier new
+! !
+
+!HLMethodClassifier methodsFor: 'private'!
+
+addClassifier: aClassifier
+	aClassifier next: firstClassifier.
+	firstClassifier := aClassifier
+! !
+
+!HLMethodClassifier methodsFor: 'protocol'!
+
+classify: aMethod
+	firstClassifier
+		method: aMethod;
+		classify
+!
+
+classifyAll: aCollectionOfMethods
+	aCollectionOfMethods do: [ :method |
+		self classify: method ]
+! !
+
+Object subclass: #HLMethodGenerator
+	instanceVariableNames: 'output'
+	package: 'Helios-Helpers'!
+!HLMethodGenerator commentStamp!
+I am the abstract super class of the method generators.
+
+My main method is `generate` which produces an `output` object accessed with `#output`.!
+
+!HLMethodGenerator methodsFor: 'accessing'!
+
+class: aClass
+	output targetClass: aClass
+!
+
+output
+	^ output
+! !
+
+!HLMethodGenerator methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	
+	output := HLGenerationOutput new
+! !
+
+!HLMethodGenerator methodsFor: 'protocol'!
+
+generate
+	output targetClass ifNil: [ self error: 'class should not be nil'].
+! !
+
+HLMethodGenerator subclass: #HLAccessorsGenerator
+	instanceVariableNames: ''
+	package: 'Helios-Helpers'!
+!HLAccessorsGenerator commentStamp!
+I am a generator used to compile the getters/setters of a class.!
+
+!HLAccessorsGenerator methodsFor: 'double-dispatch'!
+
+accessorProtocolForObject
+	output protocol: 'accessing'
+!
+
+accessorsForObject
+	| sources |
+	
+	sources := OrderedCollection new.
+	output targetClass instanceVariableNames sorted do: [ :each | 
+		sources 
+			add: (self getterFor: each);
+			add: (self setterFor: each) ].
+	output sourceCodes: sources
+! !
+
+!HLAccessorsGenerator methodsFor: 'private'!
+
+getterFor: anInstanceVariable
+	^ HLMethodSourceCode new
+		selector:anInstanceVariable;
+		sourceCode: (String streamContents: [ :stream |
+		stream << anInstanceVariable.
+		stream cr tab.
+		stream << '^ ' << anInstanceVariable ])
+!
+
+setterFor: anInstanceVariable
+	^ HLMethodSourceCode new
+		selector: anInstanceVariable, ':';
+		sourceCode: (String streamContents: [ :stream |
+		stream << anInstanceVariable << ': anObject'.
+		stream cr tab.
+		stream << anInstanceVariable << ' := anObject' ])
+! !
+
+!HLAccessorsGenerator methodsFor: 'protocol'!
+
+generate
+	super generate.
+	
+	output targetClass 
+		accessorsSourceCodesWith: self;
+		accessorProtocolWith: self
+! !
+
+HLMethodGenerator subclass: #HLInitializeGenerator
+	instanceVariableNames: ''
+	package: 'Helios-Helpers'!
+!HLInitializeGenerator commentStamp!
+I am used to double-dispatch the `initialize` method(s) generation. I am a disposable object.
+
+## Usage
+
+    ^ HLInitializeGenerator new
+        class: aClass;
+        generate;
+        output!
+
+!HLInitializeGenerator methodsFor: 'double-dispatch'!
+
+initializeForObject
+	output addSourceCode: self initializeMethodForObject
+!
+
+initializeProtocolForObject
+	output protocol: 'initialization'
+! !
+
+!HLInitializeGenerator methodsFor: 'private'!
+
+generateInitializeCodeForObject	
+	^ String streamContents: [ :str || instVars size |
+		instVars := output targetClass instanceVariableNames sorted.
+		size := instVars size.
+		str << 'initialize'.
+		str cr tab << 'super initialize.';cr.
+		str cr tab.
+		instVars withIndexDo: [ :name :index |
+			index ~= 1 ifTrue: [ str cr tab ].
+			str << name << ' := nil'.
+			index ~= size ifTrue: [ str << '.' ] ] ].
+!
+
+initializeMethodForObject	
+	^ HLMethodSourceCode new
+		selector: 'initialize';
+		sourceCode: self generateInitializeCodeForObject;
+		yourself
+! !
+
+!HLInitializeGenerator methodsFor: 'protocol'!
+
+generate
+	super generate.
+	
+	output targetClass 
+		initializeSourceCodesWith: self;
+		initializeProtocolWith: self
+! !
+
+Object subclass: #HLMethodSourceCode
+	instanceVariableNames: 'selector sourceCode'
+	package: 'Helios-Helpers'!
+!HLMethodSourceCode commentStamp!
+I am a simple data object keeping track of the information about a method that will be compiled at the end of the generation process.!
+
+!HLMethodSourceCode methodsFor: 'accessing'!
+
+selector
+	^ selector
+!
+
+selector: aSelector
+	selector := aSelector
+!
+
+sourceCode
+	^ sourceCode
+!
+
+sourceCode: aString
+	sourceCode := aString
+! !
+
+Object subclass: #HLPackageCommitErrorHelper
+	instanceVariableNames: 'model'
+	package: 'Helios-Helpers'!
+
+!HLPackageCommitErrorHelper methodsFor: 'accessing'!
+
+model
+	^ model
+!
+
+model: aToolModel
+	model := aToolModel
+!
+
+package
+	^ self model packageToCommit
+! !
+
+!HLPackageCommitErrorHelper methodsFor: 'actions'!
+
+commitPackage
+	(HLCommitPackageCommand for: self model)
+		execute
+!
+
+commitToPath: aString
+	"We only take AMD package transport into account for now"
+	
+	self package transport setPath: aString.
+	
+	self commitPackage
+!
+
+showHelp
+	HLConfirmationWidget new
+		confirmationString: 'Commit failed for namespace "', self package transport namespace, '". Do you want to commit to another path?';
+		actionBlock: [ self showNewCommitPath ];
+		cancelButtonLabel: 'Abandon';
+		confirmButtonLabel: 'Set path';
+		show
+!
+
+showNewCommitPath
+	HLRequestWidget new
+		beSingleline;
+		confirmationString: 'Set commit path';
+		actionBlock: [ :url | self commitToPath: url ];
+		confirmButtonLabel: 'Commit with new path';
+		value: '/src';
+		show
+! !
+
+!HLPackageCommitErrorHelper class methodsFor: 'instance creation'!
+
+on: aToolModel
+	^ self new
+		model: aToolModel;
+		yourself
+! !
+

+ 1449 - 0
src/Helios-Inspector.js

@@ -0,0 +1,1449 @@
+define("helios/Helios-Inspector", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "helios/Helios-Core"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Inspector');
+smalltalk.packages["Helios-Inspector"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLInspectorDisplayWidget', globals.HLNavigationListWidget, ['inspector'], 'Helios-Inspector');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@inspector"];
+return $1;
+},
+args: [],
+source: "inspector\x0a\x09^ inspector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorDisplayWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspector:",
+protocol: 'accessing',
+fn: function (anInspector){
+var self=this;
+self["@inspector"]=anInspector;
+return self},
+args: ["anInspector"],
+source: "inspector: anInspector\x0a\x09inspector := anInspector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorDisplayWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._inspector())._model();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},globals.HLInspectorDisplayWidget)})},
+args: [],
+source: "model\x0a\x0a\x09^ self inspector model",
+messageSends: ["model", "inspector"],
+referencedClasses: []
+}),
+globals.HLInspectorDisplayWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(html)._div())._with_(self._selectionDisplayString());
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLInspectorDisplayWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09\x0a    html div with: self selectionDisplayString",
+messageSends: ["with:", "div", "selectionDisplayString"],
+referencedClasses: []
+}),
+globals.HLInspectorDisplayWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectionDisplayString",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+var selection;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$5,$4,$3,$2;
+$1=self._model();
+$ctx1.sendIdx["model"]=1;
+selection=_st($1)._selection();
+$5=self._model();
+$ctx1.sendIdx["model"]=2;
+$4=_st($5)._variables();
+$3=_st($4)._includesKey_(selection);
+if(smalltalk.assert($3)){
+$2=_st(_st(self._model())._instVarObjectAt_(selection))._printString();
+} else {
+$2="";
+};
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"selectionDisplayString",{selection:selection},globals.HLInspectorDisplayWidget)})},
+args: [],
+source: "selectionDisplayString\x0a\x09|selection|\x0a\x09selection := self model selection.\x0a    ^ (self model variables includesKey: selection)\x0a    \x09ifTrue:[ (self model instVarObjectAt: selection) printString ]\x0a      \x09ifFalse:[ '' ]",
+messageSends: ["selection", "model", "ifTrue:ifFalse:", "includesKey:", "variables", "printString", "instVarObjectAt:"],
+referencedClasses: []
+}),
+globals.HLInspectorDisplayWidget);
+
+
+
+smalltalk.addClass('HLInspectorModel', globals.HLModel, ['inspectee', 'code', 'variables', 'label', 'selection'], 'Helios-Inspector');
+globals.HLInspectorModel.comment="I am the model of the Helios inspector `HLInspectorWidget`.\x0a\x0a## API\x0a\x0aUse the method `inspect:on:` to inspect an object on an inspector.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "code",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLCodeModel(){return globals.HLCodeModel||(typeof HLCodeModel=="undefined"?nil:HLCodeModel)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@code"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@code"]=_st($HLCodeModel())._on_(self._environment());
+$1=self["@code"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"code",{},globals.HLInspectorModel)})},
+args: [],
+source: "code\x0a\x09\x22Answers the code model working for this workspace model\x22\x0a\x09^ code ifNil:[ code := HLCodeModel on: self environment ]",
+messageSends: ["ifNil:", "on:", "environment"],
+referencedClasses: ["HLCodeModel"]
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspect:on:",
+protocol: 'actions',
+fn: function (anObject,anInspector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@inspectee"]=anObject;
+self["@variables"]=[];
+_st(self["@inspectee"])._inspectOn_(anInspector);
+return self}, function($ctx1) {$ctx1.fill(self,"inspect:on:",{anObject:anObject,anInspector:anInspector},globals.HLInspectorModel)})},
+args: ["anObject", "anInspector"],
+source: "inspect: anObject on: anInspector\x0a\x09inspectee := anObject.\x0a\x09variables := #().\x0a\x09inspectee inspectOn: anInspector",
+messageSends: ["inspectOn:"],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectee",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@inspectee"];
+return $1;
+},
+args: [],
+source: "inspectee \x0a\x09^ inspectee",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectee:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@inspectee"]=anObject;
+return self},
+args: ["anObject"],
+source: "inspectee: anObject \x0a\x09inspectee := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instVarObjectAt:",
+protocol: 'actions',
+fn: function (anInstVarName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._variables())._at_(anInstVarName);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"instVarObjectAt:",{anInstVarName:anInstVarName},globals.HLInspectorModel)})},
+args: ["anInstVarName"],
+source: "instVarObjectAt: anInstVarName\x0a\x09^ self variables at: anInstVarName",
+messageSends: ["at:", "variables"],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@label"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=_st(self._inspectee())._printString();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"label",{},globals.HLInspectorModel)})},
+args: [],
+source: "label\x0a    ^ label ifNil: [ self inspectee printString ]",
+messageSends: ["ifNil:", "printString", "inspectee"],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@label"]=aString;
+return self},
+args: ["aString"],
+source: "label: aString\x0a    label := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedInstVar:",
+protocol: 'actions',
+fn: function (anInstVarName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selection_(anInstVarName);
+return self}, function($ctx1) {$ctx1.fill(self,"selectedInstVar:",{anInstVarName:anInstVarName},globals.HLInspectorModel)})},
+args: ["anInstVarName"],
+source: "selectedInstVar: anInstVarName\x0a    self selection: anInstVarName",
+messageSends: ["selection:"],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedInstVarObject",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._instVarObjectAt_(self._selection());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectedInstVarObject",{},globals.HLInspectorModel)})},
+args: [],
+source: "selectedInstVarObject\x0a\x09^ self instVarObjectAt: self selection",
+messageSends: ["instVarObjectAt:", "selection"],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selection",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@selection"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selection",{},globals.HLInspectorModel)})},
+args: [],
+source: "selection\x0a\x09^ selection ifNil:[ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selection:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+function $HLInstanceVariableSelected(){return globals.HLInstanceVariableSelected||(typeof HLInstanceVariableSelected=="undefined"?nil:HLInstanceVariableSelected)}
+return smalltalk.withContext(function($ctx1) { 
+self["@selection"]=anObject;
+_st(self._announcer())._announce_(_st($HLInstanceVariableSelected())._on_(self["@selection"]));
+return self}, function($ctx1) {$ctx1.fill(self,"selection:",{anObject:anObject},globals.HLInspectorModel)})},
+args: ["anObject"],
+source: "selection: anObject\x0a\x09selection := anObject.\x0a\x0a\x09self announcer announce: (HLInstanceVariableSelected on: selection)",
+messageSends: ["announce:", "announcer", "on:"],
+referencedClasses: ["HLInstanceVariableSelected"]
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subscribe:",
+protocol: 'actions',
+fn: function (aWidget){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aWidget)._subscribeTo_(self._announcer());
+return self}, function($ctx1) {$ctx1.fill(self,"subscribe:",{aWidget:aWidget},globals.HLInspectorModel)})},
+args: ["aWidget"],
+source: "subscribe: aWidget\x0a\x09aWidget subscribeTo: self announcer",
+messageSends: ["subscribeTo:", "announcer"],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@variables"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=_st($Dictionary())._new();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"variables",{},globals.HLInspectorModel)})},
+args: [],
+source: "variables\x0a\x09^ variables ifNil: [ Dictionary new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Dictionary"]
+}),
+globals.HLInspectorModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variables:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@variables"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "variables: aCollection\x0a\x09variables := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorModel);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'actions',
+fn: function (anEnvironment){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._environment_(anEnvironment);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment},globals.HLInspectorModel.klass)})},
+args: ["anEnvironment"],
+source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a    \x09environment: anEnvironment;\x0a        yourself",
+messageSends: ["environment:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLInspectorModel.klass);
+
+
+smalltalk.addClass('HLInspectorVariablesWidget', globals.HLNavigationListWidget, ['announcer', 'inspector', 'list', 'diveButton'], 'Helios-Inspector');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announcer",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@announcer"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@announcer"]=_st($Announcer())._new();
+$1=self["@announcer"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.HLInspectorVariablesWidget)})},
+args: [],
+source: "announcer\x0a\x09^ announcer ifNil:[ announcer := Announcer new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Announcer"]
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultItems",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._variables();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultItems",{},globals.HLInspectorVariablesWidget)})},
+args: [],
+source: "defaultItems\x0a\x09^ self variables",
+messageSends: ["variables"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "dive",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDiveRequested(){return globals.HLDiveRequested||(typeof HLDiveRequested=="undefined"?nil:HLDiveRequested)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._announcer())._announce_(_st($HLDiveRequested())._new());
+return self}, function($ctx1) {$ctx1.fill(self,"dive",{},globals.HLInspectorVariablesWidget)})},
+args: [],
+source: "dive\x0a\x09self announcer announce: HLDiveRequested new",
+messageSends: ["announce:", "announcer", "new"],
+referencedClasses: ["HLDiveRequested"]
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@inspector"];
+return $1;
+},
+args: [],
+source: "inspector\x0a\x09^ inspector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspector:",
+protocol: 'accessing',
+fn: function (anInspector){
+var self=this;
+self["@inspector"]=anInspector;
+return self},
+args: ["anInspector"],
+source: "inspector: anInspector\x0a\x09inspector := anInspector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._label();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"label",{},globals.HLInspectorVariablesWidget)})},
+args: [],
+source: "label\x0a\x09^ self model label",
+messageSends: ["label", "model"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._inspector())._model();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},globals.HLInspectorVariablesWidget)})},
+args: [],
+source: "model\x0a    ^ self inspector model",
+messageSends: ["model", "inspector"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "refresh",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._variables()).__eq(self._items());
+if(! smalltalk.assert($1)){
+self._resetItems();
+($ctx1.supercall = true, globals.HLInspectorVariablesWidget.superclass.fn.prototype._refresh.apply(_st(self), []));
+$ctx1.supercall = false;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},globals.HLInspectorVariablesWidget)})},
+args: [],
+source: "refresh\x0a\x09self variables = self items ifFalse: [\x0a\x09\x09self resetItems.\x0a    \x09super refresh ]",
+messageSends: ["ifFalse:", "=", "variables", "items", "resetItems", "refresh"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._button();
+_st($1)._class_("btn");
+_st($1)._with_("Dive");
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._dive();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+self["@diveButton"]=$2;
+return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},globals.HLInspectorVariablesWidget)})},
+args: ["html"],
+source: "renderButtonsOn: html\x0a\x09diveButton := html button \x0a\x09\x09class: 'btn';\x0a\x09\x09with: 'Dive'; \x0a\x09\x09onClick: [ self dive ]",
+messageSends: ["class:", "button", "with:", "onClick:", "dive"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._renderHeadOn_(html);
+($ctx1.supercall = true, globals.HLInspectorVariablesWidget.superclass.fn.prototype._renderContentOn_.apply(_st(self), [html]));
+$ctx1.supercall = false;
+_st(self._wrapper())._onDblClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._dive();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLInspectorVariablesWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09self renderHeadOn: html.\x0a\x09super renderContentOn: html.\x0a\x09self wrapper onDblClick: [ self dive ]",
+messageSends: ["renderHeadOn:", "renderContentOn:", "onDblClick:", "wrapper", "dive"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderHeadOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("list-label");
+$2=_st($1)._with_(self._label());
+return self}, function($ctx1) {$ctx1.fill(self,"renderHeadOn:",{html:html},globals.HLInspectorVariablesWidget)})},
+args: ["html"],
+source: "renderHeadOn: html\x0a\x09html div \x0a\x09\x09class: 'list-label';\x0a\x09\x09with: self label",
+messageSends: ["class:", "div", "with:", "label"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resetItems",
+protocol: 'actions',
+fn: function (){
+var self=this;
+self["@items"]=nil;
+return self},
+args: [],
+source: "resetItems\x0a\x09items := nil",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectItem:",
+protocol: 'reactions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLInspectorVariablesWidget.superclass.fn.prototype._selectItem_.apply(_st(self), [anObject]));
+$ctx1.supercall = false;
+_st(self._model())._selectedInstVar_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{anObject:anObject},globals.HLInspectorVariablesWidget)})},
+args: ["anObject"],
+source: "selectItem: anObject\x0a\x09super selectItem: anObject.\x0a    self model selectedInstVar: anObject",
+messageSends: ["selectItem:", "selectedInstVar:", "model"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selection",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._selection();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selection",{},globals.HLInspectorVariablesWidget)})},
+args: [],
+source: "selection\x0a\x09^ self model selection",
+messageSends: ["selection", "model"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._model())._variables())._keys();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"variables",{},globals.HLInspectorVariablesWidget)})},
+args: [],
+source: "variables\x0a\x09^ self model variables keys",
+messageSends: ["keys", "variables", "model"],
+referencedClasses: []
+}),
+globals.HLInspectorVariablesWidget);
+
+
+
+smalltalk.addClass('HLInspectorWidget', globals.HLWidget, ['model', 'variablesWidget', 'displayWidget', 'codeWidget'], 'Helios-Inspector');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "codeWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@codeWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@codeWidget"]=self._defaultCodeWidget();
+$1=self["@codeWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"codeWidget",{},globals.HLInspectorWidget)})},
+args: [],
+source: "codeWidget\x0a\x09^ codeWidget ifNil: [\x0a\x09\x09codeWidget := self defaultCodeWidget ]",
+messageSends: ["ifNil:", "defaultCodeWidget"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "codeWidget:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+self["@codeWidget"]=aWidget;
+return self},
+args: ["aWidget"],
+source: "codeWidget: aWidget\x0a\x09codeWidget := aWidget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultCodeWidget",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+function $HLCodeWidget(){return globals.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$5,$4,$6,$1;
+$2=_st($HLCodeWidget())._new();
+$3=$2;
+$5=self._model();
+$ctx1.sendIdx["model"]=1;
+$4=_st($5)._code();
+_st($3)._model_($4);
+_st($2)._receiver_(_st(self._model())._inspectee());
+$6=_st($2)._yourself();
+$1=$6;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultCodeWidget",{},globals.HLInspectorWidget)})},
+args: [],
+source: "defaultCodeWidget\x0a\x09^ HLCodeWidget new\x0a    \x09model: self model code;\x0a       \x09receiver: self model inspectee;\x0a       \x09yourself",
+messageSends: ["model:", "new", "code", "model", "receiver:", "inspectee", "yourself"],
+referencedClasses: ["HLCodeWidget"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLInspectorDisplayWidget(){return globals.HLInspectorDisplayWidget||(typeof HLInspectorDisplayWidget=="undefined"?nil:HLInspectorDisplayWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+$2=self["@displayWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($HLInspectorDisplayWidget())._new();
+_st($3)._inspector_(self);
+$4=_st($3)._yourself();
+self["@displayWidget"]=$4;
+$1=self["@displayWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"displayWidget",{},globals.HLInspectorWidget)})},
+args: [],
+source: "displayWidget\x0a\x09^ displayWidget ifNil: [\x0a\x09\x09displayWidget := HLInspectorDisplayWidget new\x0a    \x09\x09inspector: self;\x0a        \x09yourself ]",
+messageSends: ["ifNil:", "inspector:", "new", "yourself"],
+referencedClasses: ["HLInspectorDisplayWidget"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLInspectorWidget.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self._register();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLInspectorWidget)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09self register",
+messageSends: ["initialize", "register"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspect:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(self._model())._inspect_on_(anObject,self);
+_st(self._codeWidget())._receiver_(anObject);
+self._refreshVariablesWidget();
+$1=self._refreshDisplayWidget();
+return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.HLInspectorWidget)})},
+args: ["anObject"],
+source: "inspect: anObject\x0a\x09self model inspect: anObject on: self.\x0a\x09self codeWidget receiver: anObject.\x0a    \x0a\x09self \x0a    \x09refreshVariablesWidget;\x0a\x09\x09refreshDisplayWidget",
+messageSends: ["inspect:on:", "model", "receiver:", "codeWidget", "refreshVariablesWidget", "refreshDisplayWidget"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectee",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._inspectee();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inspectee",{},globals.HLInspectorWidget)})},
+args: [],
+source: "inspectee\x0a\x09^ self model inspectee",
+messageSends: ["inspectee", "model"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectee:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._inspectee_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"inspectee:",{anObject:anObject},globals.HLInspectorWidget)})},
+args: ["anObject"],
+source: "inspectee: anObject\x0a\x09self model inspectee: anObject",
+messageSends: ["inspectee:", "model"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._label();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"label",{},globals.HLInspectorWidget)})},
+args: [],
+source: "label\x0a    ^ self model label",
+messageSends: ["label", "model"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLInspectorModel(){return globals.HLInspectorModel||(typeof HLInspectorModel=="undefined"?nil:HLInspectorModel)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@model"];
+if(($receiver = $2) == null || $receiver.isNil){
+self._model_(_st($HLInspectorModel())._new());
+$1=self["@model"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},globals.HLInspectorWidget)})},
+args: [],
+source: "model\x0a\x09^ model ifNil: [ \x0a    \x09self model: HLInspectorModel new.\x0a\x09\x09model ]",
+messageSends: ["ifNil:", "model:", "new"],
+referencedClasses: ["HLInspectorModel"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+protocol: 'accessing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self["@model"]=aModel;
+_st(self._codeWidget())._model_(_st(aModel)._code());
+self._observeCodeWidget();
+self._observeVariablesWidget();
+$1=self._observeModel();
+return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},globals.HLInspectorWidget)})},
+args: ["aModel"],
+source: "model: aModel\x0a\x09model := aModel. \x0a    self codeWidget model: aModel code.\x0a    \x0a    self \x0a        observeCodeWidget;\x0a    \x09observeVariablesWidget;\x0a        observeModel",
+messageSends: ["model:", "codeWidget", "code", "observeCodeWidget", "observeVariablesWidget", "observeModel"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeCodeWidget",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDoItExecuted(){return globals.HLDoItExecuted||(typeof HLDoItExecuted=="undefined"?nil:HLDoItExecuted)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._codeWidget())._announcer())._on_do_($HLDoItExecuted(),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._onDoneIt();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"observeCodeWidget",{},globals.HLInspectorWidget)})},
+args: [],
+source: "observeCodeWidget\x0a\x09self codeWidget announcer \x0a    \x09on: HLDoItExecuted \x0a        do: [ self onDoneIt ]",
+messageSends: ["on:do:", "announcer", "codeWidget", "onDoneIt"],
+referencedClasses: ["HLDoItExecuted"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLInstanceVariableSelected(){return globals.HLInstanceVariableSelected||(typeof HLInstanceVariableSelected=="undefined"?nil:HLInstanceVariableSelected)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._model())._announcer())._on_send_to_($HLInstanceVariableSelected(),"onInstanceVariableSelected",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLInspectorWidget)})},
+args: [],
+source: "observeModel\x0a\x09self model announcer\x0a        on: HLInstanceVariableSelected\x0a\x09\x09send: #onInstanceVariableSelected\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "model"],
+referencedClasses: ["HLInstanceVariableSelected"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeVariablesWidget",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLDiveRequested(){return globals.HLDiveRequested||(typeof HLDiveRequested=="undefined"?nil:HLDiveRequested)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._variablesWidget())._announcer())._on_send_to_($HLDiveRequested(),"onDive",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeVariablesWidget",{},globals.HLInspectorWidget)})},
+args: [],
+source: "observeVariablesWidget\x0a\x09self variablesWidget announcer \x0a        on: HLDiveRequested \x0a\x09\x09send: #onDive\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "variablesWidget"],
+referencedClasses: ["HLDiveRequested"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onDive",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+function $HLInspector(){return globals.HLInspector||(typeof HLInspector=="undefined"?nil:HLInspector)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLInspector())._new();
+_st($1)._inspect_(_st(self._model())._selectedInstVarObject());
+$2=_st($1)._openAsTab();
+return self}, function($ctx1) {$ctx1.fill(self,"onDive",{},globals.HLInspectorWidget)})},
+args: [],
+source: "onDive\x0a\x09HLInspector new \x0a\x09\x09inspect: self model selectedInstVarObject;\x0a\x09\x09openAsTab",
+messageSends: ["inspect:", "new", "selectedInstVarObject", "model", "openAsTab"],
+referencedClasses: ["HLInspector"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onDoneIt",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onDoneIt",{},globals.HLInspectorWidget)})},
+args: [],
+source: "onDoneIt\x0a\x0a\x09self refresh",
+messageSends: ["refresh"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onInspectIt",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "onInspectIt",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onInstanceVariableSelected",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._refreshDisplayWidget();
+return self}, function($ctx1) {$ctx1.fill(self,"onInstanceVariableSelected",{},globals.HLInspectorWidget)})},
+args: [],
+source: "onInstanceVariableSelected\x0a\x09self refreshDisplayWidget",
+messageSends: ["refreshDisplayWidget"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPrintIt",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "onPrintIt",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "refresh",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._inspect_(self._inspectee());
+return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},globals.HLInspectorWidget)})},
+args: [],
+source: "refresh\x0a\x09self inspect: self inspectee",
+messageSends: ["inspect:", "inspectee"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "refreshDisplayWidget",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._displayWidget())._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"refreshDisplayWidget",{},globals.HLInspectorWidget)})},
+args: [],
+source: "refreshDisplayWidget\x0a\x09self displayWidget refresh",
+messageSends: ["refresh", "displayWidget"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "refreshVariablesWidget",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._variablesWidget())._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"refreshVariablesWidget",{},globals.HLInspectorWidget)})},
+args: [],
+source: "refreshVariablesWidget\x0a\x09self variablesWidget refresh",
+messageSends: ["refresh", "variablesWidget"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "register",
+protocol: 'registration',
+fn: function (){
+var self=this;
+function $HLInspector(){return globals.HLInspector||(typeof HLInspector=="undefined"?nil:HLInspector)}
+return smalltalk.withContext(function($ctx1) { 
+_st($HLInspector())._register_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"register",{},globals.HLInspectorWidget)})},
+args: [],
+source: "register\x0a\x09HLInspector register: self",
+messageSends: ["register:"],
+referencedClasses: ["HLInspector"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $HLHorizontalSplitter(){return globals.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
+function $HLVerticalSplitter(){return globals.HLVerticalSplitter||(typeof HLVerticalSplitter=="undefined"?nil:HLVerticalSplitter)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLHorizontalSplitter())._with_with_(_st($HLVerticalSplitter())._with_with_(self._variablesWidget(),self._displayWidget()),self._codeWidget());
+$ctx1.sendIdx["with:with:"]=1;
+_st(html)._with_($1);
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLInspectorWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a   \x09html with: (HLHorizontalSplitter\x0a    \x09with: (HLVerticalSplitter \x0a            with: self variablesWidget\x0a            with: self displayWidget)\x0a        with: self codeWidget)",
+messageSends: ["with:", "with:with:", "variablesWidget", "displayWidget", "codeWidget"],
+referencedClasses: ["HLHorizontalSplitter", "HLVerticalSplitter"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setLabel:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._label_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"setLabel:",{aString:aString},globals.HLInspectorWidget)})},
+args: ["aString"],
+source: "setLabel: aString\x0a\x09self model label: aString",
+messageSends: ["label:", "model"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setVariables:",
+protocol: 'actions',
+fn: function (aDictionary){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._variables_(aDictionary);
+return self}, function($ctx1) {$ctx1.fill(self,"setVariables:",{aDictionary:aDictionary},globals.HLInspectorWidget)})},
+args: ["aDictionary"],
+source: "setVariables: aDictionary\x0a\x09self model variables: aDictionary",
+messageSends: ["variables:", "model"],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Inspector";
+},
+args: [],
+source: "tabLabel\x0a    ^ 'Inspector'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'registration',
+fn: function (){
+var self=this;
+function $HLInspector(){return globals.HLInspector||(typeof HLInspector=="undefined"?nil:HLInspector)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLInspectorWidget.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+_st($HLInspector())._unregister_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLInspectorWidget)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x09HLInspector unregister: self",
+messageSends: ["unregister", "unregister:"],
+referencedClasses: ["HLInspector"]
+}),
+globals.HLInspectorWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variablesWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLInspectorVariablesWidget(){return globals.HLInspectorVariablesWidget||(typeof HLInspectorVariablesWidget=="undefined"?nil:HLInspectorVariablesWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+$2=self["@variablesWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($HLInspectorVariablesWidget())._new();
+_st($3)._inspector_(self);
+$4=_st($3)._yourself();
+self["@variablesWidget"]=$4;
+$1=self["@variablesWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"variablesWidget",{},globals.HLInspectorWidget)})},
+args: [],
+source: "variablesWidget\x0a\x09^ variablesWidget ifNil: [\x0a\x09\x09variablesWidget := HLInspectorVariablesWidget new\x0a    \x09\x09inspector: self;\x0a        \x09yourself ]",
+messageSends: ["ifNil:", "inspector:", "new", "yourself"],
+referencedClasses: ["HLInspectorVariablesWidget"]
+}),
+globals.HLInspectorWidget);
+
+
+
+smalltalk.addClass('HLInspector', globals.HLInspectorWidget, [], 'Helios-Inspector');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspect:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._setTabLabel_(_st(anObject)._printString());
+($ctx1.supercall = true, globals.HLInspector.superclass.fn.prototype._inspect_.apply(_st(self), [anObject]));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.HLInspector)})},
+args: ["anObject"],
+source: "inspect: anObject\x0a\x09self setTabLabel: anObject printString.\x0a\x09super inspect: anObject",
+messageSends: ["setTabLabel:", "printString", "inspect:"],
+referencedClasses: []
+}),
+globals.HLInspector);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $HLContainer(){return globals.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
+function $HLHorizontalSplitter(){return globals.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
+function $HLVerticalSplitter(){return globals.HLVerticalSplitter||(typeof HLVerticalSplitter=="undefined"?nil:HLVerticalSplitter)}
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+$4=self._variablesWidget();
+$ctx1.sendIdx["variablesWidget"]=1;
+$3=_st($HLVerticalSplitter())._with_with_($4,self._displayWidget());
+$2=_st($HLHorizontalSplitter())._with_with_($3,self._codeWidget());
+$ctx1.sendIdx["with:with:"]=1;
+$1=_st($HLContainer())._with_($2);
+_st(html)._with_($1);
+$ctx1.sendIdx["with:"]=1;
+_st(self._variablesWidget())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLInspector)})},
+args: ["html"],
+source: "renderContentOn: html\x0a   \x09html with: (HLContainer with: (HLHorizontalSplitter\x0a    \x09with: (HLVerticalSplitter \x0a            with: self variablesWidget\x0a            with: self displayWidget)\x0a        with: self codeWidget)).\x0a\x09\x0a\x09self variablesWidget focus",
+messageSends: ["with:", "with:with:", "variablesWidget", "displayWidget", "codeWidget", "focus"],
+referencedClasses: ["HLContainer", "HLHorizontalSplitter", "HLVerticalSplitter"]
+}),
+globals.HLInspector);
+
+
+globals.HLInspector.klass.iVarNames = ['inspectors'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeOpenAsTab",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "canBeOpenAsTab\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspector.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLInspector.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self._watchChanges();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLInspector.klass)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09self watchChanges",
+messageSends: ["initialize", "watchChanges"],
+referencedClasses: []
+}),
+globals.HLInspector.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspect:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._new();
+_st($1)._openAsTab();
+$2=_st($1)._inspect_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.HLInspector.klass)})},
+args: ["anObject"],
+source: "inspect: anObject\x0a\x09self new\x0a\x09\x09openAsTab;\x0a\x09\x09inspect: anObject",
+messageSends: ["openAsTab", "new", "inspect:"],
+referencedClasses: []
+}),
+globals.HLInspector.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectors",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@inspectors"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@inspectors"]=_st($OrderedCollection())._new();
+$1=self["@inspectors"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inspectors",{},globals.HLInspector.klass)})},
+args: [],
+source: "inspectors\x0a\x09^ inspectors ifNil: [ inspectors := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLInspector.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "register:",
+protocol: 'registration',
+fn: function (anInspector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._inspectors())._add_(anInspector);
+return self}, function($ctx1) {$ctx1.fill(self,"register:",{anInspector:anInspector},globals.HLInspector.klass)})},
+args: ["anInspector"],
+source: "register: anInspector\x0a\x09self inspectors add: anInspector",
+messageSends: ["add:", "inspectors"],
+referencedClasses: []
+}),
+globals.HLInspector.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "inspector";
+},
+args: [],
+source: "tabClass\x0a\x09^ 'inspector'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspector.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Inspector";
+},
+args: [],
+source: "tabLabel\x0a\x09^ 'Inspector'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspector.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabPriority",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return (10);
+},
+args: [],
+source: "tabPriority\x0a\x09^ 10",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLInspector.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister:",
+protocol: 'registration',
+fn: function (anInspector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._inspectors())._remove_(anInspector);
+return self}, function($ctx1) {$ctx1.fill(self,"unregister:",{anInspector:anInspector},globals.HLInspector.klass)})},
+args: ["anInspector"],
+source: "unregister: anInspector\x0a\x09self inspectors remove: anInspector",
+messageSends: ["remove:", "inspectors"],
+referencedClasses: []
+}),
+globals.HLInspector.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "watchChanges",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._inspectors())._do_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(each)._refresh();
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithInterval_((500));
+return self}, function($ctx1) {$ctx1.fill(self,"watchChanges",{},globals.HLInspector.klass)})},
+args: [],
+source: "watchChanges\x0a\x09[ self inspectors do: [ :each | each refresh ] ]\x0a\x09\x09valueWithInterval: 500",
+messageSends: ["valueWithInterval:", "do:", "inspectors", "refresh"],
+referencedClasses: []
+}),
+globals.HLInspector.klass);
+
+});

+ 452 - 0
src/Helios-Inspector.st

@@ -0,0 +1,452 @@
+Smalltalk createPackage: 'Helios-Inspector'!
+HLNavigationListWidget subclass: #HLInspectorDisplayWidget
+	instanceVariableNames: 'inspector'
+	package: 'Helios-Inspector'!
+
+!HLInspectorDisplayWidget methodsFor: 'accessing'!
+
+inspector
+	^ inspector
+!
+
+inspector: anInspector
+	inspector := anInspector
+!
+
+model
+
+	^ self inspector model
+! !
+
+!HLInspectorDisplayWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+	
+    html div with: self selectionDisplayString
+!
+
+selectionDisplayString
+	|selection|
+	selection := self model selection.
+    ^ (self model variables includesKey: selection)
+    	ifTrue:[ (self model instVarObjectAt: selection) printString ]
+      	ifFalse:[ '' ]
+! !
+
+HLModel subclass: #HLInspectorModel
+	instanceVariableNames: 'inspectee code variables label selection'
+	package: 'Helios-Inspector'!
+!HLInspectorModel commentStamp!
+I am the model of the Helios inspector `HLInspectorWidget`.
+
+## API
+
+Use the method `inspect:on:` to inspect an object on an inspector.!
+
+!HLInspectorModel methodsFor: 'accessing'!
+
+code
+	"Answers the code model working for this workspace model"
+	^ code ifNil:[ code := HLCodeModel on: self environment ]
+!
+
+inspectee 
+	^ inspectee
+!
+
+inspectee: anObject 
+	inspectee := anObject
+!
+
+label
+    ^ label ifNil: [ self inspectee printString ]
+!
+
+label: aString
+    label := aString
+!
+
+selectedInstVarObject
+	^ self instVarObjectAt: self selection
+!
+
+selection
+	^ selection ifNil:[ '' ]
+!
+
+selection: anObject
+	selection := anObject.
+
+	self announcer announce: (HLInstanceVariableSelected on: selection)
+!
+
+variables
+	^ variables ifNil: [ Dictionary new ]
+!
+
+variables: aCollection
+	variables := aCollection
+! !
+
+!HLInspectorModel methodsFor: 'actions'!
+
+inspect: anObject on: anInspector
+	inspectee := anObject.
+	variables := #().
+	inspectee inspectOn: anInspector
+!
+
+instVarObjectAt: anInstVarName
+	^ self variables at: anInstVarName
+!
+
+selectedInstVar: anInstVarName
+    self selection: anInstVarName
+!
+
+subscribe: aWidget
+	aWidget subscribeTo: self announcer
+! !
+
+!HLInspectorModel class methodsFor: 'actions'!
+
+on: anEnvironment
+
+	^ self new
+    	environment: anEnvironment;
+        yourself
+! !
+
+HLNavigationListWidget subclass: #HLInspectorVariablesWidget
+	instanceVariableNames: 'announcer inspector list diveButton'
+	package: 'Helios-Inspector'!
+
+!HLInspectorVariablesWidget methodsFor: 'accessing'!
+
+announcer
+	^ announcer ifNil:[ announcer := Announcer new ]
+!
+
+inspector
+	^ inspector
+!
+
+inspector: anInspector
+	inspector := anInspector
+!
+
+label
+	^ self model label
+!
+
+model
+    ^ self inspector model
+!
+
+selection
+	^ self model selection
+!
+
+variables
+	^ self model variables keys
+! !
+
+!HLInspectorVariablesWidget methodsFor: 'actions'!
+
+dive
+	self announcer announce: HLDiveRequested new
+!
+
+refresh
+	self variables = self items ifFalse: [
+		self resetItems.
+    	super refresh ]
+!
+
+resetItems
+	items := nil
+! !
+
+!HLInspectorVariablesWidget methodsFor: 'defaults'!
+
+defaultItems
+	^ self variables
+! !
+
+!HLInspectorVariablesWidget methodsFor: 'reactions'!
+
+selectItem: anObject
+	super selectItem: anObject.
+    self model selectedInstVar: anObject
+! !
+
+!HLInspectorVariablesWidget methodsFor: 'rendering'!
+
+renderButtonsOn: html
+	diveButton := html button 
+		class: 'btn';
+		with: 'Dive'; 
+		onClick: [ self dive ]
+!
+
+renderContentOn: html
+	self renderHeadOn: html.
+	super renderContentOn: html.
+	self wrapper onDblClick: [ self dive ]
+!
+
+renderHeadOn: html
+	html div 
+		class: 'list-label';
+		with: self label
+! !
+
+HLWidget subclass: #HLInspectorWidget
+	instanceVariableNames: 'model variablesWidget displayWidget codeWidget'
+	package: 'Helios-Inspector'!
+
+!HLInspectorWidget methodsFor: 'accessing'!
+
+codeWidget
+	^ codeWidget ifNil: [
+		codeWidget := self defaultCodeWidget ]
+!
+
+codeWidget: aWidget
+	codeWidget := aWidget
+!
+
+displayWidget
+	^ displayWidget ifNil: [
+		displayWidget := HLInspectorDisplayWidget new
+    		inspector: self;
+        	yourself ]
+!
+
+initialize
+	super initialize.
+	self register
+!
+
+inspectee
+	^ self model inspectee
+!
+
+inspectee: anObject
+	self model inspectee: anObject
+!
+
+label
+    ^ self model label
+!
+
+model
+	^ model ifNil: [ 
+    	self model: HLInspectorModel new.
+		model ]
+!
+
+model: aModel
+	model := aModel. 
+    self codeWidget model: aModel code.
+    
+    self 
+        observeCodeWidget;
+    	observeVariablesWidget;
+        observeModel
+!
+
+tabLabel
+    ^ 'Inspector'
+!
+
+variablesWidget
+	^ variablesWidget ifNil: [
+		variablesWidget := HLInspectorVariablesWidget new
+    		inspector: self;
+        	yourself ]
+! !
+
+!HLInspectorWidget methodsFor: 'actions'!
+
+inspect: anObject
+	self model inspect: anObject on: self.
+	self codeWidget receiver: anObject.
+    
+	self 
+    	refreshVariablesWidget;
+		refreshDisplayWidget
+!
+
+observeCodeWidget
+	self codeWidget announcer 
+    	on: HLDoItExecuted 
+        do: [ self onDoneIt ]
+!
+
+observeModel
+	self model announcer
+        on: HLInstanceVariableSelected
+		send: #onInstanceVariableSelected
+		to: self
+!
+
+observeVariablesWidget
+	self variablesWidget announcer 
+        on: HLDiveRequested 
+		send: #onDive
+		to: self
+!
+
+refresh
+	self inspect: self inspectee
+!
+
+refreshDisplayWidget
+	self displayWidget refresh
+!
+
+refreshVariablesWidget
+	self variablesWidget refresh
+!
+
+setLabel: aString
+	self model label: aString
+!
+
+setVariables: aDictionary
+	self model variables: aDictionary
+! !
+
+!HLInspectorWidget methodsFor: 'defaults'!
+
+defaultCodeWidget
+	^ HLCodeWidget new
+    	model: self model code;
+       	receiver: self model inspectee;
+       	yourself
+! !
+
+!HLInspectorWidget methodsFor: 'reactions'!
+
+onDive
+	HLInspector new 
+		inspect: self model selectedInstVarObject;
+		openAsTab
+!
+
+onDoneIt
+
+	self refresh
+!
+
+onInspectIt
+!
+
+onInstanceVariableSelected
+	self refreshDisplayWidget
+!
+
+onPrintIt
+! !
+
+!HLInspectorWidget methodsFor: 'registration'!
+
+register
+	HLInspector register: self
+!
+
+unregister
+	super unregister.
+	HLInspector unregister: self
+! !
+
+!HLInspectorWidget methodsFor: 'rendering'!
+
+renderContentOn: html
+   	html with: (HLHorizontalSplitter
+    	with: (HLVerticalSplitter 
+            with: self variablesWidget
+            with: self displayWidget)
+        with: self codeWidget)
+! !
+
+HLInspectorWidget subclass: #HLInspector
+	instanceVariableNames: ''
+	package: 'Helios-Inspector'!
+
+!HLInspector methodsFor: 'actions'!
+
+inspect: anObject
+	self setTabLabel: anObject printString.
+	super inspect: anObject
+! !
+
+!HLInspector methodsFor: 'rendering'!
+
+renderContentOn: html
+   	html with: (HLContainer with: (HLHorizontalSplitter
+    	with: (HLVerticalSplitter 
+            with: self variablesWidget
+            with: self displayWidget)
+        with: self codeWidget)).
+	
+	self variablesWidget focus
+! !
+
+HLInspector class instanceVariableNames: 'inspectors'!
+
+!HLInspector class methodsFor: 'accessing'!
+
+inspectors
+	^ inspectors ifNil: [ inspectors := OrderedCollection new ]
+!
+
+tabClass
+	^ 'inspector'
+!
+
+tabLabel
+	^ 'Inspector'
+!
+
+tabPriority
+	^ 10
+! !
+
+!HLInspector class methodsFor: 'actions'!
+
+inspect: anObject
+	self new
+		openAsTab;
+		inspect: anObject
+! !
+
+!HLInspector class methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	self watchChanges
+!
+
+watchChanges
+	[ self inspectors do: [ :each | each refresh ] ]
+		valueWithInterval: 500
+! !
+
+!HLInspector class methodsFor: 'registration'!
+
+register: anInspector
+	self inspectors add: anInspector
+!
+
+unregister: anInspector
+	self inspectors remove: anInspector
+! !
+
+!HLInspector class methodsFor: 'testing'!
+
+canBeOpenAsTab
+	^ false
+! !
+

+ 2280 - 0
src/Helios-KeyBindings.js

@@ -0,0 +1,2280 @@
+define("helios/Helios-KeyBindings", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "helios/Helios-Core"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-KeyBindings');
+smalltalk.packages["Helios-KeyBindings"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLBinding', globals.Object, ['key', 'label'], 'Helios-KeyBindings');
+globals.HLBinding.comment="I am the abstract representation of a keybinding in Helios. My instances hold a key (integer value) and a label. \x0a\x0aBindings are built into a tree of keys, so pressing a key may result in more key choices (for example, to open a workspace, 'o' is pressed first then 'w' is pressed).\x0a\x0aBinding action handling and selection is handled by the `current` instance of `HLKeyBinder`.\x0a\x0aSubclasses implement specific behavior like evaluating actions or (sub-)grouping other bindings.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "apply",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "apply",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "atKey:",
+protocol: 'accessing',
+fn: function (aKey){
+var self=this;
+return nil;
+},
+args: ["aKey"],
+source: "atKey: aKey\x0a\x09\x22Answer the sub-binding at key aKey.\x0a\x09Always answer nil here. See HLBindingGroup for more.\x22\x0a\x09\x0a\x09^ nil",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._label();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"displayLabel",{},globals.HLBinding)})},
+args: [],
+source: "displayLabel\x0a\x09^ self label",
+messageSends: ["label"],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._subclassResponsibility();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLBinding)})},
+args: [],
+source: "isActive\x0a\x09^ self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@key"];
+return $1;
+},
+args: [],
+source: "key\x0a\x09^ key",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@key"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "key: anInteger\x0a\x09key := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@label"];
+return $1;
+},
+args: [],
+source: "label\x0a\x09^ label",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@label"]=aString;
+return self},
+args: ["aString"],
+source: "label: aString\x0a\x09label := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "release",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "release",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:html:",
+protocol: 'rendering',
+fn: function (aBindingHelper,html){
+var self=this;
+return self},
+args: ["aBindingHelper", "html"],
+source: "renderOn: aBindingHelper html: html",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBinding);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shortcut",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($String())._fromCharCode_(self._key());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shortcut",{},globals.HLBinding)})},
+args: [],
+source: "shortcut\x0a\x09^ String fromCharCode: self key",
+messageSends: ["fromCharCode:", "key"],
+referencedClasses: ["String"]
+}),
+globals.HLBinding);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:labelled:",
+protocol: 'instance creation',
+fn: function (anInteger,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._key_(anInteger);
+_st($2)._label_(aString);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:labelled:",{anInteger:anInteger,aString:aString},globals.HLBinding.klass)})},
+args: ["anInteger", "aString"],
+source: "on: anInteger labelled: aString\x0a\x09^ self new\x0a    \x09key: anInteger;\x0a        label: aString;\x0a        yourself",
+messageSends: ["key:", "new", "label:", "yourself"],
+referencedClasses: []
+}),
+globals.HLBinding.klass);
+
+
+smalltalk.addClass('HLBindingAction', globals.HLBinding, ['command'], 'Helios-KeyBindings');
+globals.HLBindingAction.comment="My instances are the leafs of the binding tree. They evaluate actions through commands, instances of concrete subclasses of `HLCommand`.\x0a\x0aThe `#apply` methods is used to evaluate the `command`. If the command requires user input, an `inputWidget` will be displayed to the user.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "apply",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLKeyBinder(){return globals.HLKeyBinder||(typeof HLKeyBinder=="undefined"?nil:HLKeyBinder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._command())._isInputRequired();
+if(smalltalk.assert($1)){
+_st(_st(_st($HLKeyBinder())._current())._helper())._showWidget_(self._inputWidget());
+} else {
+self._executeCommand();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"apply",{},globals.HLBindingAction)})},
+args: [],
+source: "apply\x0a\x09self command isInputRequired\x0a\x09\x09ifTrue: [ HLKeyBinder current helper showWidget: self inputWidget ]\x0a\x09\x09ifFalse: [ self executeCommand ]",
+messageSends: ["ifTrue:ifFalse:", "isInputRequired", "command", "showWidget:", "helper", "current", "inputWidget", "executeCommand"],
+referencedClasses: ["HLKeyBinder"]
+}),
+globals.HLBindingAction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "command",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@command"];
+return $1;
+},
+args: [],
+source: "command\x0a\x09^ command",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingAction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "command:",
+protocol: 'accessing',
+fn: function (aCommand){
+var self=this;
+self["@command"]=aCommand;
+return self},
+args: ["aCommand"],
+source: "command: aCommand\x0a\x09command := aCommand",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingAction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "executeCommand",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLKeyBinder(){return globals.HLKeyBinder||(typeof HLKeyBinder=="undefined"?nil:HLKeyBinder)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._command())._execute();
+_st(_st($HLKeyBinder())._current())._deactivate();
+return self}, function($ctx1) {$ctx1.fill(self,"executeCommand",{},globals.HLBindingAction)})},
+args: [],
+source: "executeCommand\x0a\x09self command execute.\x0a\x09HLKeyBinder current deactivate",
+messageSends: ["execute", "command", "deactivate", "current"],
+referencedClasses: ["HLKeyBinder"]
+}),
+globals.HLBindingAction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "input:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._command())._input_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"input:",{aString:aString},globals.HLBindingAction)})},
+args: ["aString"],
+source: "input: aString\x0a\x09self command input: aString",
+messageSends: ["input:", "command"],
+referencedClasses: []
+}),
+globals.HLBindingAction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputBinding",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLBindingInput(){return globals.HLBindingInput||(typeof HLBindingInput=="undefined"?nil:HLBindingInput)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$5,$4,$6,$8,$7,$9,$11,$10,$12,$14,$13,$15,$16,$17,$1;
+$2=_st($HLBindingInput())._new();
+$3=$2;
+$5=self._command();
+$ctx1.sendIdx["command"]=1;
+$4=_st($5)._inputLabel();
+_st($3)._label_($4);
+$6=$2;
+$8=self._command();
+$ctx1.sendIdx["command"]=2;
+$7=_st($8)._displayLabel();
+_st($6)._ghostText_($7);
+$9=$2;
+$11=self._command();
+$ctx1.sendIdx["command"]=3;
+$10=_st($11)._defaultInput();
+_st($9)._defaultValue_($10);
+$12=$2;
+$14=self._command();
+$ctx1.sendIdx["command"]=4;
+$13=_st($14)._inputCompletion();
+_st($12)._inputCompletion_($13);
+_st($2)._callback_((function(val){
+return smalltalk.withContext(function($ctx2) {
+$15=self._command();
+_st($15)._input_(val);
+$16=_st($15)._execute();
+return $16;
+}, function($ctx2) {$ctx2.fillBlock({val:val},$ctx1,1)})}));
+$17=_st($2)._yourself();
+$1=$17;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputBinding",{},globals.HLBindingAction)})},
+args: [],
+source: "inputBinding\x0a\x09^ HLBindingInput new\x0a\x09\x09label: self command inputLabel;\x0a\x09\x09ghostText: self command displayLabel;\x0a\x09\x09defaultValue: self command defaultInput;\x0a\x09\x09inputCompletion: self command inputCompletion;\x0a\x09\x09callback: [ :val | \x0a\x09\x09\x09self command \x0a\x09\x09\x09\x09input: val;\x0a\x09\x09\x09\x09execute ];\x0a\x09\x09yourself",
+messageSends: ["label:", "new", "inputLabel", "command", "ghostText:", "displayLabel", "defaultValue:", "defaultInput", "inputCompletion:", "inputCompletion", "callback:", "input:", "execute", "yourself"],
+referencedClasses: ["HLBindingInput"]
+}),
+globals.HLBindingAction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLBindingActionInputWidget(){return globals.HLBindingActionInputWidget||(typeof HLBindingActionInputWidget=="undefined"?nil:HLBindingActionInputWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$5,$4,$6,$8,$7,$9,$10,$1;
+$2=_st($HLBindingActionInputWidget())._new();
+$3=$2;
+$5=self._command();
+$ctx1.sendIdx["command"]=1;
+$4=_st($5)._displayLabel();
+_st($3)._ghostText_($4);
+$6=$2;
+$8=self._command();
+$ctx1.sendIdx["command"]=2;
+$7=_st($8)._defaultInput();
+_st($6)._defaultValue_($7);
+_st($2)._inputCompletion_(_st(self._command())._inputCompletion());
+_st($2)._callback_((function(value){
+return smalltalk.withContext(function($ctx2) {
+self._input_(value);
+$9=self._executeCommand();
+return $9;
+}, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
+$10=_st($2)._yourself();
+$1=$10;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputWidget",{},globals.HLBindingAction)})},
+args: [],
+source: "inputWidget\x0a\x09^ HLBindingActionInputWidget new\x0a\x09\x09ghostText: self command displayLabel;\x0a\x09\x09defaultValue: self command defaultInput;\x0a\x09\x09inputCompletion: self command inputCompletion;\x0a\x09\x09callback: [ :value | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09input: value;\x0a\x09\x09\x09\x09executeCommand ];\x0a\x09\x09yourself",
+messageSends: ["ghostText:", "new", "displayLabel", "command", "defaultValue:", "defaultInput", "inputCompletion:", "inputCompletion", "callback:", "input:", "executeCommand", "yourself"],
+referencedClasses: ["HLBindingActionInputWidget"]
+}),
+globals.HLBindingAction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._command())._isActive();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLBindingAction)})},
+args: [],
+source: "isActive\x0a\x09^ self command isActive",
+messageSends: ["isActive", "command"],
+referencedClasses: []
+}),
+globals.HLBindingAction);
+
+
+
+smalltalk.addClass('HLBindingGroup', globals.HLBinding, ['bindings'], 'Helios-KeyBindings');
+globals.HLBindingGroup.comment="My instances hold other bindings, either actions or groups, and do not have actions by themselves.\x0a\x0aChildren are accessed with `atKey:` and added with the `add*` methods.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activeBindings",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._bindings())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._isActive();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"activeBindings",{},globals.HLBindingGroup)})},
+args: [],
+source: "activeBindings\x0a\x09^ self bindings select: [ :each | each isActive ]",
+messageSends: ["select:", "bindings", "isActive"],
+referencedClasses: []
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "add:",
+protocol: 'adding',
+fn: function (aBinding){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._bindings())._add_(aBinding);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding},globals.HLBindingGroup)})},
+args: ["aBinding"],
+source: "add: aBinding\x0a\x09^ self bindings add: aBinding",
+messageSends: ["add:", "bindings"],
+referencedClasses: []
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addActionKey:labelled:callback:",
+protocol: 'adding',
+fn: function (anInteger,aString,aBlock){
+var self=this;
+function $HLBindingAction(){return globals.HLBindingAction||(typeof HLBindingAction=="undefined"?nil:HLBindingAction)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($HLBindingAction())._on_labelled_(anInteger,aString);
+_st($1)._callback_(aBlock);
+$2=_st($1)._yourself();
+self._add_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock},globals.HLBindingGroup)})},
+args: ["anInteger", "aString", "aBlock"],
+source: "addActionKey: anInteger labelled: aString callback: aBlock\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a    \x09callback: aBlock;\x0a        yourself)",
+messageSends: ["add:", "callback:", "on:labelled:", "yourself"],
+referencedClasses: ["HLBindingAction"]
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addGroupKey:labelled:",
+protocol: 'add',
+fn: function (anInteger,aString){
+var self=this;
+function $HLBindingGroup(){return globals.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
+return smalltalk.withContext(function($ctx1) { 
+self._add_(_st($HLBindingGroup())._on_labelled_(anInteger,aString));
+return self}, function($ctx1) {$ctx1.fill(self,"addGroupKey:labelled:",{anInteger:anInteger,aString:aString},globals.HLBindingGroup)})},
+args: ["anInteger", "aString"],
+source: "addGroupKey: anInteger labelled: aString\x0a\x09self add: (HLBindingGroup on: anInteger labelled: aString)",
+messageSends: ["add:", "on:labelled:"],
+referencedClasses: ["HLBindingGroup"]
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._bindings())._detect_ifNone_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._label()).__eq(aString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return nil;
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.HLBindingGroup)})},
+args: ["aString"],
+source: "at: aString\x0a\x09^ self bindings \x0a    \x09detect: [ :each | each label = aString ]\x0a      \x09ifNone: [ nil ]",
+messageSends: ["detect:ifNone:", "bindings", "=", "label"],
+referencedClasses: []
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:add:",
+protocol: 'accessing',
+fn: function (aString,aBinding){
+var self=this;
+var binding;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+binding=self._at_(aString);
+$1=binding;
+if(($receiver = $1) == null || $receiver.isNil){
+return self;
+} else {
+$1;
+};
+_st(binding)._add_(aBinding);
+return self}, function($ctx1) {$ctx1.fill(self,"at:add:",{aString:aString,aBinding:aBinding,binding:binding},globals.HLBindingGroup)})},
+args: ["aString", "aBinding"],
+source: "at: aString add: aBinding\x0a\x09| binding |\x0a\x09\x0a\x09binding := self at: aString.\x0a\x09binding ifNil: [ ^ self ].\x0a\x09\x09\x0a\x09binding add: aBinding",
+messageSends: ["at:", "ifNil:", "add:"],
+referencedClasses: []
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "atKey:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._bindings())._detect_ifNone_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._key()).__eq(anInteger);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return nil;
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger},globals.HLBindingGroup)})},
+args: ["anInteger"],
+source: "atKey: anInteger\x0a\x09^ self bindings \x0a    \x09detect: [ :each | each key = anInteger ]\x0a      \x09ifNone: [ nil ]",
+messageSends: ["detect:ifNone:", "bindings", "=", "key"],
+referencedClasses: []
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "bindings",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@bindings"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@bindings"]=_st($OrderedCollection())._new();
+$1=self["@bindings"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"bindings",{},globals.HLBindingGroup)})},
+args: [],
+source: "bindings\x0a\x09^ bindings ifNil: [ bindings := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "displayLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=($ctx1.supercall = true, globals.HLBindingGroup.superclass.fn.prototype._displayLabel.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st($2).__comma("...");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"displayLabel",{},globals.HLBindingGroup)})},
+args: [],
+source: "displayLabel\x0a\x09^ super displayLabel, '...'",
+messageSends: [",", "displayLabel"],
+referencedClasses: []
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._activeBindings())._notEmpty();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLBindingGroup)})},
+args: [],
+source: "isActive\x0a\x09^ self activeBindings notEmpty",
+messageSends: ["notEmpty", "activeBindings"],
+referencedClasses: []
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "release",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._bindings())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._release();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"release",{},globals.HLBindingGroup)})},
+args: [],
+source: "release\x0a\x09self bindings do: [ :each | each release ]",
+messageSends: ["do:", "bindings", "release"],
+referencedClasses: []
+}),
+globals.HLBindingGroup);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:html:",
+protocol: 'rendering',
+fn: function (aBindingHelper,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._isActive();
+if(smalltalk.assert($1)){
+_st(aBindingHelper)._renderBindingGroup_on_(self,html);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},globals.HLBindingGroup)})},
+args: ["aBindingHelper", "html"],
+source: "renderOn: aBindingHelper html: html\x0a\x09self isActive ifTrue: [\x0a\x09\x09aBindingHelper renderBindingGroup: self on: html ]",
+messageSends: ["ifTrue:", "isActive", "renderBindingGroup:on:"],
+referencedClasses: []
+}),
+globals.HLBindingGroup);
+
+
+
+smalltalk.addClass('HLBindingActionInputWidget', globals.HLWidget, ['input', 'callback', 'status', 'wrapper', 'ghostText', 'message', 'inputCompletion', 'defaultValue', 'messageTag'], 'Helios-KeyBindings');
+globals.HLBindingActionInputWidget.comment="My instances are built when a `HLBindingAction` that requires user input is applied.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "callback",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@callback"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@callback"]=(function(value){
+});
+$1=self["@callback"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"callback",{},globals.HLBindingActionInputWidget)})},
+args: [],
+source: "callback\x0a\x09^ callback ifNil: [ callback := [ :value | ] ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "callback:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@callback"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "callback: aBlock\x0a\x09callback := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "clearStatus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._status_("info");
+self._message_("");
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"clearStatus",{},globals.HLBindingActionInputWidget)})},
+args: [],
+source: "clearStatus\x0a\x09self status: 'info'.\x0a\x09self message: ''.\x0a\x09self refresh",
+messageSends: ["status:", "message:", "refresh"],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultValue",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@defaultValue"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultValue",{},globals.HLBindingActionInputWidget)})},
+args: [],
+source: "defaultValue\x0a\x09^ defaultValue ifNil: [ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultValue:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@defaultValue"]=aString;
+return self},
+args: ["aString"],
+source: "defaultValue: aString\x0a\x09defaultValue := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "errorStatus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._status_("error");
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"errorStatus",{},globals.HLBindingActionInputWidget)})},
+args: [],
+source: "errorStatus\x0a\x09self status: 'error'.\x0a\x09self refresh",
+messageSends: ["status:", "refresh"],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+return smalltalk.withContext(function($ctx1) { 
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._callback())._value_(aString);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
+return smalltalk.withContext(function($ctx2) {
+_st(_st(self._input())._asJQuery())._one_do_("keydown",(function(){
+return smalltalk.withContext(function($ctx3) {
+return self._clearStatus();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+self._message_(_st(ex)._messageText());
+return self._errorStatus();
+}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"evaluate:",{aString:aString},globals.HLBindingActionInputWidget)})},
+args: ["aString"],
+source: "evaluate: aString\x09\x0a\x09[ self callback value: aString ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex |\x0a\x09\x09\x09self input asJQuery \x0a\x09\x09\x09\x09one: 'keydown' \x0a\x09\x09\x09\x09do: [ self clearStatus ].\x0a\x09\x09\x09self message: ex messageText.\x0a\x09\x09\x09self errorStatus ]",
+messageSends: ["on:do:", "value:", "callback", "one:do:", "asJQuery", "input", "clearStatus", "message:", "messageText", "errorStatus"],
+referencedClasses: ["Error"]
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ghostText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@ghostText"];
+return $1;
+},
+args: [],
+source: "ghostText\x0a\x09^ ghostText",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ghostText:",
+protocol: 'accessing',
+fn: function (aText){
+var self=this;
+self["@ghostText"]=aText;
+return self},
+args: ["aText"],
+source: "ghostText: aText\x0a\x09ghostText := aText",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "input",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@input"];
+return $1;
+},
+args: [],
+source: "input\x0a\x09^ input",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputCompletion",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@inputCompletion"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=[];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},globals.HLBindingActionInputWidget)})},
+args: [],
+source: "inputCompletion\x0a\x09^ inputCompletion ifNil: [ #() ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inputCompletion:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@inputCompletion"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "inputCompletion: aCollection\x0a\x09inputCompletion := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "message",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@message"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@message"]="";
+$1=self["@message"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"message",{},globals.HLBindingActionInputWidget)})},
+args: [],
+source: "message\x0a\x09^ message ifNil: [ message := '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "message:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@message"]=aString;
+return self},
+args: ["aString"],
+source: "message: aString\x0a\x09message := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "refresh",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self["@wrapper"];
+if(($receiver = $1) == null || $receiver.isNil){
+return self;
+} else {
+$1;
+};
+_st(self["@wrapper"])._class_(self._status());
+_st(self["@messageTag"])._contents_(self._message());
+return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},globals.HLBindingActionInputWidget)})},
+args: [],
+source: "refresh\x0a\x09wrapper ifNil: [ ^ self ].\x0a    \x0a\x09wrapper class: self status.\x0a\x09messageTag contents: self message",
+messageSends: ["ifNil:", "class:", "status", "contents:", "message"],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$6,$8,$10,$9,$7,$5,$11,$12,$13,$3,$14,$15,$receiver;
+$1=self["@wrapper"];
+if(($receiver = $1) == null || $receiver.isNil){
+self["@wrapper"]=_st(html)._span();
+$ctx1.sendIdx["span"]=1;
+self["@wrapper"];
+} else {
+$1;
+};
+$2=self["@wrapper"];
+_st($2)._class_(self._status());
+$ctx1.sendIdx["class:"]=1;
+$3=_st($2)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(html)._input();
+_st($4)._placeholder_(self._ghostText());
+_st($4)._value_(self._defaultValue());
+$6=$4;
+$7=_st((function(event){
+return smalltalk.withContext(function($ctx3) {
+$8=_st(_st(event)._which()).__eq((13));
+if(smalltalk.assert($8)){
+$10=_st(self["@input"])._asJQuery();
+$ctx3.sendIdx["asJQuery"]=1;
+$9=_st($10)._val();
+return self._evaluate_($9);
+};
+}, function($ctx3) {$ctx3.fillBlock({event:event},$ctx2,3)})}))._yourself();
+$ctx2.sendIdx["yourself"]=1;
+$5=_st($6)._onKeyDown_($7);
+self["@input"]=$5;
+self["@input"];
+$11=_st(self["@input"])._asJQuery();
+$ctx2.sendIdx["asJQuery"]=2;
+_st($11)._typeahead_(globals.HashedCollection._newFromPairs_(["source",self._inputCompletion()]));
+$12=_st(html)._span();
+_st($12)._class_("help-inline");
+_st($12)._with_(self._message());
+$13=_st($12)._yourself();
+self["@messageTag"]=$13;
+return self["@messageTag"];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$ctx1.sendIdx["with:"]=1;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+$14=_st(self["@input"])._asJQuery();
+_st($14)._focus();
+$15=_st($14)._select();
+return $15;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._valueWithTimeout_((10));
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.HLBindingActionInputWidget)})},
+args: ["html"],
+source: "renderOn: html\x0a\x09wrapper ifNil: [ wrapper := html span ].\x0a\x0a\x09wrapper \x0a\x09\x09class: self status;\x0a\x09\x09with: [\x0a\x09\x09\x09input := html input\x0a\x09\x09\x09\x09placeholder: self ghostText;\x0a\x09\x09\x09\x09value: self defaultValue;\x0a\x09\x09\x09\x09onKeyDown: [ :event | \x0a\x09\x09\x09\x09\x09event which = 13 ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self evaluate: input asJQuery val ] ]\x0a\x09\x09\x09\x09yourself.\x0a\x09\x09\x09input asJQuery \x0a\x09\x09\x09\x09typeahead: #{ 'source' -> self inputCompletion }.\x0a\x09\x09\x09messageTag := (html span\x0a\x09\x09\x09\x09class: 'help-inline';\x0a\x09\x09\x09\x09with: self message;\x0a\x09\x09\x09\x09yourself) ].\x0a\x09\x0a\x09\x22Evaluate with a timeout to ensure focus.\x0a\x09Commands can be executed from a menu, clicking on the menu to\x0a\x09evaluate the command would give it the focus otherwise\x22\x0a\x09\x0a\x09[ input asJQuery focus; select ] valueWithTimeout: 10",
+messageSends: ["ifNil:", "span", "class:", "status", "with:", "placeholder:", "input", "ghostText", "value:", "defaultValue", "onKeyDown:", "yourself", "ifTrue:", "=", "which", "evaluate:", "val", "asJQuery", "typeahead:", "inputCompletion", "message", "valueWithTimeout:", "focus", "select"],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "status",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@status"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@status"]="info";
+$1=self["@status"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"status",{},globals.HLBindingActionInputWidget)})},
+args: [],
+source: "status\x0a\x09^ status ifNil: [ status := 'info' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "status:",
+protocol: 'accessing',
+fn: function (aStatus){
+var self=this;
+self["@status"]=aStatus;
+return self},
+args: ["aStatus"],
+source: "status: aStatus\x0a\x09status := aStatus",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBindingActionInputWidget);
+
+
+
+smalltalk.addClass('HLKeyBinder', globals.Object, ['modifierKey', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
+globals.HLKeyBinder.comment="My `current` instance holds keybindings for Helios actions and evaluate them.\x0a\x0aBindings can be nested by groups. The `bindings` instance variable holds the root of the key bindings tree.\x0a\x0aBindings are instances of a concrete subclass of `HLBinding`.\x0a\x0aI am always either in 'active' or 'inactive' state. In active state I capture key down events and my `helper` widget is displayed at the bottom of the window. My `selectedBinding`, if any, is displayed by the helper.\x0a\x0aBindings are evaluated through `applyBinding:`. If a binding is final (not a group of other bindings), evaluating it will result in deactivating the binder, and hiding the `helper` widget.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activate",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._helper())._show();
+return self}, function($ctx1) {$ctx1.fill(self,"activate",{},globals.HLKeyBinder)})},
+args: [],
+source: "activate\x0a\x09self helper show",
+messageSends: ["show", "helper"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activationKey",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return (32);
+},
+args: [],
+source: "activationKey\x0a\x09\x22SPACE\x22\x0a\x09^ 32",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activationKeyLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "ctrl + space";
+},
+args: [],
+source: "activationKeyLabel\x0a\x09^ 'ctrl + space'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "applyBinding:",
+protocol: 'actions',
+fn: function (aBinding){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aBinding)._isActive();
+if(! smalltalk.assert($1)){
+return self;
+};
+self._selectBinding_(aBinding);
+_st(aBinding)._apply();
+return self}, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding},globals.HLKeyBinder)})},
+args: ["aBinding"],
+source: "applyBinding: aBinding\x0a\x09aBinding isActive ifFalse: [ ^ self ].\x0a\x09\x0a\x09self selectBinding: aBinding.\x0a    aBinding apply",
+messageSends: ["ifFalse:", "isActive", "selectBinding:", "apply"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "bindings",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@bindings"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@bindings"]=self._defaultBindings();
+$1=self["@bindings"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"bindings",{},globals.HLKeyBinder)})},
+args: [],
+source: "bindings\x0a\x09^ bindings ifNil: [ bindings := self defaultBindings ]",
+messageSends: ["ifNil:", "defaultBindings"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deactivate",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self["@selectedBinding"];
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(self["@selectedBinding"])._release();
+};
+self["@selectedBinding"]=nil;
+_st(self._helper())._hide();
+return self}, function($ctx1) {$ctx1.fill(self,"deactivate",{},globals.HLKeyBinder)})},
+args: [],
+source: "deactivate\x0a\x09selectedBinding ifNotNil: [ selectedBinding release ].\x0a    selectedBinding := nil.\x0a\x09self helper hide",
+messageSends: ["ifNotNil:", "release", "hide", "helper"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultBindings",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+var group;
+function $HLBindingGroup(){return globals.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
+function $HLCloseTabCommand(){return globals.HLCloseTabCommand||(typeof HLCloseTabCommand=="undefined"?nil:HLCloseTabCommand)}
+function $HLSwitchTabCommand(){return globals.HLSwitchTabCommand||(typeof HLSwitchTabCommand=="undefined"?nil:HLSwitchTabCommand)}
+function $HLOpenCommand(){return globals.HLOpenCommand||(typeof HLOpenCommand=="undefined"?nil:HLOpenCommand)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3,$5,$6;
+$1=_st($HLBindingGroup())._new();
+$ctx1.sendIdx["new"]=1;
+$2=$1;
+$4=_st($HLCloseTabCommand())._new();
+$ctx1.sendIdx["new"]=2;
+$3=_st($4)._asBinding();
+$ctx1.sendIdx["asBinding"]=1;
+_st($2)._add_($3);
+$ctx1.sendIdx["add:"]=1;
+_st($1)._add_(_st(_st($HLSwitchTabCommand())._new())._asBinding());
+$5=_st($1)._yourself();
+group=$5;
+_st($HLOpenCommand())._registerConcreteClassesOn_(group);
+$6=group;
+return $6;
+}, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},globals.HLKeyBinder)})},
+args: [],
+source: "defaultBindings\x0a\x09| group |\x0a\x09\x0a\x09group := HLBindingGroup new\x0a\x09\x09add: HLCloseTabCommand new asBinding;\x0a\x09\x09add: HLSwitchTabCommand new asBinding;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09HLOpenCommand registerConcreteClassesOn: group.\x0a\x09\x09\x09\x09\x0a\x09^ group",
+messageSends: ["add:", "new", "asBinding", "yourself", "registerConcreteClassesOn:"],
+referencedClasses: ["HLBindingGroup", "HLCloseTabCommand", "HLSwitchTabCommand", "HLOpenCommand"]
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "escapeKey",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return (27);
+},
+args: [],
+source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "flushBindings",
+protocol: 'actions',
+fn: function (){
+var self=this;
+self["@bindings"]=nil;
+return self},
+args: [],
+source: "flushBindings\x0a\x09bindings := nil",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleActiveKeyDown:",
+protocol: 'events',
+fn: function (event){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$6,$5,$4,$1,$7;
+$3=_st(event)._which();
+$ctx1.sendIdx["which"]=1;
+$2=_st($3).__eq(self._escapeKey());
+$ctx1.sendIdx["="]=1;
+$1=_st($2)._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+$6=_st(event)._which();
+$ctx2.sendIdx["which"]=2;
+$5=_st($6).__eq((71));
+$ctx2.sendIdx["="]=2;
+$4=_st($5)._or_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(event)._which()).__eq(self._activationKey());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+return _st($4)._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(event)._ctrlKey();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["or:"]=1;
+if(smalltalk.assert($1)){
+self._deactivate();
+_st(event)._preventDefault();
+return false;
+};
+$7=self._handleBindingFor_(event);
+return $7;
+}, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event},globals.HLKeyBinder)})},
+args: ["event"],
+source: "handleActiveKeyDown: event\x0a\x0a\x09\x22ESC, ctrl+g ctrl+space deactivate the keyBinder\x22\x0a\x09(event which = self escapeKey or: [\x0a\x09\x09(event which = 71 or: [ event which = self activationKey ]) \x0a\x09\x09\x09and: [ event ctrlKey ] ])\x0a        \x09\x09ifTrue: [ \x0a           \x09\x09\x09self deactivate.\x0a\x09\x09\x09\x09\x09event preventDefault.\x0a\x09\x09\x09\x09\x09^ false ].\x0a            \x0a    \x22Handle the keybinding\x22\x0a    ^ self handleBindingFor: event",
+messageSends: ["ifTrue:", "or:", "=", "which", "escapeKey", "and:", "activationKey", "ctrlKey", "deactivate", "preventDefault", "handleBindingFor:"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleBindingFor:",
+protocol: 'events',
+fn: function (anEvent){
+var self=this;
+var binding;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+binding=_st(self._selectedBinding())._atKey_(_st(anEvent)._which());
+$1=binding;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+self._applyBinding_(binding);
+_st(anEvent)._preventDefault();
+return false;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding},globals.HLKeyBinder)})},
+args: ["anEvent"],
+source: "handleBindingFor: anEvent\x0a\x09| binding |\x0a    binding := self selectedBinding atKey: anEvent which.\x0a    \x0a    binding ifNotNil: [ \x0a    \x09self applyBinding: binding.\x0a\x09\x09anEvent preventDefault.\x0a\x09\x09^ false ]",
+messageSends: ["atKey:", "selectedBinding", "which", "ifNotNil:", "applyBinding:", "preventDefault"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleInactiveKeyDown:",
+protocol: 'events',
+fn: function (event){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(_st(event)._which()).__eq(self._activationKey());
+if(smalltalk.assert($1)){
+$2=_st(event)._ctrlKey();
+if(smalltalk.assert($2)){
+self._activate();
+_st(event)._preventDefault();
+return false;
+};
+};
+return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event},globals.HLKeyBinder)})},
+args: ["event"],
+source: "handleInactiveKeyDown: event\x0a\x09event which = self activationKey ifTrue: [\x0a    \x09event ctrlKey ifTrue: [\x0a\x09\x09\x09self activate. \x0a            event preventDefault. \x0a            ^ false ] ]",
+messageSends: ["ifTrue:", "=", "which", "activationKey", "ctrlKey", "activate", "preventDefault"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleKeyDown:",
+protocol: 'events',
+fn: function (event){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._isActive();
+if(smalltalk.assert($2)){
+$1=self._handleActiveKeyDown_(event);
+} else {
+$1=self._handleInactiveKeyDown_(event);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event},globals.HLKeyBinder)})},
+args: ["event"],
+source: "handleKeyDown: event\x0a\x09^ self isActive\x0a    \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a      \x09ifFalse: [ self handleInactiveKeyDown: event ]",
+messageSends: ["ifTrue:ifFalse:", "isActive", "handleActiveKeyDown:", "handleInactiveKeyDown:"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "helper",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@helper"];
+return $1;
+},
+args: [],
+source: "helper\x0a\x09^ helper",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $HLKeyBinderHelperWidget(){return globals.HLKeyBinderHelperWidget||(typeof HLKeyBinderHelperWidget=="undefined"?nil:HLKeyBinderHelperWidget)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLKeyBinder.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@helper"]=_st($HLKeyBinderHelperWidget())._on_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLKeyBinder)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelperWidget on: self",
+messageSends: ["initialize", "on:"],
+referencedClasses: ["HLKeyBinderHelperWidget"]
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isActive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(".".__comma(_st(self._helper())._cssClass()))._asJQuery())._is_(":visible");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isActive",{},globals.HLKeyBinder)})},
+args: [],
+source: "isActive\x0a\x09^ ('.', self helper cssClass) asJQuery is: ':visible'",
+messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectBinding:",
+protocol: 'actions',
+fn: function (aBinding){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aBinding).__eq(self["@selectedBinding"]);
+if(smalltalk.assert($1)){
+return self;
+};
+self["@selectedBinding"]=aBinding;
+_st(self._helper())._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"selectBinding:",{aBinding:aBinding},globals.HLKeyBinder)})},
+args: ["aBinding"],
+source: "selectBinding: aBinding\x0a\x09aBinding = selectedBinding ifTrue: [ ^ self ].\x0a\x09\x0a\x09selectedBinding := aBinding.\x0a\x09self helper refresh",
+messageSends: ["ifTrue:", "=", "refresh", "helper"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedBinding",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@selectedBinding"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._bindings();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},globals.HLKeyBinder)})},
+args: [],
+source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
+messageSends: ["ifNil:", "bindings"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupEvents",
+protocol: 'events',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st("body"._asJQuery())._keydown_((function(event){
+return smalltalk.withContext(function($ctx2) {
+return self._handleKeyDown_(event);
+}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{},globals.HLKeyBinder)})},
+args: [],
+source: "setupEvents\x0a\x09'body' asJQuery keydown: [ :event | self handleKeyDown: event ]",
+messageSends: ["keydown:", "asJQuery", "handleKeyDown:"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "systemIsMac",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(navigator)._platform())._match_("Mac");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"systemIsMac",{},globals.HLKeyBinder)})},
+args: [],
+source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
+messageSends: ["match:", "platform"],
+referencedClasses: []
+}),
+globals.HLKeyBinder);
+
+
+globals.HLKeyBinder.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "current",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@current"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@current"]=($ctx1.supercall = true, globals.HLKeyBinder.klass.superclass.fn.prototype._new.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=self["@current"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"current",{},globals.HLKeyBinder.klass)})},
+args: [],
+source: "current\x0a\x09^ current ifNil: [ current := super new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: []
+}),
+globals.HLKeyBinder.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._shouldNotImplement();
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.HLKeyBinder.klass)})},
+args: [],
+source: "new\x0a\x09self shouldNotImplement",
+messageSends: ["shouldNotImplement"],
+referencedClasses: []
+}),
+globals.HLKeyBinder.klass);
+
+
+smalltalk.addClass('HLKeyBinderHelperWidget', globals.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
+globals.HLKeyBinderHelperWidget.comment="I am the widget responsible for displaying active keybindings in a bar at the bottom of the window. Each keybinding is an instance of `HLBinding`. \x0a\x0aRendering is done through a double dispatch, see `#renderSelectedBindingOn:`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "key_helper";
+},
+args: [],
+source: "cssClass\x0a\x09^ 'key_helper'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deactivate",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._keyBinder())._deactivate();
+return self}, function($ctx1) {$ctx1.fill(self,"deactivate",{},globals.HLKeyBinderHelperWidget)})},
+args: [],
+source: "deactivate\x0a\x09self keyBinder deactivate",
+messageSends: ["deactivate", "keyBinder"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hide",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(".".__comma(self._cssClass()))._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($1)._remove();
+$ctx1.sendIdx["remove"]=1;
+_st(".helper_overlay"._asJQuery())._remove();
+self._showCog();
+return self}, function($ctx1) {$ctx1.fill(self,"hide",{},globals.HLKeyBinderHelperWidget)})},
+args: [],
+source: "hide\x0a\x09('.', self cssClass) asJQuery remove.\x0a\x09'.helper_overlay' asJQuery remove.\x0a\x09self showCog",
+messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hideCog",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st("#cog-helper"._asJQuery())._hide();
+return self}, function($ctx1) {$ctx1.fill(self,"hideCog",{},globals.HLKeyBinderHelperWidget)})},
+args: [],
+source: "hideCog\x0a\x09'#cog-helper' asJQuery hide",
+messageSends: ["hide", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyBinder",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@keyBinder"];
+return $1;
+},
+args: [],
+source: "keyBinder\x0a\x09^ keyBinder",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyBinder:",
+protocol: 'accessing',
+fn: function (aKeyBinder){
+var self=this;
+self["@keyBinder"]=aKeyBinder;
+return self},
+args: ["aKeyBinder"],
+source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "mainId",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "binding-helper-main";
+},
+args: [],
+source: "mainId\x0a\x09^ 'binding-helper-main'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderBindingActionFor:on:",
+protocol: 'rendering',
+fn: function (aBinding,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$5,$6,$2;
+$1=_st(html)._span();
+_st($1)._class_("command");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._strong();
+_st($3)._class_("label");
+$ctx2.sendIdx["class:"]=2;
+$4=_st($3)._with_(_st(_st(aBinding)._shortcut())._asLowercase());
+$ctx2.sendIdx["with:"]=2;
+$4;
+$5=_st(html)._a();
+_st($5)._class_("action");
+_st($5)._with_(_st(aBinding)._displayLabel());
+$6=_st($5)._onClick_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._keyBinder())._applyBinding_(aBinding);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+return $6;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderBindingActionFor:on:",{aBinding:aBinding,html:html},globals.HLKeyBinderHelperWidget)})},
+args: ["aBinding", "html"],
+source: "renderBindingActionFor: aBinding on: html\x0a\x09html span class: 'command'; with: [\x0a\x09\x09html strong \x0a\x09\x09\x09class: 'label'; \x0a\x09\x09\x09with: aBinding shortcut asLowercase.\x0a  \x09\x09html a \x0a        \x09class: 'action'; \x0a            with: aBinding displayLabel;\x0a  \x09\x09\x09onClick: [ self keyBinder applyBinding: aBinding ] ]",
+messageSends: ["class:", "span", "with:", "strong", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:", "keyBinder"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderBindingGroup:on:",
+protocol: 'rendering',
+fn: function (aBindingGroup,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(_st(_st(aBindingGroup)._activeBindings())._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(a)._key();
+$ctx2.sendIdx["key"]=1;
+return _st($1).__lt(_st(b)._key());
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._renderBindingActionFor_on_(each,html);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},globals.HLKeyBinderHelperWidget)})},
+args: ["aBindingGroup", "html"],
+source: "renderBindingGroup: aBindingGroup on: html\x0a\x09(aBindingGroup activeBindings \x0a    \x09sorted: [ :a :b | a key < b key ])\x0a        do: [ :each | self renderBindingActionFor: each on: html ]",
+messageSends: ["do:", "sorted:", "activeBindings", "<", "key", "renderBindingActionFor:on:"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderCloseOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._a();
+_st($1)._class_("close");
+$ctx1.sendIdx["class:"]=1;
+_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(html)._tag_("i"))._class_("icon-remove");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._keyBinder())._deactivate();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},globals.HLKeyBinderHelperWidget)})},
+args: ["html"],
+source: "renderCloseOn: html\x0a\x09html a\x0a\x09\x09class: 'close';\x0a\x09\x09with: [ (html tag: 'i') class: 'icon-remove' ];\x0a\x09\x09onClick: [ self keyBinder deactivate ]",
+messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$5,$6,$4;
+$1=_st(html)._div();
+$ctx1.sendIdx["div"]=1;
+_st($1)._id_("overlay");
+$ctx1.sendIdx["id:"]=1;
+_st($1)._class_("helper_overlay");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._deactivate();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$3=_st(html)._div();
+$ctx1.sendIdx["div"]=2;
+_st($3)._class_(self._cssClass());
+$4=_st($3)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+self._renderLabelOn_(html);
+$5=_st(html)._div();
+_st($5)._id_(self._mainId());
+$6=_st($5)._with_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._renderSelectedBindingOn_(html);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+$6;
+return self._renderCloseOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$ctx1.sendIdx["with:"]=1;
+_st(":focus"._asJQuery())._blur();
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLKeyBinderHelperWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html div \x0a\x09\x09id: 'overlay';\x0a\x09\x09class: 'helper_overlay';\x0a\x09\x09onClick: [ self deactivate ].\x0a\x09\x0a\x09html div class: self cssClass; with: [\x0a      \x09self renderLabelOn: html.\x0a\x09\x09html div\x0a\x09\x09\x09id: self mainId;\x0a\x09\x09\x09with: [ self renderSelectedBindingOn: html ].\x0a\x09\x09self renderCloseOn: html ].\x0a\x09\x09\x0a\x09':focus' asJQuery blur",
+messageSends: ["id:", "div", "class:", "onClick:", "deactivate", "cssClass", "with:", "renderLabelOn:", "mainId", "renderSelectedBindingOn:", "renderCloseOn:", "blur", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderLabelOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$5,$4,$2,$receiver;
+$1=_st(html)._span();
+_st($1)._class_("selected");
+$3=$1;
+$5=_st(self._selectedBinding())._label();
+if(($receiver = $5) == null || $receiver.isNil){
+$4="Action";
+} else {
+$4=$5;
+};
+$2=_st($3)._with_($4);
+return self}, function($ctx1) {$ctx1.fill(self,"renderLabelOn:",{html:html},globals.HLKeyBinderHelperWidget)})},
+args: ["html"],
+source: "renderLabelOn: html\x0a\x09\x09html span \x0a        \x09class: 'selected'; \x0a            with: (self selectedBinding label ifNil: [ 'Action' ])",
+messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderSelectedBindingOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._selectedBinding())._renderOn_html_(self,html);
+return self}, function($ctx1) {$ctx1.fill(self,"renderSelectedBindingOn:",{html:html},globals.HLKeyBinderHelperWidget)})},
+args: ["html"],
+source: "renderSelectedBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html",
+messageSends: ["renderOn:html:", "selectedBinding"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectedBinding",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._keyBinder())._selectedBinding();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},globals.HLKeyBinderHelperWidget)})},
+args: [],
+source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
+messageSends: ["selectedBinding", "keyBinder"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "show",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._hideCog();
+self._appendToJQuery_("body"._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"show",{},globals.HLKeyBinderHelperWidget)})},
+args: [],
+source: "show\x0a\x09self hideCog.\x0a\x09self appendToJQuery: 'body' asJQuery",
+messageSends: ["hideCog", "appendToJQuery:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showCog",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st("#cog-helper"._asJQuery())._show();
+return self}, function($ctx1) {$ctx1.fill(self,"showCog",{},globals.HLKeyBinderHelperWidget)})},
+args: [],
+source: "showCog\x0a\x09'#cog-helper' asJQuery show",
+messageSends: ["show", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showWidget:",
+protocol: 'actions',
+fn: function (aWidget){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self._mainId();
+$ctx1.sendIdx["mainId"]=1;
+$2="#".__comma($3);
+$ctx1.sendIdx[","]=1;
+$1=_st($2)._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($1)._empty();
+_st(aWidget)._appendToJQuery_(_st("#".__comma(self._mainId()))._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"showWidget:",{aWidget:aWidget},globals.HLKeyBinderHelperWidget)})},
+args: ["aWidget"],
+source: "showWidget: aWidget\x0a\x09\x22Some actions need to display more info to the user or request input.\x0a\x09This method is the right place for that\x22\x0a\x09\x0a\x09('#', self mainId) asJQuery empty.\x0a\x09aWidget appendToJQuery: ('#', self mainId) asJQuery",
+messageSends: ["empty", "asJQuery", ",", "mainId", "appendToJQuery:"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aKeyBinder){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._keyBinder_(aKeyBinder);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder},globals.HLKeyBinderHelperWidget.klass)})},
+args: ["aKeyBinder"],
+source: "on: aKeyBinder\x0a\x09^ self new\x0a    \x09keyBinder: aKeyBinder;\x0a        yourself",
+messageSends: ["keyBinder:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLKeyBinderHelperWidget.klass);
+
+
+smalltalk.addClass('HLRepeatedKeyDownHandler', globals.Object, ['repeatInterval', 'delay', 'interval', 'keyBindings', 'widget', 'keyDown'], 'Helios-KeyBindings');
+globals.HLRepeatedKeyDownHandler.comment="I am responsible for handling repeated key down actions for widgets.\x0a\x0a##Usage\x0a\x0a    (self on: aWidget)\x0a        whileKeyDown: 38 do: aBlock;\x0a        whileKeyDown: 40 do: anotherBlock;\x0a        bindKeys\x0a\x0aI perform an action block on a key press, wait for 300 ms and then preform the same action block every `repeatInterval` milliseconds until the key is released.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "bindKeys",
+protocol: 'binding',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._widget())._bindKeyDown_keyUp_((function(e){
+return smalltalk.withContext(function($ctx2) {
+return self._handleKeyDown_(e);
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,1)})}),(function(e){
+return smalltalk.withContext(function($ctx2) {
+return self._handleKeyUp();
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"bindKeys",{},globals.HLRepeatedKeyDownHandler)})},
+args: [],
+source: "bindKeys\x0a\x09self widget \x0a\x09\x09bindKeyDown: [ :e | self handleKeyDown: e ] \x0a\x09\x09keyUp: [ :e | self handleKeyUp ]",
+messageSends: ["bindKeyDown:keyUp:", "widget", "handleKeyDown:", "handleKeyUp"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultRepeatInterval",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return (70);
+},
+args: [],
+source: "defaultRepeatInterval\x0a\x09^ 70",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleEvent:forKey:action:",
+protocol: 'events handling',
+fn: function (anEvent,anInteger,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(anEvent)._which()).__eq(anInteger))._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._isKeyDown())._not();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(smalltalk.assert($1)){
+self._whileKeyDownDo_(aBlock);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"handleEvent:forKey:action:",{anEvent:anEvent,anInteger:anInteger,aBlock:aBlock},globals.HLRepeatedKeyDownHandler)})},
+args: ["anEvent", "anInteger", "aBlock"],
+source: "handleEvent: anEvent forKey: anInteger action: aBlock\x0a\x09(anEvent which = anInteger and: [ self isKeyDown not ])\x0a\x09\x09ifTrue: [ self whileKeyDownDo: aBlock ]",
+messageSends: ["ifTrue:", "and:", "=", "which", "not", "isKeyDown", "whileKeyDownDo:"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleKeyDown:",
+protocol: 'events handling',
+fn: function (anEvent){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._keyBindings())._keysAndValuesDo_((function(key,action){
+return smalltalk.withContext(function($ctx2) {
+return self._handleEvent_forKey_action_(anEvent,key,action);
+}, function($ctx2) {$ctx2.fillBlock({key:key,action:action},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{anEvent:anEvent},globals.HLRepeatedKeyDownHandler)})},
+args: ["anEvent"],
+source: "handleKeyDown: anEvent\x0a\x09self keyBindings keysAndValuesDo: [ :key :action | \x0a\x09\x09self handleEvent: anEvent forKey: key action: action ]",
+messageSends: ["keysAndValuesDo:", "keyBindings", "handleEvent:forKey:action:"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleKeyUp",
+protocol: 'events handling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+$1=self._isKeyDown();
+if(smalltalk.assert($1)){
+self["@keyDown"]=false;
+self["@keyDown"];
+$2=self["@interval"];
+if(($receiver = $2) == null || $receiver.isNil){
+$2;
+} else {
+_st(self["@interval"])._clearInterval();
+};
+$3=self["@delay"];
+if(($receiver = $3) == null || $receiver.isNil){
+$3;
+} else {
+_st(self["@delay"])._clearTimeout();
+};
+};
+return self}, function($ctx1) {$ctx1.fill(self,"handleKeyUp",{},globals.HLRepeatedKeyDownHandler)})},
+args: [],
+source: "handleKeyUp\x0a\x09self isKeyDown ifTrue: [\x0a\x09\x09keyDown := false.\x0a\x09\x09interval ifNotNil: [ interval clearInterval ].\x0a\x09\x09delay ifNotNil: [ delay clearTimeout ] ]",
+messageSends: ["ifTrue:", "isKeyDown", "ifNotNil:", "clearInterval", "clearTimeout"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isKeyDown",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@keyDown"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isKeyDown",{},globals.HLRepeatedKeyDownHandler)})},
+args: [],
+source: "isKeyDown\x0a\x09^ keyDown ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyBindings",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@keyBindings"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@keyBindings"]=_st($Dictionary())._new();
+$1=self["@keyBindings"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"keyBindings",{},globals.HLRepeatedKeyDownHandler)})},
+args: [],
+source: "keyBindings\x0a\x09^ keyBindings ifNil: [ keyBindings := Dictionary new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Dictionary"]
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "rebindKeys",
+protocol: 'binding',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._unbindKeys();
+$1=self._bindKeys();
+return self}, function($ctx1) {$ctx1.fill(self,"rebindKeys",{},globals.HLRepeatedKeyDownHandler)})},
+args: [],
+source: "rebindKeys\x0a\x09self \x0a\x09\x09unbindKeys;\x0a\x09\x09bindKeys",
+messageSends: ["unbindKeys", "bindKeys"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "repeatInterval",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@repeatInterval"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._defaultRepeatInterval();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"repeatInterval",{},globals.HLRepeatedKeyDownHandler)})},
+args: [],
+source: "repeatInterval\x0a\x09^ repeatInterval ifNil: [ self defaultRepeatInterval ]",
+messageSends: ["ifNil:", "defaultRepeatInterval"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "repeatInterval:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@repeatInterval"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "repeatInterval: anInteger\x0a\x09repeatInterval := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "startRepeatingAction:",
+protocol: 'actions',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(self._widget())._hasFocus();
+if(smalltalk.assert($2)){
+return _st(aBlock)._value();
+} else {
+return self._handleKeyUp();
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithInterval_(self._repeatInterval());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"startRepeatingAction:",{aBlock:aBlock},globals.HLRepeatedKeyDownHandler)})},
+args: ["aBlock"],
+source: "startRepeatingAction: aBlock\x0a\x09^ [ (self widget hasFocus)\x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self handleKeyUp ] ] valueWithInterval: self repeatInterval",
+messageSends: ["valueWithInterval:", "ifTrue:ifFalse:", "hasFocus", "widget", "value", "handleKeyUp", "repeatInterval"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unbindKeys",
+protocol: 'binding',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._widget())._unbindKeyDownKeyUp();
+return self}, function($ctx1) {$ctx1.fill(self,"unbindKeys",{},globals.HLRepeatedKeyDownHandler)})},
+args: [],
+source: "unbindKeys\x0a\x09self widget unbindKeyDownKeyUp",
+messageSends: ["unbindKeyDownKeyUp", "widget"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "whileKeyDown:do:",
+protocol: 'actions',
+fn: function (aKey,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._keyBindings())._at_put_(aKey,aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"whileKeyDown:do:",{aKey:aKey,aBlock:aBlock},globals.HLRepeatedKeyDownHandler)})},
+args: ["aKey", "aBlock"],
+source: "whileKeyDown: aKey do: aBlock\x0a\x09self keyBindings at: aKey put: aBlock",
+messageSends: ["at:put:", "keyBindings"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "whileKeyDownDo:",
+protocol: 'events handling',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@keyDown"]=true;
+_st(aBlock)._value();
+self["@delay"]=_st((function(){
+return smalltalk.withContext(function($ctx2) {
+self["@interval"]=self._startRepeatingAction_(aBlock);
+return self["@interval"];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithTimeout_((300));
+return self}, function($ctx1) {$ctx1.fill(self,"whileKeyDownDo:",{aBlock:aBlock},globals.HLRepeatedKeyDownHandler)})},
+args: ["aBlock"],
+source: "whileKeyDownDo: aBlock\x0a\x09keyDown := true.\x0a\x09aBlock value.\x0a\x09delay := [ interval := self startRepeatingAction: aBlock ] \x0a\x09\x09valueWithTimeout: 300",
+messageSends: ["value", "valueWithTimeout:", "startRepeatingAction:"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "widget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@widget"];
+return $1;
+},
+args: [],
+source: "widget\x0a\x09^ widget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "widget:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+self["@widget"]=aWidget;
+return self},
+args: ["aWidget"],
+source: "widget: aWidget\x0a\x09widget := aWidget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aWidget){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._widget_(aWidget);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aWidget:aWidget},globals.HLRepeatedKeyDownHandler.klass)})},
+args: ["aWidget"],
+source: "on: aWidget\x0a\x09^ self new\x0a\x09\x09widget: aWidget;\x0a\x09\x09yourself",
+messageSends: ["widget:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLRepeatedKeyDownHandler.klass);
+
+});

+ 737 - 0
src/Helios-KeyBindings.st

@@ -0,0 +1,737 @@
+Smalltalk createPackage: 'Helios-KeyBindings'!
+Object subclass: #HLBinding
+	instanceVariableNames: 'key label'
+	package: 'Helios-KeyBindings'!
+!HLBinding commentStamp!
+I am the abstract representation of a keybinding in Helios. My instances hold a key (integer value) and a label. 
+
+Bindings are built into a tree of keys, so pressing a key may result in more key choices (for example, to open a workspace, 'o' is pressed first then 'w' is pressed).
+
+Binding action handling and selection is handled by the `current` instance of `HLKeyBinder`.
+
+Subclasses implement specific behavior like evaluating actions or (sub-)grouping other bindings.!
+
+!HLBinding methodsFor: 'accessing'!
+
+atKey: aKey
+	"Answer the sub-binding at key aKey.
+	Always answer nil here. See HLBindingGroup for more."
+	
+	^ nil
+!
+
+displayLabel
+	^ self label
+!
+
+key
+	^ key
+!
+
+key: anInteger
+	key := anInteger
+!
+
+label
+	^ label
+!
+
+label: aString
+	label := aString
+!
+
+shortcut
+	^ String fromCharCode: self key
+! !
+
+!HLBinding methodsFor: 'actions'!
+
+apply
+!
+
+release
+! !
+
+!HLBinding methodsFor: 'rendering'!
+
+renderOn: aBindingHelper html: html
+! !
+
+!HLBinding methodsFor: 'testing'!
+
+isActive
+	^ self subclassResponsibility
+! !
+
+!HLBinding class methodsFor: 'instance creation'!
+
+on: anInteger labelled: aString
+	^ self new
+    	key: anInteger;
+        label: aString;
+        yourself
+! !
+
+HLBinding subclass: #HLBindingAction
+	instanceVariableNames: 'command'
+	package: 'Helios-KeyBindings'!
+!HLBindingAction commentStamp!
+My instances are the leafs of the binding tree. They evaluate actions through commands, instances of concrete subclasses of `HLCommand`.
+
+The `#apply` methods is used to evaluate the `command`. If the command requires user input, an `inputWidget` will be displayed to the user.!
+
+!HLBindingAction methodsFor: 'accessing'!
+
+command
+	^ command
+!
+
+command: aCommand
+	command := aCommand
+!
+
+input: aString
+	self command input: aString
+!
+
+inputBinding
+	^ HLBindingInput new
+		label: self command inputLabel;
+		ghostText: self command displayLabel;
+		defaultValue: self command defaultInput;
+		inputCompletion: self command inputCompletion;
+		callback: [ :val | 
+			self command 
+				input: val;
+				execute ];
+		yourself
+!
+
+inputWidget
+	^ HLBindingActionInputWidget new
+		ghostText: self command displayLabel;
+		defaultValue: self command defaultInput;
+		inputCompletion: self command inputCompletion;
+		callback: [ :value | 
+			self 
+				input: value;
+				executeCommand ];
+		yourself
+! !
+
+!HLBindingAction methodsFor: 'actions'!
+
+apply
+	self command isInputRequired
+		ifTrue: [ HLKeyBinder current helper showWidget: self inputWidget ]
+		ifFalse: [ self executeCommand ]
+!
+
+executeCommand
+	self command execute.
+	HLKeyBinder current deactivate
+! !
+
+!HLBindingAction methodsFor: 'testing'!
+
+isActive
+	^ self command isActive
+! !
+
+HLBinding subclass: #HLBindingGroup
+	instanceVariableNames: 'bindings'
+	package: 'Helios-KeyBindings'!
+!HLBindingGroup commentStamp!
+My instances hold other bindings, either actions or groups, and do not have actions by themselves.
+
+Children are accessed with `atKey:` and added with the `add*` methods.!
+
+!HLBindingGroup methodsFor: 'accessing'!
+
+activeBindings
+	^ self bindings select: [ :each | each isActive ]
+!
+
+at: aString
+	^ self bindings 
+    	detect: [ :each | each label = aString ]
+      	ifNone: [ nil ]
+!
+
+at: aString add: aBinding
+	| binding |
+	
+	binding := self at: aString.
+	binding ifNil: [ ^ self ].
+		
+	binding add: aBinding
+!
+
+atKey: anInteger
+	^ self bindings 
+    	detect: [ :each | each key = anInteger ]
+      	ifNone: [ nil ]
+!
+
+bindings
+	^ bindings ifNil: [ bindings := OrderedCollection new ]
+!
+
+displayLabel
+	^ super displayLabel, '...'
+! !
+
+!HLBindingGroup methodsFor: 'actions'!
+
+release
+	self bindings do: [ :each | each release ]
+! !
+
+!HLBindingGroup methodsFor: 'add'!
+
+addGroupKey: anInteger labelled: aString
+	self add: (HLBindingGroup on: anInteger labelled: aString)
+! !
+
+!HLBindingGroup methodsFor: 'adding'!
+
+add: aBinding
+	^ self bindings add: aBinding
+!
+
+addActionKey: anInteger labelled: aString callback: aBlock
+	self add: ((HLBindingAction on: anInteger labelled: aString)
+    	callback: aBlock;
+        yourself)
+! !
+
+!HLBindingGroup methodsFor: 'rendering'!
+
+renderOn: aBindingHelper html: html
+	self isActive ifTrue: [
+		aBindingHelper renderBindingGroup: self on: html ]
+! !
+
+!HLBindingGroup methodsFor: 'testing'!
+
+isActive
+	^ self activeBindings notEmpty
+! !
+
+HLWidget subclass: #HLBindingActionInputWidget
+	instanceVariableNames: 'input callback status wrapper ghostText message inputCompletion defaultValue messageTag'
+	package: 'Helios-KeyBindings'!
+!HLBindingActionInputWidget commentStamp!
+My instances are built when a `HLBindingAction` that requires user input is applied.!
+
+!HLBindingActionInputWidget methodsFor: 'accessing'!
+
+callback
+	^ callback ifNil: [ callback := [ :value | ] ]
+!
+
+callback: aBlock
+	callback := aBlock
+!
+
+defaultValue
+	^ defaultValue ifNil: [ '' ]
+!
+
+defaultValue: aString
+	defaultValue := aString
+!
+
+ghostText
+	^ ghostText
+!
+
+ghostText: aText
+	ghostText := aText
+!
+
+input
+	^ input
+!
+
+inputCompletion
+	^ inputCompletion ifNil: [ #() ]
+!
+
+inputCompletion: aCollection
+	inputCompletion := aCollection
+!
+
+message
+	^ message ifNil: [ message := '' ]
+!
+
+message: aString
+	message := aString
+!
+
+status
+	^ status ifNil: [ status := 'info' ]
+!
+
+status: aStatus
+	status := aStatus
+! !
+
+!HLBindingActionInputWidget methodsFor: 'actions'!
+
+clearStatus
+	self status: 'info'.
+	self message: ''.
+	self refresh
+!
+
+errorStatus
+	self status: 'error'.
+	self refresh
+!
+
+evaluate: aString	
+	[ self callback value: aString ]
+		on: Error
+		do: [ :ex |
+			self input asJQuery 
+				one: 'keydown' 
+				do: [ self clearStatus ].
+			self message: ex messageText.
+			self errorStatus ]
+!
+
+refresh
+	wrapper ifNil: [ ^ self ].
+    
+	wrapper class: self status.
+	messageTag contents: self message
+! !
+
+!HLBindingActionInputWidget methodsFor: 'rendering'!
+
+renderOn: html
+	wrapper ifNil: [ wrapper := html span ].
+
+	wrapper 
+		class: self status;
+		with: [
+			input := html input
+				placeholder: self ghostText;
+				value: self defaultValue;
+				onKeyDown: [ :event | 
+					event which = 13 ifTrue: [
+						self evaluate: input asJQuery val ] ]
+				yourself.
+			input asJQuery 
+				typeahead: #{ 'source' -> self inputCompletion }.
+			messageTag := (html span
+				class: 'help-inline';
+				with: self message;
+				yourself) ].
+	
+	"Evaluate with a timeout to ensure focus.
+	Commands can be executed from a menu, clicking on the menu to
+	evaluate the command would give it the focus otherwise"
+	
+	[ input asJQuery focus; select ] valueWithTimeout: 10
+! !
+
+Object subclass: #HLKeyBinder
+	instanceVariableNames: 'modifierKey helper bindings selectedBinding'
+	package: 'Helios-KeyBindings'!
+!HLKeyBinder commentStamp!
+My `current` instance holds keybindings for Helios actions and evaluate them.
+
+Bindings can be nested by groups. The `bindings` instance variable holds the root of the key bindings tree.
+
+Bindings are instances of a concrete subclass of `HLBinding`.
+
+I am always either in 'active' or 'inactive' state. In active state I capture key down events and my `helper` widget is displayed at the bottom of the window. My `selectedBinding`, if any, is displayed by the helper.
+
+Bindings are evaluated through `applyBinding:`. If a binding is final (not a group of other bindings), evaluating it will result in deactivating the binder, and hiding the `helper` widget.!
+
+!HLKeyBinder methodsFor: 'accessing'!
+
+activationKey
+	"SPACE"
+	^ 32
+!
+
+activationKeyLabel
+	^ 'ctrl + space'
+!
+
+bindings
+	^ bindings ifNil: [ bindings := self defaultBindings ]
+!
+
+escapeKey
+	"ESC"
+	^ 27
+!
+
+helper
+	^ helper
+!
+
+selectedBinding
+	^ selectedBinding ifNil: [ self bindings ]
+! !
+
+!HLKeyBinder methodsFor: 'actions'!
+
+activate
+	self helper show
+!
+
+applyBinding: aBinding
+	aBinding isActive ifFalse: [ ^ self ].
+	
+	self selectBinding: aBinding.
+    aBinding apply
+!
+
+deactivate
+	selectedBinding ifNotNil: [ selectedBinding release ].
+    selectedBinding := nil.
+	self helper hide
+!
+
+flushBindings
+	bindings := nil
+!
+
+selectBinding: aBinding
+	aBinding = selectedBinding ifTrue: [ ^ self ].
+	
+	selectedBinding := aBinding.
+	self helper refresh
+! !
+
+!HLKeyBinder methodsFor: 'defaults'!
+
+defaultBindings
+	| group |
+	
+	group := HLBindingGroup new
+		add: HLCloseTabCommand new asBinding;
+		add: HLSwitchTabCommand new asBinding;
+		yourself.
+		
+	HLOpenCommand registerConcreteClassesOn: group.
+				
+	^ group
+! !
+
+!HLKeyBinder methodsFor: 'events'!
+
+handleActiveKeyDown: event
+
+	"ESC, ctrl+g ctrl+space deactivate the keyBinder"
+	(event which = self escapeKey or: [
+		(event which = 71 or: [ event which = self activationKey ]) 
+			and: [ event ctrlKey ] ])
+        		ifTrue: [ 
+           			self deactivate.
+					event preventDefault.
+					^ false ].
+            
+    "Handle the keybinding"
+    ^ self handleBindingFor: event
+!
+
+handleBindingFor: anEvent
+	| binding |
+    binding := self selectedBinding atKey: anEvent which.
+    
+    binding ifNotNil: [ 
+    	self applyBinding: binding.
+		anEvent preventDefault.
+		^ false ]
+!
+
+handleInactiveKeyDown: event
+	event which = self activationKey ifTrue: [
+    	event ctrlKey ifTrue: [
+			self activate. 
+            event preventDefault. 
+            ^ false ] ]
+!
+
+handleKeyDown: event
+	^ self isActive
+    	ifTrue: [ self handleActiveKeyDown: event ]
+      	ifFalse: [ self handleInactiveKeyDown: event ]
+!
+
+setupEvents
+	'body' asJQuery keydown: [ :event | self handleKeyDown: event ]
+! !
+
+!HLKeyBinder methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	helper := HLKeyBinderHelperWidget on: self
+! !
+
+!HLKeyBinder methodsFor: 'testing'!
+
+isActive
+	^ ('.', self helper cssClass) asJQuery is: ':visible'
+!
+
+systemIsMac
+	^ navigator platform match: 'Mac'
+! !
+
+HLKeyBinder class instanceVariableNames: 'current'!
+
+!HLKeyBinder class methodsFor: 'instance creation'!
+
+current
+	^ current ifNil: [ current := super new ]
+!
+
+new
+	self shouldNotImplement
+! !
+
+HLWidget subclass: #HLKeyBinderHelperWidget
+	instanceVariableNames: 'keyBinder'
+	package: 'Helios-KeyBindings'!
+!HLKeyBinderHelperWidget commentStamp!
+I am the widget responsible for displaying active keybindings in a bar at the bottom of the window. Each keybinding is an instance of `HLBinding`. 
+
+Rendering is done through a double dispatch, see `#renderSelectedBindingOn:`.!
+
+!HLKeyBinderHelperWidget methodsFor: 'accessing'!
+
+cssClass
+	^ 'key_helper'
+!
+
+keyBinder
+	^ keyBinder
+!
+
+keyBinder: aKeyBinder
+	keyBinder := aKeyBinder
+!
+
+mainId
+	^ 'binding-helper-main'
+!
+
+selectedBinding
+	^ self keyBinder selectedBinding
+! !
+
+!HLKeyBinderHelperWidget methodsFor: 'actions'!
+
+deactivate
+	self keyBinder deactivate
+!
+
+hide
+	('.', self cssClass) asJQuery remove.
+	'.helper_overlay' asJQuery remove.
+	self showCog
+!
+
+hideCog
+	'#cog-helper' asJQuery hide
+!
+
+show
+	self hideCog.
+	self appendToJQuery: 'body' asJQuery
+!
+
+showCog
+	'#cog-helper' asJQuery show
+!
+
+showWidget: aWidget
+	"Some actions need to display more info to the user or request input.
+	This method is the right place for that"
+	
+	('#', self mainId) asJQuery empty.
+	aWidget appendToJQuery: ('#', self mainId) asJQuery
+! !
+
+!HLKeyBinderHelperWidget methodsFor: 'rendering'!
+
+renderBindingActionFor: aBinding on: html
+	html span class: 'command'; with: [
+		html strong 
+			class: 'label'; 
+			with: aBinding shortcut asLowercase.
+  		html a 
+        	class: 'action'; 
+            with: aBinding displayLabel;
+  			onClick: [ self keyBinder applyBinding: aBinding ] ]
+!
+
+renderBindingGroup: aBindingGroup on: html
+	(aBindingGroup activeBindings 
+    	sorted: [ :a :b | a key < b key ])
+        do: [ :each | self renderBindingActionFor: each on: html ]
+!
+
+renderCloseOn: html
+	html a
+		class: 'close';
+		with: [ (html tag: 'i') class: 'icon-remove' ];
+		onClick: [ self keyBinder deactivate ]
+!
+
+renderContentOn: html
+	html div 
+		id: 'overlay';
+		class: 'helper_overlay';
+		onClick: [ self deactivate ].
+	
+	html div class: self cssClass; with: [
+      	self renderLabelOn: html.
+		html div
+			id: self mainId;
+			with: [ self renderSelectedBindingOn: html ].
+		self renderCloseOn: html ].
+		
+	':focus' asJQuery blur
+!
+
+renderLabelOn: html
+		html span 
+        	class: 'selected'; 
+            with: (self selectedBinding label ifNil: [ 'Action' ])
+!
+
+renderSelectedBindingOn: html
+	self selectedBinding renderOn: self html: html
+! !
+
+!HLKeyBinderHelperWidget class methodsFor: 'instance creation'!
+
+on: aKeyBinder
+	^ self new
+    	keyBinder: aKeyBinder;
+        yourself
+! !
+
+Object subclass: #HLRepeatedKeyDownHandler
+	instanceVariableNames: 'repeatInterval delay interval keyBindings widget keyDown'
+	package: 'Helios-KeyBindings'!
+!HLRepeatedKeyDownHandler commentStamp!
+I am responsible for handling repeated key down actions for widgets.
+
+##Usage
+
+    (self on: aWidget)
+        whileKeyDown: 38 do: aBlock;
+        whileKeyDown: 40 do: anotherBlock;
+        bindKeys
+
+I perform an action block on a key press, wait for 300 ms and then preform the same action block every `repeatInterval` milliseconds until the key is released.!
+
+!HLRepeatedKeyDownHandler methodsFor: 'accessing'!
+
+keyBindings
+	^ keyBindings ifNil: [ keyBindings := Dictionary new ]
+!
+
+repeatInterval
+	^ repeatInterval ifNil: [ self defaultRepeatInterval ]
+!
+
+repeatInterval: anInteger
+	repeatInterval := anInteger
+!
+
+widget
+	^ widget
+!
+
+widget: aWidget
+	widget := aWidget
+! !
+
+!HLRepeatedKeyDownHandler methodsFor: 'actions'!
+
+startRepeatingAction: aBlock
+	^ [ (self widget hasFocus)
+		ifTrue: [ aBlock value ]
+		ifFalse: [ self handleKeyUp ] ] valueWithInterval: self repeatInterval
+!
+
+whileKeyDown: aKey do: aBlock
+	self keyBindings at: aKey put: aBlock
+! !
+
+!HLRepeatedKeyDownHandler methodsFor: 'binding'!
+
+bindKeys
+	self widget 
+		bindKeyDown: [ :e | self handleKeyDown: e ] 
+		keyUp: [ :e | self handleKeyUp ]
+!
+
+rebindKeys
+	self 
+		unbindKeys;
+		bindKeys
+!
+
+unbindKeys
+	self widget unbindKeyDownKeyUp
+! !
+
+!HLRepeatedKeyDownHandler methodsFor: 'defaults'!
+
+defaultRepeatInterval
+	^ 70
+! !
+
+!HLRepeatedKeyDownHandler methodsFor: 'events handling'!
+
+handleEvent: anEvent forKey: anInteger action: aBlock
+	(anEvent which = anInteger and: [ self isKeyDown not ])
+		ifTrue: [ self whileKeyDownDo: aBlock ]
+!
+
+handleKeyDown: anEvent
+	self keyBindings keysAndValuesDo: [ :key :action | 
+		self handleEvent: anEvent forKey: key action: action ]
+!
+
+handleKeyUp
+	self isKeyDown ifTrue: [
+		keyDown := false.
+		interval ifNotNil: [ interval clearInterval ].
+		delay ifNotNil: [ delay clearTimeout ] ]
+!
+
+whileKeyDownDo: aBlock
+	keyDown := true.
+	aBlock value.
+	delay := [ interval := self startRepeatingAction: aBlock ] 
+		valueWithTimeout: 300
+! !
+
+!HLRepeatedKeyDownHandler methodsFor: 'testing'!
+
+isKeyDown
+	^ keyDown ifNil: [ false ]
+! !
+
+!HLRepeatedKeyDownHandler class methodsFor: 'instance creation'!
+
+on: aWidget
+	^ self new
+		widget: aWidget;
+		yourself
+! !
+

+ 603 - 0
src/Helios-Layout.js

@@ -0,0 +1,603 @@
+define("helios/Helios-Layout", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "helios/Helios-Core", "amber_core/Web", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Layout');
+smalltalk.packages["Helios-Layout"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLContainer', globals.HLWidget, ['splitter'], 'Helios-Layout');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("tool_container");
+$2=_st($1)._with_(self._splitter());
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.HLContainer)})},
+args: ["html"],
+source: "renderOn: html\x0a\x09html div \x0a    \x09class: 'tool_container'; \x0a        with: self splitter",
+messageSends: ["class:", "div", "with:", "splitter"],
+referencedClasses: []
+}),
+globals.HLContainer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "splitter",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@splitter"];
+return $1;
+},
+args: [],
+source: "splitter\x0a\x09^ splitter",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLContainer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "splitter:",
+protocol: 'accessing',
+fn: function (aSplitter){
+var self=this;
+self["@splitter"]=aSplitter;
+return self},
+args: ["aSplitter"],
+source: "splitter: aSplitter\x0a\x09splitter := aSplitter",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLContainer);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:",
+protocol: 'instance creation',
+fn: function (aSplitter){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._splitter_(aSplitter);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"with:",{aSplitter:aSplitter},globals.HLContainer.klass)})},
+args: ["aSplitter"],
+source: "with: aSplitter\x0a\x09^ self new \x0a    \x09splitter: aSplitter; \x0a        yourself",
+messageSends: ["splitter:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLContainer.klass);
+
+
+smalltalk.addClass('HLSplitter', globals.Widget, ['firstWidget', 'secondWidget', 'firstPane', 'secondPane', 'splitter'], 'Helios-Layout');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "splitter";
+},
+args: [],
+source: "cssClass\x0a\x09^ 'splitter'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "firstWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@firstWidget"];
+return $1;
+},
+args: [],
+source: "firstWidget\x0a\x09^ firstWidget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "firstWidget:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+self["@firstWidget"]=aWidget;
+return self},
+args: ["aWidget"],
+source: "firstWidget: aWidget\x0a\x09firstWidget := aWidget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isHeliosSplitter",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isHeliosSplitter\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "panesCssClass",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+return "panes";
+},
+args: [],
+source: "panesCssClass\x0a\x09^ 'panes'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$5,$6,$7,$2;
+$1=_st(html)._div();
+$ctx1.sendIdx["div"]=1;
+_st($1)._class_(self._panesCssClass());
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._div();
+$ctx2.sendIdx["div"]=2;
+_st($3)._class_("pane");
+$ctx2.sendIdx["class:"]=2;
+$4=_st($3)._with_(self._firstWidget());
+$ctx2.sendIdx["with:"]=2;
+self["@firstPane"]=$4;
+self["@firstPane"];
+$5=_st(html)._div();
+$ctx2.sendIdx["div"]=3;
+self["@splitter"]=_st($5)._class_(self._cssClass());
+$ctx2.sendIdx["class:"]=3;
+self["@splitter"];
+$6=_st(html)._div();
+_st($6)._class_("pane");
+$7=_st($6)._with_(self._secondWidget());
+self["@secondPane"]=$7;
+return self["@secondPane"];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+self._setupSplitter();
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.HLSplitter)})},
+args: ["html"],
+source: "renderOn: html\x0a\x09html div class: self panesCssClass; with: [\x0a\x09\x09firstPane := html div class: 'pane'; with: self firstWidget.\x0a    \x09splitter := html div class: self cssClass.\x0a    \x09secondPane := html div class: 'pane'; with: self secondWidget ].\x0a        \x0a\x09self setupSplitter",
+messageSends: ["class:", "div", "panesCssClass", "with:", "firstWidget", "cssClass", "secondWidget", "setupSplitter"],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resize",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "resize",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "secondWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@secondWidget"];
+return $1;
+},
+args: [],
+source: "secondWidget\x0a\x09^ secondWidget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "secondWidget:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+self["@secondWidget"]=aWidget;
+return self},
+args: ["aWidget"],
+source: "secondWidget: aWidget\x0a\x09secondWidget := aWidget",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupSplitter",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "setupSplitter",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSplitter);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:with:",
+protocol: 'instance creation',
+fn: function (aWidget,anotherWidget){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._firstWidget_(aWidget);
+_st($2)._secondWidget_(anotherWidget);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"with:with:",{aWidget:aWidget,anotherWidget:anotherWidget},globals.HLSplitter.klass)})},
+args: ["aWidget", "anotherWidget"],
+source: "with: aWidget with: anotherWidget\x0a\x09^ self new\x0a    \x09\x09firstWidget: aWidget;\x0a            secondWidget: anotherWidget;\x0a            yourself",
+messageSends: ["firstWidget:", "new", "secondWidget:", "yourself"],
+referencedClasses: []
+}),
+globals.HLSplitter.klass);
+
+
+smalltalk.addClass('HLHorizontalSplitter', globals.HLSplitter, [], 'Helios-Layout');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=($ctx1.supercall = true, globals.HLHorizontalSplitter.superclass.fn.prototype._cssClass.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st($2).__comma(" horizontal");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cssClass",{},globals.HLHorizontalSplitter)})},
+args: [],
+source: "cssClass\x0a\x09^ super cssClass, ' horizontal'",
+messageSends: [",", "cssClass"],
+referencedClasses: []
+}),
+globals.HLHorizontalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "panesCssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=($ctx1.supercall = true, globals.HLHorizontalSplitter.superclass.fn.prototype._panesCssClass.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st($2).__comma(" horizontal");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"panesCssClass",{},globals.HLHorizontalSplitter)})},
+args: [],
+source: "panesCssClass\x0a\x09^ super panesCssClass, ' horizontal'",
+messageSends: [",", "panesCssClass"],
+referencedClasses: []
+}),
+globals.HLHorizontalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resize",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._resize_(_st(_st(self["@splitter"])._asJQuery())._css_("top"));
+return self}, function($ctx1) {$ctx1.fill(self,"resize",{},globals.HLHorizontalSplitter)})},
+args: [],
+source: "resize\x0a\x09self resize: (splitter asJQuery css: 'top')",
+messageSends: ["resize:", "css:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLHorizontalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resize:",
+protocol: 'actions',
+fn: function (anInteger){
+var self=this;
+var container,size,offset,percentage;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$6,$7,$5,$4,$8,$10,$9,$11,$14,$13,$12;
+$1=_st(self["@firstPane"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+container=_st($1)._parent();
+$3=_st(self["@firstPane"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=2;
+$2=_st($3)._offset();
+offset=_st($2)._top();
+size=_st(container)._height();
+$6=size;
+$7=_st(anInteger).__minus(offset);
+$ctx1.sendIdx["-"]=2;
+$5=_st($6).__minus($7);
+$ctx1.sendIdx["-"]=1;
+$4=_st($5).__slash(size);
+percentage=_st($4).__star((100));
+percentage=(80)._min_(_st(percentage)._max_((20)));
+$8=_st(self["@firstPane"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=3;
+$10=_st(percentage)._asString();
+$ctx1.sendIdx["asString"]=1;
+$9=_st($10).__comma("%");
+$ctx1.sendIdx[","]=1;
+_st($8)._css_put_("bottom",$9);
+$ctx1.sendIdx["css:put:"]=1;
+$11=_st(self["@splitter"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=4;
+$14=(100).__minus(percentage);
+$ctx1.sendIdx["-"]=3;
+$13=_st($14)._asString();
+$ctx1.sendIdx["asString"]=2;
+$12=_st($13).__comma("%");
+$ctx1.sendIdx[","]=2;
+_st($11)._css_put_("top",$12);
+$ctx1.sendIdx["css:put:"]=2;
+_st(_st(self["@secondPane"])._asJQuery())._css_put_("top",_st(_st((100).__minus(percentage))._asString()).__comma("%"));
+return self}, function($ctx1) {$ctx1.fill(self,"resize:",{anInteger:anInteger,container:container,size:size,offset:offset,percentage:percentage},globals.HLHorizontalSplitter)})},
+args: ["anInteger"],
+source: "resize: anInteger\x0a\x09| container size offset percentage |\x0a    \x0a    container := firstPane asJQuery parent.\x0a\x09offset := firstPane asJQuery offset top.\x0a    size := container height.\x0a\x09\x0a\x09percentage := (size - (anInteger - offset)) / size * 100.\x0a\x09percentage := 80 min: (percentage max: 20).\x0a\x09\x0a    firstPane asJQuery css: 'bottom' put: percentage asString, '%'.\x0a\x09\x0a\x09splitter asJQuery css: 'top' put: (100 - percentage) asString, '%'.\x0a\x09secondPane asJQuery css: 'top' put: (100 - percentage) asString, '%'",
+messageSends: ["parent", "asJQuery", "top", "offset", "height", "*", "/", "-", "min:", "max:", "css:put:", ",", "asString"],
+referencedClasses: []
+}),
+globals.HLHorizontalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupSplitter",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@splitter"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($1)._draggable_(globals.HashedCollection._newFromPairs_(["axis","y","containment",_st(_st(self["@splitter"])._asJQuery())._parent(),"helper","clone","start",(function(e,ui){
+return smalltalk.withContext(function($ctx2) {
+return self._startResizing_(_st(ui)._helper());
+}, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,1)})}),"drag",(function(e,ui){
+return smalltalk.withContext(function($ctx2) {
+return self._resize_(_st(_st(ui)._offset())._top());
+}, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,2)})})]));
+return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{},globals.HLHorizontalSplitter)})},
+args: [],
+source: "setupSplitter\x0a\x09splitter asJQuery draggable: #{ \x0a    \x09'axis' -> 'y'. \x0a        'containment' -> splitter asJQuery parent.\x0a        'helper' -> 'clone'.\x0a        'start' -> [ :e :ui | self startResizing: ui helper ].\x0a        'drag' -> [ :e :ui | self resize: ui offset top ] }",
+messageSends: ["draggable:", "asJQuery", "parent", "startResizing:", "helper", "resize:", "top", "offset"],
+referencedClasses: []
+}),
+globals.HLHorizontalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "startResizing:",
+protocol: 'actions',
+fn: function (aSplitter){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aSplitter)._width_(_st(_st(self["@splitter"])._asJQuery())._width());
+return self}, function($ctx1) {$ctx1.fill(self,"startResizing:",{aSplitter:aSplitter},globals.HLHorizontalSplitter)})},
+args: ["aSplitter"],
+source: "startResizing: aSplitter\x0a\x09aSplitter width: splitter asJQuery width",
+messageSends: ["width:", "width", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLHorizontalSplitter);
+
+
+
+smalltalk.addClass('HLVerticalSplitter', globals.HLSplitter, [], 'Helios-Layout');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=($ctx1.supercall = true, globals.HLVerticalSplitter.superclass.fn.prototype._cssClass.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st($2).__comma(" vertical");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cssClass",{},globals.HLVerticalSplitter)})},
+args: [],
+source: "cssClass\x0a\x09^ super cssClass, ' vertical'",
+messageSends: [",", "cssClass"],
+referencedClasses: []
+}),
+globals.HLVerticalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "panesCssClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=($ctx1.supercall = true, globals.HLVerticalSplitter.superclass.fn.prototype._panesCssClass.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=_st($2).__comma(" vertical");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"panesCssClass",{},globals.HLVerticalSplitter)})},
+args: [],
+source: "panesCssClass\x0a\x09^ super panesCssClass, ' vertical'",
+messageSends: [",", "panesCssClass"],
+referencedClasses: []
+}),
+globals.HLVerticalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resize",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._resize_(_st(_st(self["@splitter"])._asJQuery())._css_("left"));
+return self}, function($ctx1) {$ctx1.fill(self,"resize",{},globals.HLVerticalSplitter)})},
+args: [],
+source: "resize\x0a\x09self resize: (splitter asJQuery css: 'left')",
+messageSends: ["resize:", "css:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLVerticalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resize:",
+protocol: 'actions',
+fn: function (anInteger){
+var self=this;
+var container,size,offset,percentage;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$6,$7,$5,$4,$8,$10,$9,$11,$14,$13,$12;
+$1=_st(self["@firstPane"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+container=_st($1)._parent();
+$3=_st(self["@firstPane"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=2;
+$2=_st($3)._offset();
+offset=_st($2)._left();
+size=_st(container)._width();
+$6=size;
+$7=_st(anInteger).__minus(offset);
+$ctx1.sendIdx["-"]=2;
+$5=_st($6).__minus($7);
+$ctx1.sendIdx["-"]=1;
+$4=_st($5).__slash(size);
+percentage=_st($4).__star((100));
+percentage=(80)._min_(_st(percentage)._max_((20)));
+$8=_st(self["@firstPane"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=3;
+$10=_st(percentage)._asString();
+$ctx1.sendIdx["asString"]=1;
+$9=_st($10).__comma("%");
+$ctx1.sendIdx[","]=1;
+_st($8)._css_put_("right",$9);
+$ctx1.sendIdx["css:put:"]=1;
+$11=_st(self["@splitter"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=4;
+$14=(100).__minus(percentage);
+$ctx1.sendIdx["-"]=3;
+$13=_st($14)._asString();
+$ctx1.sendIdx["asString"]=2;
+$12=_st($13).__comma("%");
+$ctx1.sendIdx[","]=2;
+_st($11)._css_put_("left",$12);
+$ctx1.sendIdx["css:put:"]=2;
+_st(_st(self["@secondPane"])._asJQuery())._css_put_("left",_st(_st((100).__minus(percentage))._asString()).__comma("%"));
+return self}, function($ctx1) {$ctx1.fill(self,"resize:",{anInteger:anInteger,container:container,size:size,offset:offset,percentage:percentage},globals.HLVerticalSplitter)})},
+args: ["anInteger"],
+source: "resize: anInteger\x0a\x09| container size offset percentage |\x0a    \x0a    container := firstPane asJQuery parent.\x0a\x09offset := firstPane asJQuery offset left.\x0a    size := container width.\x0a\x09\x0a\x09percentage := (size - (anInteger - offset)) / size * 100.\x0a\x09percentage := 80 min: (percentage max: 20).\x0a\x09\x0a    firstPane asJQuery css: 'right' put: percentage asString, '%'.\x0a\x09\x0a\x09splitter asJQuery css: 'left' put: (100 - percentage) asString, '%'.\x0a\x09secondPane asJQuery css: 'left' put: (100 - percentage) asString, '%'",
+messageSends: ["parent", "asJQuery", "left", "offset", "width", "*", "/", "-", "min:", "max:", "css:put:", ",", "asString"],
+referencedClasses: []
+}),
+globals.HLVerticalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupSplitter",
+protocol: 'rendering',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@splitter"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($1)._draggable_(globals.HashedCollection._newFromPairs_(["axis","x","containment",_st(_st(self["@splitter"])._asJQuery())._parent(),"helper","clone","start",(function(e,ui){
+return smalltalk.withContext(function($ctx2) {
+return self._startResizing_(_st(ui)._helper());
+}, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,1)})}),"drag",(function(e,ui){
+return smalltalk.withContext(function($ctx2) {
+return self._resize_(_st(_st(ui)._offset())._left());
+}, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,2)})})]));
+return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{},globals.HLVerticalSplitter)})},
+args: [],
+source: "setupSplitter\x0a\x09splitter asJQuery draggable: #{ \x0a    \x09'axis' -> 'x'. \x0a        'containment' -> splitter asJQuery parent.\x0a        'helper' -> 'clone'.\x0a        'start' -> [ :e :ui | self startResizing: ui helper ].\x0a        'drag' -> [ :e :ui | self resize: (ui offset left) ] }",
+messageSends: ["draggable:", "asJQuery", "parent", "startResizing:", "helper", "resize:", "left", "offset"],
+referencedClasses: []
+}),
+globals.HLVerticalSplitter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "startResizing:",
+protocol: 'actions',
+fn: function (aSplitter){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aSplitter)._height_(_st(_st(self["@splitter"])._asJQuery())._height());
+return self}, function($ctx1) {$ctx1.fill(self,"startResizing:",{aSplitter:aSplitter},globals.HLVerticalSplitter)})},
+args: ["aSplitter"],
+source: "startResizing: aSplitter\x0a\x09aSplitter height: splitter asJQuery height",
+messageSends: ["height:", "height", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLVerticalSplitter);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isHeliosSplitter",
+protocol: '*Helios-Layout',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isHeliosSplitter\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+});

+ 201 - 0
src/Helios-Layout.st

@@ -0,0 +1,201 @@
+Smalltalk createPackage: 'Helios-Layout'!
+HLWidget subclass: #HLContainer
+	instanceVariableNames: 'splitter'
+	package: 'Helios-Layout'!
+
+!HLContainer methodsFor: 'accessing'!
+
+splitter
+	^ splitter
+!
+
+splitter: aSplitter
+	splitter := aSplitter
+! !
+
+!HLContainer methodsFor: 'rendering'!
+
+renderOn: html
+	html div 
+    	class: 'tool_container'; 
+        with: self splitter
+! !
+
+!HLContainer class methodsFor: 'instance creation'!
+
+with: aSplitter
+	^ self new 
+    	splitter: aSplitter; 
+        yourself
+! !
+
+Widget subclass: #HLSplitter
+	instanceVariableNames: 'firstWidget secondWidget firstPane secondPane splitter'
+	package: 'Helios-Layout'!
+
+!HLSplitter methodsFor: 'accessing'!
+
+cssClass
+	^ 'splitter'
+!
+
+firstWidget
+	^ firstWidget
+!
+
+firstWidget: aWidget
+	firstWidget := aWidget
+!
+
+secondWidget
+	^ secondWidget
+!
+
+secondWidget: aWidget
+	secondWidget := aWidget
+! !
+
+!HLSplitter methodsFor: 'rendering'!
+
+panesCssClass
+	^ 'panes'
+!
+
+renderOn: html
+	html div class: self panesCssClass; with: [
+		firstPane := html div class: 'pane'; with: self firstWidget.
+    	splitter := html div class: self cssClass.
+    	secondPane := html div class: 'pane'; with: self secondWidget ].
+        
+	self setupSplitter
+!
+
+resize
+!
+
+setupSplitter
+! !
+
+!HLSplitter methodsFor: 'testing'!
+
+isHeliosSplitter
+	^ true
+! !
+
+!HLSplitter class methodsFor: 'instance creation'!
+
+with: aWidget with: anotherWidget
+	^ self new
+    		firstWidget: aWidget;
+            secondWidget: anotherWidget;
+            yourself
+! !
+
+HLSplitter subclass: #HLHorizontalSplitter
+	instanceVariableNames: ''
+	package: 'Helios-Layout'!
+
+!HLHorizontalSplitter methodsFor: 'accessing'!
+
+cssClass
+	^ super cssClass, ' horizontal'
+!
+
+panesCssClass
+	^ super panesCssClass, ' horizontal'
+! !
+
+!HLHorizontalSplitter methodsFor: 'actions'!
+
+resize
+	self resize: (splitter asJQuery css: 'top')
+!
+
+resize: anInteger
+	| container size offset percentage |
+    
+    container := firstPane asJQuery parent.
+	offset := firstPane asJQuery offset top.
+    size := container height.
+	
+	percentage := (size - (anInteger - offset)) / size * 100.
+	percentage := 80 min: (percentage max: 20).
+	
+    firstPane asJQuery css: 'bottom' put: percentage asString, '%'.
+	
+	splitter asJQuery css: 'top' put: (100 - percentage) asString, '%'.
+	secondPane asJQuery css: 'top' put: (100 - percentage) asString, '%'
+!
+
+startResizing: aSplitter
+	aSplitter width: splitter asJQuery width
+! !
+
+!HLHorizontalSplitter methodsFor: 'rendering'!
+
+setupSplitter
+	splitter asJQuery draggable: #{ 
+    	'axis' -> 'y'. 
+        'containment' -> splitter asJQuery parent.
+        'helper' -> 'clone'.
+        'start' -> [ :e :ui | self startResizing: ui helper ].
+        'drag' -> [ :e :ui | self resize: ui offset top ] }
+! !
+
+HLSplitter subclass: #HLVerticalSplitter
+	instanceVariableNames: ''
+	package: 'Helios-Layout'!
+
+!HLVerticalSplitter methodsFor: 'accessing'!
+
+cssClass
+	^ super cssClass, ' vertical'
+!
+
+panesCssClass
+	^ super panesCssClass, ' vertical'
+! !
+
+!HLVerticalSplitter methodsFor: 'actions'!
+
+resize
+	self resize: (splitter asJQuery css: 'left')
+!
+
+resize: anInteger
+	| container size offset percentage |
+    
+    container := firstPane asJQuery parent.
+	offset := firstPane asJQuery offset left.
+    size := container width.
+	
+	percentage := (size - (anInteger - offset)) / size * 100.
+	percentage := 80 min: (percentage max: 20).
+	
+    firstPane asJQuery css: 'right' put: percentage asString, '%'.
+	
+	splitter asJQuery css: 'left' put: (100 - percentage) asString, '%'.
+	secondPane asJQuery css: 'left' put: (100 - percentage) asString, '%'
+!
+
+startResizing: aSplitter
+	aSplitter height: splitter asJQuery height
+! !
+
+!HLVerticalSplitter methodsFor: 'rendering'!
+
+setupSplitter
+	splitter asJQuery draggable: #{ 
+    	'axis' -> 'x'. 
+        'containment' -> splitter asJQuery parent.
+        'helper' -> 'clone'.
+        'start' -> [ :e :ui | self startResizing: ui helper ].
+        'drag' -> [ :e :ui | self resize: (ui offset left) ] }
+! !
+
+!Object methodsFor: '*Helios-Layout'!
+
+isHeliosSplitter
+	^ false
+! !
+

+ 1138 - 0
src/Helios-References.js

@@ -0,0 +1,1138 @@
+define("helios/Helios-References", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "helios/Helios-Core"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-References');
+smalltalk.packages["Helios-References"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLMethodReference', globals.Object, ['selector', 'methodClass'], 'Helios-References');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeFromMethod:",
+protocol: 'initialization',
+fn: function (aCompiledMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._selector_(_st(aCompiledMethod)._selector());
+$1=self._methodClass_(_st(aCompiledMethod)._methodClass());
+return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethod:",{aCompiledMethod:aCompiledMethod},globals.HLMethodReference)})},
+args: ["aCompiledMethod"],
+source: "initializeFromMethod: aCompiledMethod\x0a\x09self\x0a\x09\x09selector: aCompiledMethod selector;\x0a\x09\x09methodClass: aCompiledMethod methodClass",
+messageSends: ["selector:", "selector", "methodClass:", "methodClass"],
+referencedClasses: []
+}),
+globals.HLMethodReference);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._methodClass())._methodAt_(self._selector());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"method",{},globals.HLMethodReference)})},
+args: [],
+source: "method\x0a\x09^ self methodClass methodAt: self selector",
+messageSends: ["methodAt:", "methodClass", "selector"],
+referencedClasses: []
+}),
+globals.HLMethodReference);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@methodClass"];
+return $1;
+},
+args: [],
+source: "methodClass\x0a\x09^ methodClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodReference);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@methodClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "methodClass: aClass\x0a\x09methodClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodReference);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selector"];
+return $1;
+},
+args: [],
+source: "selector\x0a\x09^ selector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodReference);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@selector"]=aString;
+return self},
+args: ["aString"],
+source: "selector: aString\x0a\x09selector := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLMethodReference);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._method())._source();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"source",{},globals.HLMethodReference)})},
+args: [],
+source: "source\x0a\x09^ self method source",
+messageSends: ["source", "method"],
+referencedClasses: []
+}),
+globals.HLMethodReference);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aCompiledMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._initializeFromMethod_(aCompiledMethod);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aCompiledMethod:aCompiledMethod},globals.HLMethodReference.klass)})},
+args: ["aCompiledMethod"],
+source: "on: aCompiledMethod\x0a\x09^ self new\x0a\x09\x09initializeFromMethod: aCompiledMethod;\x0a\x09\x09yourself",
+messageSends: ["initializeFromMethod:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLMethodReference.klass);
+
+
+smalltalk.addClass('HLReferences', globals.HLWidget, ['model', 'sendersListWidget', 'implementorsListWidget', 'classReferencesListWidget', 'regexpListWidget', 'sourceCodeWidget'], 'Helios-References');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classReferencesListWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLClassReferencesListWidget(){return globals.HLClassReferencesListWidget||(typeof HLClassReferencesListWidget=="undefined"?nil:HLClassReferencesListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@classReferencesListWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@classReferencesListWidget"]=_st($HLClassReferencesListWidget())._on_(self._model());
+self["@classReferencesListWidget"];
+$1=_st(self["@classReferencesListWidget"])._next_(self._regexpListWidget());
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classReferencesListWidget",{},globals.HLReferences)})},
+args: [],
+source: "classReferencesListWidget\x0a\x09^ classReferencesListWidget ifNil: [\x0a      \x09classReferencesListWidget := HLClassReferencesListWidget on: self model.\x0a\x09\x09classReferencesListWidget next: self regexpListWidget ]",
+messageSends: ["ifNil:", "on:", "model", "next:", "regexpListWidget"],
+referencedClasses: ["HLClassReferencesListWidget"]
+}),
+globals.HLReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "implementorsListWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLImplementorsListWidget(){return globals.HLImplementorsListWidget||(typeof HLImplementorsListWidget=="undefined"?nil:HLImplementorsListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@implementorsListWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@implementorsListWidget"]=_st($HLImplementorsListWidget())._on_(self._model());
+self["@implementorsListWidget"];
+$1=_st(self["@implementorsListWidget"])._next_(self._classReferencesListWidget());
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"implementorsListWidget",{},globals.HLReferences)})},
+args: [],
+source: "implementorsListWidget\x0a\x09^ implementorsListWidget ifNil: [\x0a      \x09implementorsListWidget := HLImplementorsListWidget on: self model.\x0a\x09\x09implementorsListWidget next: self classReferencesListWidget ]",
+messageSends: ["ifNil:", "on:", "model", "next:", "classReferencesListWidget"],
+referencedClasses: ["HLImplementorsListWidget"]
+}),
+globals.HLReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLReferencesModel(){return globals.HLReferencesModel||(typeof HLReferencesModel=="undefined"?nil:HLReferencesModel)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+$2=self["@model"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($HLReferencesModel())._new();
+_st($3)._environment_(_st(self._manager())._environment());
+$4=_st($3)._yourself();
+self["@model"]=$4;
+$1=self["@model"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},globals.HLReferences)})},
+args: [],
+source: "model\x0a\x09^ model ifNil: [\x0a\x09\x09model := (HLReferencesModel new\x0a\x09\x09\x09environment: self manager environment;\x0a\x09\x09\x09yourself) ]",
+messageSends: ["ifNil:", "environment:", "new", "environment", "manager", "yourself"],
+referencedClasses: ["HLReferencesModel"]
+}),
+globals.HLReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+protocol: 'accessing',
+fn: function (aModel){
+var self=this;
+self["@model"]=aModel;
+return self},
+args: ["aModel"],
+source: "model: aModel\x0a\x09model := aModel",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "regexpListWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLRegexpListWidget(){return globals.HLRegexpListWidget||(typeof HLRegexpListWidget=="undefined"?nil:HLRegexpListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@regexpListWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@regexpListWidget"]=_st($HLRegexpListWidget())._on_(self._model());
+self["@regexpListWidget"];
+$1=_st(self["@regexpListWidget"])._next_(self._sourceCodeWidget());
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"regexpListWidget",{},globals.HLReferences)})},
+args: [],
+source: "regexpListWidget\x0a\x09^ regexpListWidget ifNil: [\x0a      \x09regexpListWidget := HLRegexpListWidget on: self model.\x0a\x09\x09regexpListWidget next: self sourceCodeWidget ]",
+messageSends: ["ifNil:", "on:", "model", "next:", "sourceCodeWidget"],
+referencedClasses: ["HLRegexpListWidget"]
+}),
+globals.HLReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerBindingsOn:",
+protocol: 'actions',
+fn: function (aBindingGroup){
+var self=this;
+function $HLToolCommand(){return globals.HLToolCommand||(typeof HLToolCommand=="undefined"?nil:HLToolCommand)}
+return smalltalk.withContext(function($ctx1) { 
+_st($HLToolCommand())._registerConcreteClassesOn_for_(aBindingGroup,self._model());
+return self}, function($ctx1) {$ctx1.fill(self,"registerBindingsOn:",{aBindingGroup:aBindingGroup},globals.HLReferences)})},
+args: ["aBindingGroup"],
+source: "registerBindingsOn: aBindingGroup\x0a\x09HLToolCommand \x0a\x09\x09registerConcreteClassesOn: aBindingGroup \x0a\x09\x09for: self model",
+messageSends: ["registerConcreteClassesOn:for:", "model"],
+referencedClasses: ["HLToolCommand"]
+}),
+globals.HLReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $HLContainer(){return globals.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
+function $HLHorizontalSplitter(){return globals.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
+function $HLVerticalSplitter(){return globals.HLVerticalSplitter||(typeof HLVerticalSplitter=="undefined"?nil:HLVerticalSplitter)}
+return smalltalk.withContext(function($ctx1) { 
+var $5,$4,$3,$2,$1;
+$5=self._sendersListWidget();
+$ctx1.sendIdx["sendersListWidget"]=1;
+$4=_st($HLVerticalSplitter())._with_with_($5,self._implementorsListWidget());
+$ctx1.sendIdx["with:with:"]=3;
+$3=_st($HLVerticalSplitter())._with_with_($4,_st($HLVerticalSplitter())._with_with_(self._classReferencesListWidget(),self._regexpListWidget()));
+$ctx1.sendIdx["with:with:"]=2;
+$2=_st($HLHorizontalSplitter())._with_with_($3,self._sourceCodeWidget());
+$ctx1.sendIdx["with:with:"]=1;
+$1=_st($HLContainer())._with_($2);
+_st(html)._with_($1);
+$ctx1.sendIdx["with:"]=1;
+_st(self._sendersListWidget())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLReferences)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html with: (HLContainer with: (HLHorizontalSplitter \x0a    \x09with: (HLVerticalSplitter\x0a        \x09with: (HLVerticalSplitter\x0a            \x09with: self sendersListWidget\x0a                with: self implementorsListWidget)\x0a            with: (HLVerticalSplitter\x0a            \x09with: self classReferencesListWidget\x0a                with: self regexpListWidget)) \x0a        with: self sourceCodeWidget)).\x0a\x09\x0a\x09self sendersListWidget focus",
+messageSends: ["with:", "with:with:", "sendersListWidget", "implementorsListWidget", "classReferencesListWidget", "regexpListWidget", "sourceCodeWidget", "focus"],
+referencedClasses: ["HLContainer", "HLHorizontalSplitter", "HLVerticalSplitter"]
+}),
+globals.HLReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "search:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._search_(aString);
+self._setTabLabel_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"search:",{aString:aString},globals.HLReferences)})},
+args: ["aString"],
+source: "search: aString\x0a\x09self model search: aString.\x0a\x09self setTabLabel: aString",
+messageSends: ["search:", "model", "setTabLabel:"],
+referencedClasses: []
+}),
+globals.HLReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendersListWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLSendersListWidget(){return globals.HLSendersListWidget||(typeof HLSendersListWidget=="undefined"?nil:HLSendersListWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@sendersListWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@sendersListWidget"]=_st($HLSendersListWidget())._on_(self._model());
+self["@sendersListWidget"];
+$1=_st(self["@sendersListWidget"])._next_(self._implementorsListWidget());
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sendersListWidget",{},globals.HLReferences)})},
+args: [],
+source: "sendersListWidget\x0a\x09^ sendersListWidget ifNil: [\x0a      \x09sendersListWidget := HLSendersListWidget on: self model.\x0a\x09\x09sendersListWidget next: self implementorsListWidget ]",
+messageSends: ["ifNil:", "on:", "model", "next:", "implementorsListWidget"],
+referencedClasses: ["HLSendersListWidget"]
+}),
+globals.HLReferences);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sourceCodeWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLBrowserCodeWidget(){return globals.HLBrowserCodeWidget||(typeof HLBrowserCodeWidget=="undefined"?nil:HLBrowserCodeWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+$2=self["@sourceCodeWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($HLBrowserCodeWidget())._new();
+_st($3)._browserModel_(self._model());
+$4=_st($3)._yourself();
+self["@sourceCodeWidget"]=$4;
+$1=self["@sourceCodeWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sourceCodeWidget",{},globals.HLReferences)})},
+args: [],
+source: "sourceCodeWidget\x0a\x09^ sourceCodeWidget ifNil: [\x0a      \x09sourceCodeWidget := HLBrowserCodeWidget new\x0a\x09\x09\x09browserModel: self model;\x0a\x09\x09\x09yourself ]",
+messageSends: ["ifNil:", "browserModel:", "new", "model", "yourself"],
+referencedClasses: ["HLBrowserCodeWidget"]
+}),
+globals.HLReferences);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeOpenAsTab",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "canBeOpenAsTab\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLReferences.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "references";
+},
+args: [],
+source: "tabClass\x0a\x09^ 'references'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLReferences.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "References";
+},
+args: [],
+source: "tabLabel\x0a\x09^ 'References'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLReferences.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabPriority",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return (100);
+},
+args: [],
+source: "tabPriority\x0a\x09^ 100",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLReferences.klass);
+
+
+smalltalk.addClass('HLReferencesListWidget', globals.HLToolListWidget, [], 'Helios-References');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "activateListItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+return ($ctx2.supercall = true, globals.HLReferencesListWidget.superclass.fn.prototype._activateListItem_.apply(_st(self), [anItem]));
+$ctx2.supercall = false;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"activateListItem:",{anItem:anItem},globals.HLReferencesListWidget)})},
+args: ["anItem"],
+source: "activateListItem: anItem\x0a\x09self model withChangesDo: [ super activateListItem: anItem ]",
+messageSends: ["withChangesDo:", "model", "activateListItem:"],
+referencedClasses: []
+}),
+globals.HLReferencesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commandCategory",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Methods";
+},
+args: [],
+source: "commandCategory\x0a\x09^ 'Methods'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLReferencesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "List";
+},
+args: [],
+source: "label\x0a\x09^ 'List'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLReferencesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLSearchReferences(){return globals.HLSearchReferences||(typeof HLSearchReferences=="undefined"?nil:HLSearchReferences)}
+function $HLMethodSelected(){return globals.HLMethodSelected||(typeof HLMethodSelected=="undefined"?nil:HLMethodSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._model())._announcer();
+_st($1)._on_do_($HLSearchReferences(),(function(ann){
+return smalltalk.withContext(function($ctx2) {
+return self._onSearchReferences_(_st(ann)._searchString());
+}, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)})}));
+$ctx1.sendIdx["on:do:"]=1;
+$2=_st($1)._on_do_($HLMethodSelected(),(function(ann){
+return smalltalk.withContext(function($ctx2) {
+return self._onMethodSelected_(_st(ann)._item());
+}, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},globals.HLReferencesListWidget)})},
+args: [],
+source: "observeModel\x0a\x09self model announcer\x0a\x09\x09on: HLSearchReferences\x0a\x09\x09do: [ :ann | self onSearchReferences: ann searchString ];\x0a\x09\x09on: HLMethodSelected\x0a\x09\x09do: [ :ann | self onMethodSelected: ann item ]",
+messageSends: ["on:do:", "announcer", "model", "onSearchReferences:", "searchString", "onMethodSelected:", "item"],
+referencedClasses: ["HLSearchReferences", "HLMethodSelected"]
+}),
+globals.HLReferencesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodSelected:",
+protocol: 'reactions',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+var $early={};
+try {
+if(($receiver = aMethod) == null || $receiver.isNil){
+return self;
+} else {
+aMethod;
+};
+_st(self._items())._detect_ifNone_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aMethod)._selector();
+$ctx2.sendIdx["selector"]=1;
+return _st(each).__eq($1);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
+throw $early=[self];
+}));
+$2=_st(aMethod)._selector();
+$ctx1.sendIdx["selector"]=2;
+self._selectedItem_($2);
+$3=self._activateItem_(_st(aMethod)._selector());
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"onMethodSelected:",{aMethod:aMethod},globals.HLReferencesListWidget)})},
+args: ["aMethod"],
+source: "onMethodSelected: aMethod\x0a\x09aMethod ifNil: [ ^ self ].\x0a\x09self items detect: [ :each | each = aMethod selector ] ifNone: [ ^ self ].\x0a\x09\x0a\x09self \x0a\x09\x09selectedItem: aMethod selector;\x0a\x09\x09activateItem: aMethod selector",
+messageSends: ["ifNil:", "detect:ifNone:", "items", "=", "selector", "selectedItem:", "activateItem:"],
+referencedClasses: []
+}),
+globals.HLReferencesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onSearchReferences:",
+protocol: 'reactions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"onSearchReferences:",{aString:aString},globals.HLReferencesListWidget)})},
+args: ["aString"],
+source: "onSearchReferences: aString\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.HLReferencesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderItemLabel:on:",
+protocol: 'rendering',
+fn: function (aMethod,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(_st(aMethod)._methodClass())._name()).__comma(" >> #")).__comma(_st(aMethod)._selector());
+$ctx1.sendIdx[","]=1;
+_st(html)._with_($1);
+return self}, function($ctx1) {$ctx1.fill(self,"renderItemLabel:on:",{aMethod:aMethod,html:html},globals.HLReferencesListWidget)})},
+args: ["aMethod", "html"],
+source: "renderItemLabel: aMethod on: html\x0a\x09html with: aMethod methodClass name, ' >> #', aMethod selector",
+messageSends: ["with:", ",", "name", "methodClass", "selector"],
+referencedClasses: []
+}),
+globals.HLReferencesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectItem:",
+protocol: 'actions',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._selectedMethod_(aMethod);
+return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aMethod:aMethod},globals.HLReferencesListWidget)})},
+args: ["aMethod"],
+source: "selectItem: aMethod\x0a\x09self model selectedMethod: aMethod",
+messageSends: ["selectedMethod:", "model"],
+referencedClasses: []
+}),
+globals.HLReferencesListWidget);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._model_(aModel);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aModel:aModel},globals.HLReferencesListWidget.klass)})},
+args: ["aModel"],
+source: "on: aModel\x0a\x09^ self new \x0a\x09\x09model: aModel; \x0a\x09\x09yourself",
+messageSends: ["model:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLReferencesListWidget.klass);
+
+
+smalltalk.addClass('HLClassReferencesListWidget', globals.HLReferencesListWidget, [], 'Helios-References');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Class references";
+},
+args: [],
+source: "label\x0a\x09^ 'Class references'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLClassReferencesListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onSearchReferences:",
+protocol: 'reactions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selectItem_(nil);
+self._items_(_st(self._model())._classReferencesOf_(aString));
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onSearchReferences:",{aString:aString},globals.HLClassReferencesListWidget)})},
+args: ["aString"],
+source: "onSearchReferences: aString\x0a\x09self selectItem: nil.\x0a\x09self items: (self model classReferencesOf: aString).\x0a\x09self refresh",
+messageSends: ["selectItem:", "items:", "classReferencesOf:", "model", "refresh"],
+referencedClasses: []
+}),
+globals.HLClassReferencesListWidget);
+
+
+
+smalltalk.addClass('HLImplementorsListWidget', globals.HLReferencesListWidget, [], 'Helios-References');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Implementors";
+},
+args: [],
+source: "label\x0a\x09^ 'Implementors'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLImplementorsListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onSearchReferences:",
+protocol: 'reactions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selectItem_(nil);
+self._items_(_st(self._model())._implementorsOf_(aString));
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onSearchReferences:",{aString:aString},globals.HLImplementorsListWidget)})},
+args: ["aString"],
+source: "onSearchReferences: aString\x0a\x09self selectItem: nil.\x0a\x09self items: (self model implementorsOf: aString).\x0a\x09self refresh",
+messageSends: ["selectItem:", "items:", "implementorsOf:", "model", "refresh"],
+referencedClasses: []
+}),
+globals.HLImplementorsListWidget);
+
+
+
+smalltalk.addClass('HLRegexpListWidget', globals.HLReferencesListWidget, [], 'Helios-References');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Source search";
+},
+args: [],
+source: "label\x0a\x09^ 'Source search'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLRegexpListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onSearchReferences:",
+protocol: 'reactions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selectItem_(nil);
+self._items_(_st(self._model())._regexpReferencesOf_(aString));
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onSearchReferences:",{aString:aString},globals.HLRegexpListWidget)})},
+args: ["aString"],
+source: "onSearchReferences: aString\x0a\x09self selectItem: nil.\x0a\x09self items: (self model regexpReferencesOf: aString).\x0a\x09self refresh",
+messageSends: ["selectItem:", "items:", "regexpReferencesOf:", "model", "refresh"],
+referencedClasses: []
+}),
+globals.HLRegexpListWidget);
+
+
+
+smalltalk.addClass('HLSendersListWidget', globals.HLReferencesListWidget, [], 'Helios-References');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Senders";
+},
+args: [],
+source: "label\x0a\x09^ 'Senders'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSendersListWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onSearchReferences:",
+protocol: 'reactions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._selectItem_(nil);
+self._items_(_st(self._model())._sendersOf_(aString));
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onSearchReferences:",{aString:aString},globals.HLSendersListWidget)})},
+args: ["aString"],
+source: "onSearchReferences: aString\x0a\x09self selectItem: nil.\x0a\x09self items: (self model sendersOf: aString).\x0a\x09self refresh",
+messageSends: ["selectItem:", "items:", "sendersOf:", "model", "refresh"],
+referencedClasses: []
+}),
+globals.HLSendersListWidget);
+
+
+
+smalltalk.addClass('HLReferencesModel', globals.HLToolModel, ['methodsCache', 'classesAndMetaclassesCache'], 'Helios-References');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allMethods",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._methodsCache();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allMethods",{},globals.HLReferencesModel)})},
+args: [],
+source: "allMethods\x0a\x09^ self methodsCache",
+messageSends: ["methodsCache"],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classReferencesOf:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._allMethods())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._referencedClasses())._includes_(aString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classReferencesOf:",{aString:aString},globals.HLReferencesModel)})},
+args: ["aString"],
+source: "classReferencesOf: aString\x0a\x09\x22Answer all methods referencing the class named aString\x22\x0a\x09\x0a\x09^self allMethods select: [ :each |\x0a\x09\x09\x09(each referencedClasses includes: aString) ].",
+messageSends: ["select:", "allMethods", "includes:", "referencedClasses"],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classesAndMetaclasses",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._classesAndMetaclassesCache();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classesAndMetaclasses",{},globals.HLReferencesModel)})},
+args: [],
+source: "classesAndMetaclasses\x0a\x09^ self classesAndMetaclassesCache",
+messageSends: ["classesAndMetaclassesCache"],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classesAndMetaclassesCache",
+protocol: 'cache',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=self["@classesAndMetaclassesCache"];
+if(($receiver = $1) == null || $receiver.isNil){
+self._updateClassesAndMetaclassesCache();
+} else {
+$1;
+};
+$2=self["@classesAndMetaclassesCache"];
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"classesAndMetaclassesCache",{},globals.HLReferencesModel)})},
+args: [],
+source: "classesAndMetaclassesCache\x0a\x09classesAndMetaclassesCache ifNil: [ self updateClassesAndMetaclassesCache ].\x0a\x09^ classesAndMetaclassesCache",
+messageSends: ["ifNil:", "updateClassesAndMetaclassesCache"],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "implementorsOf:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._allMethods())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._selector()).__eq(aString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._methodReferenceOn_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"implementorsOf:",{aString:aString},globals.HLReferencesModel)})},
+args: ["aString"],
+source: "implementorsOf: aString\x0a\x09^ (self allMethods select: [ :each |\x0a\x09\x09each selector = aString ])\x0a\x09\x09\x09collect: [ :each | self methodReferenceOn: each ]",
+messageSends: ["collect:", "select:", "allMethods", "=", "selector", "methodReferenceOn:"],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isReferencesModel",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isReferencesModel\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodReferenceOn:",
+protocol: 'accessing',
+fn: function (aCompiledMethod){
+var self=this;
+function $HLMethodReference(){return globals.HLMethodReference||(typeof HLMethodReference=="undefined"?nil:HLMethodReference)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HLMethodReference())._on_(aCompiledMethod);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodReferenceOn:",{aCompiledMethod:aCompiledMethod},globals.HLReferencesModel)})},
+args: ["aCompiledMethod"],
+source: "methodReferenceOn: aCompiledMethod\x0a\x09^ HLMethodReference on: aCompiledMethod",
+messageSends: ["on:"],
+referencedClasses: ["HLMethodReference"]
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodsCache",
+protocol: 'cache',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=self["@methodsCache"];
+if(($receiver = $1) == null || $receiver.isNil){
+self._updateMethodsCache();
+} else {
+$1;
+};
+$2=self["@methodsCache"];
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"methodsCache",{},globals.HLReferencesModel)})},
+args: [],
+source: "methodsCache\x0a\x09methodsCache ifNil: [ self updateMethodsCache ].\x0a\x09^ methodsCache",
+messageSends: ["ifNil:", "updateMethodsCache"],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openClassNamed:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+var browser;
+function $HLBrowser(){return globals.HLBrowser||(typeof HLBrowser=="undefined"?nil:HLBrowser)}
+return smalltalk.withContext(function($ctx1) { 
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+browser=_st($HLBrowser())._openAsTab();
+browser;
+return _st(browser)._openClassNamed_(aString);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"openClassNamed:",{aString:aString,browser:browser},globals.HLReferencesModel)})},
+args: ["aString"],
+source: "openClassNamed: aString\x0a\x09| browser |\x0a\x09\x0a\x09self withChangesDo: [\x0a\x09\x09browser := HLBrowser openAsTab.\x0a\x09\x09browser openClassNamed: aString ]",
+messageSends: ["withChangesDo:", "openAsTab", "openClassNamed:"],
+referencedClasses: ["HLBrowser"]
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "openMethod",
+protocol: 'actions',
+fn: function (){
+var self=this;
+var browser;
+function $HLBrowser(){return globals.HLBrowser||(typeof HLBrowser=="undefined"?nil:HLBrowser)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self._selectedMethod();
+$ctx1.sendIdx["selectedMethod"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return self;
+} else {
+$1;
+};
+self._withChangesDo_((function(){
+return smalltalk.withContext(function($ctx2) {
+browser=_st($HLBrowser())._openAsTab();
+browser;
+return _st(browser)._openMethod_(self._selectedMethod());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"openMethod",{browser:browser},globals.HLReferencesModel)})},
+args: [],
+source: "openMethod\x0a\x09| browser |\x0a\x09\x0a\x09self selectedMethod ifNil: [ ^ self ].\x0a\x09\x0a\x09self withChangesDo: [\x0a\x09\x09browser := HLBrowser openAsTab.\x0a\x09\x09browser openMethod: self selectedMethod ]",
+messageSends: ["ifNil:", "selectedMethod", "withChangesDo:", "openAsTab", "openMethod:"],
+referencedClasses: ["HLBrowser"]
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "regexpReferencesOf:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._allMethods())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._source())._match_(aString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._methodReferenceOn_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"regexpReferencesOf:",{aString:aString},globals.HLReferencesModel)})},
+args: ["aString"],
+source: "regexpReferencesOf: aString\x0a\x09^ (self allMethods select: [ :each |\x0a\x09\x09each source match: aString ])\x0a\x09\x09\x09collect: [ :each | self methodReferenceOn: each ]",
+messageSends: ["collect:", "select:", "allMethods", "match:", "source", "methodReferenceOn:"],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "search:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $HLSearchReferences(){return globals.HLSearchReferences||(typeof HLSearchReferences=="undefined"?nil:HLSearchReferences)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._updateCaches();
+$1=_st($HLSearchReferences())._new();
+_st($1)._searchString_(aString);
+$2=_st($1)._yourself();
+_st(self._announcer())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"search:",{aString:aString},globals.HLReferencesModel)})},
+args: ["aString"],
+source: "search: aString\x0a\x09self updateCaches.\x0a\x09\x0a\x09self announcer announce: (HLSearchReferences new\x0a\x09\x09searchString: aString;\x0a\x09\x09yourself)",
+messageSends: ["updateCaches", "announce:", "announcer", "searchString:", "new", "yourself"],
+referencedClasses: ["HLSearchReferences"]
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendersOf:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._allMethods())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._messageSends())._includes_(aString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._methodReferenceOn_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sendersOf:",{aString:aString},globals.HLReferencesModel)})},
+args: ["aString"],
+source: "sendersOf: aString\x0a\x09^ (self allMethods select: [ :each |\x0a\x09\x09each messageSends includes: aString ])\x0a\x09\x09\x09collect: [ :each | self methodReferenceOn: each ]",
+messageSends: ["collect:", "select:", "allMethods", "includes:", "messageSends", "methodReferenceOn:"],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "updateCaches",
+protocol: 'cache',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._updateClassesAndMetaclassesCache();
+$1=self._updateMethodsCache();
+return self}, function($ctx1) {$ctx1.fill(self,"updateCaches",{},globals.HLReferencesModel)})},
+args: [],
+source: "updateCaches\x0a\x09self \x0a\x09\x09updateClassesAndMetaclassesCache;\x0a\x09\x09updateMethodsCache",
+messageSends: ["updateClassesAndMetaclassesCache", "updateMethodsCache"],
+referencedClasses: []
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "updateClassesAndMetaclassesCache",
+protocol: 'cache',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self["@classesAndMetaclassesCache"]=_st($OrderedCollection())._new();
+_st(_st(self._environment())._classes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=self["@classesAndMetaclassesCache"];
+_st($1)._add_(each);
+$ctx2.sendIdx["add:"]=1;
+$2=_st($1)._add_(_st(each)._class());
+return $2;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"updateClassesAndMetaclassesCache",{},globals.HLReferencesModel)})},
+args: [],
+source: "updateClassesAndMetaclassesCache\x0a\x09classesAndMetaclassesCache := OrderedCollection new.\x0a\x09\x0a\x09self environment classes do: [ :each |\x0a\x09\x09classesAndMetaclassesCache\x0a\x09\x09\x09\x09add: each; \x0a\x09\x09\x09\x09add: each class ]",
+messageSends: ["new", "do:", "classes", "environment", "add:", "class"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLReferencesModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "updateMethodsCache",
+protocol: 'cache',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+self["@methodsCache"]=_st($OrderedCollection())._new();
+_st(self._classesAndMetaclasses())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@methodsCache"])._addAll_(_st(each)._methods());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"updateMethodsCache",{},globals.HLReferencesModel)})},
+args: [],
+source: "updateMethodsCache\x0a\x09methodsCache := OrderedCollection new.\x0a\x09\x0a\x09self classesAndMetaclasses\x0a\x09\x09do: [ :each | methodsCache addAll: each methods ]",
+messageSends: ["new", "do:", "classesAndMetaclasses", "addAll:", "methods"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLReferencesModel);
+
+
+});

+ 388 - 0
src/Helios-References.st

@@ -0,0 +1,388 @@
+Smalltalk createPackage: 'Helios-References'!
+Object subclass: #HLMethodReference
+	instanceVariableNames: 'selector methodClass'
+	package: 'Helios-References'!
+
+!HLMethodReference methodsFor: 'accessing'!
+
+method
+	^ self methodClass methodAt: self selector
+!
+
+methodClass
+	^ methodClass
+!
+
+methodClass: aClass
+	methodClass := aClass
+!
+
+selector
+	^ selector
+!
+
+selector: aString
+	selector := aString
+!
+
+source
+	^ self method source
+! !
+
+!HLMethodReference methodsFor: 'initialization'!
+
+initializeFromMethod: aCompiledMethod
+	self
+		selector: aCompiledMethod selector;
+		methodClass: aCompiledMethod methodClass
+! !
+
+!HLMethodReference class methodsFor: 'instance creation'!
+
+on: aCompiledMethod
+	^ self new
+		initializeFromMethod: aCompiledMethod;
+		yourself
+! !
+
+HLWidget subclass: #HLReferences
+	instanceVariableNames: 'model sendersListWidget implementorsListWidget classReferencesListWidget regexpListWidget sourceCodeWidget'
+	package: 'Helios-References'!
+
+!HLReferences methodsFor: 'accessing'!
+
+classReferencesListWidget
+	^ classReferencesListWidget ifNil: [
+      	classReferencesListWidget := HLClassReferencesListWidget on: self model.
+		classReferencesListWidget next: self regexpListWidget ]
+!
+
+implementorsListWidget
+	^ implementorsListWidget ifNil: [
+      	implementorsListWidget := HLImplementorsListWidget on: self model.
+		implementorsListWidget next: self classReferencesListWidget ]
+!
+
+model
+	^ model ifNil: [
+		model := (HLReferencesModel new
+			environment: self manager environment;
+			yourself) ]
+!
+
+model: aModel
+	model := aModel
+!
+
+regexpListWidget
+	^ regexpListWidget ifNil: [
+      	regexpListWidget := HLRegexpListWidget on: self model.
+		regexpListWidget next: self sourceCodeWidget ]
+!
+
+sendersListWidget
+	^ sendersListWidget ifNil: [
+      	sendersListWidget := HLSendersListWidget on: self model.
+		sendersListWidget next: self implementorsListWidget ]
+!
+
+sourceCodeWidget
+	^ sourceCodeWidget ifNil: [
+      	sourceCodeWidget := HLBrowserCodeWidget new
+			browserModel: self model;
+			yourself ]
+! !
+
+!HLReferences methodsFor: 'actions'!
+
+registerBindingsOn: aBindingGroup
+	HLToolCommand 
+		registerConcreteClassesOn: aBindingGroup 
+		for: self model
+!
+
+search: aString
+	self model search: aString.
+	self setTabLabel: aString
+! !
+
+!HLReferences methodsFor: 'rendering'!
+
+renderContentOn: html
+	html with: (HLContainer with: (HLHorizontalSplitter 
+    	with: (HLVerticalSplitter
+        	with: (HLVerticalSplitter
+            	with: self sendersListWidget
+                with: self implementorsListWidget)
+            with: (HLVerticalSplitter
+            	with: self classReferencesListWidget
+                with: self regexpListWidget)) 
+        with: self sourceCodeWidget)).
+	
+	self sendersListWidget focus
+! !
+
+!HLReferences class methodsFor: 'accessing'!
+
+tabClass
+	^ 'references'
+!
+
+tabLabel
+	^ 'References'
+!
+
+tabPriority
+	^ 100
+! !
+
+!HLReferences class methodsFor: 'testing'!
+
+canBeOpenAsTab
+	^ false
+! !
+
+HLToolListWidget subclass: #HLReferencesListWidget
+	instanceVariableNames: ''
+	package: 'Helios-References'!
+
+!HLReferencesListWidget methodsFor: 'accessing'!
+
+commandCategory
+	^ 'Methods'
+!
+
+label
+	^ 'List'
+! !
+
+!HLReferencesListWidget methodsFor: 'actions'!
+
+activateListItem: anItem
+	self model withChangesDo: [ super activateListItem: anItem ]
+!
+
+observeModel
+	self model announcer
+		on: HLSearchReferences
+		do: [ :ann | self onSearchReferences: ann searchString ];
+		on: HLMethodSelected
+		do: [ :ann | self onMethodSelected: ann item ]
+!
+
+selectItem: aMethod
+	self model selectedMethod: aMethod
+! !
+
+!HLReferencesListWidget methodsFor: 'reactions'!
+
+onMethodSelected: aMethod
+	aMethod ifNil: [ ^ self ].
+	self items detect: [ :each | each = aMethod selector ] ifNone: [ ^ self ].
+	
+	self 
+		selectedItem: aMethod selector;
+		activateItem: aMethod selector
+!
+
+onSearchReferences: aString
+	self subclassResponsibility
+! !
+
+!HLReferencesListWidget methodsFor: 'rendering'!
+
+renderItemLabel: aMethod on: html
+	html with: aMethod methodClass name, ' >> #', aMethod selector
+! !
+
+!HLReferencesListWidget class methodsFor: 'instance creation'!
+
+on: aModel
+	^ self new 
+		model: aModel; 
+		yourself
+! !
+
+HLReferencesListWidget subclass: #HLClassReferencesListWidget
+	instanceVariableNames: ''
+	package: 'Helios-References'!
+
+!HLClassReferencesListWidget methodsFor: 'accessing'!
+
+label
+	^ 'Class references'
+! !
+
+!HLClassReferencesListWidget methodsFor: 'reactions'!
+
+onSearchReferences: aString
+	self selectItem: nil.
+	self items: (self model classReferencesOf: aString).
+	self refresh
+! !
+
+HLReferencesListWidget subclass: #HLImplementorsListWidget
+	instanceVariableNames: ''
+	package: 'Helios-References'!
+
+!HLImplementorsListWidget methodsFor: 'accessing'!
+
+label
+	^ 'Implementors'
+! !
+
+!HLImplementorsListWidget methodsFor: 'reactions'!
+
+onSearchReferences: aString
+	self selectItem: nil.
+	self items: (self model implementorsOf: aString).
+	self refresh
+! !
+
+HLReferencesListWidget subclass: #HLRegexpListWidget
+	instanceVariableNames: ''
+	package: 'Helios-References'!
+
+!HLRegexpListWidget methodsFor: 'accessing'!
+
+label
+	^ 'Source search'
+! !
+
+!HLRegexpListWidget methodsFor: 'reactions'!
+
+onSearchReferences: aString
+	self selectItem: nil.
+	self items: (self model regexpReferencesOf: aString).
+	self refresh
+! !
+
+HLReferencesListWidget subclass: #HLSendersListWidget
+	instanceVariableNames: ''
+	package: 'Helios-References'!
+
+!HLSendersListWidget methodsFor: 'accessing'!
+
+label
+	^ 'Senders'
+! !
+
+!HLSendersListWidget methodsFor: 'reactions'!
+
+onSearchReferences: aString
+	self selectItem: nil.
+	self items: (self model sendersOf: aString).
+	self refresh
+! !
+
+HLToolModel subclass: #HLReferencesModel
+	instanceVariableNames: 'methodsCache classesAndMetaclassesCache'
+	package: 'Helios-References'!
+
+!HLReferencesModel methodsFor: 'accessing'!
+
+allMethods
+	^ self methodsCache
+!
+
+classReferencesOf: aString
+	"Answer all methods referencing the class named aString"
+	
+	^self allMethods select: [ :each |
+			(each referencedClasses includes: aString) ].
+!
+
+classesAndMetaclasses
+	^ self classesAndMetaclassesCache
+!
+
+implementorsOf: aString
+	^ (self allMethods select: [ :each |
+		each selector = aString ])
+			collect: [ :each | self methodReferenceOn: each ]
+!
+
+methodReferenceOn: aCompiledMethod
+	^ HLMethodReference on: aCompiledMethod
+!
+
+regexpReferencesOf: aString
+	^ (self allMethods select: [ :each |
+		each source match: aString ])
+			collect: [ :each | self methodReferenceOn: each ]
+!
+
+sendersOf: aString
+	^ (self allMethods select: [ :each |
+		each messageSends includes: aString ])
+			collect: [ :each | self methodReferenceOn: each ]
+! !
+
+!HLReferencesModel methodsFor: 'actions'!
+
+openClassNamed: aString
+	| browser |
+	
+	self withChangesDo: [
+		browser := HLBrowser openAsTab.
+		browser openClassNamed: aString ]
+!
+
+openMethod
+	| browser |
+	
+	self selectedMethod ifNil: [ ^ self ].
+	
+	self withChangesDo: [
+		browser := HLBrowser openAsTab.
+		browser openMethod: self selectedMethod ]
+!
+
+search: aString
+	self updateCaches.
+	
+	self announcer announce: (HLSearchReferences new
+		searchString: aString;
+		yourself)
+! !
+
+!HLReferencesModel methodsFor: 'cache'!
+
+classesAndMetaclassesCache
+	classesAndMetaclassesCache ifNil: [ self updateClassesAndMetaclassesCache ].
+	^ classesAndMetaclassesCache
+!
+
+methodsCache
+	methodsCache ifNil: [ self updateMethodsCache ].
+	^ methodsCache
+!
+
+updateCaches
+	self 
+		updateClassesAndMetaclassesCache;
+		updateMethodsCache
+!
+
+updateClassesAndMetaclassesCache
+	classesAndMetaclassesCache := OrderedCollection new.
+	
+	self environment classes do: [ :each |
+		classesAndMetaclassesCache
+				add: each; 
+				add: each class ]
+!
+
+updateMethodsCache
+	methodsCache := OrderedCollection new.
+	
+	self classesAndMetaclasses
+		do: [ :each | methodsCache addAll: each methods ]
+! !
+
+!HLReferencesModel methodsFor: 'testing'!
+
+isReferencesModel
+	^ true
+! !
+

+ 67 - 0
src/Helios-SUnit.js

@@ -0,0 +1,67 @@
+define("helios/Helios-SUnit", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "helios/Helios-Core"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-SUnit');
+smalltalk.packages["Helios-SUnit"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLSUnit', globals.HLWidget, [], 'Helios-SUnit');
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeOpenAsTab",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canBeOpenAsTab\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSUnit.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "sunit";
+},
+args: [],
+source: "tabClass\x0a\x09^ 'sunit'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSUnit.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "SUnit";
+},
+args: [],
+source: "tabLabel\x0a\x09^ 'SUnit'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSUnit.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabPriority",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return (1000);
+},
+args: [],
+source: "tabPriority\x0a\x09^ 1000",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLSUnit.klass);
+
+});

+ 25 - 0
src/Helios-SUnit.st

@@ -0,0 +1,25 @@
+Smalltalk createPackage: 'Helios-SUnit'!
+HLWidget subclass: #HLSUnit
+	instanceVariableNames: ''
+	package: 'Helios-SUnit'!
+
+!HLSUnit class methodsFor: 'accessing'!
+
+tabClass
+	^ 'sunit'
+!
+
+tabLabel
+	^ 'SUnit'
+!
+
+tabPriority
+	^ 1000
+! !
+
+!HLSUnit class methodsFor: 'testing'!
+
+canBeOpenAsTab
+	^ true
+! !
+

+ 242 - 0
src/Helios-Transcript.js

@@ -0,0 +1,242 @@
+define("helios/Helios-Transcript", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "helios/Helios-Core", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Transcript');
+smalltalk.packages["Helios-Transcript"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLTranscript', globals.HLWidget, ['textarea'], 'Helios-Transcript');
+globals.HLTranscript.comment="I am a widget responsible for displaying transcript contents.\x0a\x0a## Transcript API\x0a\x0a    Transcript \x0a        show: 'hello world';\x0a        cr;\x0a        show: anObject.\x0a\x0a    Transcript clear.\x0a\x0aSee the `Transcript` service class.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "clear",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self["@textarea"])._asJQuery())._text_("");
+return self}, function($ctx1) {$ctx1.fill(self,"clear",{},globals.HLTranscript)})},
+args: [],
+source: "clear\x0a\x09textarea asJQuery text: ''",
+messageSends: ["text:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLTranscript);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLTranscript.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self._register();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLTranscript)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09self register",
+messageSends: ["initialize", "register"],
+referencedClasses: []
+}),
+globals.HLTranscript);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "register",
+protocol: 'registration',
+fn: function (){
+var self=this;
+function $HLTranscriptHandler(){return globals.HLTranscriptHandler||(typeof HLTranscriptHandler=="undefined"?nil:HLTranscriptHandler)}
+return smalltalk.withContext(function($ctx1) { 
+_st($HLTranscriptHandler())._register_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"register",{},globals.HLTranscript)})},
+args: [],
+source: "register\x0a\x09HLTranscriptHandler register: self",
+messageSends: ["register:"],
+referencedClasses: ["HLTranscriptHandler"]
+}),
+globals.HLTranscript);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("transcript");
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+self["@textarea"]=_st(html)._textarea();
+return self["@textarea"];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.HLTranscript)})},
+args: ["html"],
+source: "renderOn: html\x0a\x09html div\x0a\x09\x09class: 'transcript';\x0a\x09\x09with: [ textarea := html textarea ]",
+messageSends: ["class:", "div", "with:", "textarea"],
+referencedClasses: []
+}),
+globals.HLTranscript);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "show:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self["@textarea"];
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(_st(self["@textarea"])._asJQuery())._append_(_st(aString)._asString());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"show:",{aString:aString},globals.HLTranscript)})},
+args: ["aString"],
+source: "show: aString\x0a\x09textarea ifNotNil: [\x0a \x09\x09textarea asJQuery append: aString asString ]",
+messageSends: ["ifNotNil:", "append:", "asJQuery", "asString"],
+referencedClasses: []
+}),
+globals.HLTranscript);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'registration',
+fn: function (){
+var self=this;
+function $HLTranscriptHandler(){return globals.HLTranscriptHandler||(typeof HLTranscriptHandler=="undefined"?nil:HLTranscriptHandler)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLTranscript.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+_st($HLTranscriptHandler())._unregister_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLTranscript)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x09HLTranscriptHandler unregister: self",
+messageSends: ["unregister", "unregister:"],
+referencedClasses: ["HLTranscriptHandler"]
+}),
+globals.HLTranscript);
+
+
+
+smalltalk.addClass('HLTranscriptHandler', globals.Object, [], 'Helios-Transcript');
+globals.HLTranscriptHandler.comment="I handle transcript events, dispatching them to all instances of `HLTranscript`.\x0a\x0a## API\x0a\x0aUse the class-side method `#register:` to add transcript instances.";
+
+globals.HLTranscriptHandler.klass.iVarNames = ['transcripts'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "clear",
+protocol: 'printing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._transcripts())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._clear();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"clear",{},globals.HLTranscriptHandler.klass)})},
+args: [],
+source: "clear\x0a\x09self transcripts do: [ :each |\x0a\x09\x09each clear ]",
+messageSends: ["do:", "transcripts", "clear"],
+referencedClasses: []
+}),
+globals.HLTranscriptHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cr",
+protocol: 'printing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._transcripts())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._cr();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.HLTranscriptHandler.klass)})},
+args: [],
+source: "cr\x0a\x09self transcripts do: [ :each | each cr ]",
+messageSends: ["do:", "transcripts", "cr"],
+referencedClasses: []
+}),
+globals.HLTranscriptHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "register:",
+protocol: 'registration',
+fn: function (aTranscript){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._transcripts())._add_(aTranscript);
+return self}, function($ctx1) {$ctx1.fill(self,"register:",{aTranscript:aTranscript},globals.HLTranscriptHandler.klass)})},
+args: ["aTranscript"],
+source: "register: aTranscript\x0a\x09self transcripts add: aTranscript",
+messageSends: ["add:", "transcripts"],
+referencedClasses: []
+}),
+globals.HLTranscriptHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "show:",
+protocol: 'printing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._transcripts())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._show_(aString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"show:",{aString:aString},globals.HLTranscriptHandler.klass)})},
+args: ["aString"],
+source: "show: aString\x0a\x09self transcripts do: [ :each |\x0a\x09\x09each show: aString ]",
+messageSends: ["do:", "transcripts", "show:"],
+referencedClasses: []
+}),
+globals.HLTranscriptHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transcripts",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@transcripts"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@transcripts"]=_st($OrderedCollection())._new();
+$1=self["@transcripts"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"transcripts",{},globals.HLTranscriptHandler.klass)})},
+args: [],
+source: "transcripts\x0a\x09^ transcripts ifNil: [ transcripts := OrderedCollection new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.HLTranscriptHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister:",
+protocol: 'registration',
+fn: function (aTranscript){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._transcripts())._remove_(aTranscript);
+return self}, function($ctx1) {$ctx1.fill(self,"unregister:",{aTranscript:aTranscript},globals.HLTranscriptHandler.klass)})},
+args: ["aTranscript"],
+source: "unregister: aTranscript\x0a\x09self transcripts remove: aTranscript",
+messageSends: ["remove:", "transcripts"],
+referencedClasses: []
+}),
+globals.HLTranscriptHandler.klass);
+
+});

+ 99 - 0
src/Helios-Transcript.st

@@ -0,0 +1,99 @@
+Smalltalk createPackage: 'Helios-Transcript'!
+HLWidget subclass: #HLTranscript
+	instanceVariableNames: 'textarea'
+	package: 'Helios-Transcript'!
+!HLTranscript commentStamp!
+I am a widget responsible for displaying transcript contents.
+
+## Transcript API
+
+    Transcript 
+        show: 'hello world';
+        cr;
+        show: anObject.
+
+    Transcript clear.
+
+See the `Transcript` service class.!
+
+!HLTranscript methodsFor: 'actions'!
+
+clear
+	textarea asJQuery text: ''
+!
+
+show: aString
+	textarea ifNotNil: [
+ 		textarea asJQuery append: aString asString ]
+! !
+
+!HLTranscript methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	self register
+! !
+
+!HLTranscript methodsFor: 'registration'!
+
+register
+	HLTranscriptHandler register: self
+!
+
+unregister
+	super unregister.
+	HLTranscriptHandler unregister: self
+! !
+
+!HLTranscript methodsFor: 'rendering'!
+
+renderOn: html
+	html div
+		class: 'transcript';
+		with: [ textarea := html textarea ]
+! !
+
+Object subclass: #HLTranscriptHandler
+	instanceVariableNames: ''
+	package: 'Helios-Transcript'!
+!HLTranscriptHandler commentStamp!
+I handle transcript events, dispatching them to all instances of `HLTranscript`.
+
+## API
+
+Use the class-side method `#register:` to add transcript instances.!
+
+HLTranscriptHandler class instanceVariableNames: 'transcripts'!
+
+!HLTranscriptHandler class methodsFor: 'accessing'!
+
+transcripts
+	^ transcripts ifNil: [ transcripts := OrderedCollection new ]
+! !
+
+!HLTranscriptHandler class methodsFor: 'printing'!
+
+clear
+	self transcripts do: [ :each |
+		each clear ]
+!
+
+cr
+	self transcripts do: [ :each | each cr ]
+!
+
+show: aString
+	self transcripts do: [ :each |
+		each show: aString ]
+! !
+
+!HLTranscriptHandler class methodsFor: 'registration'!
+
+register: aTranscript
+	self transcripts add: aTranscript
+!
+
+unregister: aTranscript
+	self transcripts remove: aTranscript
+! !
+

+ 30 - 0
src/Helios-Workspace-Tests.js

@@ -0,0 +1,30 @@
+define("helios/Helios-Workspace-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/SUnit"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Workspace-Tests');
+smalltalk.packages["Helios-Workspace-Tests"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLCodeWidgetTest', globals.TestCase, [], 'Helios-Workspace-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testKeyMap",
+protocol: 'tests',
+fn: function (){
+var self=this;
+function $HLCodeWidget(){return globals.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($HLCodeWidget())._pcKeyMap())._isKindOf_($HashedCollection());
+$ctx1.sendIdx["isKindOf:"]=1;
+self._assert_($1);
+$ctx1.sendIdx["assert:"]=1;
+self._assert_(_st(_st($HLCodeWidget())._macKeyMap())._isKindOf_($HashedCollection()));
+return self}, function($ctx1) {$ctx1.fill(self,"testKeyMap",{},globals.HLCodeWidgetTest)})},
+args: [],
+source: "testKeyMap\x0a\x09\x22Key maps are a collection of associations.\x22\x0a\x09self assert: (HLCodeWidget pcKeyMap isKindOf: HashedCollection).\x0a\x09self assert: (HLCodeWidget macKeyMap isKindOf: HashedCollection)",
+messageSends: ["assert:", "isKindOf:", "pcKeyMap", "macKeyMap"],
+referencedClasses: ["HLCodeWidget", "HashedCollection"]
+}),
+globals.HLCodeWidgetTest);
+
+
+});

+ 13 - 0
src/Helios-Workspace-Tests.st

@@ -0,0 +1,13 @@
+Smalltalk createPackage: 'Helios-Workspace-Tests'!
+TestCase subclass: #HLCodeWidgetTest
+	instanceVariableNames: ''
+	package: 'Helios-Workspace-Tests'!
+
+!HLCodeWidgetTest methodsFor: 'tests'!
+
+testKeyMap
+	"Key maps are a collection of associations."
+	self assert: (HLCodeWidget pcKeyMap isKindOf: HashedCollection).
+	self assert: (HLCodeWidget macKeyMap isKindOf: HashedCollection)
+! !
+

+ 2372 - 0
src/Helios-Workspace.js

@@ -0,0 +1,2372 @@
+define("helios/Helios-Workspace", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "helios/Helios-Core"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Helios-Workspace');
+smalltalk.packages["Helios-Workspace"].transport = {"type":"amd","amdNamespace":"helios"};
+
+smalltalk.addClass('HLCodeModel', globals.Object, ['announcer', 'environment', 'receiver'], 'Helios-Workspace');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announcer",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@announcer"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@announcer"]=_st($Announcer())._new();
+$1=self["@announcer"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.HLCodeModel)})},
+args: [],
+source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["Announcer"]
+}),
+globals.HLCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "browse:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(anObject)._browse();
+return self}, function($ctx1) {$ctx1.fill(self,"browse:",{anObject:anObject},globals.HLCodeModel)})},
+args: ["anObject"],
+source: "browse: anObject\x0a\x09anObject browse",
+messageSends: ["browse"],
+referencedClasses: []
+}),
+globals.HLCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultReceiver",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._environment())._doItReceiver();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultReceiver",{},globals.HLCodeModel)})},
+args: [],
+source: "defaultReceiver\x0a\x09^ self environment doItReceiver",
+messageSends: ["doItReceiver", "environment"],
+referencedClasses: []
+}),
+globals.HLCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doIt:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._environment())._evaluate_for_(aString,self._receiver());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._tryCatch_((function(e){
+return smalltalk.withContext(function($ctx2) {
+_st($ErrorHandler())._handleError_(e);
+return nil;
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"doIt:",{aString:aString},globals.HLCodeModel)})},
+args: ["aString"],
+source: "doIt: aString\x0a\x09\x22Evaluate aString in the receiver's `environment`.\x0a\x09\x0a\x09Note: Catch any error and handle it manually, bypassing\x0a\x09boot.js behavior to avoid the browser default action on\x0a\x09ctrl+d/ctrl+p.\x0a\x09\x0a\x09See https://github.com/amber-smalltalk/amber/issues/882\x22\x0a\x0a\x09^ [ self environment evaluate: aString for: self receiver ]\x0a\x09\x09tryCatch: [ :e | \x0a\x09\x09\x09ErrorHandler handleError: e.\x0a\x09\x09\x09nil ]",
+messageSends: ["tryCatch:", "evaluate:for:", "environment", "receiver", "handleError:"],
+referencedClasses: ["ErrorHandler"]
+}),
+globals.HLCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "environment",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@environment"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=_st(_st($HLManager())._current())._environment();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"environment",{},globals.HLCodeModel)})},
+args: [],
+source: "environment\x0a\x09^ environment ifNil: [ HLManager current environment ]",
+messageSends: ["ifNil:", "environment", "current"],
+referencedClasses: ["HLManager"]
+}),
+globals.HLCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "environment:",
+protocol: 'accessing',
+fn: function (anEnvironment){
+var self=this;
+self["@environment"]=anEnvironment;
+return self},
+args: ["anEnvironment"],
+source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspect:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._environment())._inspect_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.HLCodeModel)})},
+args: ["anObject"],
+source: "inspect: anObject\x0a\x09self environment inspect: anObject",
+messageSends: ["inspect:", "environment"],
+referencedClasses: []
+}),
+globals.HLCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@receiver"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@receiver"]=self._defaultReceiver();
+$1=self["@receiver"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.HLCodeModel)})},
+args: [],
+source: "receiver\x0a\x09^ receiver ifNil: [ receiver := self defaultReceiver ]",
+messageSends: ["ifNil:", "defaultReceiver"],
+referencedClasses: []
+}),
+globals.HLCodeModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@receiver"]=anObject;
+return self},
+args: ["anObject"],
+source: "receiver: anObject\x0a\x09receiver := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeModel);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'actions',
+fn: function (anEnvironment){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._environment_(anEnvironment);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment},globals.HLCodeModel.klass)})},
+args: ["anEnvironment"],
+source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a    \x09environment: anEnvironment;\x0a        yourself",
+messageSends: ["environment:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLCodeModel.klass);
+
+
+smalltalk.addClass('HLCodeWidget', globals.HLWidget, ['model', 'wrapper', 'code', 'editor', 'state'], 'Helios-Workspace');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announcer",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._announcer();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.HLCodeWidget)})},
+args: [],
+source: "announcer\x0a\x09^ self model announcer",
+messageSends: ["announcer", "model"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "browseIt",
+protocol: 'actions',
+fn: function (){
+var self=this;
+var result;
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+var $early={};
+try {
+result=_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._doIt();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(exception){
+return smalltalk.withContext(function($ctx2) {
+$1=_st($ErrorHandler())._handleError_(exception);
+throw $early=[$1];
+}, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)})}));
+_st(self._model())._browse_(result);
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"browseIt",{result:result},globals.HLCodeWidget)})},
+args: [],
+source: "browseIt\x0a\x09| result |\x0a\x09\x0a\x09result := [ self doIt ] on: Error do: [ :exception | \x0a\x09\x09^ ErrorHandler handleError: exception ].\x0a\x09\x09\x0a\x09self model browse: result",
+messageSends: ["on:do:", "doIt", "handleError:", "browse:", "model"],
+referencedClasses: ["Error", "ErrorHandler"]
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canHaveFocus",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canHaveFocus\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "clear",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._contents_("");
+return self}, function($ctx1) {$ctx1.fill(self,"clear",{},globals.HLCodeWidget)})},
+args: [],
+source: "clear\x0a\x09self contents: ''",
+messageSends: ["contents:"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "configureEditor",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=self._editor();
+$ctx1.sendIdx["editor"]=1;
+_st($1)._at_put_("amberCodeWidget",self);
+$2=self._editor();
+$ctx1.sendIdx["editor"]=2;
+_st($2)._on_do_("change",(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._onChange();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+_st(_st(self._wrapper())._asJQuery())._on_in_do_("mousedown",".CodeMirror pre",(function(event){
+var position,node;
+return smalltalk.withContext(function($ctx2) {
+$3=_st(event)._at_("ctrlKey");
+if(smalltalk.assert($3)){
+position=_st(self._editor())._coordsChar_(globals.HashedCollection._newFromPairs_(["left",_st(event)._clientX(),"top",_st(event)._clientY()]));
+position;
+self._onCtrlClickAt_(_st(_st(_st(position)._line()).__at(_st(position)._ch())).__plus((1)));
+return _st(event)._preventDefault();
+};
+}, function($ctx2) {$ctx2.fillBlock({event:event,position:position,node:node},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{},globals.HLCodeWidget)})},
+args: [],
+source: "configureEditor\x0a\x09self editor at: 'amberCodeWidget' put: self.\x0a\x09self editor on: 'change' do: [ self onChange ].\x0a\x0a\x09self wrapper asJQuery on: 'mousedown' in: '.CodeMirror pre' do: [ :event | | position node |\x0a\x09\x09(event at: 'ctrlKey') ifTrue: [\x0a\x09\x09\x09position := self editor coordsChar: #{ \x0a\x09\x09\x09\x09'left' -> event clientX.\x0a\x09\x09\x09\x09'top' -> event clientY\x0a\x09\x09\x09}.\x0a\x09\x09\x09self onCtrlClickAt: (position line @ position ch) + 1.\x0a\x09\x09\x09event preventDefault ] ]",
+messageSends: ["at:put:", "editor", "on:do:", "onChange", "on:in:do:", "asJQuery", "wrapper", "ifTrue:", "at:", "coordsChar:", "clientX", "clientY", "onCtrlClickAt:", "+", "@", "line", "ch", "preventDefault"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contents",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@editor"])._getValue();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"contents",{},globals.HLCodeWidget)})},
+args: [],
+source: "contents\x0a\x09^ editor getValue",
+messageSends: ["getValue"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contents:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+_st(self["@editor"])._setValue_(aString);
+$1=self["@state"];
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+self._updateState();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},globals.HLCodeWidget)})},
+args: ["aString"],
+source: "contents: aString\x0a\x09editor setValue: aString.\x0a\x09state ifNotNil: [ self updateState ]",
+messageSends: ["setValue:", "ifNotNil:", "updateState"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentLine",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"currentLine",{},globals.HLCodeWidget)})},
+args: [],
+source: "currentLine\x0a    ^editor getLine: (editor getCursor line)",
+messageSends: ["getLine:", "line", "getCursor"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currentLineOrSelection",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(self["@editor"])._somethingSelected();
+if(smalltalk.assert($2)){
+$1=self._selection();
+} else {
+$1=self._currentLine();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{},globals.HLCodeWidget)})},
+args: [],
+source: "currentLineOrSelection\x0a    ^editor somethingSelected\x0a\x09\x09ifFalse: [ self currentLine ]\x0a\x09\x09ifTrue: [ self selection ]",
+messageSends: ["ifFalse:ifTrue:", "somethingSelected", "currentLine", "selection"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doIt",
+protocol: 'actions',
+fn: function (){
+var self=this;
+var result;
+function $HLDoItExecuted(){return globals.HLDoItExecuted||(typeof HLDoItExecuted=="undefined"?nil:HLDoItExecuted)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._model();
+$ctx1.sendIdx["model"]=1;
+result=_st($1)._doIt_(self._currentLineOrSelection());
+_st(_st(self._model())._announcer())._announce_(_st($HLDoItExecuted())._on_(self["@model"]));
+$2=result;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"doIt",{result:result},globals.HLCodeWidget)})},
+args: [],
+source: "doIt\x0a\x09| result |\x0a\x0a\x09result := self model doIt: self currentLineOrSelection.\x0a\x09self model announcer announce: (HLDoItExecuted on: model).\x0a\x0a\x09^ result",
+messageSends: ["doIt:", "model", "currentLineOrSelection", "announce:", "announcer", "on:"],
+referencedClasses: ["HLDoItExecuted"]
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "editor",
+protocol: 'actions',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@editor"];
+return $1;
+},
+args: [],
+source: "editor\x0a\x09^ editor",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "editorOptions",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2="helios.editorTheme"._settingValueIfAbsent_("default");
+$ctx1.sendIdx["settingValueIfAbsent:"]=1;
+$1=globals.HashedCollection._newFromPairs_(["theme",$2,"mode","text/x-stsrc","lineNumbers",true,"enterMode","flat","indentWithTabs",true,"indentUnit",(4),"matchBrackets",true,"electricChars",false,"keyMap","Amber","extraKeys",_st($HashedCollection())._with_(_st("helios.completionKey"._settingValueIfAbsent_("Shift-Space")).__minus_gt("autocomplete"))]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"editorOptions",{},globals.HLCodeWidget)})},
+args: [],
+source: "editorOptions\x0a\x09^ #{\x0a\x09\x09'theme' -> ('helios.editorTheme' settingValueIfAbsent: 'default').\x0a\x09\x09'mode' -> 'text/x-stsrc'.\x0a        'lineNumbers' -> true.\x0a        'enterMode' -> 'flat'.\x0a        'indentWithTabs' -> true.\x0a\x09\x09'indentUnit' -> 4.\x0a        'matchBrackets' -> true.\x0a        'electricChars' -> false.\x0a\x09\x09'keyMap' -> 'Amber'.\x0a\x09\x09'extraKeys' -> (HashedCollection with: ('helios.completionKey' settingValueIfAbsent: 'Shift-Space') -> 'autocomplete')\x0a\x09}",
+messageSends: ["settingValueIfAbsent:", "with:", "->"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@editor"])._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLCodeWidget)})},
+args: [],
+source: "focus\x0a\x09editor focus",
+messageSends: ["focus"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hasFocus",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self["@code"])._asJQuery())._is_(":active");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"hasFocus",{},globals.HLCodeWidget)})},
+args: [],
+source: "hasFocus\x0a\x09^ code asJQuery is: ':active'",
+messageSends: ["is:", "asJQuery"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hasModification",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "hasModification\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectIt",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._inspect_(self._doIt());
+return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{},globals.HLCodeWidget)})},
+args: [],
+source: "inspectIt\x0a\x09self model inspect: self doIt",
+messageSends: ["inspect:", "model", "doIt"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageHintFor:token:",
+protocol: 'hints',
+fn: function (anEditor,aToken){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st(_st(_st(_st(_st($Smalltalk())._vm())._allSelectors())._asArray())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(aToken)._string();
+$ctx2.sendIdx["string"]=1;
+return _st(each)._includesSubString_($2);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each).__eq(_st(aToken)._string());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},globals.HLCodeWidget)})},
+args: ["anEditor", "aToken"],
+source: "messageHintFor: anEditor token: aToken\x0a\x09^ (Smalltalk vm allSelectors asArray \x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
+messageSends: ["reject:", "select:", "asArray", "allSelectors", "vm", "includesSubString:", "string", "="],
+referencedClasses: ["Smalltalk"]
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLCodeModel(){return globals.HLCodeModel||(typeof HLCodeModel=="undefined"?nil:HLCodeModel)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@model"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@model"]=_st($HLCodeModel())._new();
+$1=self["@model"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},globals.HLCodeWidget)})},
+args: [],
+source: "model\x0a\x09^ model ifNil: [ model := HLCodeModel new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HLCodeModel"]
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+protocol: 'accessing',
+fn: function (aModel){
+var self=this;
+self["@model"]=aModel;
+return self},
+args: ["aModel"],
+source: "model: aModel\x0a\x09model := aModel",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "navigateTo:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Finder())._findString_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"navigateTo:",{aString:aString},globals.HLCodeWidget)})},
+args: ["aString"],
+source: "navigateTo: aString\x0a\x09Finder findString: aString",
+messageSends: ["findString:"],
+referencedClasses: ["Finder"]
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "navigateToReference:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $HLReferences(){return globals.HLReferences||(typeof HLReferences=="undefined"?nil:HLReferences)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($HLReferences())._openAsTab())._search_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"navigateToReference:",{aString:aString},globals.HLCodeWidget)})},
+args: ["aString"],
+source: "navigateToReference: aString\x0a\x09(HLReferences openAsTab)\x0a\x09\x09search: aString",
+messageSends: ["search:", "openAsTab"],
+referencedClasses: ["HLReferences"]
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onChange",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._updateState();
+return self}, function($ctx1) {$ctx1.fill(self,"onChange",{},globals.HLCodeWidget)})},
+args: [],
+source: "onChange\x0a\x09self updateState",
+messageSends: ["updateState"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onCtrlClickAt:",
+protocol: 'reactions',
+fn: function (aPoint){
+var self=this;
+var ast,node;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+return smalltalk.withContext(function($ctx1) { 
+var $early={};
+try {
+ast=_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st($Smalltalk())._parse_(_st(self._editor())._getValue());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
+throw $early=[self];
+}));
+node=_st(ast)._navigationNodeAt_ifAbsent_(aPoint,(function(){
+throw $early=[nil];
+}));
+self._navigateTo_(_st(node)._navigationLink());
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"onCtrlClickAt:",{aPoint:aPoint,ast:ast,node:node},globals.HLCodeWidget)})},
+args: ["aPoint"],
+source: "onCtrlClickAt: aPoint\x0a\x09| ast node |\x0a\x09\x0a\x09ast := [ Smalltalk parse: self editor getValue ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :error | ^ self ].\x0a\x09\x0a\x09node := ast \x0a\x09\x09navigationNodeAt: aPoint \x0a\x09\x09ifAbsent: [ ^ nil ].\x0a\x09\x09\x0a\x09self navigateTo: node navigationLink",
+messageSends: ["on:do:", "parse:", "getValue", "editor", "navigationNodeAt:ifAbsent:", "navigateTo:", "navigationLink"],
+referencedClasses: ["Smalltalk", "Error"]
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onInspectIt",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._inspectIt();
+return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{},globals.HLCodeWidget)})},
+args: [],
+source: "onInspectIt\x0a\x0a\x09self inspectIt",
+messageSends: ["inspectIt"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPrintIt",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._printIt();
+return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{},globals.HLCodeWidget)})},
+args: [],
+source: "onPrintIt\x0a\x0a\x09self printIt",
+messageSends: ["printIt"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onSaveIt",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "onSaveIt\x0a\x09\x22I do not do anything\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "print:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+var start,stop,currentLine;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$4,$3,$5,$6,$7,$8,$9,$10,$12,$11;
+$1=_st(self["@editor"])._getCursor_(false);
+$ctx1.sendIdx["getCursor:"]=1;
+currentLine=_st($1)._line();
+start=_st($HashedCollection())._new();
+$ctx1.sendIdx["new"]=1;
+_st(start)._at_put_("line",currentLine);
+$ctx1.sendIdx["at:put:"]=1;
+$2=start;
+$4=_st(self["@editor"])._getCursor_(false);
+$ctx1.sendIdx["getCursor:"]=2;
+$3=_st($4)._ch();
+_st($2)._at_put_("ch",$3);
+$ctx1.sendIdx["at:put:"]=2;
+$5=_st(self["@editor"])._getSelection();
+$ctx1.sendIdx["getSelection"]=1;
+_st($5)._ifEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+$6=start;
+$7=_st(_st(self["@editor"])._getLine_(currentLine))._size();
+$ctx2.sendIdx["size"]=1;
+_st($6)._at_put_("ch",$7);
+$ctx2.sendIdx["at:put:"]=3;
+return _st(self["@editor"])._setSelection_end_(globals.HashedCollection._newFromPairs_(["line",currentLine,"ch",(0)]),start);
+$ctx2.sendIdx["setSelection:end:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+stop=_st($HashedCollection())._new();
+_st(stop)._at_put_("line",currentLine);
+$ctx1.sendIdx["at:put:"]=4;
+$8=stop;
+$9=_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2));
+$ctx1.sendIdx["+"]=1;
+_st($8)._at_put_("ch",$9);
+$10=self["@editor"];
+$12=_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString);
+$ctx1.sendIdx[","]=2;
+$11=_st($12).__comma(" ");
+$ctx1.sendIdx[","]=1;
+_st($10)._replaceSelection_($11);
+_st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
+_st(self["@editor"])._setSelection_end_(stop,start);
+return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine},globals.HLCodeWidget)})},
+args: ["aString"],
+source: "print: aString\x0a\x09| start stop currentLine |\x0a    currentLine := (editor getCursor: false) line.\x0a\x09start := HashedCollection new.\x0a\x09start at: 'line' put: currentLine.\x0a\x09start at: 'ch' put: (editor getCursor: false) ch.\x0a    (editor getSelection) ifEmpty: [\x0a    \x09\x22select current line if selection is empty\x22\x0a    \x09start at: 'ch' put: (editor getLine: currentLine) size.\x0a        editor setSelection: #{'line' -> currentLine. 'ch' -> 0} end: start.\x0a    ].\x0a\x09stop := HashedCollection new.\x0a\x09stop at: 'line' put: currentLine.\x0a\x09stop at: 'ch' put: ((start at: 'ch') + aString size + 2).\x0a\x0a\x09editor replaceSelection: (editor getSelection, ' ', aString, ' ').\x0a\x09editor setCursor: (editor getCursor: true).\x0a\x09editor setSelection: stop end: start",
+messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "getSelection", "size", "getLine:", "setSelection:end:", "+", "at:", "replaceSelection:", ",", "setCursor:"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printIt",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._print_(_st(self._doIt())._printString());
+return self}, function($ctx1) {$ctx1.fill(self,"printIt",{},globals.HLCodeWidget)})},
+args: [],
+source: "printIt\x0a\x09self print: self doIt printString",
+messageSends: ["print:", "printString", "doIt"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._receiver();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.HLCodeWidget)})},
+args: [],
+source: "receiver\x0a\x09^ self model receiver",
+messageSends: ["receiver", "model"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._receiver_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},globals.HLCodeWidget)})},
+args: ["anObject"],
+source: "receiver: anObject\x0a\x09self model receiver: anObject",
+messageSends: ["receiver:", "model"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$6,$7,$8;
+$1=_st(html)._button();
+$ctx1.sendIdx["button"]=1;
+_st($1)._class_("button");
+$ctx1.sendIdx["class:"]=1;
+_st($1)._with_("DoIt");
+$ctx1.sendIdx["with:"]=1;
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._doIt();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["onClick:"]=1;
+$3=_st(html)._button();
+$ctx1.sendIdx["button"]=2;
+_st($3)._class_("button");
+$ctx1.sendIdx["class:"]=2;
+_st($3)._with_("PrintIt");
+$ctx1.sendIdx["with:"]=2;
+$4=_st($3)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._printIt();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$ctx1.sendIdx["onClick:"]=2;
+$5=_st(html)._button();
+$ctx1.sendIdx["button"]=3;
+_st($5)._class_("button");
+$ctx1.sendIdx["class:"]=3;
+_st($5)._with_("InspectIt");
+$ctx1.sendIdx["with:"]=3;
+$6=_st($5)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._inspectIt();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+$ctx1.sendIdx["onClick:"]=3;
+$7=_st(html)._button();
+_st($7)._class_("button");
+_st($7)._with_("BrowseIt");
+$8=_st($7)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._browseIt();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},globals.HLCodeWidget)})},
+args: ["html"],
+source: "renderButtonsOn: html\x0a\x09html button \x0a\x09\x09class: 'button';\x0a\x09\x09with: 'DoIt';\x0a\x09\x09onClick: [ self doIt ].\x0a\x09html button \x0a\x09\x09class: 'button';\x0a\x09\x09with: 'PrintIt';\x0a\x09\x09onClick: [ self printIt ].\x0a\x09html button \x0a\x09\x09class: 'button';\x0a\x09\x09with: 'InspectIt';\x0a\x09\x09onClick: [ self inspectIt ].\x0a\x09html button \x0a\x09\x09class: 'button';\x0a\x09\x09with: 'BrowseIt';\x0a\x09\x09onClick: [ self browseIt ]",
+messageSends: ["class:", "button", "with:", "onClick:", "doIt", "printIt", "inspectIt", "browseIt"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$6;
+$1=_st(html)._div();
+$ctx1.sendIdx["div"]=1;
+_st($1)._class_("editor");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+self["@code"]=_st(html)._textarea();
+return self["@code"];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+$3=_st(html)._div();
+$ctx1.sendIdx["div"]=2;
+self["@state"]=_st($3)._class_("state");
+$ctx1.sendIdx["class:"]=2;
+$4=_st(html)._div();
+_st($4)._class_("buttons_bar");
+$5=_st($4)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._renderButtonsOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+self._setEditorOn_(_st(self["@code"])._element());
+self._configureEditor();
+$6=self._updateState();
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLCodeWidget)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html div class: 'editor'; with: [\x0a\x09\x09code := html textarea ].\x0a\x09state := html div class: 'state'.\x0a\x09\x0a\x09html div \x0a\x09\x09class: 'buttons_bar';\x0a\x09\x09with: [ self renderButtonsOn: html ].\x0a\x09\x0a\x09self \x0a\x09\x09setEditorOn: code element;\x0a\x09\x09configureEditor;\x0a\x09\x09updateState",
+messageSends: ["class:", "div", "with:", "textarea", "renderButtonsOn:", "setEditorOn:", "element", "configureEditor", "updateState"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "saveIt",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "saveIt\x0a\x09\x22I do not do anything\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selection",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@editor"])._getSelection();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selection",{},globals.HLCodeWidget)})},
+args: [],
+source: "selection\x0a\x09^editor getSelection",
+messageSends: ["getSelection"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectionEnd",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self["@code"])._element())._selectionEnd();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectionEnd",{},globals.HLCodeWidget)})},
+args: [],
+source: "selectionEnd\x0a   ^code element selectionEnd",
+messageSends: ["selectionEnd", "element"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectionEnd:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self["@code"])._element())._selectionEnd_(anInteger);
+return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger},globals.HLCodeWidget)})},
+args: ["anInteger"],
+source: "selectionEnd: anInteger\x0a   code element selectionEnd: anInteger",
+messageSends: ["selectionEnd:", "element"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectionStart",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self["@code"])._element())._selectionStart();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectionStart",{},globals.HLCodeWidget)})},
+args: [],
+source: "selectionStart\x0a   ^code element selectionStart",
+messageSends: ["selectionStart", "element"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectionStart:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self["@code"])._element())._selectionStart_(anInteger);
+return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger},globals.HLCodeWidget)})},
+args: ["anInteger"],
+source: "selectionStart: anInteger\x0a   code element selectionStart: anInteger",
+messageSends: ["selectionStart:", "element"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setEditorOn:",
+protocol: 'actions',
+fn: function (aTextarea){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self['@editor'] = CodeMirror.fromTextArea(aTextarea, self._editorOptions());
+return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea},globals.HLCodeWidget)})},
+args: ["aTextarea"],
+source: "setEditorOn: aTextarea\x0a\x09<self['@editor'] = CodeMirror.fromTextArea(aTextarea, self._editorOptions())>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "updateState",
+protocol: 'updating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._hasModification();
+if(smalltalk.assert($1)){
+$2=_st(self["@state"])._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+_st($2)._addClass_("modified");
+} else {
+_st(_st(self["@state"])._asJQuery())._removeClass_("modified");
+};
+return self}, function($ctx1) {$ctx1.fill(self,"updateState",{},globals.HLCodeWidget)})},
+args: [],
+source: "updateState\x0a\x09self hasModification \x0a\x09\x09ifTrue: [ state asJQuery addClass: 'modified' ]\x0a\x09\x09ifFalse: [ state asJQuery removeClass: 'modified' ]",
+messageSends: ["ifTrue:ifFalse:", "hasModification", "addClass:", "asJQuery", "removeClass:"],
+referencedClasses: []
+}),
+globals.HLCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableHintFor:token:",
+protocol: 'hints',
+fn: function (anEditor,aToken){
+var self=this;
+var variables,classNames,pseudoVariables;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$9,$8,$7,$6,$10,$5,$4;
+$3=_st(_st(_st(anEditor)._display())._wrapper())._asJQuery();
+$ctx1.sendIdx["asJQuery"]=1;
+$2=_st($3)._find_("span.cm-variable");
+$1=_st($2)._get();
+variables=_st($1)._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._asJQuery())._html();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["collect:"]=1;
+classNames=_st(_st($Smalltalk())._classes())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._name();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+pseudoVariables=_st($Smalltalk())._pseudoVariableNames();
+$9=_st(_st(variables).__comma(classNames)).__comma(pseudoVariables);
+$ctx1.sendIdx[","]=1;
+$8=_st($9)._asSet();
+$7=_st($8)._asArray();
+$6=_st($7)._sort();
+$5=_st($6)._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$10=_st(aToken)._string();
+$ctx2.sendIdx["string"]=1;
+return _st(each)._includesSubString_($10);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
+$4=_st($5)._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each).__eq(_st(aToken)._string());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken,variables:variables,classNames:classNames,pseudoVariables:pseudoVariables},globals.HLCodeWidget)})},
+args: ["anEditor", "aToken"],
+source: "variableHintFor: anEditor token: aToken\x0a\x09| variables classNames pseudoVariables |\x0a\x09\x0a\x09variables := (anEditor display wrapper asJQuery find: 'span.cm-variable') get\x0a\x09\x09collect: [ :each | each asJQuery html ].\x0a\x09\x0a\x09classNames := Smalltalk classes collect: [ :each | each name ].\x0a\x09pseudoVariables := Smalltalk pseudoVariableNames.\x0a\x09\x0a\x09^ ((variables, classNames, pseudoVariables) asSet asArray sort\x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
+messageSends: ["collect:", "get", "find:", "asJQuery", "wrapper", "display", "html", "classes", "name", "pseudoVariableNames", "reject:", "select:", "sort", "asArray", "asSet", ",", "includesSubString:", "string", "="],
+referencedClasses: ["Smalltalk"]
+}),
+globals.HLCodeWidget);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hintFor:options:",
+protocol: 'hints',
+fn: function (anEditor,options){
+var self=this;
+var cursor,token,completions;
+function $CodeMirror(){return globals.CodeMirror||(typeof CodeMirror=="undefined"?nil:CodeMirror)}
+function $HLCodeWidget(){return globals.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$4,$3,$2,$5,$7,$9,$10,$8,$6;
+cursor=_st(anEditor)._getCursor();
+token=_st(anEditor)._getTokenAt_(cursor);
+$1=token;
+$4=_st($CodeMirror())._basicAt_("innerMode");
+$ctx1.sendIdx["basicAt:"]=1;
+$3=_st($4)._value_value_(_st(anEditor)._getMode(),_st(token)._at_("state"));
+$ctx1.sendIdx["value:value:"]=1;
+$2=_st($3)._state();
+_st($1)._at_put_("state",$2);
+$5=_st(_st(token)._type()).__eq("variable");
+if(smalltalk.assert($5)){
+completions=_st($HLCodeWidget())._variableHintFor_token_(anEditor,token);
+} else {
+completions=_st($HLCodeWidget())._messageHintFor_token_(anEditor,token);
+};
+$7=completions;
+$9=_st($CodeMirror())._basicAt_("Pos");
+$ctx1.sendIdx["basicAt:"]=2;
+$10=_st(cursor)._line();
+$ctx1.sendIdx["line"]=1;
+$8=_st($9)._value_value_($10,_st(token)._end());
+$ctx1.sendIdx["value:value:"]=2;
+$6=globals.HashedCollection._newFromPairs_(["list",$7,"from",$8,"to",_st(_st($CodeMirror())._basicAt_("Pos"))._value_value_(_st(cursor)._line(),_st(token)._start())]);
+return $6;
+}, function($ctx1) {$ctx1.fill(self,"hintFor:options:",{anEditor:anEditor,options:options,cursor:cursor,token:token,completions:completions},globals.HLCodeWidget.klass)})},
+args: ["anEditor", "options"],
+source: "hintFor: anEditor options: options\x0a\x09| cursor token completions |\x0a\x09\x0a\x09cursor := anEditor getCursor.\x0a\x09token := anEditor getTokenAt: cursor.\x0a\x09token at: 'state' put: ((CodeMirror basicAt: 'innerMode')\x0a\x09\x09value: anEditor getMode value: (token at: 'state')) state.\x0a\x09\x0a\x09completions := token type = 'variable' \x0a\x09\x09ifTrue: [ HLCodeWidget variableHintFor: anEditor token: token ]\x0a\x09\x09ifFalse: [ HLCodeWidget messageHintFor: anEditor token: token ].\x0a\x09\x0a\x09^ #{\x0a\x09\x09'list' -> completions.\x0a\x09\x09'from' -> ((CodeMirror basicAt: 'Pos') value: cursor line value: token end).\x0a\x09\x09'to' -> ((CodeMirror basicAt: 'Pos') value: cursor line value: token start)\x0a\x09}",
+messageSends: ["getCursor", "getTokenAt:", "at:put:", "state", "value:value:", "basicAt:", "getMode", "at:", "ifTrue:ifFalse:", "=", "type", "variableHintFor:token:", "messageHintFor:token:", "line", "end", "start"],
+referencedClasses: ["CodeMirror", "HLCodeWidget"]
+}),
+globals.HLCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+($ctx1.supercall = true, globals.HLCodeWidget.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self._setupCodeMirror();
+self._setupCommands();
+$1=self._setupKeyMaps();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLCodeWidget.klass)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09self \x0a\x09\x09setupCodeMirror;\x0a\x09\x09setupCommands;\x0a\x09\x09setupKeyMaps.",
+messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"],
+referencedClasses: []
+}),
+globals.HLCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyMap",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(_st(_st($HLManager())._current())._keyBinder())._systemIsMac();
+if(smalltalk.assert($2)){
+$1=self._macKeyMap();
+} else {
+$1=self._pcKeyMap();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"keyMap",{},globals.HLCodeWidget.klass)})},
+args: [],
+source: "keyMap\x0a\x09^ HLManager current keyBinder systemIsMac\x0a\x09\x09ifTrue: [ self macKeyMap ]\x0a\x09\x09ifFalse: [ self pcKeyMap ]",
+messageSends: ["ifTrue:ifFalse:", "systemIsMac", "keyBinder", "current", "macKeyMap", "pcKeyMap"],
+referencedClasses: ["HLManager"]
+}),
+globals.HLCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "macKeyMap",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=globals.HashedCollection._newFromPairs_(["Alt-Backspace","delWordBefore","Alt-Delete","delWordAfter","Alt-Left","goWordLeft","Alt-Right","goWordRight","Cmd-A","selectAll","Cmd-Alt-F","replace","Cmd-D","doIt","Cmd-B","browseIt","Cmd-Down","goDocEnd","Cmd-End","goDocEnd","Cmd-F","find","Cmd-G","findNext","Cmd-I","inspectIt","Cmd-Left","goLineStart","Cmd-P","printIt","Cmd-Right","goLineEnd","Cmd-S","saveIt","Cmd-Up","goDocStart","Cmd-Y","redo","Cmd-Z","undo","Cmd-[","indentLess","Cmd-]","indentMore","Ctrl-Alt-Backspace","delWordAfter","Shift-Cmd-Alt-F","replaceAll","Shift-Cmd-G","findPrev","Shift-Cmd-Z","redo","fallthrough",["basic","emacsy"]]);
+return $1;
+},
+args: [],
+source: "macKeyMap\x0a\x09^ #{\x0a\x09\x09'Alt-Backspace'\x09\x09\x09-> 'delWordBefore'.\x0a\x09\x09'Alt-Delete'\x09\x09\x09-> 'delWordAfter'. \x0a\x09\x09'Alt-Left'\x09\x09\x09\x09-> 'goWordLeft'.\x0a\x09\x09'Alt-Right'\x09\x09\x09\x09-> 'goWordRight'. \x0a\x09\x09'Cmd-A'\x09\x09\x09\x09\x09-> 'selectAll'. \x0a\x09\x09'Cmd-Alt-F'\x09\x09\x09\x09-> 'replace'. \x0a\x09\x09'Cmd-D'\x09\x09\x09\x09\x09-> 'doIt'. \x0a\x09\x09'Cmd-B'\x09\x09\x09\x09\x09-> 'browseIt'. \x0a\x09\x09'Cmd-Down'\x09\x09\x09\x09-> 'goDocEnd'. \x0a\x09\x09'Cmd-End'\x09\x09\x09\x09-> 'goDocEnd'. \x0a\x09\x09'Cmd-F'\x09\x09\x09\x09\x09-> 'find'.\x0a\x09\x09'Cmd-G'\x09\x09\x09\x09\x09-> 'findNext'. \x0a\x09\x09'Cmd-I'\x09\x09\x09\x09\x09-> 'inspectIt'. \x0a\x09\x09'Cmd-Left'\x09\x09\x09\x09-> 'goLineStart'. \x0a\x09\x09'Cmd-P'\x09\x09\x09\x09\x09-> 'printIt'. \x0a\x09\x09'Cmd-Right'\x09\x09\x09\x09-> 'goLineEnd'. \x0a\x09\x09'Cmd-S'\x09\x09\x09\x09\x09-> 'saveIt'. \x0a\x09\x09'Cmd-Up'\x09\x09\x09\x09-> 'goDocStart'. \x0a\x09\x09'Cmd-Y'\x09\x09\x09\x09\x09-> 'redo'.\x0a\x09\x09'Cmd-Z'\x09\x09\x09\x09\x09-> 'undo'. \x0a\x09\x09'Cmd-['\x09\x09\x09\x09\x09-> 'indentLess'. \x0a\x09\x09'Cmd-]'\x09\x09\x09\x09\x09-> 'indentMore'.\x0a\x09\x09'Ctrl-Alt-Backspace'\x09-> 'delWordAfter'. \x0a\x09\x09'Shift-Cmd-Alt-F'\x09\x09-> 'replaceAll'.\x0a\x09\x09'Shift-Cmd-G'\x09\x09\x09-> 'findPrev'. \x0a\x09\x09'Shift-Cmd-Z'\x09\x09\x09-> 'redo'. \x0a    \x09'fallthrough' \x09\x09\x09-> { 'basic'. 'emacsy' }\x0a  }",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageHintFor:token:",
+protocol: 'hints',
+fn: function (anEditor,aToken){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(anEditor)._at_("amberCodeWidget"))._messageHintFor_token_(anEditor,aToken);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},globals.HLCodeWidget.klass)})},
+args: ["anEditor", "aToken"],
+source: "messageHintFor: anEditor token: aToken\x0a\x09^ (anEditor at: 'amberCodeWidget')\x0a\x09\x09messageHintFor: anEditor token: aToken",
+messageSends: ["messageHintFor:token:", "at:"],
+referencedClasses: []
+}),
+globals.HLCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pcKeyMap",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=globals.HashedCollection._newFromPairs_(["Alt-Left","goLineStart","Alt-Right","goLineEnd","Alt-Up","goDocStart","Ctrl-A","selectAll","Ctrl-Backspace","delWordBefore","Ctrl-D","doIt","Ctrl-B","browseIt","Ctrl-Delete","delWordAfter","Ctrl-Down","goDocEnd","Ctrl-End","goDocEnd","Ctrl-F","find","Ctrl-G","findNext","Ctrl-I","inspectIt","Ctrl-Home","goDocStart","Ctrl-Left","goWordLeft","Ctrl-P","printIt","Ctrl-Right","goWordRight","Ctrl-S","saveIt","Ctrl-Y","redo","Ctrl-Z","undo","Ctrl-[","indentLess","Ctrl-]","indentMore","Shift-Ctrl-F","replace","Shift-Ctrl-G","findPrev","Shift-Ctrl-R","replaceAll","Shift-Ctrl-Z","redo","fallthrough",["basic"]]);
+return $1;
+},
+args: [],
+source: "pcKeyMap\x0a\x09^ #{\x0a\x09\x09'Alt-Left' -> \x09\x09'goLineStart'. \x0a\x09\x09'Alt-Right' -> \x09\x09'goLineEnd'.\x0a\x09\x09'Alt-Up' -> \x09\x09'goDocStart'. \x0a\x09\x09'Ctrl-A' -> \x09\x09'selectAll'. \x0a\x09\x09'Ctrl-Backspace' -> 'delWordBefore'. \x0a\x09\x09'Ctrl-D' -> \x09\x09'doIt'. \x0a\x09\x09'Ctrl-B' -> \x09\x09'browseIt'. \x0a\x09\x09'Ctrl-Delete' -> \x09\x09'delWordAfter'. \x0a\x09\x09'Ctrl-Down' -> \x09\x09'goDocEnd'.\x0a\x09\x09'Ctrl-End' -> \x09\x09'goDocEnd'. \x0a\x09\x09'Ctrl-F' -> \x09\x09'find'.\x0a\x09\x09'Ctrl-G' -> \x09\x09'findNext'. \x0a\x09\x09'Ctrl-I' -> \x09\x09'inspectIt'.\x0a\x09\x09'Ctrl-Home' -> \x09\x09'goDocStart'. \x0a\x09\x09'Ctrl-Left' -> \x09\x09'goWordLeft'. \x0a\x09\x09'Ctrl-P' -> \x09\x09'printIt'.\x0a\x09\x09'Ctrl-Right' -> \x09'goWordRight'. \x0a\x09\x09'Ctrl-S' -> \x09\x09'saveIt'. \x0a\x09\x09'Ctrl-Y' -> \x09\x09'redo'.\x0a\x09\x09'Ctrl-Z' -> \x09\x09'undo'. \x0a\x09\x09'Ctrl-[' -> \x09\x09'indentLess'. \x0a\x09\x09'Ctrl-]' -> \x09\x09'indentMore'.\x0a\x09\x09'Shift-Ctrl-F' -> \x09'replace'. \x0a\x09\x09'Shift-Ctrl-G' -> \x09'findPrev'. \x0a\x09\x09'Shift-Ctrl-R' -> \x09'replaceAll'.\x0a\x09\x09'Shift-Ctrl-Z' -> \x09'redo'. \x0a\x09\x09'fallthrough' -> \x09#('basic')\x0a}",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupCodeMirror",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ 
+		CodeMirror.keyMap.default.fallthrough = ["basic"];
+		CodeMirror.commands.autocomplete = function(cm) {
+			CodeMirror.showHint(cm, self._hintFor_options_);
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{},globals.HLCodeWidget.klass)})},
+args: [],
+source: "setupCodeMirror\x0a\x09< \x0a\x09\x09CodeMirror.keyMap.default.fallthrough = [\x22basic\x22];\x0a\x09\x09CodeMirror.commands.autocomplete = function(cm) {\x0a\x09\x09\x09CodeMirror.showHint(cm, self._hintFor_options_);\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupCommands",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $CodeMirror(){return globals.CodeMirror||(typeof CodeMirror=="undefined"?nil:CodeMirror)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$6;
+$1=_st($CodeMirror())._basicAt_("commands");
+_st($1)._at_put_("doIt",(function(cm){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(cm)._amberCodeWidget();
+$ctx2.sendIdx["amberCodeWidget"]=1;
+return _st($2)._doIt();
+}, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1,1)})}));
+$ctx1.sendIdx["at:put:"]=1;
+_st($1)._at_put_("inspectIt",(function(cm){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(cm)._amberCodeWidget();
+$ctx2.sendIdx["amberCodeWidget"]=2;
+return _st($3)._inspectIt();
+}, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1,2)})}));
+$ctx1.sendIdx["at:put:"]=2;
+_st($1)._at_put_("printIt",(function(cm){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(cm)._amberCodeWidget();
+$ctx2.sendIdx["amberCodeWidget"]=3;
+return _st($4)._printIt();
+}, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1,3)})}));
+$ctx1.sendIdx["at:put:"]=3;
+_st($1)._at_put_("saveIt",(function(cm){
+return smalltalk.withContext(function($ctx2) {
+$5=_st(cm)._amberCodeWidget();
+$ctx2.sendIdx["amberCodeWidget"]=4;
+return _st($5)._saveIt();
+}, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1,4)})}));
+$ctx1.sendIdx["at:put:"]=4;
+$6=_st($1)._at_put_("browseIt",(function(cm){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(cm)._amberCodeWidget())._browseIt();
+}, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1,5)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{},globals.HLCodeWidget.klass)})},
+args: [],
+source: "setupCommands\x0a\x09(CodeMirror basicAt: 'commands') \x0a\x09\x09at: 'doIt' put: [ :cm | cm amberCodeWidget doIt ];\x0a\x09\x09at: 'inspectIt' put: [ :cm | cm amberCodeWidget inspectIt ];\x0a\x09\x09at: 'printIt' put: [ :cm | cm amberCodeWidget printIt ];\x0a\x09\x09at: 'saveIt' put: [ :cm | cm amberCodeWidget saveIt ];\x0a\x09\x09at: 'browseIt' put: [ :cm | cm amberCodeWidget browseIt ]",
+messageSends: ["at:put:", "basicAt:", "doIt", "amberCodeWidget", "inspectIt", "printIt", "saveIt", "browseIt"],
+referencedClasses: ["CodeMirror"]
+}),
+globals.HLCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupKeyMaps",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+CodeMirror.keyMap['Amber'] = self._keyMap();
+return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{},globals.HLCodeWidget.klass)})},
+args: [],
+source: "setupKeyMaps\x0a\x09<CodeMirror.keyMap['Amber'] = self._keyMap()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "variableHintFor:token:",
+protocol: 'hints',
+fn: function (anEditor,aToken){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(anEditor)._at_("amberCodeWidget"))._variableHintFor_token_(anEditor,aToken);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken},globals.HLCodeWidget.klass)})},
+args: ["anEditor", "aToken"],
+source: "variableHintFor: anEditor token: aToken\x0a\x09^ (anEditor at: 'amberCodeWidget')\x0a\x09\x09variableHintFor: anEditor token: aToken",
+messageSends: ["variableHintFor:token:", "at:"],
+referencedClasses: []
+}),
+globals.HLCodeWidget.klass);
+
+
+smalltalk.addClass('HLNavigationCodeWidget', globals.HLCodeWidget, ['methodContents'], 'Helios-Workspace');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "configureEditor",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLNavigationCodeWidget.superclass.fn.prototype._configureEditor.apply(_st(self), []));
+$ctx1.supercall = false;
+self._contents_(self._methodContents());
+return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{},globals.HLNavigationCodeWidget)})},
+args: [],
+source: "configureEditor\x0a\x09super configureEditor.\x0a\x09self contents: self methodContents",
+messageSends: ["configureEditor", "contents:", "methodContents"],
+referencedClasses: []
+}),
+globals.HLNavigationCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contents:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._methodContents_(aString);
+($ctx1.supercall = true, globals.HLNavigationCodeWidget.superclass.fn.prototype._contents_.apply(_st(self), [aString]));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},globals.HLNavigationCodeWidget)})},
+args: ["aString"],
+source: "contents: aString\x0a\x09self methodContents: aString.\x0a\x09super contents: aString",
+messageSends: ["methodContents:", "contents:"],
+referencedClasses: []
+}),
+globals.HLNavigationCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hasModification",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._methodContents()).__eq(self._contents()))._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"hasModification",{},globals.HLNavigationCodeWidget)})},
+args: [],
+source: "hasModification\x0a\x09^ (self methodContents = self contents) not",
+messageSends: ["not", "=", "methodContents", "contents"],
+referencedClasses: []
+}),
+globals.HLNavigationCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodContents",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@methodContents"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodContents",{},globals.HLNavigationCodeWidget)})},
+args: [],
+source: "methodContents\x0a\x09^ methodContents ifNil: [ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.HLNavigationCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodContents:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+var $1;
+self["@methodContents"]=aString;
+$1=self["@methodContents"];
+return $1;
+},
+args: ["aString"],
+source: "methodContents: aString\x0a\x09^ methodContents := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLNavigationCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "previous",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "previous\x0a\x09\x22for browser lists widget\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLNavigationCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "previous:",
+protocol: 'accessing',
+fn: function (aWidget){
+var self=this;
+return self},
+args: ["aWidget"],
+source: "previous: aWidget\x0a\x09\x22for browser lists widget\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLNavigationCodeWidget);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeOpenAsTab",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "canBeOpenAsTab\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLNavigationCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aBrowserModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._browserModel_(aBrowserModel);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel},globals.HLNavigationCodeWidget.klass)})},
+args: ["aBrowserModel"],
+source: "on: aBrowserModel\x0a\x09^ self new\x0a\x09\x09browserModel: aBrowserModel;\x0a\x09\x09yourself",
+messageSends: ["browserModel:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLNavigationCodeWidget.klass);
+
+
+smalltalk.addClass('HLBrowserCodeWidget', globals.HLNavigationCodeWidget, ['browserModel'], 'Helios-Workspace');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "browserModel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@browserModel"];
+return $1;
+},
+args: [],
+source: "browserModel\x0a\x09^ browserModel",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "browserModel:",
+protocol: 'accessing',
+fn: function (aBrowserModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self["@browserModel"]=aBrowserModel;
+self._observeSystem();
+$1=self._observeBrowserModel();
+return self}, function($ctx1) {$ctx1.fill(self,"browserModel:",{aBrowserModel:aBrowserModel},globals.HLBrowserCodeWidget)})},
+args: ["aBrowserModel"],
+source: "browserModel: aBrowserModel\x0a\x09browserModel := aBrowserModel.\x0a\x09self \x0a\x09\x09observeSystem;\x0a\x09\x09observeBrowserModel",
+messageSends: ["observeSystem", "observeBrowserModel"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeBrowserModel",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLSaveSourceCode(){return globals.HLSaveSourceCode||(typeof HLSaveSourceCode=="undefined"?nil:HLSaveSourceCode)}
+function $HLShowInstanceToggled(){return globals.HLShowInstanceToggled||(typeof HLShowInstanceToggled=="undefined"?nil:HLShowInstanceToggled)}
+function $HLSourceCodeSaved(){return globals.HLSourceCodeSaved||(typeof HLSourceCodeSaved=="undefined"?nil:HLSourceCodeSaved)}
+function $HLAboutToChange(){return globals.HLAboutToChange||(typeof HLAboutToChange=="undefined"?nil:HLAboutToChange)}
+function $HLParseErrorRaised(){return globals.HLParseErrorRaised||(typeof HLParseErrorRaised=="undefined"?nil:HLParseErrorRaised)}
+function $HLCompileErrorRaised(){return globals.HLCompileErrorRaised||(typeof HLCompileErrorRaised=="undefined"?nil:HLCompileErrorRaised)}
+function $HLUnknownVariableErrorRaised(){return globals.HLUnknownVariableErrorRaised||(typeof HLUnknownVariableErrorRaised=="undefined"?nil:HLUnknownVariableErrorRaised)}
+function $HLInstVarAdded(){return globals.HLInstVarAdded||(typeof HLInstVarAdded=="undefined"?nil:HLInstVarAdded)}
+function $HLMethodSelected(){return globals.HLMethodSelected||(typeof HLMethodSelected=="undefined"?nil:HLMethodSelected)}
+function $HLClassSelected(){return globals.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
+function $HLPackageSelected(){return globals.HLPackageSelected||(typeof HLPackageSelected=="undefined"?nil:HLPackageSelected)}
+function $HLProtocolSelected(){return globals.HLProtocolSelected||(typeof HLProtocolSelected=="undefined"?nil:HLProtocolSelected)}
+function $HLSourceCodeFocusRequested(){return globals.HLSourceCodeFocusRequested||(typeof HLSourceCodeFocusRequested=="undefined"?nil:HLSourceCodeFocusRequested)}
+function $HLShowTemplate(){return globals.HLShowTemplate||(typeof HLShowTemplate=="undefined"?nil:HLShowTemplate)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._browserModel())._announcer();
+_st($1)._on_send_to_($HLSaveSourceCode(),"onSaveIt",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st($1)._on_send_to_($HLShowInstanceToggled(),"onShowInstanceToggled",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+_st($1)._on_send_to_($HLSourceCodeSaved(),"onSourceCodeSaved",self);
+$ctx1.sendIdx["on:send:to:"]=3;
+_st($1)._on_send_to_($HLAboutToChange(),"onBrowserAboutToChange:",self);
+$ctx1.sendIdx["on:send:to:"]=4;
+_st($1)._on_send_to_($HLParseErrorRaised(),"onParseError:",self);
+$ctx1.sendIdx["on:send:to:"]=5;
+_st($1)._on_send_to_($HLCompileErrorRaised(),"onCompileError:",self);
+$ctx1.sendIdx["on:send:to:"]=6;
+_st($1)._on_send_to_($HLUnknownVariableErrorRaised(),"onUnknownVariableError:",self);
+$ctx1.sendIdx["on:send:to:"]=7;
+_st($1)._on_send_to_($HLInstVarAdded(),"onInstVarAdded",self);
+$ctx1.sendIdx["on:send:to:"]=8;
+_st($1)._on_send_to_($HLMethodSelected(),"onMethodSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=9;
+_st($1)._on_send_to_($HLClassSelected(),"onClassSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=10;
+_st($1)._on_send_to_($HLPackageSelected(),"onPackageSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=11;
+_st($1)._on_send_to_($HLProtocolSelected(),"onProtocolSelected:",self);
+$ctx1.sendIdx["on:send:to:"]=12;
+_st($1)._on_send_to_($HLSourceCodeFocusRequested(),"onSourceCodeFocusRequested",self);
+$ctx1.sendIdx["on:send:to:"]=13;
+$2=_st($1)._on_send_to_($HLShowTemplate(),"onShowTemplate:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "observeBrowserModel\x0a\x09self browserModel announcer\x0a\x09\x09on: HLSaveSourceCode\x0a\x09\x09send: #onSaveIt\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLShowInstanceToggled\x0a\x09\x09send: #onShowInstanceToggled\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLSourceCodeSaved\x0a\x09\x09send: #onSourceCodeSaved\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLAboutToChange\x0a\x09\x09send: #onBrowserAboutToChange:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLParseErrorRaised\x0a\x09\x09send: #onParseError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLCompileErrorRaised\x0a\x09\x09send: #onCompileError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLUnknownVariableErrorRaised\x0a\x09\x09send: #onUnknownVariableError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLInstVarAdded \x0a\x09\x09send: #onInstVarAdded\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLMethodSelected \x0a\x09\x09send: #onMethodSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: HLClassSelected \x0a\x09\x09send: #onClassSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLPackageSelected \x0a\x09\x09send: #onPackageSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: HLProtocolSelected \x0a\x09\x09send: #onProtocolSelected: \x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLSourceCodeFocusRequested \x0a\x09\x09send: #onSourceCodeFocusRequested\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLShowTemplate\x0a\x09\x09send: #onShowTemplate:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer", "browserModel"],
+referencedClasses: ["HLSaveSourceCode", "HLShowInstanceToggled", "HLSourceCodeSaved", "HLAboutToChange", "HLParseErrorRaised", "HLCompileErrorRaised", "HLUnknownVariableErrorRaised", "HLInstVarAdded", "HLMethodSelected", "HLClassSelected", "HLPackageSelected", "HLProtocolSelected", "HLSourceCodeFocusRequested", "HLShowTemplate"]
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeSystem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $MethodModified(){return globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(self._browserModel())._systemAnnouncer())._on_send_to_($MethodModified(),"onMethodModified:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "observeSystem\x0a\x09self browserModel systemAnnouncer\x0a    \x09on: MethodModified\x0a        send: #onMethodModified:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "systemAnnouncer", "browserModel"],
+referencedClasses: ["MethodModified"]
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onBrowserAboutToChange:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var block;
+function $HLChangeForbidden(){return globals.HLChangeForbidden||(typeof HLChangeForbidden=="undefined"?nil:HLChangeForbidden)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+block=_st(anAnnouncement)._actionBlock();
+$1=self._hasModification();
+if(smalltalk.assert($1)){
+self._confirm_ifTrue_("Changes have not been saved. Do you want to discard these changes?",(function(){
+return smalltalk.withContext(function($ctx2) {
+self._methodContents_(self._contents());
+return _st(block)._value();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st($HLChangeForbidden())._signal();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onBrowserAboutToChange:",{anAnnouncement:anAnnouncement,block:block},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onBrowserAboutToChange: anAnnouncement\x0a\x09| block |\x0a\x09\x0a\x09block := anAnnouncement actionBlock.\x0a\x09\x0a\x09self hasModification\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09confirm: 'Changes have not been saved. Do you want to discard these changes?' \x0a\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x22Don't ask twice\x22\x0a\x09\x09\x09\x09\x09self methodContents: self contents.\x0a\x09\x09\x09\x09\x09block value ].\x0a\x09\x09\x09\x0a\x09\x09\x09\x0a\x09\x09\x09HLChangeForbidden signal ]",
+messageSends: ["actionBlock", "ifTrue:", "hasModification", "confirm:ifTrue:", "methodContents:", "contents", "value", "signal"],
+referencedClasses: ["HLChangeForbidden"]
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var class_;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+class_=_st(anAnnouncement)._item();
+$1=class_;
+if(($receiver = $1) == null || $receiver.isNil){
+$2=self._contents_("");
+$ctx1.sendIdx["contents:"]=1;
+return $2;
+} else {
+$1;
+};
+self._contents_(_st(class_)._definition());
+return self}, function($ctx1) {$ctx1.fill(self,"onClassSelected:",{anAnnouncement:anAnnouncement,class_:class_},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onClassSelected: anAnnouncement\x0a\x09| class |\x0a\x09\x0a\x09class:= anAnnouncement item.\x0a\x09\x0a\x09class ifNil: [ ^ self contents: '' ].\x0a\x09self contents: class definition",
+messageSends: ["item", "ifNil:", "contents:", "definition"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onCompileError:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._alert_(_st(_st(anAnnouncement)._error())._messageText());
+return self}, function($ctx1) {$ctx1.fill(self,"onCompileError:",{anAnnouncement:anAnnouncement},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onCompileError: anAnnouncement\x0a\x09self alert: anAnnouncement error messageText",
+messageSends: ["alert:", "messageText", "error"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onInstVarAdded",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._browserModel())._save_(self._contents());
+return self}, function($ctx1) {$ctx1.fill(self,"onInstVarAdded",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "onInstVarAdded\x0a\x09self browserModel save: self contents",
+messageSends: ["save:", "browserModel", "contents"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodModified:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var method;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$5,$4,$7,$6,$receiver;
+method=_st(anAnnouncement)._method();
+$3=self._browserModel();
+$ctx1.sendIdx["browserModel"]=1;
+$2=_st($3)._selectedClass();
+$1=_st($2).__eq(_st(method)._methodClass());
+$ctx1.sendIdx["="]=1;
+if(! smalltalk.assert($1)){
+return self;
+};
+$5=self._browserModel();
+$ctx1.sendIdx["browserModel"]=2;
+$4=_st($5)._selectedMethod();
+$ctx1.sendIdx["selectedMethod"]=1;
+if(($receiver = $4) == null || $receiver.isNil){
+return self;
+} else {
+$4;
+};
+$7=_st(_st(self._browserModel())._selectedMethod())._selector();
+$ctx1.sendIdx["selector"]=1;
+$6=_st($7).__eq(_st(method)._selector());
+if(! smalltalk.assert($6)){
+return self;
+};
+self._refresh();
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodModified:",{anAnnouncement:anAnnouncement,method:method},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onMethodModified: anAnnouncement\x0a\x09| method |\x0a\x09\x0a\x09method := anAnnouncement method.\x0a\x09\x0a\x09self browserModel selectedClass = method methodClass ifFalse: [ ^ self ].\x0a\x09self browserModel selectedMethod ifNil: [ ^ self ].\x0a\x09self browserModel selectedMethod selector = method selector ifFalse: [ ^ self ].\x0a\x0a\x09self refresh",
+messageSends: ["method", "ifFalse:", "=", "selectedClass", "browserModel", "methodClass", "ifNil:", "selectedMethod", "selector", "refresh"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var method;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+method=_st(anAnnouncement)._item();
+$1=method;
+if(($receiver = $1) == null || $receiver.isNil){
+$2=self._contents_("");
+$ctx1.sendIdx["contents:"]=1;
+return $2;
+} else {
+$1;
+};
+self._contents_(_st(method)._source());
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodSelected:",{anAnnouncement:anAnnouncement,method:method},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onMethodSelected: anAnnouncement\x0a\x09| method |\x0a\x09\x0a\x09method := anAnnouncement item.\x0a\x09\x0a\x09method ifNil: [ ^ self contents: '' ].\x0a\x09self contents: method source",
+messageSends: ["item", "ifNil:", "contents:", "source"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPackageSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var package_;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+package_=_st(anAnnouncement)._item();
+$1=package_;
+if(($receiver = $1) == null || $receiver.isNil){
+$2=self._contents_("");
+$ctx1.sendIdx["contents:"]=1;
+return $2;
+} else {
+$1;
+};
+self._contents_(_st(package_)._definition());
+return self}, function($ctx1) {$ctx1.fill(self,"onPackageSelected:",{anAnnouncement:anAnnouncement,package_:package_},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onPackageSelected: anAnnouncement\x0a\x09| package |\x0a\x09\x0a\x09package := anAnnouncement item.\x0a\x09\x0a\x09package ifNil: [ ^ self contents: '' ].\x0a\x09self contents: package definition",
+messageSends: ["item", "ifNil:", "contents:", "definition"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onParseError:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var lineIndex,newContents;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$6,$5,$4;
+lineIndex=(1);
+self._contents_(_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._contents())._linesDo_((function(each){
+return smalltalk.withContext(function($ctx3) {
+$1=_st(lineIndex).__eq(_st(anAnnouncement)._line());
+if(smalltalk.assert($1)){
+$3=_st(anAnnouncement)._column();
+$ctx3.sendIdx["column"]=1;
+$2=_st(each)._copyFrom_to_((1),$3);
+$ctx3.sendIdx["copyFrom:to:"]=1;
+_st(stream)._nextPutAll_($2);
+$ctx3.sendIdx["nextPutAll:"]=1;
+_st(stream)._nextPutAll_("<- ");
+$ctx3.sendIdx["nextPutAll:"]=2;
+_st(stream)._nextPutAll_(_st(anAnnouncement)._message());
+$ctx3.sendIdx["nextPutAll:"]=3;
+_st(stream)._nextPutAll_(" ");
+$ctx3.sendIdx["nextPutAll:"]=4;
+$6=_st(_st(anAnnouncement)._column()).__plus((1));
+$ctx3.sendIdx["+"]=1;
+$5=_st(each)._copyFrom_to_($6,_st(each)._size());
+$4=_st(stream)._nextPutAll_($5);
+$ctx3.sendIdx["nextPutAll:"]=5;
+$4;
+} else {
+_st(stream)._nextPutAll_(each);
+$ctx3.sendIdx["nextPutAll:"]=6;
+};
+_st(stream)._nextPutAll_(_st($String())._cr());
+lineIndex=_st(lineIndex).__plus((1));
+return lineIndex;
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})})));
+return self}, function($ctx1) {$ctx1.fill(self,"onParseError:",{anAnnouncement:anAnnouncement,lineIndex:lineIndex,newContents:newContents},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onParseError: anAnnouncement\x0a\x09| lineIndex newContents |\x0a\x09\x0a\x09lineIndex := 1.\x0a\x09\x0a\x09self contents: (String streamContents: [ :stream |\x0a\x09\x09self contents linesDo: [ :each |\x0a\x09\x09\x09lineIndex = anAnnouncement line \x0a\x09\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09\x09stream \x0a\x09\x09\x09\x09\x09\x09nextPutAll: (each copyFrom: 1 to: anAnnouncement column);\x0a\x09\x09\x09\x09\x09\x09nextPutAll: '<- ';\x0a\x09\x09\x09\x09\x09\x09nextPutAll: anAnnouncement message;\x0a\x09\x09\x09\x09\x09\x09nextPutAll: ' ';\x0a\x09\x09\x09\x09\x09\x09nextPutAll: (each copyFrom: anAnnouncement column + 1 to: each size) ]\x0a\x09\x09\x09\x09ifFalse: [ stream nextPutAll: each ].\x0a\x09\x09\x09stream nextPutAll: String cr.\x0a\x09\x09\x09lineIndex := lineIndex + 1 ] ])",
+messageSends: ["contents:", "streamContents:", "linesDo:", "contents", "ifTrue:ifFalse:", "=", "line", "nextPutAll:", "copyFrom:to:", "column", "message", "+", "size", "cr"],
+referencedClasses: ["String"]
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onProtocolSelected:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$receiver;
+$2=self._browserModel();
+$ctx1.sendIdx["browserModel"]=1;
+$1=_st($2)._selectedClass();
+$ctx1.sendIdx["selectedClass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$3=self._contents_("");
+$ctx1.sendIdx["contents:"]=1;
+return $3;
+} else {
+$1;
+};
+self._contents_(_st(_st(self._browserModel())._selectedClass())._definition());
+return self}, function($ctx1) {$ctx1.fill(self,"onProtocolSelected:",{anAnnouncement:anAnnouncement},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onProtocolSelected: anAnnouncement\x0a\x09self browserModel selectedClass ifNil: [ ^ self contents: '' ].\x0a\x09self contents: self browserModel selectedClass definition",
+messageSends: ["ifNil:", "selectedClass", "browserModel", "contents:", "definition"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onSaveIt",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._browserModel())._save_(self._contents());
+return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "onSaveIt\x0a\x09self browserModel save: self contents",
+messageSends: ["save:", "browserModel", "contents"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onShowInstanceToggled",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$receiver;
+$2=self._browserModel();
+$ctx1.sendIdx["browserModel"]=1;
+$1=_st($2)._selectedClass();
+$ctx1.sendIdx["selectedClass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$3=self._contents_("");
+$ctx1.sendIdx["contents:"]=1;
+return $3;
+} else {
+$1;
+};
+self._contents_(_st(_st(self._browserModel())._selectedClass())._definition());
+return self}, function($ctx1) {$ctx1.fill(self,"onShowInstanceToggled",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "onShowInstanceToggled\x0a\x09self browserModel selectedClass ifNil: [ ^ self contents: '' ].\x0a    \x0a\x09self contents: self browserModel selectedClass definition",
+messageSends: ["ifNil:", "selectedClass", "browserModel", "contents:", "definition"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onShowTemplate:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._contents_(_st(anAnnouncement)._template());
+return self}, function($ctx1) {$ctx1.fill(self,"onShowTemplate:",{anAnnouncement:anAnnouncement},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onShowTemplate: anAnnouncement\x0a\x09self contents: anAnnouncement template",
+messageSends: ["contents:", "template"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onSourceCodeFocusRequested",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"onSourceCodeFocusRequested",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "onSourceCodeFocusRequested\x0a\x09self focus",
+messageSends: ["focus"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onSourceCodeSaved",
+protocol: 'reactions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._methodContents_(self._contents());
+self._updateState();
+return self}, function($ctx1) {$ctx1.fill(self,"onSourceCodeSaved",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "onSourceCodeSaved\x0a\x09self methodContents: self contents.\x0a\x09self updateState",
+messageSends: ["methodContents:", "contents", "updateState"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onUnknownVariableError:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+var error;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+error=_st(anAnnouncement)._error();
+self._confirm_ifTrue_(_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+_st(stream)._nextPutAll_(_st(error)._messageText());
+$ctx2.sendIdx["nextPutAll:"]=1;
+_st(stream)._nextPutAll_(_st($String())._cr());
+$ctx2.sendIdx["nextPutAll:"]=2;
+$1=_st(stream)._nextPutAll_("Would you like to define an instance variable?");
+return $1;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})})),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._browserModel())._addInstVarNamed_(_st(error)._variableName());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"onUnknownVariableError:",{anAnnouncement:anAnnouncement,error:error},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onUnknownVariableError: anAnnouncement\x0a\x09| error |\x0a\x09\x0a\x09error := anAnnouncement error.\x0a\x09\x0a\x09self \x0a\x09\x09confirm: (String streamContents: [ :stream |\x0a\x09\x09\x09stream \x0a\x09\x09\x09\x09nextPutAll: error messageText;\x0a\x09\x09\x09\x09nextPutAll: String cr;\x0a\x09\x09\x09\x09nextPutAll: 'Would you like to define an instance variable?' ])\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self browserModel addInstVarNamed: error variableName ]",
+messageSends: ["error", "confirm:ifTrue:", "streamContents:", "nextPutAll:", "messageText", "cr", "addInstVarNamed:", "browserModel", "variableName"],
+referencedClasses: ["String"]
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "refresh",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._hasModification();
+if(smalltalk.assert($1)){
+return self;
+};
+$2=self._hasFocus();
+if(smalltalk.assert($2)){
+return self;
+};
+self._contents_(_st(_st(self._browserModel())._selectedMethod())._source());
+return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "refresh\x0a\x09self hasModification ifTrue: [ ^ self ].\x0a    self hasFocus ifTrue: [ ^ self ].\x0a\x0a\x09self contents: self browserModel selectedMethod source",
+messageSends: ["ifTrue:", "hasModification", "hasFocus", "contents:", "source", "selectedMethod", "browserModel"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderButtonsOn:",
+protocol: 'actions',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._button();
+_st($1)._class_("button");
+_st($1)._with_("SaveIt");
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._saveIt();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+($ctx1.supercall = true, globals.HLBrowserCodeWidget.superclass.fn.prototype._renderButtonsOn_.apply(_st(self), [html]));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},globals.HLBrowserCodeWidget)})},
+args: ["html"],
+source: "renderButtonsOn: html\x0a\x09html button \x0a\x09\x09class: 'button';\x0a\x09\x09with: 'SaveIt';\x0a\x09\x09onClick: [ self saveIt ].\x0a\x09super renderButtonsOn: html",
+messageSends: ["class:", "button", "with:", "onClick:", "saveIt", "renderButtonsOn:"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "saveIt",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._browserModel())._saveSourceCode();
+return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "saveIt\x0a\x09self browserModel saveSourceCode",
+messageSends: ["saveSourceCode", "browserModel"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+($ctx1.supercall = true, globals.HLBrowserCodeWidget.superclass.fn.prototype._unregsiter.apply(_st(self), []));
+$ctx1.supercall = false;
+$2=self._browserModel();
+$ctx1.sendIdx["browserModel"]=1;
+$1=_st($2)._announcer();
+_st($1)._unsubscribe_(self);
+$ctx1.sendIdx["unsubscribe:"]=1;
+_st(_st(self._browserModel())._systemAnnouncer())._unsubscribe_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLBrowserCodeWidget)})},
+args: [],
+source: "unregister\x0a\x09super unregsiter.\x0a\x09\x0a\x09self browserModel announcer unsubscribe: self.\x0a\x09self browserModel systemAnnouncer unsubscribe: self",
+messageSends: ["unregsiter", "unsubscribe:", "announcer", "browserModel", "systemAnnouncer"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeOpenAsTab",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "canBeOpenAsTab\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aBrowserModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._browserModel_(aBrowserModel);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel},globals.HLBrowserCodeWidget.klass)})},
+args: ["aBrowserModel"],
+source: "on: aBrowserModel\x0a\x09^ self new\x0a\x09\x09browserModel: aBrowserModel;\x0a\x09\x09yourself",
+messageSends: ["browserModel:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget.klass);
+
+
+smalltalk.addClass('HLWorkspace', globals.HLWidget, ['codeWidget', 'transcript'], 'Helios-Workspace');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canHaveFocus",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canHaveFocus\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "codeWidget",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLCodeWidget(){return globals.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@codeWidget"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@codeWidget"]=_st($HLCodeWidget())._new();
+$1=self["@codeWidget"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"codeWidget",{},globals.HLWorkspace)})},
+args: [],
+source: "codeWidget\x0a\x09^ codeWidget ifNil: [ codeWidget := HLCodeWidget new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HLCodeWidget"]
+}),
+globals.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._codeWidget())._focus();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLWorkspace)})},
+args: [],
+source: "focus\x0a\x09^ self codeWidget focus",
+messageSends: ["focus", "codeWidget"],
+referencedClasses: []
+}),
+globals.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+function $HLContainer(){return globals.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
+function $HLHorizontalSplitter(){return globals.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
+return smalltalk.withContext(function($ctx1) { 
+_st(html)._with_(_st($HLContainer())._with_(_st($HLHorizontalSplitter())._with_with_(self._codeWidget(),(function(canvas){
+return smalltalk.withContext(function($ctx2) {
+return self._renderTranscriptOn_(canvas);
+}, function($ctx2) {$ctx2.fillBlock({canvas:canvas},$ctx1,1)})}))));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLWorkspace)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html with: (HLContainer with: (HLHorizontalSplitter\x0a\x09\x09with: self codeWidget\x0a\x09\x09with: [ :canvas | self renderTranscriptOn: canvas ]))",
+messageSends: ["with:", "with:with:", "codeWidget", "renderTranscriptOn:"],
+referencedClasses: ["HLContainer", "HLHorizontalSplitter"]
+}),
+globals.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderTranscriptOn:",
+protocol: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2;
+$1=_st(html)._div();
+$ctx1.sendIdx["div"]=1;
+_st($1)._class_("transcript-container");
+$ctx1.sendIdx["class:"]=1;
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._div();
+_st($3)._class_("list-label");
+$4=_st($3)._with_("Transcript");
+$4;
+return _st(self._transcript())._renderOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["with:"]=1;
+return self}, function($ctx1) {$ctx1.fill(self,"renderTranscriptOn:",{html:html},globals.HLWorkspace)})},
+args: ["html"],
+source: "renderTranscriptOn: html\x0a\x09html div \x0a\x09\x09class: 'transcript-container';\x0a\x09\x09with: [\x0a\x09\x09\x09html div\x0a\x09\x09\x09\x09class: 'list-label';\x0a\x09\x09\x09\x09with: 'Transcript'.\x0a\x09\x09\x09self transcript renderOn: html ]",
+messageSends: ["class:", "div", "with:", "renderOn:", "transcript"],
+referencedClasses: []
+}),
+globals.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transcript",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $HLTranscript(){return globals.HLTranscript||(typeof HLTranscript=="undefined"?nil:HLTranscript)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@transcript"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@transcript"]=_st($HLTranscript())._new();
+$1=self["@transcript"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"transcript",{},globals.HLWorkspace)})},
+args: [],
+source: "transcript\x0a\x09^ transcript ifNil: [ transcript := HLTranscript new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HLTranscript"]
+}),
+globals.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLWorkspace.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+$ctx1.sendIdx["unregister"]=1;
+_st(self._transcript())._unregister();
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLWorkspace)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x09self transcript unregister",
+messageSends: ["unregister", "transcript"],
+referencedClasses: []
+}),
+globals.HLWorkspace);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canBeOpenAsTab",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "canBeOpenAsTab\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWorkspace.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "workspace";
+},
+args: [],
+source: "tabClass\x0a\x09^ 'workspace'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWorkspace.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabLabel",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Workspace";
+},
+args: [],
+source: "tabLabel\x0a\x09^ 'Workspace'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWorkspace.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tabPriority",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return (10);
+},
+args: [],
+source: "tabPriority\x0a\x09^ 10",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLWorkspace.klass);
+
+});

+ 863 - 0
src/Helios-Workspace.st

@@ -0,0 +1,863 @@
+Smalltalk createPackage: 'Helios-Workspace'!
+Object subclass: #HLCodeModel
+	instanceVariableNames: 'announcer environment receiver'
+	package: 'Helios-Workspace'!
+
+!HLCodeModel methodsFor: 'accessing'!
+
+announcer
+	^ announcer ifNil: [ announcer := Announcer new ]
+!
+
+environment
+	^ environment ifNil: [ HLManager current environment ]
+!
+
+environment: anEnvironment
+	environment := anEnvironment
+!
+
+receiver
+	^ receiver ifNil: [ receiver := self defaultReceiver ]
+!
+
+receiver: anObject
+	receiver := anObject
+! !
+
+!HLCodeModel methodsFor: 'actions'!
+
+browse: anObject
+	anObject browse
+!
+
+doIt: aString
+	"Evaluate aString in the receiver's `environment`.
+	
+	Note: Catch any error and handle it manually, bypassing
+	boot.js behavior to avoid the browser default action on
+	ctrl+d/ctrl+p.
+	
+	See https://github.com/amber-smalltalk/amber/issues/882"
+
+	^ [ self environment evaluate: aString for: self receiver ]
+		tryCatch: [ :e | 
+			ErrorHandler handleError: e.
+			nil ]
+!
+
+inspect: anObject
+	self environment inspect: anObject
+! !
+
+!HLCodeModel methodsFor: 'defaults'!
+
+defaultReceiver
+	^ self environment doItReceiver
+! !
+
+!HLCodeModel class methodsFor: 'actions'!
+
+on: anEnvironment
+
+	^ self new
+    	environment: anEnvironment;
+        yourself
+! !
+
+HLWidget subclass: #HLCodeWidget
+	instanceVariableNames: 'model wrapper code editor state'
+	package: 'Helios-Workspace'!
+
+!HLCodeWidget methodsFor: 'accessing'!
+
+announcer
+	^ self model announcer
+!
+
+contents
+	^ editor getValue
+!
+
+contents: aString
+	editor setValue: aString.
+	state ifNotNil: [ self updateState ]
+!
+
+currentLine
+    ^editor getLine: (editor getCursor line)
+!
+
+currentLineOrSelection
+    ^editor somethingSelected
+		ifFalse: [ self currentLine ]
+		ifTrue: [ self selection ]
+!
+
+editorOptions
+	^ #{
+		'theme' -> ('helios.editorTheme' settingValueIfAbsent: 'default').
+		'mode' -> 'text/x-stsrc'.
+        'lineNumbers' -> true.
+        'enterMode' -> 'flat'.
+        'indentWithTabs' -> true.
+		'indentUnit' -> 4.
+        'matchBrackets' -> true.
+        'electricChars' -> false.
+		'keyMap' -> 'Amber'.
+		'extraKeys' -> (HashedCollection with: ('helios.completionKey' settingValueIfAbsent: 'Shift-Space') -> 'autocomplete')
+	}
+!
+
+model
+	^ model ifNil: [ model := HLCodeModel new ]
+!
+
+model: aModel
+	model := aModel
+!
+
+receiver
+	^ self model receiver
+!
+
+receiver: anObject
+	self model receiver: anObject
+!
+
+selection
+	^editor getSelection
+!
+
+selectionEnd
+   ^code element selectionEnd
+!
+
+selectionEnd: anInteger
+   code element selectionEnd: anInteger
+!
+
+selectionStart
+   ^code element selectionStart
+!
+
+selectionStart: anInteger
+   code element selectionStart: anInteger
+! !
+
+!HLCodeWidget methodsFor: 'actions'!
+
+browseIt
+	| result |
+	
+	result := [ self doIt ] on: Error do: [ :exception | 
+		^ ErrorHandler handleError: exception ].
+		
+	self model browse: result
+!
+
+clear
+	self contents: ''
+!
+
+configureEditor
+	self editor at: 'amberCodeWidget' put: self.
+	self editor on: 'change' do: [ self onChange ].
+
+	self wrapper asJQuery on: 'mousedown' in: '.CodeMirror pre' do: [ :event | | position node |
+		(event at: 'ctrlKey') ifTrue: [
+			position := self editor coordsChar: #{ 
+				'left' -> event clientX.
+				'top' -> event clientY
+			}.
+			self onCtrlClickAt: (position line @ position ch) + 1.
+			event preventDefault ] ]
+!
+
+doIt
+	| result |
+
+	result := self model doIt: self currentLineOrSelection.
+	self model announcer announce: (HLDoItExecuted on: model).
+
+	^ result
+!
+
+editor
+	^ editor
+!
+
+focus
+	editor focus
+!
+
+inspectIt
+	self model inspect: self doIt
+!
+
+navigateTo: aString
+	Finder findString: aString
+!
+
+navigateToReference: aString
+	(HLReferences openAsTab)
+		search: aString
+!
+
+print: aString
+	| start stop currentLine |
+    currentLine := (editor getCursor: false) line.
+	start := HashedCollection new.
+	start at: 'line' put: currentLine.
+	start at: 'ch' put: (editor getCursor: false) ch.
+    (editor getSelection) ifEmpty: [
+    	"select current line if selection is empty"
+    	start at: 'ch' put: (editor getLine: currentLine) size.
+        editor setSelection: #{'line' -> currentLine. 'ch' -> 0} end: start.
+    ].
+	stop := HashedCollection new.
+	stop at: 'line' put: currentLine.
+	stop at: 'ch' put: ((start at: 'ch') + aString size + 2).
+
+	editor replaceSelection: (editor getSelection, ' ', aString, ' ').
+	editor setCursor: (editor getCursor: true).
+	editor setSelection: stop end: start
+!
+
+printIt
+	self print: self doIt printString
+!
+
+saveIt
+	"I do not do anything"
+!
+
+setEditorOn: aTextarea
+	<self['@editor'] = CodeMirror.fromTextArea(aTextarea, self._editorOptions())>
+! !
+
+!HLCodeWidget methodsFor: 'hints'!
+
+messageHintFor: anEditor token: aToken
+	^ (Smalltalk vm allSelectors asArray 
+		select: [ :each | each includesSubString: aToken string ])
+		reject: [ :each | each = aToken string ]
+!
+
+variableHintFor: anEditor token: aToken
+	| variables classNames pseudoVariables |
+	
+	variables := (anEditor display wrapper asJQuery find: 'span.cm-variable') get
+		collect: [ :each | each asJQuery html ].
+	
+	classNames := Smalltalk classes collect: [ :each | each name ].
+	pseudoVariables := Smalltalk pseudoVariableNames.
+	
+	^ ((variables, classNames, pseudoVariables) asSet asArray sort
+		select: [ :each | each includesSubString: aToken string ])
+		reject: [ :each | each = aToken string ]
+! !
+
+!HLCodeWidget methodsFor: 'reactions'!
+
+onChange
+	self updateState
+!
+
+onCtrlClickAt: aPoint
+	| ast node |
+	
+	ast := [ Smalltalk parse: self editor getValue ] 
+		on: Error 
+		do: [ :error | ^ self ].
+	
+	node := ast 
+		navigationNodeAt: aPoint 
+		ifAbsent: [ ^ nil ].
+		
+	self navigateTo: node navigationLink
+!
+
+onInspectIt
+
+	self inspectIt
+!
+
+onPrintIt
+
+	self printIt
+!
+
+onSaveIt
+	"I do not do anything"
+! !
+
+!HLCodeWidget methodsFor: 'rendering'!
+
+renderButtonsOn: html
+	html button 
+		class: 'button';
+		with: 'DoIt';
+		onClick: [ self doIt ].
+	html button 
+		class: 'button';
+		with: 'PrintIt';
+		onClick: [ self printIt ].
+	html button 
+		class: 'button';
+		with: 'InspectIt';
+		onClick: [ self inspectIt ].
+	html button 
+		class: 'button';
+		with: 'BrowseIt';
+		onClick: [ self browseIt ]
+!
+
+renderContentOn: html
+	html div class: 'editor'; with: [
+		code := html textarea ].
+	state := html div class: 'state'.
+	
+	html div 
+		class: 'buttons_bar';
+		with: [ self renderButtonsOn: html ].
+	
+	self 
+		setEditorOn: code element;
+		configureEditor;
+		updateState
+! !
+
+!HLCodeWidget methodsFor: 'testing'!
+
+canHaveFocus
+	^ true
+!
+
+hasFocus
+	^ code asJQuery is: ':active'
+!
+
+hasModification
+	^ false
+! !
+
+!HLCodeWidget methodsFor: 'updating'!
+
+updateState
+	self hasModification 
+		ifTrue: [ state asJQuery addClass: 'modified' ]
+		ifFalse: [ state asJQuery removeClass: 'modified' ]
+! !
+
+!HLCodeWidget class methodsFor: 'accessing'!
+
+keyMap
+	^ HLManager current keyBinder systemIsMac
+		ifTrue: [ self macKeyMap ]
+		ifFalse: [ self pcKeyMap ]
+!
+
+macKeyMap
+	^ #{
+		'Alt-Backspace'			-> 'delWordBefore'.
+		'Alt-Delete'			-> 'delWordAfter'. 
+		'Alt-Left'				-> 'goWordLeft'.
+		'Alt-Right'				-> 'goWordRight'. 
+		'Cmd-A'					-> 'selectAll'. 
+		'Cmd-Alt-F'				-> 'replace'. 
+		'Cmd-D'					-> 'doIt'. 
+		'Cmd-B'					-> 'browseIt'. 
+		'Cmd-Down'				-> 'goDocEnd'. 
+		'Cmd-End'				-> 'goDocEnd'. 
+		'Cmd-F'					-> 'find'.
+		'Cmd-G'					-> 'findNext'. 
+		'Cmd-I'					-> 'inspectIt'. 
+		'Cmd-Left'				-> 'goLineStart'. 
+		'Cmd-P'					-> 'printIt'. 
+		'Cmd-Right'				-> 'goLineEnd'. 
+		'Cmd-S'					-> 'saveIt'. 
+		'Cmd-Up'				-> 'goDocStart'. 
+		'Cmd-Y'					-> 'redo'.
+		'Cmd-Z'					-> 'undo'. 
+		'Cmd-['					-> 'indentLess'. 
+		'Cmd-]'					-> 'indentMore'.
+		'Ctrl-Alt-Backspace'	-> 'delWordAfter'. 
+		'Shift-Cmd-Alt-F'		-> 'replaceAll'.
+		'Shift-Cmd-G'			-> 'findPrev'. 
+		'Shift-Cmd-Z'			-> 'redo'. 
+    	'fallthrough' 			-> { 'basic'. 'emacsy' }
+  }
+!
+
+pcKeyMap
+	^ #{
+		'Alt-Left' -> 		'goLineStart'. 
+		'Alt-Right' -> 		'goLineEnd'.
+		'Alt-Up' -> 		'goDocStart'. 
+		'Ctrl-A' -> 		'selectAll'. 
+		'Ctrl-Backspace' -> 'delWordBefore'. 
+		'Ctrl-D' -> 		'doIt'. 
+		'Ctrl-B' -> 		'browseIt'. 
+		'Ctrl-Delete' -> 		'delWordAfter'. 
+		'Ctrl-Down' -> 		'goDocEnd'.
+		'Ctrl-End' -> 		'goDocEnd'. 
+		'Ctrl-F' -> 		'find'.
+		'Ctrl-G' -> 		'findNext'. 
+		'Ctrl-I' -> 		'inspectIt'.
+		'Ctrl-Home' -> 		'goDocStart'. 
+		'Ctrl-Left' -> 		'goWordLeft'. 
+		'Ctrl-P' -> 		'printIt'.
+		'Ctrl-Right' -> 	'goWordRight'. 
+		'Ctrl-S' -> 		'saveIt'. 
+		'Ctrl-Y' -> 		'redo'.
+		'Ctrl-Z' -> 		'undo'. 
+		'Ctrl-[' -> 		'indentLess'. 
+		'Ctrl-]' -> 		'indentMore'.
+		'Shift-Ctrl-F' -> 	'replace'. 
+		'Shift-Ctrl-G' -> 	'findPrev'. 
+		'Shift-Ctrl-R' -> 	'replaceAll'.
+		'Shift-Ctrl-Z' -> 	'redo'. 
+		'fallthrough' -> 	#('basic')
+}
+! !
+
+!HLCodeWidget class methodsFor: 'hints'!
+
+hintFor: anEditor options: options
+	| cursor token completions |
+	
+	cursor := anEditor getCursor.
+	token := anEditor getTokenAt: cursor.
+	token at: 'state' put: ((CodeMirror basicAt: 'innerMode')
+		value: anEditor getMode value: (token at: 'state')) state.
+	
+	completions := token type = 'variable' 
+		ifTrue: [ HLCodeWidget variableHintFor: anEditor token: token ]
+		ifFalse: [ HLCodeWidget messageHintFor: anEditor token: token ].
+	
+	^ #{
+		'list' -> completions.
+		'from' -> ((CodeMirror basicAt: 'Pos') value: cursor line value: token end).
+		'to' -> ((CodeMirror basicAt: 'Pos') value: cursor line value: token start)
+	}
+!
+
+messageHintFor: anEditor token: aToken
+	^ (anEditor at: 'amberCodeWidget')
+		messageHintFor: anEditor token: aToken
+!
+
+variableHintFor: anEditor token: aToken
+	^ (anEditor at: 'amberCodeWidget')
+		variableHintFor: anEditor token: aToken
+! !
+
+!HLCodeWidget class methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	self 
+		setupCodeMirror;
+		setupCommands;
+		setupKeyMaps.
+!
+
+setupCodeMirror
+	< 
+		CodeMirror.keyMap.default.fallthrough = ["basic"];
+		CodeMirror.commands.autocomplete = function(cm) {
+			CodeMirror.showHint(cm, self._hintFor_options_);
+		}
+	>
+!
+
+setupCommands
+	(CodeMirror basicAt: 'commands') 
+		at: 'doIt' put: [ :cm | cm amberCodeWidget doIt ];
+		at: 'inspectIt' put: [ :cm | cm amberCodeWidget inspectIt ];
+		at: 'printIt' put: [ :cm | cm amberCodeWidget printIt ];
+		at: 'saveIt' put: [ :cm | cm amberCodeWidget saveIt ];
+		at: 'browseIt' put: [ :cm | cm amberCodeWidget browseIt ]
+!
+
+setupKeyMaps
+	<CodeMirror.keyMap['Amber'] = self._keyMap()>
+! !
+
+HLCodeWidget subclass: #HLNavigationCodeWidget
+	instanceVariableNames: 'methodContents'
+	package: 'Helios-Workspace'!
+
+!HLNavigationCodeWidget methodsFor: 'accessing'!
+
+configureEditor
+	super configureEditor.
+	self contents: self methodContents
+!
+
+contents: aString
+	self methodContents: aString.
+	super contents: aString
+!
+
+methodContents
+	^ methodContents ifNil: [ '' ]
+!
+
+methodContents: aString
+	^ methodContents := aString
+!
+
+previous
+	"for browser lists widget"
+!
+
+previous: aWidget
+	"for browser lists widget"
+! !
+
+!HLNavigationCodeWidget methodsFor: 'testing'!
+
+hasModification
+	^ (self methodContents = self contents) not
+! !
+
+!HLNavigationCodeWidget class methodsFor: 'instance creation'!
+
+on: aBrowserModel
+	^ self new
+		browserModel: aBrowserModel;
+		yourself
+! !
+
+!HLNavigationCodeWidget class methodsFor: 'testing'!
+
+canBeOpenAsTab
+	^ false
+! !
+
+HLNavigationCodeWidget subclass: #HLBrowserCodeWidget
+	instanceVariableNames: 'browserModel'
+	package: 'Helios-Workspace'!
+
+!HLBrowserCodeWidget methodsFor: 'accessing'!
+
+browserModel
+	^ browserModel
+!
+
+browserModel: aBrowserModel
+	browserModel := aBrowserModel.
+	self 
+		observeSystem;
+		observeBrowserModel
+! !
+
+!HLBrowserCodeWidget methodsFor: 'actions'!
+
+observeBrowserModel
+	self browserModel announcer
+		on: HLSaveSourceCode
+		send: #onSaveIt
+		to: self;
+		
+		on: HLShowInstanceToggled
+		send: #onShowInstanceToggled
+		to: self;
+		
+		on: HLSourceCodeSaved
+		send: #onSourceCodeSaved
+		to: self;
+		
+		on: HLAboutToChange
+		send: #onBrowserAboutToChange:
+		to: self;
+		
+		on: HLParseErrorRaised
+		send: #onParseError:
+		to: self;
+		
+		on: HLCompileErrorRaised
+		send: #onCompileError:
+		to: self;
+		
+		on: HLUnknownVariableErrorRaised
+		send: #onUnknownVariableError:
+		to: self;
+		
+		on: HLInstVarAdded 
+		send: #onInstVarAdded
+		to: self;
+		
+		on: HLMethodSelected 
+		send: #onMethodSelected:
+		to: self;
+		
+    	on: HLClassSelected 
+		send: #onClassSelected:
+		to: self;
+		
+		on: HLPackageSelected 
+		send: #onPackageSelected:
+		to: self;
+		
+    	on: HLProtocolSelected 
+		send: #onProtocolSelected: 
+		to: self;
+		
+		on: HLSourceCodeFocusRequested 
+		send: #onSourceCodeFocusRequested
+		to: self;
+		
+		on: HLShowTemplate
+		send: #onShowTemplate:
+		to: self
+!
+
+observeSystem
+	self browserModel systemAnnouncer
+    	on: MethodModified
+        send: #onMethodModified:
+		to: self
+!
+
+refresh
+	self hasModification ifTrue: [ ^ self ].
+    self hasFocus ifTrue: [ ^ self ].
+
+	self contents: self browserModel selectedMethod source
+!
+
+renderButtonsOn: html
+	html button 
+		class: 'button';
+		with: 'SaveIt';
+		onClick: [ self saveIt ].
+	super renderButtonsOn: html
+!
+
+saveIt
+	self browserModel saveSourceCode
+!
+
+unregister
+	super unregsiter.
+	
+	self browserModel announcer unsubscribe: self.
+	self browserModel systemAnnouncer unsubscribe: self
+! !
+
+!HLBrowserCodeWidget methodsFor: 'reactions'!
+
+onBrowserAboutToChange: anAnnouncement
+	| block |
+	
+	block := anAnnouncement actionBlock.
+	
+	self hasModification
+		ifTrue: [
+			self 
+				confirm: 'Changes have not been saved. Do you want to discard these changes?' 
+				ifTrue: [
+					"Don't ask twice"
+					self methodContents: self contents.
+					block value ].
+			
+			
+			HLChangeForbidden signal ]
+!
+
+onClassSelected: anAnnouncement
+	| class |
+	
+	class:= anAnnouncement item.
+	
+	class ifNil: [ ^ self contents: '' ].
+	self contents: class definition
+!
+
+onCompileError: anAnnouncement
+	self alert: anAnnouncement error messageText
+!
+
+onInstVarAdded
+	self browserModel save: self contents
+!
+
+onMethodModified: anAnnouncement
+	| method |
+	
+	method := anAnnouncement method.
+	
+	self browserModel selectedClass = method methodClass ifFalse: [ ^ self ].
+	self browserModel selectedMethod ifNil: [ ^ self ].
+	self browserModel selectedMethod selector = method selector ifFalse: [ ^ self ].
+
+	self refresh
+!
+
+onMethodSelected: anAnnouncement
+	| method |
+	
+	method := anAnnouncement item.
+	
+	method ifNil: [ ^ self contents: '' ].
+	self contents: method source
+!
+
+onPackageSelected: anAnnouncement
+	| package |
+	
+	package := anAnnouncement item.
+	
+	package ifNil: [ ^ self contents: '' ].
+	self contents: package definition
+!
+
+onParseError: anAnnouncement
+	| lineIndex newContents |
+	
+	lineIndex := 1.
+	
+	self contents: (String streamContents: [ :stream |
+		self contents linesDo: [ :each |
+			lineIndex = anAnnouncement line 
+				ifTrue: [ 
+					stream 
+						nextPutAll: (each copyFrom: 1 to: anAnnouncement column);
+						nextPutAll: '<- ';
+						nextPutAll: anAnnouncement message;
+						nextPutAll: ' ';
+						nextPutAll: (each copyFrom: anAnnouncement column + 1 to: each size) ]
+				ifFalse: [ stream nextPutAll: each ].
+			stream nextPutAll: String cr.
+			lineIndex := lineIndex + 1 ] ])
+!
+
+onProtocolSelected: anAnnouncement
+	self browserModel selectedClass ifNil: [ ^ self contents: '' ].
+	self contents: self browserModel selectedClass definition
+!
+
+onSaveIt
+	self browserModel save: self contents
+!
+
+onShowInstanceToggled
+	self browserModel selectedClass ifNil: [ ^ self contents: '' ].
+    
+	self contents: self browserModel selectedClass definition
+!
+
+onShowTemplate: anAnnouncement
+	self contents: anAnnouncement template
+!
+
+onSourceCodeFocusRequested
+	self focus
+!
+
+onSourceCodeSaved
+	self methodContents: self contents.
+	self updateState
+!
+
+onUnknownVariableError: anAnnouncement
+	| error |
+	
+	error := anAnnouncement error.
+	
+	self 
+		confirm: (String streamContents: [ :stream |
+			stream 
+				nextPutAll: error messageText;
+				nextPutAll: String cr;
+				nextPutAll: 'Would you like to define an instance variable?' ])
+		ifTrue: [
+			self browserModel addInstVarNamed: error variableName ]
+! !
+
+!HLBrowserCodeWidget class methodsFor: 'instance creation'!
+
+on: aBrowserModel
+	^ self new
+		browserModel: aBrowserModel;
+		yourself
+! !
+
+!HLBrowserCodeWidget class methodsFor: 'testing'!
+
+canBeOpenAsTab
+	^ false
+! !
+
+HLWidget subclass: #HLWorkspace
+	instanceVariableNames: 'codeWidget transcript'
+	package: 'Helios-Workspace'!
+
+!HLWorkspace methodsFor: 'accessing'!
+
+codeWidget
+	^ codeWidget ifNil: [ codeWidget := HLCodeWidget new ]
+!
+
+transcript
+	^ transcript ifNil: [ transcript := HLTranscript new ]
+! !
+
+!HLWorkspace methodsFor: 'actions'!
+
+focus
+	^ self codeWidget focus
+!
+
+unregister
+	super unregister.
+	self transcript unregister
+! !
+
+!HLWorkspace methodsFor: 'rendering'!
+
+renderContentOn: html
+	html with: (HLContainer with: (HLHorizontalSplitter
+		with: self codeWidget
+		with: [ :canvas | self renderTranscriptOn: canvas ]))
+!
+
+renderTranscriptOn: html
+	html div 
+		class: 'transcript-container';
+		with: [
+			html div
+				class: 'list-label';
+				with: 'Transcript'.
+			self transcript renderOn: html ]
+! !
+
+!HLWorkspace methodsFor: 'testing'!
+
+canHaveFocus
+	^ true
+! !
+
+!HLWorkspace class methodsFor: 'accessing'!
+
+tabClass
+	^ 'workspace'
+!
+
+tabLabel
+	^ 'Workspace'
+!
+
+tabPriority
+	^ 10
+! !
+
+!HLWorkspace class methodsFor: 'testing'!
+
+canBeOpenAsTab
+	^ true
+! !
+

Різницю між файлами не показано, бо вона завелика
+ 3809 - 0
src/IDE.js


+ 2391 - 0
src/IDE.st

@@ -0,0 +1,2391 @@
+Smalltalk createPackage: 'IDE'!
+Widget subclass: #ClassesList
+	instanceVariableNames: 'browser ul nodes'
+	package: 'IDE'!
+
+!ClassesList methodsFor: 'accessing'!
+
+browser
+	^ browser
+!
+
+browser: aBrowser
+	browser := aBrowser
+!
+
+category
+	^ self browser selectedPackage
+!
+
+getNodes
+	| classes children others |
+	classes := self browser classes.
+	children := #().
+	others := #().
+	classes do: [ :each |
+		(classes includes: each superclass)
+			ifFalse: [ children add: each ]
+			ifTrue: [ others add: each ]].
+	^ children collect: [ :each |
+		ClassesListNode on: each browser: self browser classes: others level: 0 ]
+!
+
+nodes
+	nodes ifNil: [ nodes := self getNodes ].
+	^ nodes
+!
+
+resetNodes
+	nodes := nil
+! !
+
+!ClassesList methodsFor: 'rendering'!
+
+renderOn: html
+	ul := html ul
+		class: 'amber_column browser classes';
+		yourself.
+	self updateNodes
+!
+
+updateNodes
+	ul contents: [ :html |
+		self nodes do: [ :each |
+			each renderOn: html ]]
+! !
+
+!ClassesList class methodsFor: 'instance creation'!
+
+on: aBrowser
+	^ self new
+		browser: aBrowser;
+		yourself
+! !
+
+Widget subclass: #ClassesListNode
+	instanceVariableNames: 'browser theClass level nodes'
+	package: 'IDE'!
+
+!ClassesListNode methodsFor: 'accessing'!
+
+browser
+	^ browser
+!
+
+browser: aBrowser
+	browser := aBrowser
+!
+
+getNodesFrom: aCollection
+	| children others |
+	children := #().
+	others := #().
+	aCollection do: [ :each |
+		(each superclass = self theClass)
+			ifTrue: [ children add: each ]
+			ifFalse: [ others add: each ]].
+	nodes:= children collect: [ :each |
+		ClassesListNode on: each browser: self browser classes: others level: self level + 1 ]
+!
+
+label
+	| str |
+	str := String new writeStream.
+	self level timesRepeat: [
+		str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;' ].
+	str nextPutAll: self theClass name.
+	^ str contents
+!
+
+level
+	^ level
+!
+
+level: anInteger
+	level := anInteger
+!
+
+nodes
+	^ nodes
+!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
+! !
+
+!ClassesListNode methodsFor: 'rendering'!
+
+renderOn: html
+	| li cssClass |
+	cssClass := ''.
+	li := html li
+		onClick: [ self browser selectClass: self theClass ].
+	li asJQuery html: self label.
+
+	self browser selectedClass = self theClass ifTrue: [
+		cssClass := cssClass, ' selected' ].
+
+	self theClass comment isEmpty ifFalse: [
+		cssClass := cssClass, ' commented' ].
+
+	li class: cssClass.
+
+	self nodes do: [ :each |
+		each renderOn: html ]
+! !
+
+!ClassesListNode class methodsFor: 'instance creation'!
+
+on: aClass browser: aBrowser classes: aCollection level: anInteger
+	^ self new
+		theClass: aClass;
+		browser: aBrowser;
+		level: anInteger;
+		getNodesFrom: aCollection;
+		yourself
+! !
+
+Object subclass: #DebugErrorHandler
+	instanceVariableNames: ''
+	package: 'IDE'!
+
+!DebugErrorHandler methodsFor: 'error handling'!
+
+handleError: anError
+	[ Debugger new
+		error: anError;
+		open ] on: Error do: [ :error |
+			ConsoleErrorHandler new handleError: error ]
+! !
+
+!DebugErrorHandler class methodsFor: 'initialization'!
+
+initialize
+	ErrorHandler register: self new
+! !
+
+Widget subclass: #SourceArea
+	instanceVariableNames: 'editor div receiver onDoIt'
+	package: 'IDE'!
+
+!SourceArea methodsFor: 'accessing'!
+
+currentLine
+	^ editor getLine: (editor getCursor line)
+!
+
+currentLineOrSelection
+	^ editor somethingSelected
+	ifFalse: [ self currentLine ]
+	ifTrue: [ self selection ]
+!
+
+editor
+	^ editor
+!
+
+onDoIt
+	^ onDoIt
+!
+
+onDoIt: aBlock
+	onDoIt := aBlock
+!
+
+receiver
+	^ receiver ifNil: [ DoIt new ]
+!
+
+receiver: anObject
+	receiver := anObject
+!
+
+selection
+	^ editor getSelection
+!
+
+setEditorOn: aTextarea
+	<self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
+		theme: 'ide.codeMirrorTheme'._settingValueIfAbsent_('default'),
+		mode: 'text/x-stsrc',
+		lineNumbers: true,
+		enterMode: 'flat',
+		indentWithTabs: true,
+		indentUnit: 4,
+		matchBrackets: true,
+		electricChars: false
+	})>
+!
+
+val
+	^ editor getValue
+!
+
+val: aString
+	editor setValue: aString
+! !
+
+!SourceArea methodsFor: 'actions'!
+
+clear
+	self val: ''
+!
+
+doIt
+	| result |
+	result := self eval: self currentLineOrSelection.
+	self onDoIt ifNotNil: [ self onDoIt value ].
+	^ result
+!
+
+eval: aString
+	| compiler |
+	compiler := Compiler new.
+	[ compiler parseExpression: aString ] on: Error do: [ :ex |
+		^ self alert: ex messageText ].
+	^ compiler evaluateExpression: aString on: self receiver
+!
+
+fileIn
+	Importer new import: self currentLineOrSelection readStream
+!
+
+focus
+	self editor focus.
+!
+
+handleKeyDown: anEvent
+	<if(anEvent.ctrlKey) {
+		if(anEvent.keyCode === 80) { //ctrl+p
+			self._printIt();
+			anEvent.preventDefault();
+			return false;
+		}
+		if(anEvent.keyCode === 68) { //ctrl+d
+			self._doIt();
+			anEvent.preventDefault();
+			return false;
+		}
+		if(anEvent.keyCode === 73) { //ctrl+i
+			self._inspectIt();
+			anEvent.preventDefault();
+			return false;
+		}
+	}>
+!
+
+inspectIt
+	self doIt inspect
+!
+
+print: aString
+	| start stop currentLine |
+	currentLine := (editor getCursor: false) line.
+	start := HashedCollection new.
+	start at: 'line' put: currentLine.
+	start at: 'ch' put: (editor getCursor: false) ch.
+	(editor getSelection) ifEmpty: [
+		"select current line if selection is empty"
+		start at: 'ch' put: (editor getLine: currentLine) size.
+		editor setSelection: #{'line' -> currentLine. 'ch' -> 0} end: start.
+	].
+	stop := HashedCollection new.
+	stop at: 'line' put: currentLine.
+	stop at: 'ch' put: ((start at: 'ch') + aString size + 2).
+
+	editor replaceSelection: (editor getSelection, ' ', aString, ' ').
+	editor setCursor: (editor getCursor: true).
+	editor setSelection: stop end: start
+!
+
+printIt
+	self print: self doIt printString.
+	self focus.
+! !
+
+!SourceArea methodsFor: 'events'!
+
+onKeyDown: aBlock
+	div onKeyDown: aBlock
+!
+
+onKeyUp: aBlock
+	div onKeyUp: aBlock
+! !
+
+!SourceArea methodsFor: 'rendering'!
+
+renderOn: html
+	| textarea |
+	div := html div class: 'source'.
+	div with: [ textarea := html textarea ].
+	self setEditorOn: textarea element.
+	div onKeyDown: [ :e | self handleKeyDown: e ]
+! !
+
+!SourceArea class methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	self setupCodeMirror
+!
+
+setupCodeMirror
+	< CodeMirror.keyMap["default"].fallthrough = ["basic"] >
+! !
+
+Widget subclass: #TabManager
+	instanceVariableNames: 'selectedTab tabs opened ul input'
+	package: 'IDE'!
+
+!TabManager methodsFor: 'accessing'!
+
+labelFor: aWidget
+	| label maxSize |
+	maxSize := 15.
+	label := aWidget label copyFrom: 0 to: (aWidget label size min: maxSize).
+	aWidget label size > maxSize ifTrue: [
+		label := label, '...' ].
+	^ label
+!
+
+tabs
+	^ tabs ifNil: [ tabs := Array new ]
+! !
+
+!TabManager methodsFor: 'actions'!
+
+close
+	opened ifTrue: [
+	'#amber' asJQuery hide.
+	ul asJQuery hide.
+	selectedTab hide.
+	self removeBodyMargin.
+	'body' asJQuery removeClass: 'amberBody'.
+	opened := false ]
+!
+
+closeTab: aWidget
+	self removeTab: aWidget.
+	self selectTab: self tabs last.
+	aWidget remove.
+	self update
+!
+
+newBrowserTab
+	Browser open
+!
+
+onResize: aBlock
+	'#amber' asJQuery resizable: #{
+		'handles' -> 'n'.
+		'resize' -> aBlock.
+		'minHeight' -> 230
+	}
+!
+
+onWindowResize: aBlock
+	window asJQuery resize: aBlock
+!
+
+open
+	opened ifFalse: [
+	'body' asJQuery addClass: 'amberBody'.
+	'#amber' asJQuery show.
+	ul asJQuery show.
+	self updateBodyMargin.
+	selectedTab show.
+	opened := true ]
+!
+
+removeBodyMargin
+	self setBodyMargin: 0
+!
+
+search: aString
+	| searchedClass |
+	searchedClass := Smalltalk globals at: aString.
+		searchedClass isClass
+			ifTrue: [ Browser openOn: searchedClass ]
+			ifFalse: [ ReferencesBrowser search: aString ]
+!
+
+selectTab: aWidget
+	self open.
+	selectedTab := aWidget.
+	self tabs do: [ :each |
+	each hide ].
+	aWidget show.
+	
+	self update
+!
+
+setBodyMargin: anInteger
+	'.amberBody' asJQuery css: 'margin-bottom' put: anInteger asString, 'px'
+!
+
+updateBodyMargin
+	self setBodyMargin: '#amber' asJQuery height
+!
+
+updatePosition
+	'#amber' asJQuery
+		css: 'top' put: '';
+		css: 'bottom' put: '0px'
+! !
+
+!TabManager methodsFor: 'adding/Removing'!
+
+addTab: aWidget
+	self tabs add: aWidget.
+	aWidget appendToJQuery: '#amber' asJQuery.
+	aWidget hide
+!
+
+removeTab: aWidget
+	self tabs remove: aWidget.
+	self update
+! !
+
+!TabManager methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	Inspector register: IDEInspector.
+	opened := true.
+	[ :html | html div id: 'amber' ] appendToJQuery: 'body' asJQuery.
+	'body' asJQuery
+	addClass: 'amberBody'.
+	self appendToJQuery: '#amber' asJQuery.
+	self
+	addTab: IDETranscript current;
+	addTab: Workspace new;
+	addTab: TestRunner new.
+	self selectTab: self tabs last.
+	self
+	onResize: [ self updateBodyMargin; updatePosition ];
+	onWindowResize: [ self updatePosition ]
+! !
+
+!TabManager methodsFor: 'rendering'!
+
+renderOn: html
+	html div id: 'logo'.
+	self renderToolbarOn: html.
+	ul := html ul
+		id: 'amberTabs';
+		yourself.
+	self renderTabs
+!
+
+renderTabFor: aWidget on: html
+	| li |
+	li := html li.
+	selectedTab = aWidget ifTrue: [
+	li class: 'selected' ].
+	li with: [
+		html span class: 'ltab'.
+		html span
+			class: 'mtab';
+			with: [
+				aWidget canBeClosed ifTrue: [
+					html span
+						class: 'close';
+						with: 'x';
+					onClick: [ self closeTab: aWidget ]].
+			html span with: (self labelFor: aWidget) ].
+		html span class: 'rtab' ];
+	onClick: [ self selectTab: aWidget ]
+!
+
+renderTabs
+	ul contents: [ :html |
+		self tabs do: [ :each |
+		self renderTabFor: each on: html ].
+		html li
+		class: 'newtab';
+		with: [
+			html span class: 'ltab'.
+			html span class: 'mtab'; with: ' + '.
+			html span class: 'rtab' ];
+		onClick: [ self newBrowserTab ]]
+!
+
+renderToolbarOn: html
+	html div
+		id: 'amber_toolbar';
+		with: [
+			input := html input
+				class: 'implementors';
+				yourself.
+			input onKeyPress: [ :event |
+				event keyCode = 13 ifTrue: [
+				self search: input asJQuery val ]].
+			html div id: 'amber_close'; onClick: [ self close ]]
+! !
+
+!TabManager methodsFor: 'updating'!
+
+update
+	self renderTabs
+! !
+
+TabManager class instanceVariableNames: 'current'!
+
+!TabManager class methodsFor: 'actions'!
+
+toggleAmberIDE
+	'#amber' asJQuery length = 0
+		ifTrue: [ Browser open ]
+		ifFalse: [
+			('#amber' asJQuery is: ':visible')
+				ifTrue: [ TabManager current close ]
+				ifFalse: [ TabManager current open ] ]
+! !
+
+!TabManager class methodsFor: 'instance creation'!
+
+current
+	^ current ifNil: [ current := super new ]
+!
+
+new
+	self shouldNotImplement
+! !
+
+Widget subclass: #TabWidget
+	instanceVariableNames: 'div'
+	package: 'IDE'!
+
+!TabWidget methodsFor: 'accessing'!
+
+label
+	self subclassResponsibility
+! !
+
+!TabWidget methodsFor: 'actions'!
+
+close
+	TabManager current closeTab: self
+!
+
+hide
+	div asJQuery hide
+!
+
+open
+	TabManager current addTab: self.
+	TabManager current selectTab: self
+!
+
+remove
+	div asJQuery remove
+!
+
+show
+	div asJQuery show
+! !
+
+!TabWidget methodsFor: 'rendering'!
+
+renderBoxOn: html
+!
+
+renderButtonsOn: html
+!
+
+renderOn: html
+	div := html div
+		class: 'amberTool';
+		yourself.
+	self renderTab
+!
+
+renderTab
+	div contents: [ :html |
+		html div
+		class: 'amber_box';
+		with: [ self renderBoxOn: html ].
+		html div
+		class: 'amber_buttons';
+		with: [ self renderButtonsOn: html ]]
+!
+
+update
+	self renderTab
+! !
+
+!TabWidget methodsFor: 'testing'!
+
+canBeClosed
+	^ false
+! !
+
+!TabWidget class methodsFor: 'instance creation'!
+
+open
+	^ self new open
+! !
+
+TabWidget subclass: #Browser
+	instanceVariableNames: 'selectedPackage selectedClass selectedProtocol selectedMethod packagesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges'
+	package: 'IDE'!
+
+!Browser methodsFor: 'accessing'!
+
+classCommentSource
+	^ selectedClass comment
+!
+
+classDeclarationSource
+	| stream |
+	stream := '' writeStream.
+	selectedClass ifNil: [ ^ self classDeclarationTemplate ].
+	stream
+		nextPutAll: selectedClass superclass asString;
+		nextPutAll: ' subclass: #';
+		nextPutAll: selectedClass name;
+		nextPutAll: String lf, String tab;
+		nextPutAll: 'instanceVariableNames: '''.
+	selectedClass instanceVariableNames
+		do: [ :each | stream nextPutAll: each ]
+		separatedBy: [ stream nextPutAll: ' ' ].
+	stream
+		nextPutAll: '''', String lf, String tab;
+		nextPutAll: 'package: ''';
+		nextPutAll: selectedClass category;
+		nextPutAll: ''''.
+	^ stream contents
+!
+
+classDeclarationTemplate
+	^ 'Object subclass: #NameOfSubclass
+	instanceVariableNames: ''''
+	package: ''', self selectedPackage, ''''
+!
+
+classes
+	^ ((Smalltalk classes
+	select: [ :each | each category = selectedPackage ])
+	sort: [ :a :b | a name < b name ]) asSet
+!
+
+declarationSource
+	^ selectedTab = #instance
+	ifTrue: [ self classDeclarationSource ]
+	ifFalse: [ self metaclassDeclarationSource ]
+!
+
+dummyMethodSource
+	^ 'messageSelectorAndArgumentNames
+	"comment stating purpose of message"
+
+	| temporary variable names |
+	statements'
+!
+
+label
+	^ selectedClass
+	ifNil: [ 'Browser (nil)' ]
+	ifNotNil: [ 'Browser: ', selectedClass name ]
+!
+
+metaclassDeclarationSource
+	| stream |
+	stream := '' writeStream.
+	selectedClass ifNotNil: [
+	stream
+		nextPutAll: selectedClass asString;
+		nextPutAll: ' class ';
+		nextPutAll: 'instanceVariableNames: '''.
+	selectedClass class instanceVariableNames
+		do: [ :each | stream nextPutAll: each ]
+		separatedBy: [ stream nextPutAll: ' ' ].
+	stream nextPutAll: '''' ].
+	^ stream contents
+!
+
+methodSource
+	^ selectedMethod
+	ifNil: [ self dummyMethodSource ]
+	ifNotNil: [ selectedMethod source ]
+!
+
+methods
+	| klass |
+	selectedTab = #comment ifTrue: [ ^ #() ].
+	selectedClass ifNotNil: [
+	klass := selectedTab = #instance
+		ifTrue: [ selectedClass ]
+		ifFalse: [ selectedClass class ]].
+	^ (selectedProtocol
+	ifNil: [
+		klass
+		ifNil: [ #() ]
+		ifNotNil: [ klass methodDictionary values ]]
+	ifNotNil: [
+		klass methodsInProtocol: selectedProtocol ]) 
+				sort: [ :a :b | a selector < b selector ]
+!
+
+packages
+	| packages |
+	packages := Array new.
+	Smalltalk classes do: [ :each |
+	(packages includes: each category) ifFalse: [
+		packages add: each category ]].
+	^ packages sort
+!
+
+protocols
+	| klass |
+	selectedClass ifNotNil: [
+	selectedTab = #comment ifTrue: [ ^ #() ].
+	klass := selectedTab = #instance
+		ifTrue: [ selectedClass ]
+		ifFalse: [ selectedClass class ].
+	klass methodDictionary isEmpty ifTrue: [
+		^ Array with: 'not yet classified' ].
+	^ klass protocols ].
+	^ Array new
+!
+
+selectedClass
+	^ selectedClass
+!
+
+selectedPackage
+	^ selectedPackage
+!
+
+source
+	selectedTab = #comment ifFalse: [
+	^ (selectedProtocol notNil or: [ selectedMethod notNil ])
+		ifFalse: [ self declarationSource ]
+		ifTrue: [ self methodSource ]].
+	^ selectedClass
+	ifNil: [ '' ]
+	ifNotNil: [ self classCommentSource ]
+! !
+
+!Browser methodsFor: 'actions'!
+
+addInstanceVariableNamed: aString toClass: aClass
+	ClassBuilder new
+		addSubclassOf: aClass superclass
+		named: aClass name
+		instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
+		package: aClass package name
+!
+
+addNewClass
+	| className |
+	className := self prompt: 'New class'.
+	(className notNil and: [ className notEmpty ]) ifTrue: [
+		Object subclass: className instanceVariableNames: '' package: self selectedPackage.
+			self
+			resetClassesList;
+			updateClassesList.
+		self selectClass: (Smalltalk globals at: className) ]
+!
+
+addNewProtocol
+	| newProtocol |
+	
+	newProtocol := self prompt: 'New method protocol'.
+	
+	(newProtocol notNil and: [ newProtocol notEmpty ]) ifTrue: [
+		selectedMethod protocol: newProtocol.
+		self setMethodProtocol: newProtocol ]
+!
+
+cancelChanges
+	^ unsavedChanges
+	ifTrue: [ self confirm: 'Cancel changes?' ]
+	ifFalse: [ true ]
+!
+
+commitPackage
+	selectedPackage ifNotNil: [
+		(Package named: selectedPackage) commit ]
+!
+
+compile
+	| currentEditLine |
+	self disableSaveButton.
+	currentEditLine := sourceArea editor getCursor.
+	selectedTab = #comment
+	ifTrue: [
+			selectedClass ifNotNil: [
+				self compileClassComment ]]
+	ifFalse: [
+			(selectedProtocol notNil or: [ selectedMethod notNil ])
+				ifFalse: [ self compileDefinition ]
+				ifTrue: [ self compileMethodDefinition ]].
+	sourceArea editor setCursor: currentEditLine.
+!
+
+compileClassComment
+	selectedClass comment: sourceArea val
+!
+
+compileDefinition
+	| newClass |
+	newClass := Compiler new evaluateExpression: sourceArea val.
+	self
+	resetClassesList;
+	updateCategoriesList;
+	updateClassesList.
+	self selectClass: newClass
+!
+
+compileMethodDefinition
+	selectedTab = #instance
+	ifTrue: [ self compileMethodDefinitionFor: selectedClass ]
+	ifFalse: [ self compileMethodDefinitionFor: selectedClass class ]
+!
+
+compileMethodDefinitionFor: aClass
+	| compiler method source node |
+	source := sourceArea val.
+	selectedProtocol ifNil: [ selectedProtocol := selectedMethod protocol ].
+	compiler := Compiler new.
+	compiler source: source.
+	node := compiler parse: source.
+	node isParseFailure ifTrue: [
+	^ self alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString ].
+	compiler currentClass: aClass.
+	method := compiler eval: (compiler compileNode: node).
+	compiler unknownVariables do: [ :each |
+		"Do not try to redeclare javascript's objects"
+		(PlatformInterface existsGlobal: each) ifFalse: [
+		(self confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
+			self addInstanceVariableNamed: each toClass: aClass.
+			^ self compileMethodDefinitionFor: aClass ]] ].
+	ClassBuilder new installMethod: method forClass: aClass protocol: selectedProtocol.
+	self updateMethodsList.
+	self selectMethod: method
+!
+
+copyClass
+	| className |
+	className := self prompt: 'Copy class'.
+	(className notNil and: [ className notEmpty ]) ifTrue: [
+		ClassBuilder new copyClass: self selectedClass named: className.
+			self
+			resetClassesList;
+			updateClassesList.
+		self selectClass: (Smalltalk globals at: className) ]
+!
+
+disableSaveButton
+	saveButton ifNotNil: [
+	saveButton at: 'disabled' put: true ].
+	unsavedChanges := false
+!
+
+handleSourceAreaKeyDown: anEvent
+	<if(anEvent.ctrlKey) {
+		if(anEvent.keyCode === 83) { //ctrl+s
+			self._compile();
+			anEvent.preventDefault();
+			return false;
+		}
+	}
+	>
+!
+
+hideClassButtons
+	classButtons asJQuery hide
+!
+
+hideMethodButtons
+	methodButtons asJQuery hide
+!
+
+removeClass
+	(self confirm: 'Do you really want to remove ', selectedClass name, '?')
+	ifTrue: [
+		Smalltalk removeClass: selectedClass.
+		self resetClassesList.
+		self selectClass: nil ]
+!
+
+removeMethod
+	self cancelChanges ifTrue: [
+	(self confirm: 'Do you really want to remove #', selectedMethod selector, '?')
+		ifTrue: [
+		selectedTab = #instance
+			ifTrue: [ selectedClass removeCompiledMethod: selectedMethod ]
+			ifFalse: [ selectedClass class removeCompiledMethod: selectedMethod ].
+		self selectMethod: nil ]]
+!
+
+removePackage
+
+	(self confirm: 'Do you really want to remove the whole package ', selectedPackage, ' with all its classes?')
+	ifTrue: [
+		Smalltalk removePackage: selectedPackage.
+		self updateCategoriesList ]
+!
+
+renameClass
+	| newName |
+	newName := self prompt: 'Rename class ', selectedClass name.
+	(newName notNil and: [ newName notEmpty ]) ifTrue: [
+	selectedClass rename: newName.
+	self
+		updateClassesList;
+		updateSourceAndButtons ]
+!
+
+renamePackage
+
+	| newName |
+	newName := self prompt: 'Rename package ', selectedPackage.
+	newName ifNotNil: [
+	newName notEmpty ifTrue: [
+	Smalltalk renamePackage: selectedPackage to: newName.
+	self updateCategoriesList ]]
+!
+
+search: aString
+	self cancelChanges ifTrue: [ | searchedClass |
+		searchedClass := Smalltalk globals at: aString.
+		searchedClass isClass
+			ifTrue: [ self class openOn: searchedClass ]
+			ifFalse: [ self searchReferencesOf: aString ]]
+!
+
+searchClassReferences
+	ReferencesBrowser search: selectedClass name
+!
+
+searchReferencesOf: aString
+	ReferencesBrowser search: aString
+!
+
+selectCategory: aCategory
+	self cancelChanges ifTrue: [
+	selectedPackage := aCategory.
+	selectedClass := selectedProtocol := selectedMethod := nil.
+	self resetClassesList.
+	self
+		updateCategoriesList;
+		updateClassesList;
+		updateProtocolsList;
+		updateMethodsList;
+		updateSourceAndButtons ]
+!
+
+selectClass: aClass
+	self cancelChanges ifTrue: [
+	selectedClass := aClass.
+	selectedProtocol := selectedMethod := nil.
+	self
+		updateClassesList;
+		updateProtocolsList;
+		updateMethodsList;
+		updateSourceAndButtons ]
+!
+
+selectMethod: aMethod
+	self cancelChanges ifTrue: [
+	selectedMethod := aMethod.
+	self
+		updateProtocolsList;
+		updateMethodsList;
+		updateSourceAndButtons ]
+!
+
+selectProtocol: aString
+	self cancelChanges ifTrue: [
+	selectedProtocol := aString.
+	selectedMethod := nil.
+	self
+		updateProtocolsList;
+		updateMethodsList;
+		updateSourceAndButtons ]
+!
+
+selectTab: aString
+	self cancelChanges ifTrue: [
+	selectedTab := aString.
+	self selectProtocol: nil.
+	self updateTabsList ]
+!
+
+setMethodProtocol: aString
+	self cancelChanges ifTrue: [
+	(self protocols includes: aString)
+		ifFalse: [ self addNewProtocol ]
+		ifTrue: [
+		selectedMethod protocol: aString.
+		selectedProtocol := aString.
+		selectedMethod := selectedMethod.
+		self
+			updateProtocolsList;
+			updateMethodsList;
+			updateSourceAndButtons ]]
+!
+
+showClassButtons
+	classButtons asJQuery show
+!
+
+showMethodButtons
+	methodButtons asJQuery show
+! !
+
+!Browser methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	selectedTab := #instance.
+	selectedPackage := self packages first.
+	unsavedChanges := false
+! !
+
+!Browser methodsFor: 'rendering'!
+
+renderBottomPanelOn: html
+	html div
+	class: 'amber_sourceCode';
+	with: [
+		sourceArea := SourceArea new.
+		sourceArea renderOn: html.
+			sourceArea onKeyDown: [ :e |
+				self handleSourceAreaKeyDown: e ].
+		sourceArea onKeyUp: [ self updateStatus ]]
+!
+
+renderBoxOn: html
+	self
+	renderTopPanelOn: html;
+	renderTabsOn: html;
+	renderBottomPanelOn: html
+!
+
+renderButtonsOn: html
+	saveButton := html button.
+	saveButton
+	with: 'Save';
+	onClick: [ self compile ].
+	methodButtons := html span.
+	classButtons := html span.
+	html div
+	class: 'right';
+	with: [
+		html button
+			with: 'DoIt';
+			onClick: [ sourceArea doIt ].
+		html button
+			with: 'PrintIt';
+			onClick: [ sourceArea printIt ].
+		html button with: 'InspectIt';
+			onClick: [ sourceArea inspectIt ]].
+	self updateSourceAndButtons
+!
+
+renderTabsOn: html
+	tabsList := html ul class: 'amber_tabs amber_browser'.
+	self updateTabsList.
+!
+
+renderTopPanelOn: html
+	html div
+		class: 'top';
+		with: [
+			packagesList := html ul class: 'amber_column browser packages'.
+				html div class: 'amber_packagesButtons'; with: [
+				html button
+					title: 'Commit classes in this package to disk';
+					onClick: [ self commitPackage ];
+					with: 'Commit'.
+					html button
+					title: 'Rename package';
+					onClick: [ self renamePackage ];
+					with: 'Rename'.
+					html button
+					title: 'Remove this package from the system';
+					onClick: [ self removePackage ];
+					with: 'Remove' ].
+			classesList := ClassesList on: self.
+			classesList renderOn: html.
+			protocolsList := html ul class: 'amber_column browser protocols'.
+			methodsList := html ul class: 'amber_column browser methods'.
+			self
+				updateCategoriesList;
+				updateClassesList;
+				updateProtocolsList;
+				updateMethodsList.
+			html div class: 'amber_clear' ]
+! !
+
+!Browser methodsFor: 'testing'!
+
+canBeClosed
+	^ true
+! !
+
+!Browser methodsFor: 'updating'!
+
+resetClassesList
+	classesList resetNodes
+!
+
+updateCategoriesList
+	packagesList contents: [ :html |
+	self packages do: [ :each || li label |
+		each isEmpty
+		ifTrue: [ label := 'Unclassified' ]
+		ifFalse: [ label := each ].
+		li := html li.
+		selectedPackage = each ifTrue: [
+		li class: 'selected' ].
+		li
+		with: label;
+		onClick: [ self selectCategory: each ]] ]
+!
+
+updateClassesList
+	TabManager current update.
+	classesList updateNodes
+!
+
+updateMethodsList
+	methodsList contents: [ :html |
+	self methods do: [ :each || li |
+		li := html li.
+		selectedMethod = each ifTrue: [
+		li class: 'selected' ].
+		li
+		with: each selector;
+		onClick: [ self selectMethod: each ]] ]
+!
+
+updateProtocolsList
+	protocolsList contents: [ :html |
+	self protocols do: [ :each || li |
+		li := html li.
+		selectedProtocol = each ifTrue: [
+		li class: 'selected' ].
+		li
+		with: each;
+		onClick: [ self selectProtocol: each ]] ]
+!
+
+updateSourceAndButtons
+	| currentProtocol |
+
+	self disableSaveButton.
+	classButtons contents: [ :html |
+		html button
+			title: 'Create a new class';
+			onClick: [ self addNewClass ];
+			with: 'New class'.
+		html button
+			with: 'Rename class';
+			onClick: [ self renameClass ].
+		html button
+			with: 'Copy class';
+			onClick: [ self copyClass ].
+		html button
+			with: 'Remove class';
+			onClick: [ self removeClass ].
+		html button
+			with: 'References';
+			onClick: [ self searchClassReferences ]].
+	methodButtons contents: [ :html | | protocolSelect referencesSelect |
+		html button
+			with: 'Remove method';
+			onClick: [ self removeMethod ].
+		protocolSelect := html select.
+				protocolSelect
+			onChange: [ self setMethodProtocol: protocolSelect asJQuery val ];
+			with: [
+				html option
+					with: 'Method protocol';
+					at: 'disabled' put: 'disabled'.
+				html option
+					class: 'important';
+					with: 'New...'.
+				currentProtocol := selectedProtocol.
+				(currentProtocol isNil and: [ selectedMethod notNil ])
+					ifTrue: [ currentProtocol := selectedMethod category ].
+				self protocols do: [ :each | | option |
+					option := html option with: each.
+					currentProtocol = each ifTrue: [ option at: 'selected' put: 'selected' ] ] ].
+		selectedMethod isNil ifFalse: [
+			referencesSelect := html select.
+						referencesSelect
+				onChange: [ self searchReferencesOf: referencesSelect asJQuery val ];
+				with: [ |option|
+					html option
+						with: 'References';
+						at: 'disabled' put: 'disabled';
+						at: 'selected' put: 'selected'.
+					html option
+						class: 'important';
+						with: selectedMethod selector.
+					selectedMethod messageSends sorted do: [ :each |
+						html option with: each ]] ]].
+	selectedMethod isNil
+		ifTrue: [
+			self hideMethodButtons.
+				(selectedClass isNil or: [ selectedProtocol notNil ])
+					ifTrue: [ self hideClassButtons ]
+					ifFalse: [ self showClassButtons ]]
+		ifFalse: [
+			self hideClassButtons.
+			self showMethodButtons ].
+	sourceArea val: self source
+!
+
+updateStatus
+	sourceArea val = self source
+		ifTrue: [
+			saveButton ifNotNil: [
+				saveButton at: 'disabled' put: true ].
+				unsavedChanges := false ]
+		ifFalse: [
+			saveButton ifNotNil: [
+				saveButton removeAt: 'disabled' ].
+			unsavedChanges := true ]
+!
+
+updateTabsList
+	tabsList contents: [ :html || li |
+	li := html li.
+	selectedTab = #instance ifTrue: [ li class: 'selected' ].
+	li
+		with: [
+		html span class: 'ltab'.
+		html span class: 'mtab'; with: 'Instance'.
+		html span class: 'rtab' ];
+		onClick: [ self selectTab: #instance ].
+	li := html li.
+	selectedTab = #class ifTrue: [ li class: 'selected' ].
+	li
+		with: [
+		html span class: 'ltab'.
+		html span class: 'mtab'; with: 'Class'.
+		html span class: 'rtab' ];
+		onClick: [ self selectTab: #class ].
+	li := html li.
+	selectedTab = #comment ifTrue: [ li class: 'selected' ].
+	li
+		with: [
+		html span class: 'ltab'.
+		html span class: 'mtab'; with: 'Comment'.
+		html span class: 'rtab' ];
+		onClick: [ self selectTab: #comment ]]
+! !
+
+!Browser class methodsFor: 'convenience'!
+
+open
+	self new open
+!
+
+openOn: aClass
+	^ self new
+	open;
+	selectCategory: aClass category;
+	selectClass: aClass
+! !
+
+TabWidget subclass: #Debugger
+	instanceVariableNames: 'error selectedContext sourceArea ul ul2 inspector saveButton unsavedChanges selectedVariable selectedVariableName inspectButton'
+	package: 'IDE'!
+
+!Debugger methodsFor: 'accessing'!
+
+allVariables
+	| all |
+	all := Dictionary new.
+
+	self receiver class allInstanceVariableNames do: [ :each |
+		all at: each put: (self receiver instVarAt: each) ].
+	
+	selectedContext locals keysAndValuesDo: [ :key :value |
+		all at: key put: value ].
+	
+	^ all
+!
+
+error
+	^ error
+!
+
+error: anError
+	error := anError
+!
+
+label
+	^ '[ Debugger ]'
+!
+
+method
+	^ selectedContext method
+!
+
+receiver
+	^ selectedContext receiver
+!
+
+source
+	^ self method
+		ifNil: [ 'Method doesn''t exist!!' ]
+		ifNotNil: [ self method source ]
+! !
+
+!Debugger methodsFor: 'actions'!
+
+inspectSelectedVariable
+	selectedVariable inspect
+!
+
+proceed
+	self close.
+	selectedContext receiver perform: selectedContext selector withArguments: selectedContext temps
+!
+
+save
+	| protocol |
+	protocol := (selectedContext receiver class methodDictionary at: selectedContext selector) category.
+	selectedContext receiver class compile: sourceArea val category: protocol.
+	self updateStatus
+!
+
+selectContext: aContext
+	selectedContext := aContext.
+	selectedVariable := nil.
+	selectedVariableName := nil.
+	self
+		updateContextsList;
+		updateSourceArea;
+		updateInspector;
+		updateVariablesList;
+		updateStatus
+!
+
+selectVariable: anObject named: aString
+	
+	selectedVariable := anObject.
+	selectedVariableName := aString.
+	inspector contents: [ :html | html with: anObject printString ].
+	self updateVariablesList
+! !
+
+!Debugger methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	unsavedChanges = false
+! !
+
+!Debugger methodsFor: 'rendering'!
+
+renderBottomPanelOn: html
+	html div
+		class: 'amber_sourceCode debugger';
+		with: [
+			sourceArea := SourceArea new.
+			sourceArea renderOn: html ].
+	ul2 := html ul class: 'amber_column debugger variables'.
+	inspector := html div class: 'amber_column debugger inspector'.
+	sourceArea
+		onKeyUp: [ self updateStatus ]
+!
+
+renderBoxOn: html
+	self
+		renderTopPanelOn: html;
+		renderBottomPanelOn: html
+!
+
+renderButtonsOn: html
+	saveButton := html button
+		with: 'Save';
+		onClick: [ self save ].
+	html button
+		with: 'DoIt';
+		onClick: [ sourceArea doIt ].
+	html button
+		with: 'PrintIt';
+		onClick: [ sourceArea printIt ].
+	html button
+		with: 'InspectIt';
+		onClick: [ sourceArea inspectIt ].
+	html button
+		with: 'Proceed';
+		onClick: [ self proceed ].
+	html button
+		with: 'Abandon';
+		onClick: [ self close ].
+	inspectButton := html button
+		class: 'amber_button debugger inspect';
+		with: 'Inspect';
+		onClick: [ self inspectSelectedVariable ].
+	self
+		updateSourceArea;
+		updateStatus;
+		updateVariablesList;
+		updateInspector
+!
+
+renderContext: aContext on: html
+	| li |
+	li := html li.
+	selectedContext = aContext ifTrue: [
+		li class: 'selected' ].
+	li
+		with: aContext asString;
+		onClick: [ self selectContext: aContext ].
+	aContext outerContext ifNotNil: [ self renderContext: aContext outerContext on: html ]
+!
+
+renderTopPanelOn: html
+	selectedContext := self error context.
+	html div
+		class: 'top';
+		with: [
+			html div
+				class: 'label';
+				with: self error messageText.
+			ul := html ul
+				class: 'amber_column debugger contexts';
+				with: [ self renderContext: self error context on: html ]]
+! !
+
+!Debugger methodsFor: 'testing'!
+
+canBeClosed
+	^ true
+! !
+
+!Debugger methodsFor: 'updating'!
+
+updateContextsList
+	ul contents: [ :html |
+		self renderContext: self error context on: html ]
+!
+
+updateInspector
+	inspector contents: [ :html | ]
+!
+
+updateSourceArea
+	sourceArea val: self source
+!
+
+updateStatus
+	sourceArea val = self source
+		ifTrue: [
+			saveButton ifNotNil: [
+				saveButton at: 'disabled' put: true ].
+			unsavedChanges := false ]
+		ifFalse: [
+			saveButton ifNotNil: [
+				saveButton removeAt: 'disabled' ].
+			unsavedChanges := true ]
+!
+
+updateVariablesList
+	ul2 contents: [ :html | | li |
+		li := html li
+			with: 'self';
+			onClick: [ self selectVariable: self receiver named: 'self' ].
+				selectedVariableName = 'self' ifTrue: [ li class: 'selected' ].
+		
+		self allVariables keysAndValuesDo: [ :key :value |
+						li := html li
+							with: key;
+							onClick: [ self selectVariable: value named: key ].
+						selectedVariableName = key ifTrue: [
+							li class: 'selected' ] ] ].
+							
+	selectedVariable
+		ifNil: [ inspectButton at: 'disabled' put: true ]
+		ifNotNil: [ inspectButton removeAt: 'disabled' ]
+! !
+
+TabWidget subclass: #IDEInspector
+	instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea diveButton sourceArea'
+	package: 'IDE'!
+
+!IDEInspector methodsFor: 'accessing'!
+
+label
+	^ label ifNil: [ 'Inspector (nil)' ]
+!
+
+selectedVariable
+	^ selectedVariable
+!
+
+selectedVariable: aString
+	selectedVariable := aString
+!
+
+setLabel: aString
+	label := aString
+!
+
+setVariables: aCollection
+	variables := aCollection
+!
+
+sourceArea
+	^ sourceArea
+!
+
+variables
+	^ variables
+! !
+
+!IDEInspector methodsFor: 'actions'!
+
+dive
+	(self variables at: self selectedVariable) inspect
+!
+
+inspect: anObject
+	object := anObject.
+	variables := #().
+	object inspectOn: self
+!
+
+refresh
+	self
+		inspect: object;
+		updateVariablesList;
+		updateValueTextarea
+! !
+
+!IDEInspector methodsFor: 'rendering'!
+
+renderBottomPanelOn: html
+	html div
+	class: 'amber_sourceCode';
+	with: [
+		sourceArea := SourceArea new
+		receiver: object;
+		onDoIt: [ self refresh ];
+		yourself.
+			sourceArea renderOn: html ]
+!
+
+renderBoxOn: html
+	self
+		renderTopPanelOn: html;
+		renderBottomPanelOn: html
+!
+
+renderButtonsOn: html
+	html button
+		with: 'DoIt';
+		onClick: [ self sourceArea doIt ].
+	html button
+		with: 'PrintIt';
+		onClick: [ self sourceArea printIt ].
+	html button
+		with: 'InspectIt';
+		onClick: [ self sourceArea inspectIt ].
+	self updateButtons
+!
+
+renderTopPanelOn: html
+	html div
+		class: 'top';
+		with: [
+			variablesList := html ul class: 'amber_column variables'.
+			valueTextarea := html textarea class: 'amber_column value'; at: 'readonly' put: 'readonly'; yourself.
+			html div class: 'amber_tabs inspector'; with: [
+				html button
+					class: 'amber_button inspector refresh';
+					with: 'Refresh';
+					onClick: [ self refresh ].
+				diveButton := html button
+					class: 'amber_button inspector dive';
+					with: 'Dive';
+					onClick: [ self dive ]].
+			html div class: 'amber_clear' ].
+	self
+		updateVariablesList;
+		updateValueTextarea.
+! !
+
+!IDEInspector methodsFor: 'testing'!
+
+canBeClosed
+	^ true
+! !
+
+!IDEInspector methodsFor: 'updating'!
+
+selectVariable: aString
+	self selectedVariable: aString.
+	self
+		updateVariablesList;
+		updateValueTextarea;
+		updateButtons
+!
+
+updateButtons
+	(self selectedVariable notNil and: [ (self variables at: self selectedVariable) notNil ])
+		ifFalse: [ diveButton at: 'disabled' put: true ]
+		ifTrue: [ diveButton removeAt: 'disabled' ]
+!
+
+updateValueTextarea
+	valueTextarea asJQuery val: (self selectedVariable isNil
+		ifTrue: [ '' ]
+		ifFalse: [ (self variables at: self selectedVariable) printString ])
+!
+
+updateVariablesList
+	variablesList contents: [ :html |
+		self variables keysDo: [ :each || li |
+			li := html li.
+			li
+				with: each;
+				onClick: [ self selectVariable: each ].
+			self selectedVariable = each ifTrue: [
+				li class: 'selected' ]] ]
+! !
+
+!IDEInspector class methodsFor: 'instance creation'!
+
+inspect: anObject
+	^ self new
+		inspect: anObject;
+		open;
+		yourself
+!
+
+on: anObject
+	^ self new
+		inspect: anObject;
+		yourself
+! !
+
+TabWidget subclass: #IDETranscript
+	instanceVariableNames: 'textarea'
+	package: 'IDE'!
+
+!IDETranscript methodsFor: 'accessing'!
+
+label
+	^ 'Transcript'
+! !
+
+!IDETranscript methodsFor: 'actions'!
+
+clear
+	textarea asJQuery val: ''
+!
+
+cr
+	textarea asJQuery val: textarea asJQuery val, String cr.
+!
+
+open
+	TabManager current
+	open;
+	selectTab: self
+!
+
+show: anObject
+	textarea ifNil: [ self open ].
+	textarea asJQuery val: textarea asJQuery val, anObject asString.
+! !
+
+!IDETranscript methodsFor: 'rendering'!
+
+renderBoxOn: html
+	textarea := html textarea.
+	textarea
+	class: 'amber_transcript';
+	at: 'spellcheck' put: 'false'
+!
+
+renderButtonsOn: html
+	html button
+	with: 'Clear transcript';
+	onClick: [ self clear ]
+! !
+
+IDETranscript class instanceVariableNames: 'current'!
+
+!IDETranscript class methodsFor: 'initialization'!
+
+initialize
+	Transcript register: self current
+! !
+
+!IDETranscript class methodsFor: 'instance creation'!
+
+current
+	^ current ifNil: [ current := super new ]
+!
+
+new
+	self shouldNotImplement
+!
+
+open
+	TabManager current
+		open;
+		selectTab: self current
+! !
+
+TabWidget subclass: #ProgressBar
+	instanceVariableNames: 'percent progressDiv div'
+	package: 'IDE'!
+
+!ProgressBar methodsFor: 'accessing'!
+
+percent
+	^ percent ifNil: [ 0 ]
+!
+
+percent: aNumber
+	percent := aNumber
+! !
+
+!ProgressBar methodsFor: 'rendering'!
+
+renderOn: html
+	div := html div
+		class: 'progress_bar';
+		yourself.
+	self renderProgressBar
+!
+
+renderProgressBar
+	div contents: [ :html |
+		html div
+			class: 'progress';
+			style: 'width:', self percent asString, '%' ]
+! !
+
+!ProgressBar methodsFor: 'updating'!
+
+updatePercent: aNumber
+	self percent: aNumber.
+	self renderProgressBar
+! !
+
+TabWidget subclass: #ReferencesBrowser
+	instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList matches matchesList'
+	package: 'IDE'!
+
+!ReferencesBrowser methodsFor: 'accessing'!
+
+classesAndMetaclasses
+	^ Smalltalk classes, (Smalltalk classes collect: [ :each | each class ])
+!
+
+implementors
+	^ implementors ifNil: [ implementors := Array new ]
+!
+
+label
+	^ '[ References ]'
+!
+
+matches
+	^ matches ifNil: [ matches := Array new ]
+!
+
+referencedClasses
+	^ referencedClasses ifNil: [ referencedClasses := Array new ]
+!
+
+selector
+	^ selector
+!
+
+senders
+	^ senders ifNil: [ senders := Array new ]
+! !
+
+!ReferencesBrowser methodsFor: 'actions'!
+
+openBrowserOn: aMethod
+	| browser |
+	browser := Browser openOn: (aMethod methodClass isMetaclass
+		ifTrue: [ aMethod methodClass instanceClass ] ifFalse: [ aMethod methodClass ]).
+	aMethod methodClass isMetaclass ifTrue: [ browser selectTab: #class ].
+	browser
+		selectProtocol: aMethod category;
+		selectMethod: aMethod
+!
+
+search: aString
+	self
+		searchReferencesFor: aString;
+		updateImplementorsList;
+		updateSendersList;
+		updateReferencedClassesList;
+		updateMatchesList
+!
+
+searchMethodSource
+	| regex |
+	regex := selector allButFirst.
+	self classesAndMetaclasses do: [ :each |
+		each methodDictionary valuesDo: [ :value |
+			(value source match: regex) ifTrue: [
+				self matches add: value ]] ]
+!
+
+searchReferencedClasses
+	self classesAndMetaclasses do: [ :each |
+		each methodDictionary valuesDo: [ :value |
+			(value referencedClasses includes: selector) ifTrue: [
+				self referencedClasses add: value ]] ]
+!
+
+searchReferencesFor: aString
+	selector := aString.
+	implementors := Array new.
+	senders := Array new.
+	referencedClasses := Array new.
+	matches := Array new.
+	self searchMethodSource.
+	(selector match: '^[A-Z]')
+		ifFalse: [ self searchSelectorReferences ]
+		ifTrue: [ self searchReferencedClasses ]
+!
+
+searchSelectorReferences
+	self classesAndMetaclasses do: [ :each |
+		each methodDictionary keysAndValuesDo: [ :key :value |
+			key = selector ifTrue: [ self implementors add: value ].
+			(value messageSends includes: selector) ifTrue: [
+				self senders add: value ]] ]
+! !
+
+!ReferencesBrowser methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	selector := ''
+! !
+
+!ReferencesBrowser methodsFor: 'private'!
+
+setInputEvents
+	input
+		onKeyUp: [ timer := [ self search: input asJQuery val ] valueWithTimeout: 100 ];
+		onKeyDown: [ timer ifNotNil: [ timer clearTimeout ]]
+! !
+
+!ReferencesBrowser methodsFor: 'rendering'!
+
+renderBoxOn: html
+	self
+		renderInputOn: html;
+		renderImplementorsOn: html;
+		renderSendersOn: html;
+		renderReferencedClassesOn: html;
+		renderMatchesOn: html
+!
+
+renderImplementorsOn: html
+	implementorsList := html ul class: 'amber_column implementors'.
+	self updateImplementorsList
+!
+
+renderInputOn: html
+	input := html input
+		class: 'implementors';
+		yourself.
+	input asJQuery val: selector.
+	self setInputEvents
+!
+
+renderMatchesOn: html
+	matchesList := html ul class: 'amber_column matches'.
+	self updateMatchesList
+!
+
+renderReferencedClassesOn: html
+	referencedClassesList := html ul class: 'amber_column referenced_classes'.
+	self updateReferencedClassesList
+!
+
+renderSendersOn: html
+	sendersList := html ul class: 'amber_column senders'.
+	self updateSendersList
+! !
+
+!ReferencesBrowser methodsFor: 'testing'!
+
+canBeClosed
+	^ true
+! !
+
+!ReferencesBrowser methodsFor: 'updating'!
+
+updateImplementorsList
+	implementorsList contents: [ :html |
+	html li
+		class: 'column_label';
+		with: 'Implementors (', self implementors size asString, ')';
+		style: 'font-weight: bold'.
+	self implementors do: [ :each || li |
+		li := html li.
+		li
+		with: (each methodClass asString, ' >> ', self selector);
+		onClick: [ self openBrowserOn: each ]] ]
+!
+
+updateMatchesList
+	matchesList contents: [ :html |
+	html li
+		class: 'column_label';
+		with: 'Regex matches (', self matches size asString, ')';
+		style: 'font-weight: bold'.
+	self matches do: [ :each || li |
+		li := html li.
+		li
+		with: (each methodClass asString, ' >> ', each selector);
+		onClick: [ self openBrowserOn: each ]] ]
+!
+
+updateReferencedClassesList
+	referencedClassesList contents: [ :html |
+	html li
+		class: 'column_label';
+		with: 'Class references (', self referencedClasses size asString, ')';
+		style: 'font-weight: bold'.
+	self referencedClasses do: [ :each |
+		html li
+			with: (each methodClass asString, ' >> ', each selector);
+			onClick: [ self openBrowserOn: each ]] ]
+!
+
+updateSendersList
+	sendersList contents: [ :html |
+	html li
+		class: 'column_label';
+		with: 'Senders (', self senders size asString, ')';
+		style: 'font-weight: bold'.
+	self senders do: [ :each |
+		html li
+			with: (each methodClass asString, ' >> ', each selector);
+			onClick: [ self openBrowserOn: each ]] ]
+! !
+
+!ReferencesBrowser class methodsFor: 'instance creation'!
+
+search: aString
+	^ self new
+		searchReferencesFor: aString;
+		open
+! !
+
+TabWidget subclass: #TestRunner
+	instanceVariableNames: 'selectedCategories packagesList selectedClasses classesList selectedMethods progressBar methodsList result statusDiv'
+	package: 'IDE'!
+
+!TestRunner methodsFor: 'accessing'!
+
+allClasses
+	^ TestCase allSubclasses select: [ :each | each isAbstract not ]
+!
+
+classes
+	^ (self allClasses
+	select: [ :each | self selectedCategories includes: each category ])
+	sort: [ :a :b | a name > b name ]
+!
+
+label
+	^ 'SUnit'
+!
+
+packages
+	| packages |
+	packages := Array new.
+	self allClasses do: [ :each |
+	(packages includes: each category) ifFalse: [
+		packages add: each category ]].
+	^ packages sort
+!
+
+progressBar
+	^ progressBar ifNil: [ progressBar := ProgressBar new ]
+!
+
+result
+	^ result
+!
+
+selectedCategories
+	^ selectedCategories ifNil: [ selectedCategories := Array new ]
+!
+
+selectedClasses
+	^ selectedClasses ifNil: [ selectedClasses := Array new ]
+!
+
+statusInfo
+	^ self printTotal, self printPasses, self printErrors, self printFailures
+!
+
+testCases
+	| testCases |
+	testCases := #().
+	(self selectedClasses
+		select: [ :each | self selectedCategories includes: each category ])
+		do: [ :each | testCases addAll: each buildSuite ].
+	^ testCases
+! !
+
+!TestRunner methodsFor: 'actions'!
+
+performFailure: aTestCase
+	aTestCase runCase
+!
+
+run: aCollection
+| worker |
+	worker := TestSuiteRunner on: aCollection.
+	result := worker result.
+	worker announcer on: ResultAnnouncement do: [ :ann |
+		ann result == result ifTrue: [
+			self progressBar updatePercent: result runs / result total * 100.
+			self updateStatusDiv.
+			self updateMethodsList
+		]
+	].
+	worker run
+!
+
+selectAllCategories
+	self packages do: [ :each |
+		(selectedCategories includes: each) ifFalse: [
+			self selectedCategories add: each ]].
+	self
+		updateCategoriesList;
+		updateClassesList
+!
+
+selectAllClasses
+	self classes do: [ :each |
+		(selectedClasses includes: each) ifFalse: [
+			self selectedClasses add: each ]].
+	self
+		updateCategoriesList;
+		updateClassesList
+!
+
+toggleCategory: aCategory
+	(self isSelectedCategory: aCategory)
+		ifFalse: [ selectedCategories add: aCategory ]
+		ifTrue: [ selectedCategories remove: aCategory ].
+	self
+		updateCategoriesList;
+		updateClassesList
+!
+
+toggleClass: aClass
+	(self isSelectedClass: aClass)
+		ifFalse: [ selectedClasses add: aClass ]
+		ifTrue: [ selectedClasses remove: aClass ].
+	self
+		updateClassesList
+! !
+
+!TestRunner methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	result := TestResult new
+! !
+
+!TestRunner methodsFor: 'printing'!
+
+printErrors
+	^ self result errors size asString , ' errors, '
+!
+
+printFailures
+	^ self result failures size asString, ' failures'
+!
+
+printPasses
+	^ (self result runs - self result errors size - self result failures size) asString , ' passes, '
+!
+
+printTotal
+	^ self result total asString, ' runs, '
+! !
+
+!TestRunner methodsFor: 'rendering'!
+
+renderBoxOn: html
+	self
+	renderCategoriesOn: html;
+	renderClassesOn: html;
+	renderResultsOn: html
+!
+
+renderButtonsOn: html
+	html button
+	with: 'Run selected';
+	onClick: [ self run: self testCases ]
+!
+
+renderCategoriesOn: html
+	packagesList := html ul class: 'amber_column sunit packages'.
+	self updateCategoriesList
+!
+
+renderClassesOn: html
+	classesList := html ul class: 'amber_column sunit classes'.
+	self updateClassesList
+!
+
+renderErrorsOn: html
+	self result errors do: [ :each |
+		html li
+			class: 'errors';
+			with: each class name, ' >> ', each selector;
+						onClick: [ self performFailure: each ]]
+!
+
+renderFailuresOn: html
+	self result failures do: [ :each |
+		html li
+			class: 'failures';
+			with: each class name, ' >> ', each selector;
+						onClick: [ self performFailure: each ]]
+!
+
+renderResultsOn: html
+	statusDiv := html div.
+	html with: self progressBar.
+	methodsList := html ul class: 'amber_column sunit results'.
+	self updateMethodsList.
+	self updateStatusDiv
+! !
+
+!TestRunner methodsFor: 'testing'!
+
+isSelectedCategory: aCategory
+	^ (self selectedCategories includes: aCategory)
+!
+
+isSelectedClass: aClass
+	^ (self selectedClasses includes: aClass)
+! !
+
+!TestRunner methodsFor: 'updating'!
+
+updateCategoriesList
+	packagesList contents: [ :html |
+		html li
+		class: 'all';
+		with: 'All';
+		onClick: [ self selectAllCategories ].
+	self packages do: [ :each || li |
+		li := html li.
+		(self selectedCategories includes: each) ifTrue: [
+		li class: 'selected' ].
+		li
+		with: each;
+		onClick: [ self toggleCategory: each ]] ]
+!
+
+updateClassesList
+	classesList contents: [ :html |
+	(self selectedCategories isEmpty) ifFalse: [
+		html li
+			class: 'all';
+			with: 'All';
+			onClick: [ self selectAllClasses ]].
+	self classes do: [ :each || li |
+		li := html li.
+		(self selectedClasses includes: each) ifTrue: [
+			li class: 'selected' ].
+		li
+			with: each name;
+			onClick: [ self toggleClass: each ]] ]
+!
+
+updateMethodsList
+	methodsList contents: [ :html |
+		self renderErrorsOn: html.
+				self renderFailuresOn: html ]
+!
+
+updateStatusDiv
+	statusDiv class: 'sunit status ', result status.
+	statusDiv contents: [ :html |
+		html span with: self statusInfo ]
+! !
+
+TabWidget subclass: #Workspace
+	instanceVariableNames: 'sourceArea'
+	package: 'IDE'!
+
+!Workspace methodsFor: 'accessing'!
+
+label
+	^ 'Workspace'
+! !
+
+!Workspace methodsFor: 'actions'!
+
+clearWorkspace
+	sourceArea clear
+!
+
+doIt
+	sourceArea doIt
+!
+
+fileIn
+	sourceArea fileIn
+!
+
+inspectIt
+	sourceArea inspectIt
+!
+
+printIt
+	sourceArea printIt
+!
+
+show
+	super show.
+	sourceArea focus.
+! !
+
+!Workspace methodsFor: 'rendering'!
+
+renderBoxOn: html
+	sourceArea := SourceArea new.
+	sourceArea renderOn: html
+!
+
+renderButtonsOn: html
+	html button
+	with: 'DoIt';
+	title: 'ctrl+d';
+	onClick: [ self doIt ].
+	html button
+	with: 'PrintIt';
+	title: 'ctrl+p';
+	onClick: [ self printIt ].
+	html button
+	with: 'InspectIt';
+	title: 'ctrl+i';
+	onClick: [ self inspectIt ].
+	html button
+	with: 'FileIn';
+	title: 'ctrl+f';
+	onClick: [ self fileIn ].
+	html button
+	with: 'Clear workspace';
+	onClick: [ self clearWorkspace ]
+! !
+
+!AssociativeCollection methodsFor: '*IDE'!
+
+inspectOn: anInspector
+	| variables |
+	variables := Dictionary new.
+	variables at: '#self' put: self.
+	variables at: '#keys' put: self keys.
+	self keysAndValuesDo: [ :key :value |
+		variables at: key put: value ].
+	anInspector
+		setLabel: self printString;
+		setVariables: variables
+! !
+
+!Collection methodsFor: '*IDE'!
+
+inspectOn: anInspector
+	| variables |
+	variables := Dictionary new.
+	variables at: '#self' put: self.
+	self withIndexDo: [ :each :i |
+		variables at: i put: each ].
+	anInspector
+		setLabel: self printString;
+		setVariables: variables
+! !
+
+!Date methodsFor: '*IDE'!
+
+inspectOn: anInspector
+	| variables |
+	variables := Dictionary new.
+	variables at: '#self' put: self.
+	variables at: '#year' put: self year.
+	variables at: '#month' put: self month.
+	variables at: '#day' put: self day.
+	variables at: '#hours' put: self hours.
+	variables at: '#minutes' put: self minutes.
+	variables at: '#seconds' put: self seconds.
+	variables at: '#milliseconds' put: self milliseconds.
+	anInspector
+		setLabel: self printString;
+		setVariables: variables
+! !
+
+!MethodContext methodsFor: '*IDE'!
+
+inspectOn: anInspector
+	| variables |
+	variables := Dictionary new.
+	variables at: '#self' put: self.
+	variables at: '#home' put: self home.
+	variables at: '#receiver' put: self receiver.
+	variables at: '#selector' put: self selector.
+	variables at: '#locals' put: self locals.
+	self class instanceVariableNames do: [ :each |
+		variables at: each put: (self instVarAt: each) ].
+	anInspector
+		setLabel: self printString;
+		setVariables: variables
+! !
+
+!Set methodsFor: '*IDE'!
+
+inspectOn: anInspector
+	| variables i |
+	variables := Dictionary new.
+	variables at: '#self' put: self.
+	i := 1.
+	self do: [ :each |
+		variables at: i put: each.
+		i := i + 1 ].
+	anInspector
+		setLabel: self printString;
+		setVariables: variables
+! !
+
+!String methodsFor: '*IDE'!
+
+inspectOn: anInspector
+	| label |
+	super inspectOn: anInspector.
+	self printString size > 30
+		ifTrue: [ label := (self printString copyFrom: 1 to: 30), '...''' ]
+		ifFalse: [ label := self printString ].
+	anInspector setLabel: label
+! !
+

+ 890 - 0
src/Kernel-Announcements.js

@@ -0,0 +1,890 @@
+define("amber_core/Kernel-Announcements", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Kernel-Announcements');
+smalltalk.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('AnnouncementSubscription', globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
+globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announcementClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@announcementClass"];
+return $1;
+},
+args: [],
+source: "announcementClass\x0a\x09^ announcementClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AnnouncementSubscription);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announcementClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@announcementClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AnnouncementSubscription);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "block",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._deprecatedAPI();
+$1=self._valuable();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"block",{},globals.AnnouncementSubscription)})},
+args: [],
+source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
+messageSends: ["deprecatedAPI", "valuable"],
+referencedClasses: []
+}),
+globals.AnnouncementSubscription);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "block:",
+protocol: 'accessing',
+fn: function (aValuable){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._deprecatedAPI();
+self._valuable_(aValuable);
+return self}, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},globals.AnnouncementSubscription)})},
+args: ["aValuable"],
+source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
+messageSends: ["deprecatedAPI", "valuable:"],
+referencedClasses: []
+}),
+globals.AnnouncementSubscription);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deliver:",
+protocol: 'announcing',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._handlesAnnouncement_(anAnnouncement);
+if(smalltalk.assert($1)){
+_st(self._valuable())._value_(anAnnouncement);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)})},
+args: ["anAnnouncement"],
+source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
+messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"],
+referencedClasses: []
+}),
+globals.AnnouncementSubscription);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handlesAnnouncement:",
+protocol: 'announcing',
+fn: function (anAnnouncement){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$4,$2,$1,$receiver;
+$3=_st($Smalltalk())._globals();
+$ctx1.sendIdx["globals"]=1;
+$4=_st(self._announcementClass())._name();
+$ctx1.sendIdx["name"]=1;
+$2=_st($3)._at_($4);
+$ctx1.sendIdx["at:"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+return false;
+} else {
+var class_;
+class_=$receiver;
+$1=_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)})},
+args: ["anAnnouncement"],
+source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
+messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.AnnouncementSubscription);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._valuable())._receiver();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.AnnouncementSubscription)})},
+args: [],
+source: "receiver\x0a\x09^ self valuable receiver",
+messageSends: ["receiver", "valuable"],
+referencedClasses: []
+}),
+globals.AnnouncementSubscription);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valuable",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@valuable"];
+return $1;
+},
+args: [],
+source: "valuable\x0a\x09^ valuable",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AnnouncementSubscription);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valuable:",
+protocol: 'accessing',
+fn: function (aValuable){
+var self=this;
+self["@valuable"]=aValuable;
+return self},
+args: ["aValuable"],
+source: "valuable: aValuable\x0a\x09valuable := aValuable",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AnnouncementSubscription);
+
+
+
+smalltalk.addClass('AnnouncementValuable', globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
+globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@receiver"];
+return $1;
+},
+args: [],
+source: "receiver\x0a\x09^ receiver",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AnnouncementValuable);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@receiver"]=anObject;
+return self},
+args: ["anObject"],
+source: "receiver: anObject\x0a\x09receiver := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AnnouncementValuable);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valuable",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@valuable"];
+return $1;
+},
+args: [],
+source: "valuable\x0a\x09^ valuable",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AnnouncementValuable);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valuable:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@valuable"]=anObject;
+return self},
+args: ["anObject"],
+source: "valuable: anObject\x0a\x09valuable := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AnnouncementValuable);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'evaluating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._valuable())._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value",{},globals.AnnouncementValuable)})},
+args: [],
+source: "value\x0a\x09^ self valuable value",
+messageSends: ["value", "valuable"],
+referencedClasses: []
+}),
+globals.AnnouncementValuable);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'evaluating',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._valuable())._value_(anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.AnnouncementValuable)})},
+args: ["anObject"],
+source: "value: anObject\x0a\x09^ self valuable value: anObject",
+messageSends: ["value:", "valuable"],
+referencedClasses: []
+}),
+globals.AnnouncementValuable);
+
+
+
+smalltalk.addClass('Announcer', globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
+globals.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a    SystemAnnouncer current\x0a        on: ClassAdded\x0a        do: [ :ann | window alert: ann theClass name, ' added' ].";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announce:",
+protocol: 'announcing',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@subscriptions"])._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._deliver_(anAnnouncement);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},globals.Announcer)})},
+args: ["anAnnouncement"],
+source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
+messageSends: ["do:", "deliver:"],
+referencedClasses: []
+}),
+globals.Announcer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.Announcer.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@subscriptions"]=_st($OrderedCollection())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Announcer)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
+messageSends: ["initialize", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.Announcer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:do:",
+protocol: 'subscribing',
+fn: function (aClass,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._on_do_for_(aClass,aBlock,nil);
+return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},globals.Announcer)})},
+args: ["aClass", "aBlock"],
+source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
+messageSends: ["on:do:for:"],
+referencedClasses: []
+}),
+globals.Announcer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:do:for:",
+protocol: 'subscribing',
+fn: function (aClass,aBlock,aReceiver){
+var self=this;
+function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
+function $AnnouncementValuable(){return globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$6,$7,$5,$8,$2;
+$1=self["@subscriptions"];
+$3=_st($AnnouncementSubscription())._new();
+$ctx1.sendIdx["new"]=1;
+$4=$3;
+$6=_st($AnnouncementValuable())._new();
+_st($6)._valuable_(aBlock);
+_st($6)._receiver_(aReceiver);
+$7=_st($6)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+$5=$7;
+_st($4)._valuable_($5);
+$ctx1.sendIdx["valuable:"]=1;
+_st($3)._announcementClass_(aClass);
+$8=_st($3)._yourself();
+$2=$8;
+_st($1)._add_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},globals.Announcer)})},
+args: ["aClass", "aBlock", "aReceiver"],
+source: "on: aClass do: aBlock for: aReceiver\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (AnnouncementValuable new\x0a\x09\x09\x09valuable: aBlock;\x0a\x09\x09\x09receiver: aReceiver;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
+messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"],
+referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"]
+}),
+globals.Announcer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:doOnce:",
+protocol: 'subscribing',
+fn: function (aClass,aBlock){
+var self=this;
+var subscription;
+function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($AnnouncementSubscription())._new();
+_st($1)._announcementClass_(aClass);
+$2=_st($1)._yourself();
+subscription=$2;
+_st(subscription)._valuable_((function(ann){
+return smalltalk.withContext(function($ctx2) {
+_st(self["@subscriptions"])._remove_(subscription);
+return _st(aBlock)._value_(ann);
+}, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)})}));
+_st(self["@subscriptions"])._add_(subscription);
+return self}, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},globals.Announcer)})},
+args: ["aClass", "aBlock"],
+source: "on: aClass doOnce: aBlock\x0a\x09| subscription |\x0a\x09\x0a\x09subscription := AnnouncementSubscription new\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself.\x0a\x09subscription valuable: [ :ann |\x0a\x09\x09subscriptions remove: subscription.\x0a\x09\x09aBlock value: ann ].\x0a\x0a\x09subscriptions add: subscription",
+messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"],
+referencedClasses: ["AnnouncementSubscription"]
+}),
+globals.Announcer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:send:to:",
+protocol: 'subscribing',
+fn: function (aClass,aSelector,anObject){
+var self=this;
+function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
+function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$6,$7,$5,$8,$2;
+$1=self["@subscriptions"];
+$3=_st($AnnouncementSubscription())._new();
+$ctx1.sendIdx["new"]=1;
+$4=$3;
+$6=_st($MessageSend())._new();
+_st($6)._receiver_(anObject);
+_st($6)._selector_(aSelector);
+$7=_st($6)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+$5=$7;
+_st($4)._valuable_($5);
+_st($3)._announcementClass_(aClass);
+$8=_st($3)._yourself();
+$2=$8;
+_st($1)._add_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},globals.Announcer)})},
+args: ["aClass", "aSelector", "anObject"],
+source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
+messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"],
+referencedClasses: ["AnnouncementSubscription", "MessageSend"]
+}),
+globals.Announcer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unsubscribe:",
+protocol: 'subscribing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._receiver()).__eq(anObject);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},globals.Announcer)})},
+args: ["anObject"],
+source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
+messageSends: ["reject:", "=", "receiver"],
+referencedClasses: []
+}),
+globals.Announcer);
+
+
+
+smalltalk.addClass('SystemAnnouncer', globals.Announcer, [], 'Kernel-Announcements');
+globals.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`";
+
+globals.SystemAnnouncer.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "current",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@current"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@current"]=($ctx1.supercall = true, globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=self["@current"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"current",{},globals.SystemAnnouncer.klass)})},
+args: [],
+source: "current\x0a\x09^ current ifNil: [ current := super new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: []
+}),
+globals.SystemAnnouncer.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._shouldNotImplement();
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.SystemAnnouncer.klass)})},
+args: [],
+source: "new\x0a\x09self shouldNotImplement",
+messageSends: ["shouldNotImplement"],
+referencedClasses: []
+}),
+globals.SystemAnnouncer.klass);
+
+
+smalltalk.addClass('SystemAnnouncement', globals.Object, [], 'Kernel-Announcements');
+globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+protocol: 'helios',
+fn: function (){
+var self=this;
+return "announcement";
+},
+args: [],
+source: "heliosClass\x0a\x09^ 'announcement'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SystemAnnouncement.klass);
+
+
+smalltalk.addClass('ClassAnnouncement', globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
+globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@theClass"];
+return $1;
+},
+args: [],
+source: "theClass\x0a\x09^ theClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassAnnouncement);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@theClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassAnnouncement);
+
+
+
+smalltalk.addClass('ClassAdded', globals.ClassAnnouncement, [], 'Kernel-Announcements');
+globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
+
+
+smalltalk.addClass('ClassCommentChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
+globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
+
+
+smalltalk.addClass('ClassDefinitionChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
+globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
+
+
+smalltalk.addClass('ClassMigrated', globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
+globals.ClassMigrated.comment="I am emitted when a class is migrated.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "oldClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@oldClass"];
+return $1;
+},
+args: [],
+source: "oldClass\x0a\x09^ oldClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassMigrated);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "oldClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@oldClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "oldClass: aClass\x0a\x09oldClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassMigrated);
+
+
+
+smalltalk.addClass('ClassMoved', globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
+globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "oldPackage",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@oldPackage"];
+return $1;
+},
+args: [],
+source: "oldPackage\x0a\x09^ oldPackage",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassMoved);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "oldPackage:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+self["@oldPackage"]=aPackage;
+return self},
+args: ["aPackage"],
+source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassMoved);
+
+
+
+smalltalk.addClass('ClassRemoved', globals.ClassAnnouncement, [], 'Kernel-Announcements');
+globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
+
+
+smalltalk.addClass('ClassRenamed', globals.ClassAnnouncement, [], 'Kernel-Announcements');
+globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
+
+
+smalltalk.addClass('MethodAnnouncement', globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
+globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@method"];
+return $1;
+},
+args: [],
+source: "method\x0a\x09^ method",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodAnnouncement);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method:",
+protocol: 'accessing',
+fn: function (aCompiledMethod){
+var self=this;
+self["@method"]=aCompiledMethod;
+return self},
+args: ["aCompiledMethod"],
+source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodAnnouncement);
+
+
+
+smalltalk.addClass('MethodAdded', globals.MethodAnnouncement, [], 'Kernel-Announcements');
+globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
+
+
+smalltalk.addClass('MethodModified', globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
+globals.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "oldMethod",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@oldMethod"];
+return $1;
+},
+args: [],
+source: "oldMethod\x0a\x09^ oldMethod",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodModified);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "oldMethod:",
+protocol: 'accessing',
+fn: function (aMethod){
+var self=this;
+self["@oldMethod"]=aMethod;
+return self},
+args: ["aMethod"],
+source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodModified);
+
+
+
+smalltalk.addClass('MethodMoved', globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
+globals.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "oldProtocol",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@oldProtocol"];
+return $1;
+},
+args: [],
+source: "oldProtocol\x0a\x09^ oldProtocol",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodMoved);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "oldProtocol:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@oldProtocol"]=aString;
+return self},
+args: ["aString"],
+source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodMoved);
+
+
+
+smalltalk.addClass('MethodRemoved', globals.MethodAnnouncement, [], 'Kernel-Announcements');
+globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
+
+
+smalltalk.addClass('PackageAnnouncement', globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
+globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "package",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@package"];
+return $1;
+},
+args: [],
+source: "package\x0a\x09^ package",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PackageAnnouncement);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "package:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+self["@package"]=aPackage;
+return self},
+args: ["aPackage"],
+source: "package: aPackage\x0a\x09package := aPackage",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PackageAnnouncement);
+
+
+
+smalltalk.addClass('PackageAdded', globals.PackageAnnouncement, [], 'Kernel-Announcements');
+globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
+
+
+smalltalk.addClass('PackageClean', globals.PackageAnnouncement, [], 'Kernel-Announcements');
+globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
+
+
+smalltalk.addClass('PackageDirty', globals.PackageAnnouncement, [], 'Kernel-Announcements');
+globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
+
+
+smalltalk.addClass('PackageRemoved', globals.PackageAnnouncement, [], 'Kernel-Announcements');
+globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
+
+
+smalltalk.addClass('ProtocolAnnouncement', globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
+globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "protocol",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@protocol"];
+return $1;
+},
+args: [],
+source: "protocol\x0a\x09^ protocol",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtocolAnnouncement);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "protocol:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@protocol"]=aString;
+return self},
+args: ["aString"],
+source: "protocol: aString\x0a\x09protocol := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtocolAnnouncement);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@theClass"];
+return $1;
+},
+args: [],
+source: "theClass\x0a\x09^ theClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtocolAnnouncement);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@theClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtocolAnnouncement);
+
+
+
+smalltalk.addClass('ProtocolAdded', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
+globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
+
+
+smalltalk.addClass('ProtocolRemoved', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
+globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
+
+});

+ 429 - 0
src/Kernel-Announcements.st

@@ -0,0 +1,429 @@
+Smalltalk createPackage: 'Kernel-Announcements'!
+Object subclass: #AnnouncementSubscription
+	instanceVariableNames: 'valuable announcementClass'
+	package: 'Kernel-Announcements'!
+!AnnouncementSubscription commentStamp!
+I am a single entry in a subscription registry of an `Announcer`.
+Several subscriptions by the same object is possible.!
+
+!AnnouncementSubscription methodsFor: 'accessing'!
+
+announcementClass
+	^ announcementClass
+!
+
+announcementClass: aClass
+	announcementClass := aClass
+!
+
+block
+	"Use #valuable instead"
+	
+	self deprecatedAPI.
+	^ self valuable
+!
+
+block: aValuable
+	"Use #valuable instead"
+	
+	self deprecatedAPI.
+	self valuable: aValuable
+!
+
+receiver
+	^ self valuable receiver
+!
+
+valuable
+	^ valuable
+!
+
+valuable: aValuable
+	valuable := aValuable
+! !
+
+!AnnouncementSubscription methodsFor: 'announcing'!
+
+deliver: anAnnouncement
+	(self handlesAnnouncement: anAnnouncement)
+		ifTrue: [ self valuable value: anAnnouncement ]
+!
+
+handlesAnnouncement: anAnnouncement
+	"anAnnouncement might be announced from within another Amber environment"
+	
+	^ (Smalltalk globals at: self announcementClass name)
+		ifNil: [ ^ false ]
+		ifNotNil: [ :class |
+		(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]
+! !
+
+Object subclass: #AnnouncementValuable
+	instanceVariableNames: 'valuable receiver'
+	package: 'Kernel-Announcements'!
+!AnnouncementValuable commentStamp!
+I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.!
+
+!AnnouncementValuable methodsFor: 'accessing'!
+
+receiver
+	^ receiver
+!
+
+receiver: anObject
+	receiver := anObject
+!
+
+valuable
+	^ valuable
+!
+
+valuable: anObject
+	valuable := anObject
+! !
+
+!AnnouncementValuable methodsFor: 'evaluating'!
+
+value
+	^ self valuable value
+!
+
+value: anObject
+	^ self valuable value: anObject
+! !
+
+Object subclass: #Announcer
+	instanceVariableNames: 'registry subscriptions'
+	package: 'Kernel-Announcements'!
+!Announcer commentStamp!
+I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.
+I announce (trigger) announces, which are then dispatched to all subscriptions.
+
+The code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).
+
+## API
+
+Use `#announce:` to trigger an announcement.
+
+Use `#on:do:` or `#on:send:to:` to register subscriptions.
+
+When using `#on:send:to:`, unregistration can be done with `#unregister:`.
+
+## Usage example:
+
+    SystemAnnouncer current
+        on: ClassAdded
+        do: [ :ann | window alert: ann theClass name, ' added' ].!
+
+!Announcer methodsFor: 'announcing'!
+
+announce: anAnnouncement
+	subscriptions do: [ :each |
+		each deliver: anAnnouncement ]
+! !
+
+!Announcer methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	subscriptions := OrderedCollection new
+! !
+
+!Announcer methodsFor: 'subscribing'!
+
+on: aClass do: aBlock
+	self on: aClass do: aBlock for: nil
+!
+
+on: aClass do: aBlock for: aReceiver
+	subscriptions add: (AnnouncementSubscription new
+		valuable: (AnnouncementValuable new
+			valuable: aBlock;
+			receiver: aReceiver;
+			yourself);
+		announcementClass: aClass;
+		yourself)
+!
+
+on: aClass doOnce: aBlock
+	| subscription |
+	
+	subscription := AnnouncementSubscription new
+		announcementClass: aClass;
+		yourself.
+	subscription valuable: [ :ann |
+		subscriptions remove: subscription.
+		aBlock value: ann ].
+
+	subscriptions add: subscription
+!
+
+on: aClass send: aSelector to: anObject
+	subscriptions add: (AnnouncementSubscription new
+		valuable: (MessageSend new
+			receiver: anObject;
+			selector: aSelector;
+			yourself);
+		announcementClass: aClass;
+		yourself)
+!
+
+unsubscribe: anObject
+	subscriptions := subscriptions reject: [ :each |
+		each receiver = anObject ]
+! !
+
+Announcer subclass: #SystemAnnouncer
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!SystemAnnouncer commentStamp!
+My unique instance is the global announcer handling all Amber system-related announces.
+
+## API
+
+Access to the unique instance is done via `#current`!
+
+SystemAnnouncer class instanceVariableNames: 'current'!
+
+!SystemAnnouncer class methodsFor: 'accessing'!
+
+current
+	^ current ifNil: [ current := super new ]
+! !
+
+!SystemAnnouncer class methodsFor: 'instance creation'!
+
+new
+	self shouldNotImplement
+! !
+
+Object subclass: #SystemAnnouncement
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!SystemAnnouncement commentStamp!
+I am the superclass of all system announcements!
+
+!SystemAnnouncement class methodsFor: 'helios'!
+
+heliosClass
+	^ 'announcement'
+! !
+
+SystemAnnouncement subclass: #ClassAnnouncement
+	instanceVariableNames: 'theClass'
+	package: 'Kernel-Announcements'!
+!ClassAnnouncement commentStamp!
+I am the abstract superclass of class-related announcements.!
+
+!ClassAnnouncement methodsFor: 'accessing'!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
+! !
+
+ClassAnnouncement subclass: #ClassAdded
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!ClassAdded commentStamp!
+I am emitted when a class is added to the system.
+See ClassBuilder >> #addSubclassOf:... methods!
+
+ClassAnnouncement subclass: #ClassCommentChanged
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!ClassCommentChanged commentStamp!
+I am emitted when the comment of a class changes. (Behavior >> #comment)!
+
+ClassAnnouncement subclass: #ClassDefinitionChanged
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!ClassDefinitionChanged commentStamp!
+I am emitted when the definition of a class changes.
+See ClassBuilder >> #class:instanceVariableNames:!
+
+ClassAnnouncement subclass: #ClassMigrated
+	instanceVariableNames: 'oldClass'
+	package: 'Kernel-Announcements'!
+!ClassMigrated commentStamp!
+I am emitted when a class is migrated.!
+
+!ClassMigrated methodsFor: 'accessing'!
+
+oldClass
+	^ oldClass
+!
+
+oldClass: aClass
+	oldClass := aClass
+! !
+
+ClassAnnouncement subclass: #ClassMoved
+	instanceVariableNames: 'oldPackage'
+	package: 'Kernel-Announcements'!
+!ClassMoved commentStamp!
+I am emitted when a class is moved from one package to another.!
+
+!ClassMoved methodsFor: 'accessing'!
+
+oldPackage
+	^ oldPackage
+!
+
+oldPackage: aPackage
+	oldPackage := aPackage
+! !
+
+ClassAnnouncement subclass: #ClassRemoved
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!ClassRemoved commentStamp!
+I am emitted when a class is removed.
+See Smalltalk >> #removeClass:!
+
+ClassAnnouncement subclass: #ClassRenamed
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!ClassRenamed commentStamp!
+I am emitted when a class is renamed.
+See ClassBuilder >> #renameClass:to:!
+
+SystemAnnouncement subclass: #MethodAnnouncement
+	instanceVariableNames: 'method'
+	package: 'Kernel-Announcements'!
+!MethodAnnouncement commentStamp!
+I am the abstract superclass of method-related announcements.!
+
+!MethodAnnouncement methodsFor: 'accessing'!
+
+method
+	^ method
+!
+
+method: aCompiledMethod
+	method := aCompiledMethod
+! !
+
+MethodAnnouncement subclass: #MethodAdded
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!MethodAdded commentStamp!
+I am emitted when a `CompiledMethod` is added to a class.!
+
+MethodAnnouncement subclass: #MethodModified
+	instanceVariableNames: 'oldMethod'
+	package: 'Kernel-Announcements'!
+!MethodModified commentStamp!
+I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced.!
+
+!MethodModified methodsFor: 'accessing'!
+
+oldMethod
+	^ oldMethod
+!
+
+oldMethod: aMethod
+	oldMethod := aMethod
+! !
+
+MethodAnnouncement subclass: #MethodMoved
+	instanceVariableNames: 'oldProtocol'
+	package: 'Kernel-Announcements'!
+!MethodMoved commentStamp!
+I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.!
+
+!MethodMoved methodsFor: 'accessing'!
+
+oldProtocol
+	^ oldProtocol
+!
+
+oldProtocol: aString
+	oldProtocol := aString
+! !
+
+MethodAnnouncement subclass: #MethodRemoved
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!MethodRemoved commentStamp!
+I am emitted when a `CompiledMethod` is removed from a class.!
+
+SystemAnnouncement subclass: #PackageAnnouncement
+	instanceVariableNames: 'package'
+	package: 'Kernel-Announcements'!
+!PackageAnnouncement commentStamp!
+I am the abstract superclass of package-related announcements.!
+
+!PackageAnnouncement methodsFor: 'accessing'!
+
+package
+	^ package
+!
+
+package: aPackage
+	package := aPackage
+! !
+
+PackageAnnouncement subclass: #PackageAdded
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!PackageAdded commentStamp!
+I am emitted when a `Package` is added to the system.!
+
+PackageAnnouncement subclass: #PackageClean
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!PackageClean commentStamp!
+I am emitted when a package is committed and becomes clean.!
+
+PackageAnnouncement subclass: #PackageDirty
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!PackageDirty commentStamp!
+I am emitted when a package becomes dirty.!
+
+PackageAnnouncement subclass: #PackageRemoved
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!PackageRemoved commentStamp!
+I am emitted when a `Package` is removed from the system.!
+
+SystemAnnouncement subclass: #ProtocolAnnouncement
+	instanceVariableNames: 'theClass protocol'
+	package: 'Kernel-Announcements'!
+!ProtocolAnnouncement commentStamp!
+I am the abstract superclass of protocol-related announcements.!
+
+!ProtocolAnnouncement methodsFor: 'accessing'!
+
+protocol
+	^ protocol
+!
+
+protocol: aString
+	protocol := aString
+!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
+! !
+
+ProtocolAnnouncement subclass: #ProtocolAdded
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!ProtocolAdded commentStamp!
+I am emitted when a protocol is added to a class.!
+
+ProtocolAnnouncement subclass: #ProtocolRemoved
+	instanceVariableNames: ''
+	package: 'Kernel-Announcements'!
+!ProtocolRemoved commentStamp!
+I am emitted when a protocol is removed from a class.!
+

+ 2414 - 0
src/Kernel-Classes.js

@@ -0,0 +1,2414 @@
+define("amber_core/Kernel-Classes", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Kernel-Classes');
+smalltalk.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('Behavior', globals.Object, [], 'Kernel-Classes');
+globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: ">>",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._methodAt_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},globals.Behavior)})},
+args: ["aString"],
+source: ">> aString\x0a\x09^ self methodAt: aString",
+messageSends: ["methodAt:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addCompiledMethod:",
+protocol: 'compiling',
+fn: function (aMethod){
+var self=this;
+var oldMethod,announcement;
+function $MethodAdded(){return globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
+function $MethodModified(){return globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
+oldMethod=_st(self._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
+return nil;
+}));
+$2=self._protocols();
+$3=_st(aMethod)._protocol();
+$ctx1.sendIdx["protocol"]=1;
+$1=_st($2)._includes_($3);
+if(! smalltalk.assert($1)){
+$4=self._organization();
+$5=_st(aMethod)._protocol();
+$ctx1.sendIdx["protocol"]=2;
+_st($4)._addElement_($5);
+};
+self._basicAddCompiledMethod_(aMethod);
+$6=oldMethod;
+if(($receiver = $6) == null || $receiver.isNil){
+$6;
+} else {
+self._removeProtocolIfEmpty_(_st(oldMethod)._protocol());
+};
+$7=oldMethod;
+if(($receiver = $7) == null || $receiver.isNil){
+$8=_st($MethodAdded())._new();
+$ctx1.sendIdx["new"]=1;
+_st($8)._method_(aMethod);
+$ctx1.sendIdx["method:"]=1;
+$9=_st($8)._yourself();
+$ctx1.sendIdx["yourself"]=1;
+announcement=$9;
+} else {
+$10=_st($MethodModified())._new();
+_st($10)._oldMethod_(oldMethod);
+_st($10)._method_(aMethod);
+$11=_st($10)._yourself();
+announcement=$11;
+};
+_st(_st($SystemAnnouncer())._current())._announce_(announcement);
+return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},globals.Behavior)})},
+args: ["aMethod"],
+source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
+messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"],
+referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allInstanceVariableNames",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var result;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+result=_st(self._instanceVariableNames())._copy();
+$1=self._superclass();
+$ctx1.sendIdx["superclass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(result)._addAll_(_st(self._superclass())._allInstanceVariableNames());
+};
+$2=result;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},globals.Behavior)})},
+args: [],
+source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
+messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allSelectors",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1;
+$2=self._allSuperclasses();
+$3=self._selectors();
+$ctx1.sendIdx["selectors"]=1;
+$1=_st($2)._inject_into_($3,(function(acc,each){
+return smalltalk.withContext(function($ctx2) {
+_st(acc)._addAll_(_st(each)._selectors());
+$4=_st(acc)._yourself();
+return $4;
+}, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Behavior)})},
+args: [],
+source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
+messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allSubclasses",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var subclasses,index;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+subclasses=self._subclasses();
+$ctx1.sendIdx["subclasses"]=1;
+index=(1);
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(index).__gt(_st(subclasses)._size());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(subclasses)._addAll_(_st(_st(subclasses)._at_(index))._subclasses());
+index=_st(index).__plus((1));
+return index;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$1=subclasses;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},globals.Behavior)})},
+args: [],
+source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09^ subclasses",
+messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allSubclassesDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._allSubclasses())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(aBlock)._value_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},globals.Behavior)})},
+args: ["aBlock"],
+source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a    \x09aBlock value: each ]",
+messageSends: ["do:", "allSubclasses", "value:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allSuperclasses",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$5,$4,$6,$3,$receiver;
+$1=self._superclass();
+$ctx1.sendIdx["superclass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$2=[];
+return $2;
+} else {
+$1;
+};
+$5=self._superclass();
+$ctx1.sendIdx["superclass"]=2;
+$4=_st($OrderedCollection())._with_($5);
+_st($4)._addAll_(_st(self._superclass())._allSuperclasses());
+$6=_st($4)._yourself();
+$3=$6;
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},globals.Behavior)})},
+args: [],
+source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
+messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicAddCompiledMethod:",
+protocol: 'private',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.addMethod(aMethod, self);
+return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},globals.Behavior)})},
+args: ["aMethod"],
+source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicNew",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return new self.fn();
+return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},globals.Behavior)})},
+args: [],
+source: "basicNew\x0a\x09<return new self.fn()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicRemoveCompiledMethod:",
+protocol: 'private',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.removeMethod(aMethod,self);
+return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},globals.Behavior)})},
+args: ["aMethod"],
+source: "basicRemoveCompiledMethod: aMethod\x0a\x09<smalltalk.removeMethod(aMethod,self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "canUnderstand:",
+protocol: 'testing',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$1=_st(self._includesSelector_(_st(aSelector)._asString()))._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=self._superclass();
+$ctx2.sendIdx["superclass"]=1;
+$2=_st($3)._notNil();
+return _st($2)._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(self._superclass())._canUnderstand_(aSelector);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},globals.Behavior)})},
+args: ["aSelector"],
+source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
+messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "comment",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._basicAt_("comment");
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"comment",{},globals.Behavior)})},
+args: [],
+source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
+messageSends: ["ifNil:", "basicAt:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "comment:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ClassCommentChanged(){return globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._basicAt_put_("comment",aString);
+$1=_st($ClassCommentChanged())._new();
+_st($1)._theClass_(self);
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},globals.Behavior)})},
+args: ["aString"],
+source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
+messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"],
+referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commentStamp",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $ClassCommentReader(){return globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($ClassCommentReader())._new();
+_st($2)._class_(self);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commentStamp",{},globals.Behavior)})},
+args: [],
+source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
+messageSends: ["class:", "new", "yourself"],
+referencedClasses: ["ClassCommentReader"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commentStamp:prior:",
+protocol: 'accessing',
+fn: function (aStamp,prior){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._commentStamp();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},globals.Behavior)})},
+args: ["aStamp", "prior"],
+source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
+messageSends: ["commentStamp"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compile:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._compile_protocol_(aString,"");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Behavior)})},
+args: ["aString"],
+source: "compile: aString\x0a\x09^ self compile: aString protocol: ''",
+messageSends: ["compile:protocol:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compile:protocol:",
+protocol: 'compiling',
+fn: function (aString,anotherString){
+var self=this;
+function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},globals.Behavior)})},
+args: ["aString", "anotherString"],
+source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
+messageSends: ["install:forClass:protocol:", "new"],
+referencedClasses: ["Compiler"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "definition",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "";
+},
+args: [],
+source: "definition\x0a\x09^ ''",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includesBehavior:",
+protocol: 'testing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self.__eq_eq(aClass))._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._inheritsFrom_(aClass);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},globals.Behavior)})},
+args: ["aClass"],
+source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
+messageSends: ["or:", "==", "inheritsFrom:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includesSelector:",
+protocol: 'testing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._methodDictionary())._includesKey_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},globals.Behavior)})},
+args: ["aString"],
+source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
+messageSends: ["includesKey:", "methodDictionary"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inheritsFrom:",
+protocol: 'testing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$4,$3,$2,$receiver;
+$1=self._superclass();
+$ctx1.sendIdx["superclass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return false;
+} else {
+$1;
+};
+$4=self._superclass();
+$ctx1.sendIdx["superclass"]=2;
+$3=_st(aClass).__eq_eq($4);
+$2=_st($3)._or_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._superclass())._inheritsFrom_(aClass);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},globals.Behavior)})},
+args: ["aClass"],
+source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
+messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instanceVariableNames",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.iVarNames;
+return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},globals.Behavior)})},
+args: [],
+source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBehavior",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isBehavior\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "javascriptConstructor",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.fn;
+return self}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},globals.Behavior)})},
+args: [],
+source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "javascriptConstructor:",
+protocol: 'accessing',
+fn: function (aJavaScriptFunction){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.setClassConstructor(self, aJavaScriptFunction);;
+return self}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},globals.Behavior)})},
+args: ["aJavaScriptFunction"],
+source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `smalltalk.setClassConstructor'\x22\x0a\x09\x0a\x09<smalltalk.setClassConstructor(self, aJavaScriptFunction);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lookupSelector:",
+protocol: 'accessing',
+fn: function (selector){
+var self=this;
+var lookupClass;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+var $early={};
+try {
+lookupClass=self;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(lookupClass).__eq(nil);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(lookupClass)._includesSelector_(selector);
+if(smalltalk.assert($1)){
+$2=_st(lookupClass)._methodAt_(selector);
+throw $early=[$2];
+};
+lookupClass=_st(lookupClass)._superclass();
+return lookupClass;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return nil;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},globals.Behavior)})},
+args: ["selector"],
+source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
+messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodAt:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._methodDictionary())._at_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},globals.Behavior)})},
+args: ["aString"],
+source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
+messageSends: ["at:", "methodDictionary"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodDictionary",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var dict = globals.HashedCollection._new();
+	var methods = self.methods;
+	Object.keys(methods).forEach(function(i) {
+		if(methods[i].selector) {
+			dict._at_put_(methods[i].selector, methods[i]);
+		}
+	});
+	return dict;
+return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},globals.Behavior)})},
+args: [],
+source: "methodDictionary\x0a\x09<var dict = globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodTemplate",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
+$1=_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+_st(stream)._nextPutAll_("messageSelectorAndArgumentNames");
+$ctx2.sendIdx["nextPutAll:"]=1;
+$3=_st($String())._lf();
+$ctx2.sendIdx["lf"]=1;
+$4=_st($String())._tab();
+$ctx2.sendIdx["tab"]=1;
+$2=_st($3).__comma($4);
+$ctx2.sendIdx[","]=1;
+_st(stream)._nextPutAll_($2);
+$ctx2.sendIdx["nextPutAll:"]=2;
+_st(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
+$ctx2.sendIdx["nextPutAll:"]=3;
+$7=_st($String())._lf();
+$ctx2.sendIdx["lf"]=2;
+$8=_st($String())._lf();
+$ctx2.sendIdx["lf"]=3;
+$6=_st($7).__comma($8);
+$ctx2.sendIdx[","]=3;
+$9=_st($String())._tab();
+$ctx2.sendIdx["tab"]=2;
+$5=_st($6).__comma($9);
+$ctx2.sendIdx[","]=2;
+_st(stream)._nextPutAll_($5);
+$ctx2.sendIdx["nextPutAll:"]=4;
+_st(stream)._nextPutAll_("| temporary variable names |");
+$ctx2.sendIdx["nextPutAll:"]=5;
+_st(stream)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
+$ctx2.sendIdx["nextPutAll:"]=6;
+$10=_st(stream)._nextPutAll_("statements");
+return $10;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},globals.Behavior)})},
+args: [],
+source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
+messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"],
+referencedClasses: ["String"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methods",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._methodDictionary())._values();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methods",{},globals.Behavior)})},
+args: [],
+source: "methods\x0a\x09^ self methodDictionary values",
+messageSends: ["values", "methodDictionary"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodsFor:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+function $ClassCategoryReader(){return globals.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($ClassCategoryReader())._new();
+_st($2)._class_category_(self,aString);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},globals.Behavior)})},
+args: ["aString"],
+source: "methodsFor: aString\x0a\x09^ ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
+messageSends: ["class:category:", "new", "yourself"],
+referencedClasses: ["ClassCategoryReader"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodsFor:stamp:",
+protocol: 'accessing',
+fn: function (aString,aStamp){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._methodsFor_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},globals.Behavior)})},
+args: ["aString", "aStamp"],
+source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
+messageSends: ["methodsFor:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodsInProtocol:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._methods())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._protocol()).__eq(aString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},globals.Behavior)})},
+args: ["aString"],
+source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
+messageSends: ["select:", "methods", "=", "protocol"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.className || nil;
+return self}, function($ctx1) {$ctx1.fill(self,"name",{},globals.Behavior)})},
+args: [],
+source: "name\x0a\x09<return self.className || nil>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._basicNew())._initialize();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"new",{},globals.Behavior)})},
+args: [],
+source: "new\x0a\x09^ self basicNew initialize",
+messageSends: ["initialize", "basicNew"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "organization",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_("organization");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Behavior)})},
+args: [],
+source: "organization\x0a\x09^ self basicAt: 'organization'",
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ownMethods",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st(_st(self._ownProtocols())._inject_into_(_st($OrderedCollection())._new(),(function(acc,each){
+return smalltalk.withContext(function($ctx2) {
+return _st(acc).__comma(self._methodsInProtocol_(each));
+}, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})})))._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(a)._selector();
+$ctx2.sendIdx["selector"]=1;
+return _st($2).__lt_eq(_st(b)._selector());
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ownMethods",{},globals.Behavior)})},
+args: [],
+source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
+messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ownProtocols",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._protocols())._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._match_("^\x5c*");
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},globals.Behavior)})},
+args: [],
+source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
+messageSends: ["reject:", "protocols", "match:"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "protocols",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._organization())._elements())._sorted();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"protocols",{},globals.Behavior)})},
+args: [],
+source: "protocols\x0a\x09^ self organization elements sorted",
+messageSends: ["sorted", "elements", "organization"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "protocolsDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+var methodsByProtocol;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+methodsByProtocol=_st($HashedCollection())._new();
+$ctx1.sendIdx["new"]=1;
+_st(self._methodDictionary())._valuesDo_((function(m){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(methodsByProtocol)._at_ifAbsentPut_(_st(m)._protocol(),(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st($Array())._new();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._add_(m);
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)})}));
+_st(self._protocols())._do_((function(protocol){
+return smalltalk.withContext(function($ctx2) {
+return _st(aBlock)._value_value_(protocol,_st(methodsByProtocol)._at_(protocol));
+}, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},globals.Behavior)})},
+args: ["aBlock"],
+source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
+messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"],
+referencedClasses: ["HashedCollection", "Array"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "prototype",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.fn.prototype;
+return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},globals.Behavior)})},
+args: [],
+source: "prototype\x0a\x09<return self.fn.prototype>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "recompile",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($Compiler())._new())._recompile_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"recompile",{},globals.Behavior)})},
+args: [],
+source: "recompile\x0a\x09^ Compiler new recompile: self",
+messageSends: ["recompile:", "new"],
+referencedClasses: ["Compiler"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeCompiledMethod:",
+protocol: 'compiling',
+fn: function (aMethod){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $MethodRemoved(){return globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._basicRemoveCompiledMethod_(aMethod);
+self._removeProtocolIfEmpty_(_st(aMethod)._protocol());
+$1=_st($MethodRemoved())._new();
+_st($1)._method_(aMethod);
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},globals.Behavior)})},
+args: ["aMethod"],
+source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
+messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"],
+referencedClasses: ["SystemAnnouncer", "MethodRemoved"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeProtocolIfEmpty:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._methods())._detect_ifNone_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._protocol()).__eq(aString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._organization())._removeElement_(aString);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},globals.Behavior)})},
+args: ["aString"],
+source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
+messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selectors",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._methodDictionary())._keys();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selectors",{},globals.Behavior)})},
+args: [],
+source: "selectors\x0a\x09^ self methodDictionary keys",
+messageSends: ["keys", "methodDictionary"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclasses",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Behavior)})},
+args: [],
+source: "subclasses\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superclass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.superclass || nil;
+return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},globals.Behavior)})},
+args: [],
+source: "superclass\x0a\x09<return self.superclass || nil>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theMetaClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._class();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},globals.Behavior)})},
+args: [],
+source: "theMetaClass\x0a\x09^ self class",
+messageSends: ["class"],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theNonMetaClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "theNonMetaClass\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withAllSubclasses",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($Array())._with_(self);
+_st($2)._addAll_(self._allSubclasses());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},globals.Behavior)})},
+args: [],
+source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
+messageSends: ["addAll:", "with:", "allSubclasses", "yourself"],
+referencedClasses: ["Array"]
+}),
+globals.Behavior);
+
+
+
+smalltalk.addClass('Class', globals.Behavior, [], 'Kernel-Classes');
+globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJavascript",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1="globals.".__comma(self._name());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Class)})},
+args: [],
+source: "asJavascript\x0a\x09^ 'globals.', self name",
+messageSends: [",", "name"],
+referencedClasses: []
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "browse",
+protocol: 'browsing',
+fn: function (){
+var self=this;
+function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Finder())._findClass_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"browse",{},globals.Class)})},
+args: [],
+source: "browse\x0a\x09Finder findClass: self",
+messageSends: ["findClass:"],
+referencedClasses: ["Finder"]
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._package();
+$ctx1.sendIdx["package"]=1;
+if(($receiver = $2) == null || $receiver.isNil){
+$1="Unclassified";
+} else {
+$1=_st(self._package())._name();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"category",{},globals.Class)})},
+args: [],
+source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
+messageSends: ["ifNil:ifNotNil:", "package", "name"],
+referencedClasses: []
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "definition",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$4,$2,$5,$6,$7,$1;
+$1=_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+_st(stream)._nextPutAll_(_st(self._superclass())._asString());
+$ctx2.sendIdx["nextPutAll:"]=1;
+_st(stream)._nextPutAll_(" subclass: #");
+$ctx2.sendIdx["nextPutAll:"]=2;
+_st(stream)._nextPutAll_(self._name());
+$ctx2.sendIdx["nextPutAll:"]=3;
+$3=_st($String())._lf();
+$ctx2.sendIdx["lf"]=1;
+$4=_st($String())._tab();
+$ctx2.sendIdx["tab"]=1;
+$2=_st($3).__comma($4);
+$ctx2.sendIdx[","]=1;
+_st(stream)._nextPutAll_($2);
+$ctx2.sendIdx["nextPutAll:"]=4;
+$5=_st(stream)._nextPutAll_("instanceVariableNames: '");
+$ctx2.sendIdx["nextPutAll:"]=5;
+$5;
+_st(self._instanceVariableNames())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(stream)._nextPutAll_(each);
+$ctx3.sendIdx["nextPutAll:"]=6;
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(stream)._nextPutAll_(" ");
+$ctx3.sendIdx["nextPutAll:"]=7;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+$6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
+$ctx2.sendIdx[","]=2;
+_st(stream)._nextPutAll_($6);
+$ctx2.sendIdx["nextPutAll:"]=8;
+_st(stream)._nextPutAll_("package: '");
+$ctx2.sendIdx["nextPutAll:"]=9;
+_st(stream)._nextPutAll_(self._category());
+$ctx2.sendIdx["nextPutAll:"]=10;
+$7=_st(stream)._nextPutAll_("'");
+return $7;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Class)})},
+args: [],
+source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
+messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"],
+referencedClasses: ["String"]
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isClass",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isClass\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "package",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_("pkg");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"package",{},globals.Class)})},
+args: [],
+source: "package\x0a\x09^ self basicAt: 'pkg'",
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "package:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+var oldPackage;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ClassMoved(){return globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$4,$5;
+$2=self._package();
+$ctx1.sendIdx["package"]=1;
+$1=_st($2).__eq(aPackage);
+if(smalltalk.assert($1)){
+return self;
+};
+oldPackage=self._package();
+self._basicAt_put_("pkg",aPackage);
+$3=_st(oldPackage)._organization();
+$ctx1.sendIdx["organization"]=1;
+_st($3)._removeElement_(self);
+_st(_st(aPackage)._organization())._addElement_(self);
+$4=_st($ClassMoved())._new();
+_st($4)._theClass_(self);
+_st($4)._oldPackage_(oldPackage);
+$5=_st($4)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($5);
+return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},globals.Class)})},
+args: ["aPackage"],
+source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
+messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"],
+referencedClasses: ["SystemAnnouncer", "ClassMoved"]
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aStream)._nextPutAll_(self._name());
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Class)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
+messageSends: ["nextPutAll:", "name"],
+referencedClasses: []
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "rename:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
+return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},globals.Class)})},
+args: ["aString"],
+source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
+messageSends: ["renameClass:to:", "new"],
+referencedClasses: ["ClassBuilder"]
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclass:instanceVariableNames:",
+protocol: 'class creation',
+fn: function (aString,anotherString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.Class)})},
+args: ["aString", "anotherString"],
+source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
+messageSends: ["subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclass:instanceVariableNames:category:",
+protocol: 'class creation',
+fn: function (aString,aString2,aString3){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._deprecatedAPI();
+$1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)})},
+args: ["aString", "aString2", "aString3"],
+source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
+messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
+protocol: 'class creation',
+fn: function (aString,aString2,classVars,pools,aString3){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},globals.Class)})},
+args: ["aString", "aString2", "classVars", "pools", "aString3"],
+source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Just ignore class variables and pools. Added for compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
+messageSends: ["subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclass:instanceVariableNames:package:",
+protocol: 'class creation',
+fn: function (aString,aString2,aString3){
+var self=this;
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)})},
+args: ["aString", "aString2", "aString3"],
+source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
+messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
+referencedClasses: ["ClassBuilder"]
+}),
+globals.Class);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclasses",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.subclasses._copy();
+return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Class)})},
+args: [],
+source: "subclasses\x0a\x09<return self.subclasses._copy()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Class);
+
+
+
+smalltalk.addClass('Metaclass', globals.Behavior, [], 'Kernel-Classes');
+globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJavascript",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st("globals.".__comma(_st(self._instanceClass())._name())).__comma(".klass");
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Metaclass)})},
+args: [],
+source: "asJavascript\x0a\x09^ 'globals.', self instanceClass name, '.klass'",
+messageSends: [",", "name", "instanceClass"],
+referencedClasses: []
+}),
+globals.Metaclass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "definition",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+_st(stream)._nextPutAll_(self._asString());
+$ctx2.sendIdx["nextPutAll:"]=1;
+$2=_st(stream)._nextPutAll_(" instanceVariableNames: '");
+$ctx2.sendIdx["nextPutAll:"]=2;
+$2;
+_st(self._instanceVariableNames())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(stream)._nextPutAll_(each);
+$ctx3.sendIdx["nextPutAll:"]=3;
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(stream)._nextPutAll_(" ");
+$ctx3.sendIdx["nextPutAll:"]=4;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+return _st(stream)._nextPutAll_("'");
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Metaclass)})},
+args: [],
+source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
+messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
+referencedClasses: ["String"]
+}),
+globals.Metaclass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instanceClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.instanceClass;
+return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},globals.Metaclass)})},
+args: [],
+source: "instanceClass\x0a\x09<return self.instanceClass>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Metaclass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instanceVariableNames:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
+return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},globals.Metaclass)})},
+args: ["aCollection"],
+source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
+messageSends: ["class:instanceVariableNames:", "new"],
+referencedClasses: ["ClassBuilder"]
+}),
+globals.Metaclass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isMetaclass",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isMetaclass\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Metaclass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "package",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._instanceClass())._package();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"package",{},globals.Metaclass)})},
+args: [],
+source: "package\x0a\x09^ self instanceClass package",
+messageSends: ["package", "instanceClass"],
+referencedClasses: []
+}),
+globals.Metaclass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._nextPutAll_(_st(self._instanceClass())._name());
+$ctx1.sendIdx["nextPutAll:"]=1;
+$1=_st(aStream)._nextPutAll_(" class");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Metaclass)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
+messageSends: ["nextPutAll:", "name", "instanceClass"],
+referencedClasses: []
+}),
+globals.Metaclass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclasses",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(self._instanceClass())._subclasses())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._isMetaclass())._not();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._theMetaClass();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Metaclass)})},
+args: [],
+source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
+messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"],
+referencedClasses: []
+}),
+globals.Metaclass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theMetaClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "theMetaClass\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Metaclass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theNonMetaClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._instanceClass();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},globals.Metaclass)})},
+args: [],
+source: "theNonMetaClass\x0a\x09^ self instanceClass",
+messageSends: ["instanceClass"],
+referencedClasses: []
+}),
+globals.Metaclass);
+
+
+
+smalltalk.addClass('ClassBuilder', globals.Object, [], 'Kernel-Classes');
+globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addSubclassOf:named:instanceVariableNames:package:",
+protocol: 'class definition',
+fn: function (aClass,className,aCollection,packageName){
+var self=this;
+var theClass,thePackage;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$receiver;
+theClass=_st(_st($Smalltalk())._globals())._at_(className);
+thePackage=_st($Package())._named_(packageName);
+$1=theClass;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(theClass)._package_(thePackage);
+$2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
+if(! smalltalk.assert($2)){
+$3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
+return $3;
+};
+};
+$4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},globals.ClassBuilder)})},
+args: ["aClass", "className", "aCollection", "packageName"],
+source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
+messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"],
+referencedClasses: ["Smalltalk", "Package"]
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
+protocol: 'private',
+fn: function (aClass,aString,aCollection,packageName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		smalltalk.addClass(aString, aClass, aCollection, packageName);
+		return globals[aString]
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},globals.ClassBuilder)})},
+args: ["aClass", "aString", "aCollection", "packageName"],
+source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return globals[aString]\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicClass:instanceVariableNames:",
+protocol: 'private',
+fn: function (aClass,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
+return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},globals.ClassBuilder)})},
+args: ["aClass", "aString"],
+source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
+messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicClass:instanceVariables:",
+protocol: 'private',
+fn: function (aClass,aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aClass)._isMetaclass();
+if(! smalltalk.assert($1)){
+self._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
+};
+_st(aClass)._basicAt_put_("iVarNames",aCollection);
+return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},globals.ClassBuilder)})},
+args: ["aClass", "aCollection"],
+source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
+messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicRemoveClass:",
+protocol: 'private',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.removeClass(aClass);
+return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},globals.ClassBuilder)})},
+args: ["aClass"],
+source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicRenameClass:to:",
+protocol: 'private',
+fn: function (aClass,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		globals[aString] = aClass;
+		delete globals[aClass.className];
+		aClass.className = aString;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)})},
+args: ["aClass", "aString"],
+source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09globals[aString] = aClass;\x0a\x09\x09delete globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicSwapClassNames:with:",
+protocol: 'private',
+fn: function (aClass,anotherClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var tmp = aClass.className;
+		aClass.className = anotherClass.className;
+		anotherClass.className = tmp;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)})},
+args: ["aClass", "anotherClass"],
+source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "class:instanceVariableNames:",
+protocol: 'class definition',
+fn: function (aClass,ivarNames){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ClassDefinitionChanged(){return globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._basicClass_instanceVariableNames_(aClass,ivarNames);
+self._setupClass_(aClass);
+$1=_st($ClassDefinitionChanged())._new();
+_st($1)._theClass_(aClass);
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},globals.ClassBuilder)})},
+args: ["aClass", "ivarNames"],
+source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
+messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
+referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"]
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copyClass:named:",
+protocol: 'copying',
+fn: function (aClass,className){
+var self=this;
+var newClass;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+newClass=self._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),className,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
+self._copyClass_to_(aClass,newClass);
+$1=_st($ClassAdded())._new();
+_st($1)._theClass_(newClass);
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+$3=newClass;
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},globals.ClassBuilder)})},
+args: ["aClass", "className"],
+source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
+messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"],
+referencedClasses: ["SystemAnnouncer", "ClassAdded"]
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copyClass:to:",
+protocol: 'copying',
+fn: function (aClass,anotherClass){
+var self=this;
+function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$7,$6,$9,$8;
+_st(anotherClass)._comment_(_st(aClass)._comment());
+$1=_st(aClass)._methodDictionary();
+$ctx1.sendIdx["methodDictionary"]=1;
+_st($1)._valuesDo_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$2=_st($Compiler())._new();
+$ctx2.sendIdx["new"]=1;
+$3=_st(each)._source();
+$ctx2.sendIdx["source"]=1;
+$4=_st(each)._protocol();
+$ctx2.sendIdx["protocol"]=1;
+return _st($2)._install_forClass_protocol_($3,anotherClass,$4);
+$ctx2.sendIdx["install:forClass:protocol:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["valuesDo:"]=1;
+$5=_st(anotherClass)._class();
+$ctx1.sendIdx["class"]=1;
+$7=_st(aClass)._class();
+$ctx1.sendIdx["class"]=2;
+$6=_st($7)._instanceVariableNames();
+self._basicClass_instanceVariables_($5,$6);
+$9=_st(aClass)._class();
+$ctx1.sendIdx["class"]=3;
+$8=_st($9)._methodDictionary();
+_st($8)._valuesDo_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($Compiler())._new())._install_forClass_protocol_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._protocol());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+self._setupClass_(anotherClass);
+return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)})},
+args: ["aClass", "anotherClass"],
+source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ].\x0a\x0a\x09self setupClass: anotherClass",
+messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
+referencedClasses: ["Compiler"]
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "installMethod:forClass:protocol:",
+protocol: 'method definition',
+fn: function (aCompiledMethod,aBehavior,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aCompiledMethod)._protocol_(aString);
+_st(aBehavior)._addCompiledMethod_(aCompiledMethod);
+self._setupClass_(aBehavior);
+return aCompiledMethod;
+}, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},globals.ClassBuilder)})},
+args: ["aCompiledMethod", "aBehavior", "aString"],
+source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^ aCompiledMethod",
+messageSends: ["protocol:", "addCompiledMethod:", "setupClass:"],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instanceVariableNamesFor:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._isEmpty();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},globals.ClassBuilder)})},
+args: ["aString"],
+source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
+messageSends: ["reject:", "tokenize:", "isEmpty"],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "migrateClass:superclass:",
+protocol: 'class migration',
+fn: function (aClass,anotherClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(aClass)._name();
+$ctx1.sendIdx["name"]=1;
+$1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)})},
+args: ["aClass", "anotherClass"],
+source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
+messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
+protocol: 'class migration',
+fn: function (className,aClass,aCollection,packageName){
+var self=this;
+var oldClass,newClass,tmp;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ClassMigrated(){return globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5;
+tmp="new*".__comma(className);
+oldClass=_st(_st($Smalltalk())._globals())._at_(className);
+newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
+self._basicSwapClassNames_with_(oldClass,newClass);
+$ctx1.sendIdx["basicSwapClassNames:with:"]=1;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._copyClass_to_(oldClass,newClass);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(exception){
+return smalltalk.withContext(function($ctx2) {
+self._basicSwapClassNames_with_(oldClass,newClass);
+$1=self._basicRemoveClass_(newClass);
+$ctx2.sendIdx["basicRemoveClass:"]=1;
+$1;
+return _st(exception)._signal();
+}, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)})}));
+self._rawRenameClass_to_(oldClass,tmp);
+$ctx1.sendIdx["rawRenameClass:to:"]=1;
+$2=self._rawRenameClass_to_(newClass,className);
+_st(_st(oldClass)._subclasses())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._migrateClass_superclass_(each,newClass);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
+self._basicRemoveClass_(oldClass);
+$3=_st($ClassMigrated())._new();
+_st($3)._theClass_(newClass);
+_st($3)._oldClass_(oldClass);
+$4=_st($3)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($4);
+$5=newClass;
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},globals.ClassBuilder)})},
+args: ["className", "aClass", "aCollection", "packageName"],
+source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
+messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "signal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"],
+referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"]
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "rawRenameClass:to:",
+protocol: 'private',
+fn: function (aClass,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		globals[aString] = aClass;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)})},
+args: ["aClass", "aString"],
+source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09globals[aString] = aClass;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renameClass:to:",
+protocol: 'class migration',
+fn: function (aClass,className){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ClassRenamed(){return globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._basicRenameClass_to_(aClass,className);
+_st(aClass)._recompile();
+$1=_st($ClassRenamed())._new();
+_st($1)._theClass_(aClass);
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},globals.ClassBuilder)})},
+args: ["aClass", "className"],
+source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
+messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"],
+referencedClasses: ["SystemAnnouncer", "ClassRenamed"]
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupClass:",
+protocol: 'public',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.init(aClass);;
+return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},globals.ClassBuilder)})},
+args: ["aClass"],
+source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superclass:subclass:",
+protocol: 'class definition',
+fn: function (aClass,className){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},globals.ClassBuilder)})},
+args: ["aClass", "className"],
+source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
+messageSends: ["superclass:subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+globals.ClassBuilder);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "superclass:subclass:instanceVariableNames:package:",
+protocol: 'class definition',
+fn: function (aClass,className,ivarNames,packageName){
+var self=this;
+var newClass;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5,$receiver;
+$1=self._instanceVariableNamesFor_(ivarNames);
+if(($receiver = packageName) == null || $receiver.isNil){
+$2="unclassified";
+} else {
+$2=packageName;
+};
+newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
+self._setupClass_(newClass);
+$3=_st($ClassAdded())._new();
+_st($3)._theClass_(newClass);
+$4=_st($3)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($4);
+$5=newClass;
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},globals.ClassBuilder)})},
+args: ["aClass", "className", "ivarNames", "packageName"],
+source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
+messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
+referencedClasses: ["SystemAnnouncer", "ClassAdded"]
+}),
+globals.ClassBuilder);
+
+
+
+smalltalk.addClass('ClassCategoryReader', globals.Object, ['class', 'category'], 'Kernel-Classes');
+globals.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "class:category:",
+protocol: 'accessing',
+fn: function (aClass,aString){
+var self=this;
+self["@class"]=aClass;
+self["@category"]=aString;
+return self},
+args: ["aClass", "aString"],
+source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassCategoryReader);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileMethod:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
+return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},globals.ClassCategoryReader)})},
+args: ["aString"],
+source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
+messageSends: ["install:forClass:protocol:", "new"],
+referencedClasses: ["Compiler"]
+}),
+globals.ClassCategoryReader);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.ClassCategoryReader.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCategoryReader)})},
+args: [],
+source: "initialize\x0a\x09super initialize.",
+messageSends: ["initialize"],
+referencedClasses: []
+}),
+globals.ClassCategoryReader);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scanFrom:",
+protocol: 'fileIn',
+fn: function (aChunkParser){
+var self=this;
+var chunk;
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+chunk=_st(aChunkParser)._nextChunk();
+chunk;
+return _st(chunk)._isEmpty();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._compileMethod_(chunk);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
+return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCategoryReader)})},
+args: ["aChunkParser"],
+source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class",
+messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"],
+referencedClasses: ["ClassBuilder"]
+}),
+globals.ClassCategoryReader);
+
+
+
+smalltalk.addClass('ClassCommentReader', globals.Object, ['class'], 'Kernel-Classes');
+globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "class:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@class"]=aClass;
+return self},
+args: ["aClass"],
+source: "class: aClass\x0a\x09class := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassCommentReader);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.ClassCommentReader.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCommentReader)})},
+args: [],
+source: "initialize\x0a\x09super initialize.",
+messageSends: ["initialize"],
+referencedClasses: []
+}),
+globals.ClassCommentReader);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "scanFrom:",
+protocol: 'fileIn',
+fn: function (aChunkParser){
+var self=this;
+var chunk;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+chunk=_st(aChunkParser)._nextChunk();
+$1=_st(chunk)._isEmpty();
+if(! smalltalk.assert($1)){
+self._setComment_(chunk);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCommentReader)})},
+args: ["aChunkParser"],
+source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
+messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"],
+referencedClasses: []
+}),
+globals.ClassCommentReader);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setComment:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@class"])._comment_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},globals.ClassCommentReader)})},
+args: ["aString"],
+source: "setComment: aString\x0a\x09class comment: aString",
+messageSends: ["comment:"],
+referencedClasses: []
+}),
+globals.ClassCommentReader);
+
+
+
+smalltalk.addClass('ClassSorterNode', globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
+globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "getNodesFrom:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+var children,others;
+function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+children=[];
+others=[];
+_st(aCollection)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(_st(each)._superclass()).__eq(self._theClass());
+if(smalltalk.assert($1)){
+return _st(children)._add_(each);
+$ctx2.sendIdx["add:"]=1;
+} else {
+return _st(others)._add_(each);
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+self["@nodes"]=_st(children)._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st($ClassSorterNode())._on_classes_level_(each,others,_st(self._level()).__plus((1)));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},globals.ClassSorterNode)})},
+args: ["aCollection"],
+source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]",
+messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"],
+referencedClasses: ["ClassSorterNode"]
+}),
+globals.ClassSorterNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "level",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@level"];
+return $1;
+},
+args: [],
+source: "level\x0a\x09^ level",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassSorterNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "level:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@level"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "level: anInteger\x0a\x09level := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassSorterNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nodes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@nodes"];
+return $1;
+},
+args: [],
+source: "nodes\x0a\x09^ nodes",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassSorterNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@theClass"];
+return $1;
+},
+args: [],
+source: "theClass\x0a\x09^ theClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassSorterNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@theClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassSorterNode);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "traverseClassesWith:",
+protocol: 'visiting',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2;
+$1=self._theClass();
+$ctx1.sendIdx["theClass"]=1;
+_st(aCollection)._add_($1);
+_st(_st(self._nodes())._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(a)._theClass();
+$ctx2.sendIdx["theClass"]=2;
+$2=_st($3)._name();
+$ctx2.sendIdx["name"]=1;
+return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._do_((function(aNode){
+return smalltalk.withContext(function($ctx2) {
+return _st(aNode)._traverseClassesWith_(aCollection);
+}, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},globals.ClassSorterNode)})},
+args: ["aCollection"],
+source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
+messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"],
+referencedClasses: []
+}),
+globals.ClassSorterNode);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:classes:level:",
+protocol: 'instance creation',
+fn: function (aClass,aCollection,anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._theClass_(aClass);
+_st($2)._level_(anInteger);
+_st($2)._getNodesFrom_(aCollection);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},globals.ClassSorterNode.klass)})},
+args: ["aClass", "aCollection", "anInteger"],
+source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
+messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
+referencedClasses: []
+}),
+globals.ClassSorterNode.klass);
+
+});

+ 886 - 0
src/Kernel-Classes.st

@@ -0,0 +1,886 @@
+Smalltalk createPackage: 'Kernel-Classes'!
+Object subclass: #Behavior
+	instanceVariableNames: ''
+	package: 'Kernel-Classes'!
+!Behavior commentStamp!
+I am the superclass of all class objects.
+
+I define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).
+
+My instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,
+and hold the method dictionary that's associated with each class.
+
+I also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.!
+
+!Behavior methodsFor: 'accessing'!
+
+>> aString
+	^ self methodAt: aString
+!
+
+allInstanceVariableNames
+	| result |
+	result := self instanceVariableNames copy.
+	self superclass ifNotNil: [
+		result addAll: self superclass allInstanceVariableNames ].
+	^ result
+!
+
+allSelectors
+	^ self allSuperclasses
+		inject: self selectors
+		into: [ :acc :each | acc addAll: each selectors; yourself ]
+!
+
+allSubclasses
+	"Answer an collection of the receiver's and the receiver's descendent's subclasses. "
+
+	| subclasses index |
+	
+	subclasses := self subclasses.
+	index := 1.
+	[ index > subclasses size ]
+		whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.
+			index := index + 1 ].
+
+	^ subclasses
+!
+
+allSuperclasses
+	
+	self superclass ifNil: [ ^ #() ].
+	
+	^ (OrderedCollection with: self superclass)
+		addAll: self superclass allSuperclasses;
+		yourself
+!
+
+comment
+	^ (self basicAt: 'comment') ifNil: [ '' ]
+!
+
+comment: aString
+	self basicAt: 'comment' put: aString.
+	SystemAnnouncer current
+		announce: (ClassCommentChanged new
+			theClass: self;
+			yourself)
+!
+
+commentStamp
+	^ ClassCommentReader new
+	class: self;
+	yourself
+!
+
+commentStamp: aStamp prior: prior
+		^ self commentStamp
+!
+
+definition
+	^ ''
+!
+
+instanceVariableNames
+	<return self.iVarNames>
+!
+
+javascriptConstructor
+	"Answer the JS constructor used to instantiate. See boot.js"
+	
+	<return self.fn>
+!
+
+javascriptConstructor: aJavaScriptFunction
+	"Set the JS constructor used to instantiate.
+	See the JS counter-part in boot.js `smalltalk.setClassConstructor'"
+	
+	<smalltalk.setClassConstructor(self, aJavaScriptFunction);>
+!
+
+lookupSelector: selector
+	"Look up the given selector in my methodDictionary.
+	Return the corresponding method if found.
+	Otherwise chase the superclass chain and try again.
+	Return nil if no method is found."
+	
+	| lookupClass |
+	
+	lookupClass := self.
+	[ lookupClass = nil ] whileFalse: [
+		(lookupClass includesSelector: selector)
+				ifTrue: [ ^ lookupClass methodAt: selector ].
+			lookupClass := lookupClass superclass ].
+	^ nil
+!
+
+methodAt: aString
+	^ self methodDictionary at: aString
+!
+
+methodDictionary
+	<var dict = globals.HashedCollection._new();
+	var methods = self.methods;
+	Object.keys(methods).forEach(function(i) {
+		if(methods[i].selector) {
+			dict._at_put_(methods[i].selector, methods[i]);
+		}
+	});
+	return dict>
+!
+
+methodTemplate
+	^ String streamContents: [ :stream |
+		stream 
+			nextPutAll: 'messageSelectorAndArgumentNames';
+			nextPutAll: String lf, String tab;
+			nextPutAll: '"comment stating purpose of message"';
+			nextPutAll: String lf, String lf, String tab;
+			nextPutAll: '| temporary variable names |';
+			nextPutAll: String lf, String tab;
+			nextPutAll: 'statements' ]
+!
+
+methods
+	^ self methodDictionary values
+!
+
+methodsFor: aString
+	^ ClassCategoryReader new
+		class: self category: aString;
+		yourself
+!
+
+methodsFor: aString stamp: aStamp
+	"Added for compatibility, right now ignores stamp."
+	^ self methodsFor: aString
+!
+
+methodsInProtocol: aString
+	^ self methods select: [ :each | each protocol = aString ]
+!
+
+name
+	<return self.className || nil>
+!
+
+organization
+	^ self basicAt: 'organization'
+!
+
+ownMethods
+	"Answer the methods of the receiver that are not package extensions"
+
+	^ (self ownProtocols 
+		inject: OrderedCollection new
+		into: [ :acc :each | acc, (self methodsInProtocol: each) ])
+			sorted: [ :a :b | a selector <= b selector ]
+!
+
+ownProtocols
+	"Answer the protocols of the receiver that are not package extensions"
+
+	^ self protocols reject: [ :each |
+		each match: '^\*' ]
+!
+
+protocols
+	^ self organization elements sorted
+!
+
+prototype
+	<return self.fn.prototype>
+!
+
+removeProtocolIfEmpty: aString
+	self methods
+		detect: [ :each | each protocol = aString ]
+		ifNone: [ self organization removeElement: aString ]
+!
+
+selectors
+	^ self methodDictionary keys
+!
+
+subclasses
+	self subclassResponsibility
+!
+
+superclass
+	<return self.superclass || nil>
+!
+
+theMetaClass
+	^ self class
+!
+
+theNonMetaClass
+	^ self
+!
+
+withAllSubclasses
+	^ (Array with: self) addAll: self allSubclasses; yourself
+! !
+
+!Behavior methodsFor: 'compiling'!
+
+addCompiledMethod: aMethod
+	| oldMethod announcement |
+	
+	oldMethod := self methodDictionary
+		at: aMethod selector
+		ifAbsent: [ nil ].
+	
+	(self protocols includes: aMethod protocol)
+		ifFalse: [ self organization addElement: aMethod protocol ].
+
+	self basicAddCompiledMethod: aMethod.
+	
+	oldMethod ifNotNil: [
+		self removeProtocolIfEmpty: oldMethod protocol ].
+	
+	announcement := oldMethod
+		ifNil: [
+			MethodAdded new
+					method: aMethod;
+					yourself ]
+		ifNotNil: [
+			MethodModified new
+					oldMethod: oldMethod;
+					method: aMethod;
+					yourself ].
+					
+					
+	SystemAnnouncer current
+				announce: announcement
+!
+
+compile: aString
+	^ self compile: aString protocol: ''
+!
+
+compile: aString protocol: anotherString
+	^ Compiler new
+		install: aString
+		forClass: self
+		protocol: anotherString
+!
+
+recompile
+	^ Compiler new recompile: self
+!
+
+removeCompiledMethod: aMethod
+	self basicRemoveCompiledMethod: aMethod.
+	
+	self removeProtocolIfEmpty: aMethod protocol.
+	
+	SystemAnnouncer current
+		announce: (MethodRemoved new
+			method: aMethod;
+			yourself)
+! !
+
+!Behavior methodsFor: 'enumerating'!
+
+allSubclassesDo: aBlock
+	"Evaluate the argument, aBlock, for each of the receiver's subclasses."
+
+	self allSubclasses do: [ :each |
+    	aBlock value: each ]
+!
+
+protocolsDo: aBlock
+	"Execute aBlock for each method protocol with
+	its collection of methods in the sort order of protocol name."
+
+	| methodsByProtocol |
+	methodsByProtocol := HashedCollection new.
+	self methodDictionary valuesDo: [ :m |
+		(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])
+			add: m ].
+	self protocols do: [ :protocol |
+		aBlock value: protocol value: (methodsByProtocol at: protocol) ]
+! !
+
+!Behavior methodsFor: 'instance creation'!
+
+basicNew
+	<return new self.fn()>
+!
+
+new
+	^ self basicNew initialize
+! !
+
+!Behavior methodsFor: 'private'!
+
+basicAddCompiledMethod: aMethod
+	<smalltalk.addMethod(aMethod, self)>
+!
+
+basicRemoveCompiledMethod: aMethod
+	<smalltalk.removeMethod(aMethod,self)>
+! !
+
+!Behavior methodsFor: 'testing'!
+
+canUnderstand: aSelector
+	^ (self includesSelector: aSelector asString) or: [
+		self superclass notNil and: [ self superclass canUnderstand: aSelector ]]
+!
+
+includesBehavior: aClass
+	^ self == aClass or: [
+			self inheritsFrom: aClass ]
+!
+
+includesSelector: aString
+	^ self methodDictionary includesKey: aString
+!
+
+inheritsFrom: aClass
+	self superclass ifNil: [ ^ false ].
+
+	^ aClass == self superclass or: [ 
+		self superclass inheritsFrom: aClass ]
+!
+
+isBehavior
+	^ true
+! !
+
+Behavior subclass: #Class
+	instanceVariableNames: ''
+	package: 'Kernel-Classes'!
+!Class commentStamp!
+I am __the__ class object.
+
+My instances are the classes of the system.
+Class creation is done throught a `ClassBuilder` instance.!
+
+!Class methodsFor: 'accessing'!
+
+category
+	^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]
+!
+
+definition
+	^ String streamContents: [ :stream |
+		stream
+			nextPutAll: self superclass asString;
+			nextPutAll: ' subclass: #';
+			nextPutAll: self name;
+			nextPutAll: String lf, String tab;
+			nextPutAll: 'instanceVariableNames: '''.
+		self instanceVariableNames
+			do: [ :each | stream nextPutAll: each ]
+			separatedBy: [ stream nextPutAll: ' ' ].
+		stream
+			nextPutAll: '''', String lf, String tab;
+			nextPutAll: 'package: ''';
+			nextPutAll: self category;
+			nextPutAll: '''' ]
+!
+
+package
+	^ self basicAt: 'pkg'
+!
+
+package: aPackage
+	| oldPackage |
+	
+	self package = aPackage ifTrue: [ ^ self ].
+	
+	oldPackage := self package.
+	
+	self basicAt: 'pkg' put: aPackage.
+	oldPackage organization removeElement: self.
+	aPackage organization addElement: self.
+
+	SystemAnnouncer current announce: (ClassMoved new
+		theClass: self;
+		oldPackage: oldPackage;
+		yourself)
+!
+
+rename: aString
+	ClassBuilder new renameClass: self to: aString
+!
+
+subclasses
+	<return self.subclasses._copy()>
+! !
+
+!Class methodsFor: 'browsing'!
+
+browse
+	Finder findClass: self
+! !
+
+!Class methodsFor: 'class creation'!
+
+subclass: aString instanceVariableNames: anotherString
+	"Kept for compatibility."
+	^ self subclass: aString instanceVariableNames: anotherString package: nil
+!
+
+subclass: aString instanceVariableNames: aString2 category: aString3
+	"Kept for compatibility."
+	self deprecatedAPI.
+	^ self subclass: aString instanceVariableNames: aString2 package: aString3
+!
+
+subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3
+	"Just ignore class variables and pools. Added for compatibility."
+	^ self subclass: aString instanceVariableNames: aString2 package: aString3
+!
+
+subclass: aString instanceVariableNames: aString2 package: aString3
+	^ ClassBuilder new
+		superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3
+! !
+
+!Class methodsFor: 'converting'!
+
+asJavascript
+	^ 'globals.', self name
+! !
+
+!Class methodsFor: 'printing'!
+
+printOn: aStream
+	aStream nextPutAll: self name
+! !
+
+!Class methodsFor: 'testing'!
+
+isClass
+	^ true
+! !
+
+Behavior subclass: #Metaclass
+	instanceVariableNames: ''
+	package: 'Kernel-Classes'!
+!Metaclass commentStamp!
+I am the root of the class hierarchy.
+
+My instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.!
+
+!Metaclass methodsFor: 'accessing'!
+
+definition
+	^ String streamContents: [ :stream |
+		stream
+			nextPutAll: self asString;
+			nextPutAll: ' instanceVariableNames: '''.
+		self instanceVariableNames
+			do: [ :each | stream nextPutAll: each ]
+			separatedBy: [ stream nextPutAll: ' ' ].
+		stream nextPutAll: '''' ]
+!
+
+instanceClass
+	<return self.instanceClass>
+!
+
+instanceVariableNames: aCollection
+	ClassBuilder new
+		class: self instanceVariableNames: aCollection
+!
+
+package
+	^ self instanceClass package
+!
+
+subclasses
+	^ (self instanceClass subclasses 
+		select: [ :each | each isMetaclass not ])
+		collect: [ :each | each theMetaClass ]
+!
+
+theMetaClass
+	^ self
+!
+
+theNonMetaClass
+	^ self instanceClass
+! !
+
+!Metaclass methodsFor: 'converting'!
+
+asJavascript
+	^ 'globals.', self instanceClass name, '.klass'
+! !
+
+!Metaclass methodsFor: 'printing'!
+
+printOn: aStream
+	aStream
+		nextPutAll: self instanceClass name;
+		nextPutAll: ' class'
+! !
+
+!Metaclass methodsFor: 'testing'!
+
+isMetaclass
+	^ true
+! !
+
+Object subclass: #ClassBuilder
+	instanceVariableNames: ''
+	package: 'Kernel-Classes'!
+!ClassBuilder commentStamp!
+I am responsible for compiling new classes or modifying existing classes in the system.
+
+Rather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.!
+
+!ClassBuilder methodsFor: 'accessing'!
+
+instanceVariableNamesFor: aString
+	^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]
+! !
+
+!ClassBuilder methodsFor: 'class definition'!
+
+addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName
+	| theClass thePackage |
+	
+	theClass := Smalltalk globals at: className.
+	thePackage := Package named: packageName.
+	
+	theClass ifNotNil: [
+		theClass package: thePackage.
+		theClass superclass == aClass ifFalse: [
+			^ self
+				migrateClassNamed: className
+				superclass: aClass
+				instanceVariableNames: aCollection
+				package: packageName ] ].
+		
+	^ self
+		basicAddSubclassOf: aClass
+		named: className
+		instanceVariableNames: aCollection
+		package: packageName
+!
+
+class: aClass instanceVariableNames: ivarNames
+	self basicClass: aClass instanceVariableNames: ivarNames.
+	self setupClass: aClass.
+	
+	SystemAnnouncer current
+		announce: (ClassDefinitionChanged new
+			theClass: aClass;
+			yourself)
+!
+
+superclass: aClass subclass: className
+	^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil
+!
+
+superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName
+	| newClass |
+	
+	newClass := self addSubclassOf: aClass
+		named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)
+		package: (packageName ifNil: [ 'unclassified' ]).
+	self setupClass: newClass.
+	
+	SystemAnnouncer current
+		announce: (ClassAdded new
+			theClass: newClass;
+			yourself).
+	
+	^ newClass
+! !
+
+!ClassBuilder methodsFor: 'class migration'!
+
+migrateClass: aClass superclass: anotherClass
+	^ self
+		migrateClassNamed: aClass name
+		superclass: anotherClass
+		instanceVariableNames: aClass instanceVariableNames
+		package: aClass package name
+!
+
+migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName
+	| oldClass newClass tmp |
+	
+	tmp := 'new*', className.
+	oldClass := Smalltalk globals at: className.
+	
+	newClass := self
+		addSubclassOf: aClass
+		named: tmp
+		instanceVariableNames: aCollection
+		package: packageName.
+
+	self basicSwapClassNames: oldClass with: newClass.
+
+	[ self copyClass: oldClass to: newClass ]
+		on: Error
+		do: [ :exception |
+			self
+				basicSwapClassNames: oldClass with: newClass;
+				basicRemoveClass: newClass.
+			exception signal ].
+
+	self
+		rawRenameClass: oldClass to: tmp;
+		rawRenameClass: newClass to: className.
+
+	oldClass subclasses 
+		do: [ :each | self migrateClass: each superclass: newClass ].
+
+	self basicRemoveClass: oldClass.
+	
+	SystemAnnouncer current announce: (ClassMigrated new
+		theClass: newClass;
+		oldClass: oldClass;
+		yourself).
+	
+	^ newClass
+!
+
+renameClass: aClass to: className
+	self basicRenameClass: aClass to: className.
+	
+	"Recompile the class to fix potential issues with super sends"
+	aClass recompile.
+	
+	SystemAnnouncer current
+		announce: (ClassRenamed new
+			theClass: aClass;
+			yourself)
+! !
+
+!ClassBuilder methodsFor: 'copying'!
+
+copyClass: aClass named: className
+	| newClass |
+
+	newClass := self
+		addSubclassOf: aClass superclass
+		named: className
+		instanceVariableNames: aClass instanceVariableNames
+		package: aClass package name.
+
+	self copyClass: aClass to: newClass.
+	
+	SystemAnnouncer current
+		announce: (ClassAdded new
+			theClass: newClass;
+			yourself).
+	
+	^ newClass
+!
+
+copyClass: aClass to: anotherClass
+
+	anotherClass comment: aClass comment.
+
+	aClass methodDictionary valuesDo: [ :each |
+		Compiler new install: each source forClass: anotherClass protocol: each protocol ].
+
+	self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.
+
+	aClass class methodDictionary valuesDo: [ :each |
+		Compiler new install: each source forClass: anotherClass class protocol: each protocol ].
+
+	self setupClass: anotherClass
+! !
+
+!ClassBuilder methodsFor: 'method definition'!
+
+installMethod: aCompiledMethod forClass: aBehavior protocol: aString
+	aCompiledMethod protocol: aString.
+	aBehavior addCompiledMethod: aCompiledMethod.
+	self setupClass: aBehavior.
+	^ aCompiledMethod
+! !
+
+!ClassBuilder methodsFor: 'private'!
+
+basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName
+	<
+		smalltalk.addClass(aString, aClass, aCollection, packageName);
+		return globals[aString]
+	>
+!
+
+basicClass: aClass instanceVariableNames: aString
+	self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)
+!
+
+basicClass: aClass instanceVariables: aCollection
+
+	aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].
+	aClass basicAt: 'iVarNames' put: aCollection
+!
+
+basicRemoveClass: aClass
+	<smalltalk.removeClass(aClass)>
+!
+
+basicRenameClass: aClass to: aString
+	<
+		globals[aString] = aClass;
+		delete globals[aClass.className];
+		aClass.className = aString;
+	>
+!
+
+basicSwapClassNames: aClass with: anotherClass
+	<
+		var tmp = aClass.className;
+		aClass.className = anotherClass.className;
+		anotherClass.className = tmp;
+	>
+!
+
+rawRenameClass: aClass to: aString
+	<
+		globals[aString] = aClass;
+	>
+! !
+
+!ClassBuilder methodsFor: 'public'!
+
+setupClass: aClass
+	<smalltalk.init(aClass);>
+! !
+
+Object subclass: #ClassCategoryReader
+	instanceVariableNames: 'class category'
+	package: 'Kernel-Classes'!
+!ClassCategoryReader commentStamp!
+I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.!
+
+!ClassCategoryReader methodsFor: 'accessing'!
+
+class: aClass category: aString
+	class := aClass.
+	category := aString
+! !
+
+!ClassCategoryReader methodsFor: 'fileIn'!
+
+scanFrom: aChunkParser
+	| chunk |
+	[ chunk := aChunkParser nextChunk.
+	chunk isEmpty ] whileFalse: [
+		self compileMethod: chunk ].
+	ClassBuilder new setupClass: class
+! !
+
+!ClassCategoryReader methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+! !
+
+!ClassCategoryReader methodsFor: 'private'!
+
+compileMethod: aString
+	Compiler new install: aString forClass: class protocol: category
+! !
+
+Object subclass: #ClassCommentReader
+	instanceVariableNames: 'class'
+	package: 'Kernel-Classes'!
+!ClassCommentReader commentStamp!
+I provide a mechanism for retrieving class comments stored on a file.
+
+See also `ClassCategoryReader`.!
+
+!ClassCommentReader methodsFor: 'accessing'!
+
+class: aClass
+	class := aClass
+! !
+
+!ClassCommentReader methodsFor: 'fileIn'!
+
+scanFrom: aChunkParser
+	| chunk |
+	chunk := aChunkParser nextChunk.
+	chunk isEmpty ifFalse: [
+		self setComment: chunk ].
+! !
+
+!ClassCommentReader methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+! !
+
+!ClassCommentReader methodsFor: 'private'!
+
+setComment: aString
+	class comment: aString
+! !
+
+Object subclass: #ClassSorterNode
+	instanceVariableNames: 'theClass level nodes'
+	package: 'Kernel-Classes'!
+!ClassSorterNode commentStamp!
+I provide an algorithm for sorting classes alphabetically.
+
+See [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.!
+
+!ClassSorterNode methodsFor: 'accessing'!
+
+getNodesFrom: aCollection
+	| children others |
+	children := #().
+	others := #().
+	aCollection do: [ :each |
+		(each superclass = self theClass)
+			ifTrue: [ children add: each ]
+			ifFalse: [ others add: each ]].
+	nodes:= children collect: [ :each |
+		ClassSorterNode on: each classes: others level: self level + 1 ]
+!
+
+level
+	^ level
+!
+
+level: anInteger
+	level := anInteger
+!
+
+nodes
+	^ nodes
+!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
+! !
+
+!ClassSorterNode methodsFor: 'visiting'!
+
+traverseClassesWith: aCollection
+	"sort classes alphabetically Issue #143"
+
+	aCollection add: self theClass.
+	(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |
+		aNode traverseClassesWith: aCollection ].
+! !
+
+!ClassSorterNode class methodsFor: 'instance creation'!
+
+on: aClass classes: aCollection level: anInteger
+	^ self new
+		theClass: aClass;
+		level: anInteger;
+		getNodesFrom: aCollection;
+		yourself
+! !
+

+ 6867 - 0
src/Kernel-Collections.js

@@ -0,0 +1,6867 @@
+define("amber_core/Kernel-Collections", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Kernel-Collections');
+smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('Association', globals.Object, ['key', 'value'], 'Kernel-Collections');
+globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (anAssociation){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$5,$4,$6,$1;
+$3=self._class();
+$ctx1.sendIdx["class"]=1;
+$2=_st($3).__eq(_st(anAssociation)._class());
+$ctx1.sendIdx["="]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$5=self._key();
+$ctx2.sendIdx["key"]=1;
+$4=_st($5).__eq(_st(anAssociation)._key());
+$ctx2.sendIdx["="]=2;
+return _st($4)._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+$6=self._value();
+$ctx3.sendIdx["value"]=1;
+return _st($6).__eq(_st(anAssociation)._value());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$ctx1.sendIdx["and:"]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},globals.Association)})},
+args: ["anAssociation"],
+source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
+messageSends: ["and:", "=", "class", "key", "value"],
+referencedClasses: []
+}),
+globals.Association);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@key"];
+return $1;
+},
+args: [],
+source: "key\x0a\x09^ key",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Association);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key:",
+protocol: 'accessing',
+fn: function (aKey){
+var self=this;
+self["@key"]=aKey;
+return self},
+args: ["aKey"],
+source: "key: aKey\x0a\x09key := aKey",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Association);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._key())._printOn_(aStream);
+$ctx1.sendIdx["printOn:"]=1;
+_st(aStream)._nextPutAll_(" -> ");
+_st(self._value())._printOn_(aStream);
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Association)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
+messageSends: ["printOn:", "key", "nextPutAll:", "value"],
+referencedClasses: []
+}),
+globals.Association);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@value"];
+return $1;
+},
+args: [],
+source: "value\x0a\x09^ value",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Association);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'accessing',
+fn: function (aValue){
+var self=this;
+self["@value"]=aValue;
+return self},
+args: ["aValue"],
+source: "value: aValue\x0a\x09value := aValue",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Association);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key:value:",
+protocol: 'instance creation',
+fn: function (aKey,aValue){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._key_(aKey);
+_st($2)._value_(aValue);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},globals.Association.klass)})},
+args: ["aKey", "aValue"],
+source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
+messageSends: ["key:", "new", "value:", "yourself"],
+referencedClasses: []
+}),
+globals.Association.klass);
+
+
+smalltalk.addClass('BucketStore', globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
+globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "bucketOfElement:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var hash = self['@hashBlock'](anObject);
+		if (!hash) return null;
+		var buckets = self['@buckets'],
+			bucket = buckets[hash];
+		if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
+		return bucket;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},globals.BucketStore)})},
+args: ["anObject"],
+source: "bucketOfElement: anObject\x0a\x09<\x0a\x09\x09var hash = self['@hashBlock'](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = self['@buckets'],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BucketStore);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var buckets = self['@buckets'];
+		var keys = Object.keys(buckets);
+		for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.BucketStore)})},
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09<\x0a\x09\x09var buckets = self['@buckets'];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BucketStore);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hashBlock:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+self["@hashBlock"]=aBlock;
+return self},
+args: ["aBlock"],
+source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BucketStore);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.BucketStore.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self._removeAll();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.BucketStore)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
+messageSends: ["initialize", "removeAll"],
+referencedClasses: []
+}),
+globals.BucketStore);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newBucket",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"newBucket",{},globals.BucketStore)})},
+args: [],
+source: "newBucket\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.BucketStore);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeAll",
+protocol: 'adding/removing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self['@buckets'] = Object.create(null);;
+return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.BucketStore)})},
+args: [],
+source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BucketStore);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hashBlock:",
+protocol: 'instance creation',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._hashBlock_(aBlock);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},globals.BucketStore.klass)})},
+args: ["aBlock"],
+source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
+messageSends: ["hashBlock:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.BucketStore.klass);
+
+
+smalltalk.addClass('ArrayBucketStore', globals.BucketStore, [], 'Kernel-Collections');
+globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newBucket",
+protocol: 'private',
+fn: function (){
+var self=this;
+var $1;
+$1=[];
+return $1;
+},
+args: [],
+source: "newBucket\x0a\x09^ #()",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ArrayBucketStore);
+
+
+
+smalltalk.addClass('Collection', globals.Object, [], 'Kernel-Collections');
+globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: ",",
+protocol: 'copying',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._copy();
+_st($2)._addAll_(aCollection);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},globals.Collection)})},
+args: ["aCollection"],
+source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
+messageSends: ["addAll:", "copy", "yourself"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "add:",
+protocol: 'adding/removing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Collection)})},
+args: ["anObject"],
+source: "add: anObject\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addAll:",
+protocol: 'adding/removing',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aCollection)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._add_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return aCollection;
+}, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},globals.Collection)})},
+args: ["aCollection"],
+source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
+messageSends: ["do:", "add:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allSatisfy:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+var $early={};
+try {
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aBlock)._value_(each);
+if(! smalltalk.assert($1)){
+throw $early=[false];
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return true;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},globals.Collection)})},
+args: ["aBlock"],
+source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
+messageSends: ["do:", "ifFalse:", "value:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "anyOne",
+protocol: 'adding/removing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $early={};
+try {
+self._ifEmpty_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._error_("Collection is empty");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+self._do_((function(each){
+throw $early=[each];
+}));
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"anyOne",{},globals.Collection)})},
+args: [],
+source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
+messageSends: ["ifEmpty:", "error:", "do:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "anySatisfy:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+var $early={};
+try {
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aBlock)._value_(each);
+if(smalltalk.assert($1)){
+throw $early=[true];
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return false;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},globals.Collection)})},
+args: ["aBlock"],
+source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
+messageSends: ["do:", "ifTrue:", "value:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asArray",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Array())._withAll_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asArray",{},globals.Collection)})},
+args: [],
+source: "asArray\x0a\x09^ Array withAll: self",
+messageSends: ["withAll:"],
+referencedClasses: ["Array"]
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._asArray())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._asJSON();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.Collection)})},
+args: [],
+source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
+messageSends: ["collect:", "asArray", "asJSON"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asOrderedCollection",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._asArray();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},globals.Collection)})},
+args: [],
+source: "asOrderedCollection\x0a\x09^ self asArray",
+messageSends: ["asArray"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asSet",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Set())._withAll_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asSet",{},globals.Collection)})},
+args: [],
+source: "asSet\x0a\x09^ Set withAll: self",
+messageSends: ["withAll:"],
+referencedClasses: ["Set"]
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "collect:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+var stream;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+stream=_st(_st(self._class())._new())._writeStream();
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(stream)._nextPut_(_st(aBlock)._value_(each));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=_st(stream)._contents();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},globals.Collection)})},
+args: ["aBlock"],
+source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
+messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contains:",
+protocol: 'testing',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._deprecatedAPI();
+$1=self._anySatisfy_(aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},globals.Collection)})},
+args: ["aBlock"],
+source: "contains: aBlock\x0a\x09self deprecatedAPI.\x0a\x0a\x09^ self anySatisfy: aBlock",
+messageSends: ["deprecatedAPI", "anySatisfy:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copyWith:",
+protocol: 'copying',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._copy();
+_st($2)._add_(anObject);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},globals.Collection)})},
+args: ["anObject"],
+source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
+messageSends: ["add:", "copy", "yourself"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copyWithAll:",
+protocol: 'copying',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._copy();
+_st($2)._addAll_(aCollection);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},globals.Collection)})},
+args: ["aCollection"],
+source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
+messageSends: ["addAll:", "copy", "yourself"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copyWithoutAll:",
+protocol: 'copying',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(aCollection)._includes_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},globals.Collection)})},
+args: ["aCollection"],
+source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
+messageSends: ["reject:", "includes:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "detect:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._detect_ifNone_(aBlock,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._errorNotFound();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},globals.Collection)})},
+args: ["aBlock"],
+source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
+messageSends: ["detect:ifNone:", "errorNotFound"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "detect:ifNone:",
+protocol: 'enumerating',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
+args: ["aBlock", "anotherBlock"],
+source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Collection)})},
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:separatedBy:",
+protocol: 'enumerating',
+fn: function (aBlock,anotherBlock){
+var self=this;
+var actionBeforeElement;
+return smalltalk.withContext(function($ctx1) { 
+actionBeforeElement=(function(){
+actionBeforeElement=anotherBlock;
+return actionBeforeElement;
+});
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+_st(actionBeforeElement)._value();
+return _st(aBlock)._value_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},globals.Collection)})},
+args: ["aBlock", "anotherBlock"],
+source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
+messageSends: ["do:", "value", "value:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "errorNotFound",
+protocol: 'error handling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._error_("Object is not in the collection");
+return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},globals.Collection)})},
+args: [],
+source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
+messageSends: ["error:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifEmpty:",
+protocol: 'testing',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._isEmpty();
+$1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
+return self;
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},globals.Collection)})},
+args: ["aBlock"],
+source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
+messageSends: ["ifTrue:ifFalse:", "isEmpty"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifEmpty:ifNotEmpty:",
+protocol: 'testing',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._isEmpty();
+$1=_st($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
+args: ["aBlock", "anotherBlock"],
+source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: anotherBlock",
+messageSends: ["ifTrue:ifFalse:", "isEmpty"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNotEmpty:",
+protocol: 'testing',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._notEmpty();
+$1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
+return self;
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},globals.Collection)})},
+args: ["aBlock"],
+source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
+messageSends: ["ifTrue:ifFalse:", "notEmpty"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNotEmpty:ifEmpty:",
+protocol: 'testing',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._notEmpty();
+$1=_st($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
+args: ["aBlock", "anotherBlock"],
+source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: anotherBlock",
+messageSends: ["ifTrue:ifFalse:", "notEmpty"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includes:",
+protocol: 'testing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._anySatisfy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each).__eq(anObject);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.Collection)})},
+args: ["anObject"],
+source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
+messageSends: ["anySatisfy:", "="],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inject:into:",
+protocol: 'enumerating',
+fn: function (anObject,aBlock){
+var self=this;
+var result;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+result=anObject;
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+result=_st(aBlock)._value_value_(result,each);
+return result;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=result;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},globals.Collection)})},
+args: ["anObject", "aBlock"],
+source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
+messageSends: ["do:", "value:value:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "intersection:",
+protocol: 'enumerating',
+fn: function (aCollection){
+var self=this;
+var set,outputSet;
+function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3;
+set=self._asSet();
+outputSet=_st($Set())._new();
+_st(aCollection)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(set)._includes_(each);
+$ctx2.sendIdx["includes:"]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(outputSet)._includes_(each))._not();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+if(smalltalk.assert($1)){
+return _st(outputSet)._add_(each);
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$3=_st(self._class())._withAll_(_st(outputSet)._asArray());
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},globals.Collection)})},
+args: ["aCollection"],
+source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
+messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"],
+referencedClasses: ["Set"]
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isEmpty",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._size()).__eq((0));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Collection)})},
+args: [],
+source: "isEmpty\x0a\x09^ self size = 0",
+messageSends: ["=", "size"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "noneSatisfy:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+var $early={};
+try {
+self._do_((function(item){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aBlock)._value_(item);
+if(smalltalk.assert($1)){
+throw $early=[false];
+};
+}, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)})}));
+return true;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},globals.Collection)})},
+args: ["aBlock"],
+source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
+messageSends: ["do:", "ifTrue:", "value:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "notEmpty",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._isEmpty())._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"notEmpty",{},globals.Collection)})},
+args: [],
+source: "notEmpty\x0a\x09^ self isEmpty not",
+messageSends: ["not", "isEmpty"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "occurrencesOf:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+var tally;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+tally=(0);
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(anObject).__eq(each);
+if(smalltalk.assert($1)){
+tally=_st(tally).__plus((1));
+return tally;
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$2=tally;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},globals.Collection)})},
+args: ["anObject"],
+source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally",
+messageSends: ["do:", "ifTrue:", "=", "+"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "putOn:",
+protocol: 'streaming',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._putOn_(aStream);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Collection)})},
+args: ["aStream"],
+source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
+messageSends: ["do:", "putOn:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reject:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(aBlock)._value_(each)).__eq(false);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},globals.Collection)})},
+args: ["aBlock"],
+source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
+messageSends: ["select:", "=", "value:"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove:",
+protocol: 'adding/removing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._remove_ifAbsent_(anObject,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._errorNotFound();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.Collection)})},
+args: ["anObject"],
+source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
+messageSends: ["remove:ifAbsent:", "errorNotFound"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove:ifAbsent:",
+protocol: 'adding/removing',
+fn: function (anObject,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.Collection)})},
+args: ["anObject", "aBlock"],
+source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeAll",
+protocol: 'adding/removing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Collection)})},
+args: [],
+source: "removeAll\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "select:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+var stream;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+stream=_st(_st(self._class())._new())._writeStream();
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aBlock)._value_(each);
+if(smalltalk.assert($1)){
+return _st(stream)._nextPut_(each);
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$2=_st(stream)._contents();
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},globals.Collection)})},
+args: ["aBlock"],
+source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
+messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "select:thenCollect:",
+protocol: 'enumerating',
+fn: function (selectBlock,collectBlock){
+var self=this;
+var stream;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+stream=_st(_st(self._class())._new())._writeStream();
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(selectBlock)._value_(each);
+$ctx2.sendIdx["value:"]=1;
+if(smalltalk.assert($1)){
+return _st(stream)._nextPut_(_st(collectBlock)._value_(each));
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$2=_st(stream)._contents();
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},globals.Collection)})},
+args: ["selectBlock", "collectBlock"],
+source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
+messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
+referencedClasses: []
+}),
+globals.Collection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "size",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Collection)})},
+args: [],
+source: "size\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.Collection);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+protocol: 'helios',
+fn: function (){
+var self=this;
+return "collection";
+},
+args: [],
+source: "heliosClass\x0a\x09^ 'collection'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Collection.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new:",
+protocol: 'instance creation',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Collection.klass)})},
+args: ["anInteger"],
+source: "new: anInteger\x0a\x09^ self new",
+messageSends: ["new"],
+referencedClasses: []
+}),
+globals.Collection.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:",
+protocol: 'instance creation',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._add_(anObject);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Collection.klass)})},
+args: ["anObject"],
+source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
+messageSends: ["add:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.Collection.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:with:",
+protocol: 'instance creation',
+fn: function (anObject,anotherObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._add_(anObject);
+$ctx1.sendIdx["add:"]=1;
+_st($2)._add_(anotherObject);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},globals.Collection.klass)})},
+args: ["anObject", "anotherObject"],
+source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
+messageSends: ["add:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.Collection.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:with:with:",
+protocol: 'instance creation',
+fn: function (firstObject,secondObject,thirdObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._add_(firstObject);
+$ctx1.sendIdx["add:"]=1;
+_st($2)._add_(secondObject);
+$ctx1.sendIdx["add:"]=2;
+_st($2)._add_(thirdObject);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},globals.Collection.klass)})},
+args: ["firstObject", "secondObject", "thirdObject"],
+source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
+messageSends: ["add:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.Collection.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withAll:",
+protocol: 'instance creation',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._addAll_(aCollection);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},globals.Collection.klass)})},
+args: ["aCollection"],
+source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
+messageSends: ["addAll:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.Collection.klass);
+
+
+smalltalk.addClass('IndexableCollection', globals.Collection, [], 'Kernel-Collections');
+globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:",
+protocol: 'accessing',
+fn: function (anIndex){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_ifAbsent_(anIndex,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._errorNotFound();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},globals.IndexableCollection)})},
+args: ["anIndex"],
+source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
+messageSends: ["at:ifAbsent:", "errorNotFound"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsent:",
+protocol: 'accessing',
+fn: function (anIndex,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)})},
+args: ["anIndex", "aBlock"],
+source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsentPut:",
+protocol: 'accessing',
+fn: function (aKey,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_ifAbsent_(aKey,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._at_put_(aKey,_st(aBlock)._value());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},globals.IndexableCollection)})},
+args: ["aKey", "aBlock"],
+source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
+messageSends: ["at:ifAbsent:", "at:put:", "value"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifPresent:",
+protocol: 'accessing',
+fn: function (anIndex,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
+return nil;
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)})},
+args: ["anIndex", "aBlock"],
+source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
+messageSends: ["at:ifPresent:ifAbsent:"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifPresent:ifAbsent:",
+protocol: 'accessing',
+fn: function (anIndex,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.IndexableCollection)})},
+args: ["anIndex", "aBlock", "anotherBlock"],
+source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:put:",
+protocol: 'accessing',
+fn: function (anIndex,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.IndexableCollection)})},
+args: ["anIndex", "anObject"],
+source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "indexOf:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._indexOf_ifAbsent_(anObject,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._errorNotFound();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},globals.IndexableCollection)})},
+args: ["anObject"],
+source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
+messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "indexOf:ifAbsent:",
+protocol: 'accessing',
+fn: function (anObject,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.IndexableCollection)})},
+args: ["anObject", "aBlock"],
+source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:do:",
+protocol: 'enumarating',
+fn: function (anotherCollection,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._withIndexDo_((function(each,index){
+return smalltalk.withContext(function($ctx2) {
+return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
+}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.IndexableCollection)})},
+args: ["anotherCollection", "aBlock"],
+source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
+messageSends: ["withIndexDo:", "value:value:", "at:"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withIndexDo:",
+protocol: 'enumarating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.IndexableCollection)})},
+args: ["aBlock"],
+source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.IndexableCollection);
+
+
+
+smalltalk.addClass('AssociativeCollection', globals.IndexableCollection, [], 'Kernel-Collections');
+globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (anAssocitativeCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$4,$3,$6,$5;
+$2=self._class();
+$ctx1.sendIdx["class"]=1;
+$1=_st($2).__eq(_st(anAssocitativeCollection)._class());
+$ctx1.sendIdx["="]=1;
+if(! smalltalk.assert($1)){
+return false;
+};
+$4=self._size();
+$ctx1.sendIdx["size"]=1;
+$3=_st($4).__eq(_st(anAssocitativeCollection)._size());
+$ctx1.sendIdx["="]=2;
+if(! smalltalk.assert($3)){
+return false;
+};
+$6=self._associations();
+$ctx1.sendIdx["associations"]=1;
+$5=_st($6).__eq(_st(anAssocitativeCollection)._associations());
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},globals.AssociativeCollection)})},
+args: ["anAssocitativeCollection"],
+source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
+messageSends: ["ifFalse:", "=", "class", "size", "associations"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "add:",
+protocol: 'adding/removing',
+fn: function (anAssociation){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
+return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},globals.AssociativeCollection)})},
+args: ["anAssociation"],
+source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
+messageSends: ["at:put:", "key", "value"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addAll:",
+protocol: 'adding/removing',
+fn: function (anAssociativeCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply(_st(self), [_st(anAssociativeCollection)._associations()]));
+$ctx1.supercall = false;
+return anAssociativeCollection;
+}, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},globals.AssociativeCollection)})},
+args: ["anAssociativeCollection"],
+source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
+messageSends: ["addAll:", "associations"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asDictionary",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Dictionary())._from_(self._associations());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asDictionary",{},globals.AssociativeCollection)})},
+args: [],
+source: "asDictionary\x0a\x09^ Dictionary from: self associations",
+messageSends: ["from:", "associations"],
+referencedClasses: ["Dictionary"]
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asHashedCollection",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($HashedCollection())._from_(self._associations());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},globals.AssociativeCollection)})},
+args: [],
+source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
+messageSends: ["from:", "associations"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'converting',
+fn: function (){
+var self=this;
+var hash;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+hash=_st($HashedCollection())._new();
+self._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+return _st(hash)._at_put_(key,_st(value)._asJSON());
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
+$1=hash;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},globals.AssociativeCollection)})},
+args: [],
+source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash",
+messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "associations",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var associations;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+associations=[];
+self._associationsDo_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(associations)._add_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=associations;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},globals.AssociativeCollection)})},
+args: [],
+source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
+messageSends: ["associationsDo:", "add:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "associationsDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
+return smalltalk.withContext(function($ctx1) { 
+self._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["aBlock"],
+source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
+messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
+referencedClasses: ["Association"]
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifPresent:ifAbsent:",
+protocol: 'accessing',
+fn: function (aKey,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._includesKey_(aKey);
+if(smalltalk.assert($2)){
+$1=_st(aBlock)._value_(self._at_(aKey));
+} else {
+$1=_st(anotherBlock)._value();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)})},
+args: ["aKey", "aBlock", "anotherBlock"],
+source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
+messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "collect:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+var newDict;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+newDict=_st(self._class())._new();
+self._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
+$1=newDict;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)})},
+args: ["aBlock"],
+source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
+messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deepCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+var copy;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+copy=_st(self._class())._new();
+self._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+return _st(copy)._at_put_(key,_st(value)._deepCopy());
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
+$1=copy;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},globals.AssociativeCollection)})},
+args: [],
+source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
+messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "detect:ifNone:",
+protocol: 'enumerating',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)})},
+args: ["aBlock", "anotherBlock"],
+source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
+messageSends: ["detect:ifNone:", "values"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._valuesDo_(aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09self valuesDo: aBlock",
+messageSends: ["valuesDo:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includes:",
+protocol: 'enumerating',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._values())._includes_(anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.AssociativeCollection)})},
+args: ["anObject"],
+source: "includes: anObject\x0a\x09^ self values includes: anObject",
+messageSends: ["includes:", "values"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includesKey:",
+protocol: 'testing',
+fn: function (aKey){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.AssociativeCollection)})},
+args: ["aKey"],
+source: "includesKey: aKey\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "indexOf:ifAbsent:",
+protocol: 'accessing',
+fn: function (anObject,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._keys())._detect_ifNone_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._at_(each)).__eq(anObject);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["anObject", "aBlock"],
+source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
+messageSends: ["detect:ifNone:", "keys", "=", "at:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyAtValue:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._keyAtValue_ifAbsent_(anObject,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._errorNotFound();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},globals.AssociativeCollection)})},
+args: ["anObject"],
+source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
+messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyAtValue:ifAbsent:",
+protocol: 'accessing',
+fn: function (anObject,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._indexOf_ifAbsent_(anObject,aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["anObject", "aBlock"],
+source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
+messageSends: ["indexOf:ifAbsent:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keys",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"keys",{},globals.AssociativeCollection)})},
+args: [],
+source: "keys\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keysAndValuesDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._keysDo_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(aBlock)._value_value_(each,self._at_(each));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["aBlock"],
+source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
+messageSends: ["keysDo:", "value:value:", "at:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keysDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["aBlock"],
+source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
+$ctx1.supercall = false;
+$ctx1.sendIdx["printOn:"]=1;
+_st(aStream)._nextPutAll_(" (");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(self._associations())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._printOn_(aStream);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aStream)._nextPutAll_(" , ");
+$ctx2.sendIdx["nextPutAll:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(aStream)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AssociativeCollection)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
+messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove:ifAbsent:",
+protocol: 'adding/removing',
+fn: function (aKey,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._removeKey_ifAbsent_(aKey,aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["aKey", "aBlock"],
+source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
+messageSends: ["removeKey:ifAbsent:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeAll",
+protocol: 'adding/removing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._keys())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._removeKey_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.AssociativeCollection)})},
+args: [],
+source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
+messageSends: ["do:", "keys", "removeKey:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeKey:",
+protocol: 'adding/removing',
+fn: function (aKey){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._remove_(aKey);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},globals.AssociativeCollection)})},
+args: ["aKey"],
+source: "removeKey: aKey\x0a\x09^ self remove: aKey",
+messageSends: ["remove:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeKey:ifAbsent:",
+protocol: 'adding/removing',
+fn: function (aKey,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["aKey", "aBlock"],
+source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "select:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+var newDict;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+newDict=_st(self._class())._new();
+self._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aBlock)._value_(value);
+if(smalltalk.assert($1)){
+return _st(newDict)._at_put_(key,value);
+};
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
+$2=newDict;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)})},
+args: ["aBlock"],
+source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
+messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shallowCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+var copy;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+copy=_st(self._class())._new();
+self._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+return _st(copy)._at_put_(key,value);
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
+$1=copy;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},globals.AssociativeCollection)})},
+args: [],
+source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
+messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "size",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._keys())._size();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"size",{},globals.AssociativeCollection)})},
+args: [],
+source: "size\x0a\x09^ self keys size",
+messageSends: ["size", "keys"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "values",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"values",{},globals.AssociativeCollection)})},
+args: [],
+source: "values\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valuesDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["aBlock"],
+source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withIndexDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._keysAndValuesDo_((function(key,value){
+return smalltalk.withContext(function($ctx2) {
+return _st(aBlock)._value_value_(value,key);
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
+args: ["aBlock"],
+source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
+messageSends: ["keysAndValuesDo:", "value:value:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "from:",
+protocol: 'instance creation',
+fn: function (aCollection){
+var self=this;
+var newCollection;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+newCollection=self._new();
+_st(aCollection)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(newCollection)._add_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=newCollection;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)})},
+args: ["aCollection"],
+source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
+messageSends: ["new", "do:", "add:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromPairs:",
+protocol: 'instance creation',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._from_(aCollection);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},globals.AssociativeCollection.klass)})},
+args: ["aCollection"],
+source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
+messageSends: ["from:"],
+referencedClasses: []
+}),
+globals.AssociativeCollection.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newFromPairs:",
+protocol: 'instance creation',
+fn: function (aCollection){
+var self=this;
+var newCollection;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$4,$5;
+$2=_st(aCollection)._size();
+$ctx1.sendIdx["size"]=1;
+$1=_st($2)._even();
+if(! smalltalk.assert($1)){
+self._error_("#newFromPairs only accepts arrays of an even length");
+};
+newCollection=self._new();
+_st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$3=newCollection;
+$4=_st(aCollection)._at_(each);
+$ctx2.sendIdx["at:"]=1;
+return _st($3)._at_put_($4,_st(aCollection)._at_(_st(each).__plus((1))));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+$5=newCollection;
+return $5;
+}, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)})},
+args: ["aCollection"],
+source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
+messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"],
+referencedClasses: []
+}),
+globals.AssociativeCollection.klass);
+
+
+smalltalk.addClass('Dictionary', globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
+globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsent:",
+protocol: 'accessing',
+fn: function (aKey,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var index = self._positionOfKey_(aKey);
+		return index >=0 ? self['@values'][index] : aBlock._value();
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)})},
+args: ["aKey", "aBlock"],
+source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:put:",
+protocol: 'accessing',
+fn: function (aKey,aValue){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var index = self._positionOfKey_(aKey);
+		if(index === -1) {
+			var keys = self['@keys'];
+			index = keys.length;
+			keys.push(aKey);
+		}
+
+		return self['@values'][index] = aValue;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.Dictionary)})},
+args: ["aKey", "aValue"],
+source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self['@keys'];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self['@values'][index] = aValue;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includesKey:",
+protocol: 'testing',
+fn: function (aKey){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ return self._positionOfKey_(aKey) >= 0; ;
+return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.Dictionary)})},
+args: ["aKey"],
+source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "indexOf:ifAbsent:",
+protocol: 'accessing',
+fn: function (anObject,aBlock){
+var self=this;
+var index;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
+return (0);
+}));
+$2=_st(index).__eq((0));
+if(smalltalk.assert($2)){
+$1=_st(aBlock)._value();
+} else {
+$1=_st(self["@keys"])._at_(index);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Dictionary)})},
+args: ["anObject", "aBlock"],
+source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
+messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.Dictionary.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@keys"]=[];
+self["@values"]=[];
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Dictionary)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
+messageSends: ["initialize"],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keys",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@keys"])._copy();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"keys",{},globals.Dictionary)})},
+args: [],
+source: "keys\x0a\x09^ keys copy",
+messageSends: ["copy"],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keysAndValuesDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.Dictionary)})},
+args: ["aBlock"],
+source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
+messageSends: ["with:do:"],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keysDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@keys"])._do_(aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.Dictionary)})},
+args: ["aBlock"],
+source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
+messageSends: ["do:"],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "positionOfKey:",
+protocol: 'private',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var keys = self['@keys'];
+		for(var i=0;i<keys.length;i++){
+			if(keys[i].__eq(anObject)) { return i;}
+		}
+		return -1;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},globals.Dictionary)})},
+args: ["anObject"],
+source: "positionOfKey: anObject\x0a\x09<\x0a\x09\x09var keys = self['@keys'];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeAll",
+protocol: 'adding/removing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@keys"])._removeAll();
+$ctx1.sendIdx["removeAll"]=1;
+_st(self["@values"])._removeAll();
+return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Dictionary)})},
+args: [],
+source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
+messageSends: ["removeAll"],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeKey:ifAbsent:",
+protocol: 'adding/removing',
+fn: function (aKey,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var index = self._positionOfKey_(aKey);
+		if(index === -1) {
+			return aBlock._value()
+		} else {
+			var keys = self['@keys'], values = self['@values'];
+			var value = values[index], l = keys.length;
+			keys[index] = keys[l-1];
+			keys.pop();
+			values[index] = values[l-1];
+			values.pop();
+			return value;
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)})},
+args: ["aKey", "aBlock"],
+source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self['@keys'], values = self['@values'];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "values",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@values"];
+return $1;
+},
+args: [],
+source: "values\x0a\x09^ values",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valuesDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@values"])._do_(aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.Dictionary)})},
+args: ["aBlock"],
+source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
+messageSends: ["do:"],
+referencedClasses: []
+}),
+globals.Dictionary);
+
+
+
+smalltalk.addClass('HashedCollection', globals.AssociativeCollection, [], 'Kernel-Collections');
+globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsent:",
+protocol: 'accessing',
+fn: function (aKey,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._includesKey_(aKey);
+if(smalltalk.assert($2)){
+$1=self._basicAt_(aKey);
+} else {
+$1=_st(aBlock)._value();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)})},
+args: ["aKey", "aBlock"],
+source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
+messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"],
+referencedClasses: []
+}),
+globals.HashedCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:put:",
+protocol: 'accessing',
+fn: function (aKey,aValue){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_put_(aKey,aValue);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.HashedCollection)})},
+args: ["aKey", "aValue"],
+source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
+messageSends: ["basicAt:put:"],
+referencedClasses: []
+}),
+globals.HashedCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includesKey:",
+protocol: 'testing',
+fn: function (aKey){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.hasOwnProperty(aKey);
+return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.HashedCollection)})},
+args: ["aKey"],
+source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HashedCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keys",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Object.keys(self);
+return self}, function($ctx1) {$ctx1.fill(self,"keys",{},globals.HashedCollection)})},
+args: [],
+source: "keys\x0a\x09<return Object.keys(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HashedCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keysDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._keys())._do_(aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.HashedCollection)})},
+args: ["aBlock"],
+source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
+messageSends: ["do:", "keys"],
+referencedClasses: []
+}),
+globals.HashedCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeKey:ifAbsent:",
+protocol: 'adding/removing',
+fn: function (aKey,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
+return smalltalk.withContext(function($ctx2) {
+self._basicDelete_(aKey);
+return removed;
+}, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aBlock)._value();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)})},
+args: ["aKey", "aBlock"],
+source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
+messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"],
+referencedClasses: []
+}),
+globals.HashedCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "values",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return self._keys().map(function(key){
+			return self._at_(key);
+		});
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"values",{},globals.HashedCollection)})},
+args: [],
+source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HashedCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valuesDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._values())._do_(aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.HashedCollection)})},
+args: ["aBlock"],
+source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
+messageSends: ["do:", "values"],
+referencedClasses: []
+}),
+globals.HashedCollection);
+
+
+
+smalltalk.addClass('SequenceableCollection', globals.IndexableCollection, [], 'Kernel-Collections');
+globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$4,$1,$5;
+var $early={};
+try {
+$3=self._class();
+$ctx1.sendIdx["class"]=1;
+$2=_st($3).__eq(_st(aCollection)._class());
+$ctx1.sendIdx["="]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=self._size();
+$ctx2.sendIdx["size"]=1;
+return _st($4).__eq(_st(aCollection)._size());
+$ctx2.sendIdx["="]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(! smalltalk.assert($1)){
+return false;
+};
+self._withIndexDo_((function(each,i){
+return smalltalk.withContext(function($ctx2) {
+$5=_st(_st(aCollection)._at_(i)).__eq(each);
+if(! smalltalk.assert($5)){
+throw $early=[false];
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
+return true;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.SequenceableCollection)})},
+args: ["aCollection"],
+source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true",
+messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addLast:",
+protocol: 'adding/removing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._add_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},globals.SequenceableCollection)})},
+args: ["anObject"],
+source: "addLast: anObject\x0a\x09self add: anObject",
+messageSends: ["add:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allButFirst",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._copyFrom_to_((2),self._size());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allButFirst",{},globals.SequenceableCollection)})},
+args: [],
+source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
+messageSends: ["copyFrom:to:", "size"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allButLast",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allButLast",{},globals.SequenceableCollection)})},
+args: [],
+source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
+messageSends: ["copyFrom:to:", "-", "size"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "atRandom",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_(_st(self._size())._atRandom());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.SequenceableCollection)})},
+args: [],
+source: "atRandom\x0a\x09^ self at: self size atRandom",
+messageSends: ["at:", "atRandom", "size"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "beginsWith:",
+protocol: 'testing',
+fn: function (prefix){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1,$4;
+$2=self._size();
+$ctx1.sendIdx["size"]=1;
+$3=_st(prefix)._size();
+$ctx1.sendIdx["size"]=2;
+$1=_st($2).__lt($3);
+if(smalltalk.assert($1)){
+return false;
+};
+$4=_st(self._first_(_st(prefix)._size())).__eq(prefix);
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},globals.SequenceableCollection)})},
+args: ["prefix"],
+source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
+messageSends: ["ifTrue:", "<", "size", "=", "first:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copyFrom:to:",
+protocol: 'copying',
+fn: function (anIndex,anotherIndex){
+var self=this;
+var range,newCollection;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+range=_st(anIndex)._to_(anotherIndex);
+newCollection=_st(self._class())._new_(_st(range)._size());
+_st(range)._withIndexDo_((function(each,i){
+return smalltalk.withContext(function($ctx2) {
+return _st(newCollection)._at_put_(i,self._at_(each));
+}, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
+$1=newCollection;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},globals.SequenceableCollection)})},
+args: ["anIndex", "anotherIndex"],
+source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [ :each :i |\x0a\x09\x09newCollection at: i put: (self at: each) ].\x0a\x09^ newCollection",
+messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deepCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+var newCollection;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+newCollection=_st(self._class())._new_(self._size());
+self._withIndexDo_((function(each,index){
+return smalltalk.withContext(function($ctx2) {
+return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
+}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
+$1=newCollection;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},globals.SequenceableCollection)})},
+args: [],
+source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each deepCopy ].\x0a\x09^ newCollection",
+messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "detect:ifNone:",
+protocol: 'enumerating',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		self = self._numericallyIndexable();
+		for(var i = 0; i < self.length; i++)
+			if(aBlock._value_(self[i]))
+				return self[i];
+		return anotherBlock._value();
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.SequenceableCollection)})},
+args: ["aBlock", "anotherBlock"],
+source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		self = self._numericallyIndexable();
+		for(var i=0; i < self.length; i++) {
+			aBlock._value_(self[i]);
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.SequenceableCollection)})},
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "endsWith:",
+protocol: 'testing',
+fn: function (suffix){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1,$4;
+$2=self._size();
+$ctx1.sendIdx["size"]=1;
+$3=_st(suffix)._size();
+$ctx1.sendIdx["size"]=2;
+$1=_st($2).__lt($3);
+if(smalltalk.assert($1)){
+return false;
+};
+$4=_st(self._last_(_st(suffix)._size())).__eq(suffix);
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},globals.SequenceableCollection)})},
+args: ["suffix"],
+source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
+messageSends: ["ifTrue:", "<", "size", "=", "last:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "first",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_((1));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"first",{},globals.SequenceableCollection)})},
+args: [],
+source: "first\x0a\x09^ self at: 1",
+messageSends: ["at:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "first:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._size()).__lt(aNumber);
+if(smalltalk.assert($1)){
+self._error_("Invalid number of elements");
+};
+$2=self._copyFrom_to_((1),aNumber);
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},globals.SequenceableCollection)})},
+args: ["aNumber"],
+source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
+messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fourth",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_((4));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"fourth",{},globals.SequenceableCollection)})},
+args: [],
+source: "fourth\x0a\x09^ self at: 4",
+messageSends: ["at:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includes:",
+protocol: 'testing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._indexOf_ifAbsent_(anObject,(function(){
+return nil;
+})))._notNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.SequenceableCollection)})},
+args: ["anObject"],
+source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
+messageSends: ["notNil", "indexOf:ifAbsent:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "indexOf:ifAbsent:",
+protocol: 'accessing',
+fn: function (anObject,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		self = self._numericallyIndexable();
+		for(var i=0; i < self.length; i++) {
+			if(_st(self[i]).__eq(anObject)) {return i+1}
+		};
+		return aBlock._value();
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.SequenceableCollection)})},
+args: ["anObject", "aBlock"],
+source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "indexOf:startingAt:",
+protocol: 'accessing',
+fn: function (anObject,start){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
+return (0);
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},globals.SequenceableCollection)})},
+args: ["anObject", "start"],
+source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^ self indexOf: anObject startingAt: start ifAbsent: [ 0 ]",
+messageSends: ["indexOf:startingAt:ifAbsent:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "indexOf:startingAt:ifAbsent:",
+protocol: 'accessing',
+fn: function (anObject,start,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		self = self._numericallyIndexable();
+		for(var i=start - 1; i < self.length; i++){
+			if(_st(self[i]).__eq(anObject)) {return i+1}
+		}
+		return aBlock._value();
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},globals.SequenceableCollection)})},
+args: ["anObject", "start", "aBlock"],
+source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "last",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_(self._size());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"last",{},globals.SequenceableCollection)})},
+args: [],
+source: "last\x0a\x09^ self at: self size",
+messageSends: ["at:", "size"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "last:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$6,$5,$4,$3;
+$2=self._size();
+$ctx1.sendIdx["size"]=1;
+$1=_st($2).__lt(aNumber);
+if(smalltalk.assert($1)){
+self._error_("Invalid number of elements");
+};
+$6=self._size();
+$ctx1.sendIdx["size"]=2;
+$5=_st($6).__minus(aNumber);
+$4=_st($5).__plus((1));
+$3=self._copyFrom_to_($4,self._size());
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},globals.SequenceableCollection)})},
+args: ["aNumber"],
+source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
+messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newStream",
+protocol: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._streamClass())._on_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.SequenceableCollection)})},
+args: [],
+source: "newStream\x0a\x09^ self streamClass on: self",
+messageSends: ["on:", "streamClass"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "numericallyIndexable",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.SequenceableCollection)})},
+args: [],
+source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "readStream",
+protocol: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._stream();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"readStream",{},globals.SequenceableCollection)})},
+args: [],
+source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
+messageSends: ["stream"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeLast",
+protocol: 'adding/removing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._remove_(self._last());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.SequenceableCollection)})},
+args: [],
+source: "removeLast\x0a\x09^ self remove: self last",
+messageSends: ["remove:", "last"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reversed",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.SequenceableCollection)})},
+args: [],
+source: "reversed\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "second",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_((2));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"second",{},globals.SequenceableCollection)})},
+args: [],
+source: "second\x0a\x09^ self at: 2",
+messageSends: ["at:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shallowCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+var newCollection;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+newCollection=_st(self._class())._new_(self._size());
+self._withIndexDo_((function(each,index){
+return smalltalk.withContext(function($ctx2) {
+return _st(newCollection)._at_put_(index,each);
+}, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
+$1=newCollection;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},globals.SequenceableCollection)})},
+args: [],
+source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each ].\x0a\x09^ newCollection",
+messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stream",
+protocol: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._newStream();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"stream",{},globals.SequenceableCollection)})},
+args: [],
+source: "stream\x0a\x09^ self newStream",
+messageSends: ["newStream"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "streamClass",
+protocol: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._streamClass();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"streamClass",{},globals.SequenceableCollection)})},
+args: [],
+source: "streamClass\x0a\x09^ self class streamClass",
+messageSends: ["streamClass", "class"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "third",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._at_((3));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"third",{},globals.SequenceableCollection)})},
+args: [],
+source: "third\x0a\x09^ self at: 3",
+messageSends: ["at:"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:do:",
+protocol: 'enumerating',
+fn: function (anotherCollection,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		self = self._numericallyIndexable();
+		anotherCollection = anotherCollection._numericallyIndexable();
+		for(var i=0; i<self.length; i++) {
+			aBlock._value_value_(self[i], anotherCollection[i]);
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.SequenceableCollection)})},
+args: ["anotherCollection", "aBlock"],
+source: "with: anotherCollection do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withIndexDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		self = self._numericallyIndexable();
+		for(var i=0; i < self.length; i++) {
+			aBlock._value_value_(self[i], i+1);
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.SequenceableCollection)})},
+args: ["aBlock"],
+source: "withIndexDo: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "writeStream",
+protocol: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._stream();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"writeStream",{},globals.SequenceableCollection)})},
+args: [],
+source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
+messageSends: ["stream"],
+referencedClasses: []
+}),
+globals.SequenceableCollection);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "streamClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Stream(){return globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
+return $Stream();
+},
+args: [],
+source: "streamClass\x0a\x09\x09^ Stream",
+messageSends: [],
+referencedClasses: ["Stream"]
+}),
+globals.SequenceableCollection.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "streamContents:",
+protocol: 'streaming',
+fn: function (aBlock){
+var self=this;
+var stream;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+stream=_st(self._streamClass())._on_(self._new());
+_st(aBlock)._value_(stream);
+$1=_st(stream)._contents();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},globals.SequenceableCollection.klass)})},
+args: ["aBlock"],
+source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
+messageSends: ["on:", "streamClass", "new", "value:", "contents"],
+referencedClasses: []
+}),
+globals.SequenceableCollection.klass);
+
+
+smalltalk.addClass('Array', globals.SequenceableCollection, [], 'Kernel-Collections');
+globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "add:",
+protocol: 'adding/removing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.push(anObject); return anObject;;
+return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Array)})},
+args: ["anObject"],
+source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addFirst:",
+protocol: 'adding/removing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.unshift(anObject); return anObject;;
+return self}, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},globals.Array)})},
+args: ["anObject"],
+source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJavascript",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st("[".__comma(_st(self._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._asJavascript();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._join_(", "))).__comma("]");
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Array)})},
+args: [],
+source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
+messageSends: [",", "join:", "collect:", "asJavascript"],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsent:",
+protocol: 'accessing',
+fn: function (anIndex,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return anIndex >= 1 && anIndex <= self.length
+			? self[anIndex - 1]
+			: aBlock._value()
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.Array)})},
+args: ["anIndex", "aBlock"],
+source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifPresent:ifAbsent:",
+protocol: 'accessing',
+fn: function (anIndex,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return anIndex >= 1 && anIndex <= self.length
+			? aBlock._value_(self[anIndex - 1])
+			: anotherBlock._value()
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.Array)})},
+args: ["anIndex", "aBlock", "anotherBlock"],
+source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:put:",
+protocol: 'accessing',
+fn: function (anIndex,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self[anIndex - 1] = anObject;
+return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.Array)})},
+args: ["anIndex", "anObject"],
+source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "collect:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.map(function(each) {return aBlock._value_(each)});
+return self}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},globals.Array)})},
+args: ["aBlock"],
+source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "join:",
+protocol: 'enumerating',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.join(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},globals.Array)})},
+args: ["aString"],
+source: "join: aString\x0a\x09<return self.join(aString)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "numericallyIndexable",
+protocol: 'private',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "numericallyIndexable\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.Array.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
+$ctx1.supercall = false;
+$ctx1.sendIdx["printOn:"]=1;
+_st(aStream)._nextPutAll_(" (");
+$ctx1.sendIdx["nextPutAll:"]=1;
+self._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._printOn_(aStream);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aStream)._nextPutAll_(" ");
+$ctx2.sendIdx["nextPutAll:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(aStream)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Array)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
+messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove:ifAbsent:",
+protocol: 'adding/removing',
+fn: function (anObject,aBlock){
+var self=this;
+var index;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+index=self._indexOf_ifAbsent_(anObject,(function(){
+return (0);
+}));
+$2=_st(index).__eq((0));
+if(smalltalk.assert($2)){
+$1=_st(aBlock)._value();
+} else {
+self._removeIndex_(index);
+$1=anObject;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Array)})},
+args: ["anObject", "aBlock"],
+source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
+messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeAll",
+protocol: 'adding/removing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.length = 0;
+return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Array)})},
+args: [],
+source: "removeAll\x0a\x09<self.length = 0>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeFrom:to:",
+protocol: 'adding/removing',
+fn: function (aNumber,anotherNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.splice(aNumber -1, anotherNumber - aNumber + 1);
+return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Array)})},
+args: ["aNumber", "anotherNumber"],
+source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeIndex:",
+protocol: 'adding/removing',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.splice(anInteger - 1, 1);
+return self}, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},globals.Array)})},
+args: ["anInteger"],
+source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeLast",
+protocol: 'adding/removing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.pop();;
+return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.Array)})},
+args: [],
+source: "removeLast\x0a\x09<return self.pop();>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reversed",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self._copy().reverse();
+return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.Array)})},
+args: [],
+source: "reversed\x0a\x09<return self._copy().reverse()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "select:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var result = self.klass._new();
+		for(var i=0; i<self.length; i++) {
+			if(aBlock._value_(self[i])) {
+				result.push(self[i]);
+			}
+		}
+		return result;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},globals.Array)})},
+args: ["aBlock"],
+source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09if(aBlock._value_(self[i])) {\x0a\x09\x09\x09\x09result.push(self[i]);\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09return result;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "size",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.length;
+return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Array)})},
+args: [],
+source: "size\x0a\x09<return self.length>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sort",
+protocol: 'enumerating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._sort_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+return _st(a).__lt(b);
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sort",{},globals.Array)})},
+args: [],
+source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
+messageSends: ["sort:", "<"],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sort:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return self.sort(function(a, b) {
+			if(aBlock._value_value_(a,b)) {return -1} else {return 1}
+		})
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},globals.Array)})},
+args: ["aBlock"],
+source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sorted",
+protocol: 'enumerating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._copy())._sort();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sorted",{},globals.Array)})},
+args: [],
+source: "sorted\x0a\x09^ self copy sort",
+messageSends: ["sort", "copy"],
+referencedClasses: []
+}),
+globals.Array);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sorted:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._copy())._sort_(aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},globals.Array)})},
+args: ["aBlock"],
+source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
+messageSends: ["sort:", "copy"],
+referencedClasses: []
+}),
+globals.Array);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new:",
+protocol: 'instance creation',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return new Array(anInteger);
+return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Array.klass)})},
+args: ["anInteger"],
+source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Array.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:",
+protocol: 'instance creation',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new_((1));
+_st($2)._at_put_((1),anObject);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Array.klass)})},
+args: ["anObject"],
+source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
+messageSends: ["at:put:", "new:", "yourself"],
+referencedClasses: []
+}),
+globals.Array.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:with:",
+protocol: 'instance creation',
+fn: function (anObject,anObject2){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new_((2));
+_st($2)._at_put_((1),anObject);
+$ctx1.sendIdx["at:put:"]=1;
+_st($2)._at_put_((2),anObject2);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},globals.Array.klass)})},
+args: ["anObject", "anObject2"],
+source: "with: anObject with: anObject2\x0a\x09\x09^ (self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
+messageSends: ["at:put:", "new:", "yourself"],
+referencedClasses: []
+}),
+globals.Array.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "with:with:with:",
+protocol: 'instance creation',
+fn: function (anObject,anObject2,anObject3){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new_((3));
+_st($2)._at_put_((1),anObject);
+$ctx1.sendIdx["at:put:"]=1;
+_st($2)._at_put_((2),anObject2);
+$ctx1.sendIdx["at:put:"]=2;
+_st($2)._at_put_((3),anObject3);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.Array.klass)})},
+args: ["anObject", "anObject2", "anObject3"],
+source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^ (self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
+messageSends: ["at:put:", "new:", "yourself"],
+referencedClasses: []
+}),
+globals.Array.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withAll:",
+protocol: 'instance creation',
+fn: function (aCollection){
+var self=this;
+var instance,index;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+index=(1);
+instance=self._new_(_st(aCollection)._size());
+_st(aCollection)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+_st(instance)._at_put_(index,each);
+index=_st(index).__plus((1));
+return index;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=instance;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},globals.Array.klass)})},
+args: ["aCollection"],
+source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1 ].\x0a\x09^ instance",
+messageSends: ["new:", "size", "do:", "at:put:", "+"],
+referencedClasses: []
+}),
+globals.Array.klass);
+
+
+smalltalk.addClass('CharacterArray', globals.SequenceableCollection, [], 'Kernel-Collections');
+globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: ",",
+protocol: 'copying',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._asString();
+$ctx1.sendIdx["asString"]=1;
+$1=_st($2).__comma(_st(aString)._asString());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.CharacterArray)})},
+args: ["aString"],
+source: ", aString\x0a\x09^ self asString, aString asString",
+messageSends: [",", "asString"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "add:",
+protocol: 'adding/removing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._errorReadOnly();
+return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.CharacterArray)})},
+args: ["anObject"],
+source: "add: anObject\x0a\x09self errorReadOnly",
+messageSends: ["errorReadOnly"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asLowercase",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.CharacterArray)})},
+args: [],
+source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
+messageSends: ["fromString:", "class", "asLowercase", "asString"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asNumber",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._asString())._asNumber();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.CharacterArray)})},
+args: [],
+source: "asNumber\x0a\x09^ self asString asNumber",
+messageSends: ["asNumber", "asString"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._subclassResponsibility();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.CharacterArray)})},
+args: [],
+source: "asString\x0a\x09^ self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asSymbol",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._asString();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asSymbol",{},globals.CharacterArray)})},
+args: [],
+source: "asSymbol\x0a\x09^ self asString",
+messageSends: ["asString"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asUppercase",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.CharacterArray)})},
+args: [],
+source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
+messageSends: ["fromString:", "class", "asUppercase", "asString"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:put:",
+protocol: 'accessing',
+fn: function (anIndex,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._errorReadOnly();
+return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.CharacterArray)})},
+args: ["anIndex", "anObject"],
+source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
+messageSends: ["errorReadOnly"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "errorReadOnly",
+protocol: 'error handling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._error_("Object is read-only");
+return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},globals.CharacterArray)})},
+args: [],
+source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
+messageSends: ["error:"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._asString())._printOn_(aStream);
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.CharacterArray)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09self asString printOn: aStream",
+messageSends: ["printOn:", "asString"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "putOn:",
+protocol: 'streaming',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aStream)._nextPutString_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.CharacterArray)})},
+args: ["aStream"],
+source: "putOn: aStream\x0a\x09aStream nextPutString: self",
+messageSends: ["nextPutString:"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove:",
+protocol: 'adding/removing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._errorReadOnly();
+return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.CharacterArray)})},
+args: ["anObject"],
+source: "remove: anObject\x0a\x09self errorReadOnly",
+messageSends: ["errorReadOnly"],
+referencedClasses: []
+}),
+globals.CharacterArray);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromString:",
+protocol: 'instance creation',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.CharacterArray.klass)})},
+args: ["aString"],
+source: "fromString: aString\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.CharacterArray.klass);
+
+
+smalltalk.addClass('String', globals.CharacterArray, [], 'Kernel-Collections');
+globals.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`";
+smalltalk.addMethod(
+smalltalk.method({
+selector: ",",
+protocol: 'copying',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String(self) + aString;
+return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.String)})},
+args: ["aString"],
+source: ", aString\x0a\x09<return String(self) + aString>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "<",
+protocol: 'comparing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String(self) < aString._asString();
+return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "< aString\x0a\x09<return String(self) < aString._asString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "<=",
+protocol: 'comparing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String(self) <= aString._asString();
+return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return aString != null &&
+			typeof aString._isString === "function" &&
+			aString._isString() &&
+			String(self) === String(aString)
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "= aString\x0a\x09<\x0a\x09\x09return aString != null &&\x0a\x09\x09\x09typeof aString._isString === \x22function\x22 &&\x0a\x09\x09\x09aString._isString() &&\x0a\x09\x09\x09String(self) === String(aString)\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "==",
+protocol: 'comparing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self.__eq(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "== aString\x0a\x09^ self = aString",
+messageSends: ["="],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: ">",
+protocol: 'comparing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String(self) > aString._asString();
+return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: ">=",
+protocol: 'comparing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String(self) >= aString._asString();
+return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},globals.String)})},
+args: ["aString"],
+source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "asJSON\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJavascript",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
+			return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
+		else
+			return "\"" + self + "\"";
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.String)})},
+args: [],
+source: "asJavascript\x0a\x09<\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asLowercase",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.toLowerCase();
+return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.String)})},
+args: [],
+source: "asLowercase\x0a\x09<return self.toLowerCase()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asMutator",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(self._last()).__eq(":");
+if(! smalltalk.assert($1)){
+$2=self.__comma(":");
+return $2;
+};
+return self;
+}, function($ctx1) {$ctx1.fill(self,"asMutator",{},globals.String)})},
+args: [],
+source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [  ^ self, ':' ].\x0a\x09^ self",
+messageSends: ["ifFalse:", "=", "last", ","],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asNumber",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Number(self);
+return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.String)})},
+args: [],
+source: "asNumber\x0a\x09<return Number(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asRegexp",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($RegularExpression())._fromString_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asRegexp",{},globals.String)})},
+args: [],
+source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
+messageSends: ["fromString:"],
+referencedClasses: ["RegularExpression"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asSelector",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.selector(self);
+return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},globals.String)})},
+args: [],
+source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "asString\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asSymbol",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "asSymbol\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asUppercase",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.toUpperCase();
+return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.String)})},
+args: [],
+source: "asUppercase\x0a\x09<return self.toUpperCase()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asciiValue",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.charCodeAt(0);;
+return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},globals.String)})},
+args: [],
+source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsent:",
+protocol: 'accessing',
+fn: function (anIndex,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String(self)[anIndex - 1] || aBlock._value();
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.String)})},
+args: ["anIndex", "aBlock"],
+source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifPresent:ifAbsent:",
+protocol: 'accessing',
+fn: function (anIndex,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var result = String(self)[anIndex - 1];
+		return result ? aBlock._value_(result) : anotherBlock._value();
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.String)})},
+args: ["anIndex", "aBlock", "anotherBlock"],
+source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "capitalized",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._isEmpty();
+if(smalltalk.assert($2)){
+$1=self;
+} else {
+$1=_st(_st(self._first())._asUppercase()).__comma(self._allButFirst());
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"capitalized",{},globals.String)})},
+args: [],
+source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
+messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "charCodeAt:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.charCodeAt(anInteger - 1);
+return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},globals.String)})},
+args: ["anInteger"],
+source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copyFrom:to:",
+protocol: 'copying',
+fn: function (anIndex,anotherIndex){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.substring(anIndex - 1, anotherIndex);
+return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},globals.String)})},
+args: ["anIndex", "anotherIndex"],
+source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "crlfSanitized",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._lines())._join_(_st($String())._lf());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},globals.String)})},
+args: [],
+source: "crlfSanitized\x0a\x09^ self lines join: String lf",
+messageSends: ["join:", "lines", "lf"],
+referencedClasses: ["String"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deepCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._shallowCopy();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.String)})},
+args: [],
+source: "deepCopy\x0a\x09^ self shallowCopy",
+messageSends: ["shallowCopy"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "escaped",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return escape(self);
+return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},globals.String)})},
+args: [],
+source: "escaped\x0a\x09<return escape(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "identityHash",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self.__comma("s");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.String)})},
+args: [],
+source: "identityHash\x0a\x09^ self, 's'",
+messageSends: [","],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includesSubString:",
+protocol: 'testing',
+fn: function (subString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.indexOf(subString) != -1;
+return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},globals.String)})},
+args: ["subString"],
+source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isCapitalized",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=self._first();
+$ctx1.sendIdx["first"]=1;
+$2=_st($3)._asUppercase();
+$1=_st($2).__eq_eq(self._first());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},globals.String)})},
+args: [],
+source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
+messageSends: ["==", "asUppercase", "first"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isImmutable\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isString",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isString\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isVowel",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self._size()).__eq((1)))._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return "aeiou"._includes_(self._asLowercase());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isVowel",{},globals.String)})},
+args: [],
+source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
+messageSends: ["and:", "=", "size", "includes:", "asLowercase"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "join:",
+protocol: 'split join',
+fn: function (aCollection){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+return _st(aCollection)._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx3) {
+return _st(stream)._nextPutAll_(_st(each)._asString());
+$ctx3.sendIdx["nextPutAll:"]=1;
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(stream)._nextPutAll_(self);
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},globals.String)})},
+args: ["aCollection"],
+source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [ :stream | aCollection\x0a\x09\x09\x09\x09do: [ :each | stream nextPutAll: each asString ]\x0a\x09\x09\x09\x09separatedBy: [ stream nextPutAll: self ]]",
+messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
+referencedClasses: ["String"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lineIndicesDo:",
+protocol: 'split join',
+fn: function (aBlock){
+var self=this;
+var cr,lf,start,sz,nextLF,nextCR;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
+var $early={};
+try {
+start=(1);
+sz=self._size();
+cr=_st($String())._cr();
+nextCR=self._indexOf_startingAt_(cr,(1));
+$ctx1.sendIdx["indexOf:startingAt:"]=1;
+lf=_st($String())._lf();
+nextLF=self._indexOf_startingAt_(lf,(1));
+$ctx1.sendIdx["indexOf:startingAt:"]=2;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(start).__lt_eq(sz);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(nextLF).__eq((0));
+$ctx2.sendIdx["="]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(nextCR).__eq((0));
+$ctx3.sendIdx["="]=2;
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+$ctx2.sendIdx["and:"]=1;
+if(smalltalk.assert($1)){
+_st(aBlock)._value_value_value_(start,sz,sz);
+$ctx2.sendIdx["value:value:value:"]=1;
+throw $early=[self];
+};
+$4=_st(nextCR).__eq((0));
+$ctx2.sendIdx["="]=3;
+$3=_st($4)._or_((function(){
+return smalltalk.withContext(function($ctx3) {
+$5=(0).__lt(nextLF);
+$ctx3.sendIdx["<"]=1;
+return _st($5)._and_((function(){
+return smalltalk.withContext(function($ctx4) {
+return _st(nextLF).__lt(nextCR);
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
+if(smalltalk.assert($3)){
+$6=start;
+$7=_st(nextLF).__minus((1));
+$ctx2.sendIdx["-"]=1;
+_st(aBlock)._value_value_value_($6,$7,nextLF);
+$ctx2.sendIdx["value:value:value:"]=2;
+start=(1).__plus(nextLF);
+$ctx2.sendIdx["+"]=1;
+start;
+nextLF=self._indexOf_startingAt_(lf,start);
+$ctx2.sendIdx["indexOf:startingAt:"]=3;
+return nextLF;
+} else {
+$9=(1).__plus(nextCR);
+$ctx2.sendIdx["+"]=2;
+$8=_st($9).__eq(nextLF);
+if(smalltalk.assert($8)){
+$10=start;
+$11=_st(nextCR).__minus((1));
+$ctx2.sendIdx["-"]=2;
+_st(aBlock)._value_value_value_($10,$11,nextLF);
+$ctx2.sendIdx["value:value:value:"]=3;
+start=(1).__plus(nextLF);
+$ctx2.sendIdx["+"]=3;
+start;
+nextCR=self._indexOf_startingAt_(cr,start);
+$ctx2.sendIdx["indexOf:startingAt:"]=4;
+nextCR;
+nextLF=self._indexOf_startingAt_(lf,start);
+$ctx2.sendIdx["indexOf:startingAt:"]=5;
+return nextLF;
+} else {
+_st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
+start=(1).__plus(nextCR);
+start;
+nextCR=self._indexOf_startingAt_(cr,start);
+return nextCR;
+};
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},globals.String)})},
+args: ["aBlock"],
+source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [ \x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^ self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ] ]]",
+messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"],
+referencedClasses: ["String"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lineNumber:",
+protocol: 'split join',
+fn: function (anIndex){
+var self=this;
+var lineCount;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3;
+var $early={};
+try {
+lineCount=(0);
+self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
+return smalltalk.withContext(function($ctx2) {
+lineCount=_st(lineCount).__plus((1));
+$2=lineCount;
+$1=_st($2).__eq(anIndex);
+if(smalltalk.assert($1)){
+$3=self._copyFrom_to_(start,endWithoutDelimiters);
+throw $early=[$3];
+};
+}, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
+return nil;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},globals.String)})},
+args: ["anIndex"],
+source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [ ^ self copyFrom: start to: endWithoutDelimiters ]].\x0a\x09^ nil",
+messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lines",
+protocol: 'split join',
+fn: function (){
+var self=this;
+var lines;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+lines=_st($Array())._new();
+self._linesDo_((function(aLine){
+return smalltalk.withContext(function($ctx2) {
+return _st(lines)._add_(aLine);
+}, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)})}));
+$1=lines;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},globals.String)})},
+args: [],
+source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [ :aLine | lines add: aLine ].\x0a\x09^ lines",
+messageSends: ["new", "linesDo:", "add:"],
+referencedClasses: ["Array"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "linesDo:",
+protocol: 'split join',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
+return smalltalk.withContext(function($ctx2) {
+return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
+}, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},globals.String)})},
+args: ["aBlock"],
+source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters) ]",
+messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "match:",
+protocol: 'regular expressions',
+fn: function (aRegexp){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.search(aRegexp) != -1;
+return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},globals.String)})},
+args: ["aRegexp"],
+source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "matchesOf:",
+protocol: 'regular expressions',
+fn: function (aRegularExpression){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.match(aRegularExpression);
+return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},globals.String)})},
+args: ["aRegularExpression"],
+source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "numericallyIndexable",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String(self);
+return self}, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.String)})},
+args: [],
+source: "numericallyIndexable\x0a\x09<return String(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printNl",
+protocol: 'printing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+console.log(self);
+return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},globals.String)})},
+args: [],
+source: "printNl\x0a\x09<console.log(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._nextPutAll_("'");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._nextPutAll_(self);
+$ctx1.sendIdx["nextPutAll:"]=2;
+$1=_st(aStream)._nextPutAll_("'");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.String)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
+messageSends: ["nextPutAll:"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "replace:with:",
+protocol: 'regular expressions',
+fn: function (aString,anotherString){
+var self=this;
+function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},globals.String)})},
+args: ["aString", "anotherString"],
+source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
+messageSends: ["replaceRegexp:with:", "fromString:flag:"],
+referencedClasses: ["RegularExpression"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "replaceRegexp:with:",
+protocol: 'regular expressions',
+fn: function (aRegexp,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.replace(aRegexp, aString);
+return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},globals.String)})},
+args: ["aRegexp", "aString"],
+source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reversed",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.split("").reverse().join("");
+return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.String)})},
+args: [],
+source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shallowCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._fromString_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.String)})},
+args: [],
+source: "shallowCopy\x0a\x09^ self class fromString: self",
+messageSends: ["fromString:", "class"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "size",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.length;
+return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.String)})},
+args: [],
+source: "size\x0a\x09<return self.length>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subStrings:",
+protocol: 'split join',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._tokenize_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "subStrings: aString\x0a\x09^ self tokenize: aString",
+messageSends: ["tokenize:"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tokenize:",
+protocol: 'split join',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.split(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "tokenize: aString\x0a\x09<return self.split(aString)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "trimBoth",
+protocol: 'regular expressions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._trimBoth_("\x5cs");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"trimBoth",{},globals.String)})},
+args: [],
+source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
+messageSends: ["trimBoth:"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "trimBoth:",
+protocol: 'regular expressions',
+fn: function (separators){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._trimLeft_(separators))._trimRight_(separators);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},globals.String)})},
+args: ["separators"],
+source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
+messageSends: ["trimRight:", "trimLeft:"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "trimLeft",
+protocol: 'regular expressions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._trimLeft_("\x5cs");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"trimLeft",{},globals.String)})},
+args: [],
+source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
+messageSends: ["trimLeft:"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "trimLeft:",
+protocol: 'regular expressions',
+fn: function (separators){
+var self=this;
+function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=_st("^[".__comma(separators)).__comma("]+");
+$ctx1.sendIdx[","]=1;
+$2=_st($RegularExpression())._fromString_flag_($3,"g");
+$1=self._replaceRegexp_with_($2,"");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},globals.String)})},
+args: ["separators"],
+source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
+messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
+referencedClasses: ["RegularExpression"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "trimRight",
+protocol: 'regular expressions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._trimRight_("\x5cs");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"trimRight",{},globals.String)})},
+args: [],
+source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
+messageSends: ["trimRight:"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "trimRight:",
+protocol: 'regular expressions',
+fn: function (separators){
+var self=this;
+function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$3=_st("[".__comma(separators)).__comma("]+$");
+$ctx1.sendIdx[","]=1;
+$2=_st($RegularExpression())._fromString_flag_($3,"g");
+$1=self._replaceRegexp_with_($2,"");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},globals.String)})},
+args: ["separators"],
+source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
+messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
+referencedClasses: ["RegularExpression"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unescaped",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return unescape(self);
+return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},globals.String)})},
+args: [],
+source: "unescaped\x0a\x09<return unescape(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "uriComponentDecoded",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return decodeURIComponent(self);
+return self}, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},globals.String)})},
+args: [],
+source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "uriComponentEncoded",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return encodeURIComponent(self);
+return self}, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},globals.String)})},
+args: [],
+source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "uriDecoded",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return decodeURI(self);
+return self}, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},globals.String)})},
+args: [],
+source: "uriDecoded\x0a\x09<return decodeURI(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "uriEncoded",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return encodeURI(self);
+return self}, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},globals.String)})},
+args: [],
+source: "uriEncoded\x0a\x09<return encodeURI(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'evaluating',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(anObject)._perform_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.String)})},
+args: ["anObject"],
+source: "value: anObject \x0a\x09^ anObject perform: self",
+messageSends: ["perform:"],
+referencedClasses: []
+}),
+globals.String);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cr",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return '\r';
+return self}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.String.klass)})},
+args: [],
+source: "cr\x0a\x09<return '\x5cr'>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "crlf",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return '\r\n';
+return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.String.klass)})},
+args: [],
+source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "esc",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._fromCharCode_((27));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"esc",{},globals.String.klass)})},
+args: [],
+source: "esc\x0a\x09^ self fromCharCode: 27",
+messageSends: ["fromCharCode:"],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromCharCode:",
+protocol: 'instance creation',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String.fromCharCode(anInteger);
+return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},globals.String.klass)})},
+args: ["anInteger"],
+source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromString:",
+protocol: 'instance creation',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.String.klass)})},
+args: ["aString"],
+source: "fromString: aString\x0a\x09\x09<return String(aString)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lf",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return '\n';
+return self}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.String.klass)})},
+args: [],
+source: "lf\x0a\x09<return '\x5cn'>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "random",
+protocol: 'random',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
+return self}, function($ctx1) {$ctx1.fill(self,"random",{},globals.String.klass)})},
+args: [],
+source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "randomNotIn:",
+protocol: 'random',
+fn: function (aString){
+var self=this;
+var result;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+result=self._random();
+result;
+return _st(aString)._includesSubString_(result);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue();
+$1=result;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},globals.String.klass)})},
+args: ["aString"],
+source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
+messageSends: ["whileTrue", "random", "includesSubString:"],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "space",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return ' ';
+return self}, function($ctx1) {$ctx1.fill(self,"space",{},globals.String.klass)})},
+args: [],
+source: "space\x0a\x09<return ' '>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "streamClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $StringStream(){return globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
+return $StringStream();
+},
+args: [],
+source: "streamClass\x0a\x09\x09^ StringStream",
+messageSends: [],
+referencedClasses: ["StringStream"]
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tab",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return '\t';
+return self}, function($ctx1) {$ctx1.fill(self,"tab",{},globals.String.klass)})},
+args: [],
+source: "tab\x0a\x09<return '\x5ct'>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'instance creation',
+fn: function (aUTFCharCode){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return String.fromCharCode(aUTFCharCode);;
+return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},globals.String.klass)})},
+args: ["aUTFCharCode"],
+source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.String.klass);
+
+
+smalltalk.addClass('Set', globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
+globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$4,$3,$5;
+var $early={};
+try {
+$2=self._class();
+$ctx1.sendIdx["class"]=1;
+$1=_st($2).__eq(_st(aCollection)._class());
+$ctx1.sendIdx["="]=1;
+if(! smalltalk.assert($1)){
+return false;
+};
+$4=self._size();
+$ctx1.sendIdx["size"]=1;
+$3=_st($4).__eq(_st(aCollection)._size());
+if(! smalltalk.assert($3)){
+return false;
+};
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$5=_st(aCollection)._includes_(each);
+if(! smalltalk.assert($5)){
+throw $early=[false];
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
+return true;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.Set)})},
+args: ["aCollection"],
+source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
+messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "add:",
+protocol: 'adding/removing',
+fn: function (anObject){
+var self=this;
+var bucket;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+bucket=self._bucketsOfElement_(anObject);
+$2=_st(bucket)._second();
+if(($receiver = $2) == null || $receiver.isNil){
+var object,slowBucket;
+object=_st(bucket)._first();
+$ctx1.sendIdx["first"]=1;
+object;
+slowBucket=_st(bucket)._third();
+slowBucket;
+_st(slowBucket)._indexOf_ifAbsent_(object,(function(){
+return smalltalk.withContext(function($ctx2) {
+_st(slowBucket)._add_(object);
+self["@size"]=_st(self["@size"]).__plus((1));
+return self["@size"];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+$1=object;
+} else {
+var primitiveBucket;
+primitiveBucket=$receiver;
+$1=self._add_in_(_st(bucket)._first(),primitiveBucket);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},globals.Set)})},
+args: ["anObject"],
+source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
+messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "add:in:",
+protocol: 'private',
+fn: function (anObject,anotherObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		if (anObject in anotherObject.store) { return false; }
+		self['@size']++;
+		return anotherObject.store[anObject] = true;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
+args: ["anObject", "anotherObject"],
+source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09return anotherObject.store[anObject] = true;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "bucketsOfElement:",
+protocol: 'private',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
+		if ((type = typeof prim) === "object") {
+			if (anObject !== nil) {
+				bucket = null;
+				self['@slowBucketStores'].some(function (store) {
+					return bucket = store._bucketOfElement_(anObject);
+				});
+				return [ anObject, null, bucket || self['@defaultBucket'] ];
+			}
+			
+			// include nil to well-known objects under 'boolean' fastBucket
+			prim = null;
+			type = 'boolean';
+		}
+		return [ prim, self['@fastBuckets'][type] ];
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},globals.Set)})},
+args: ["anObject"],
+source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<\x0a\x09\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classNameOf:",
+protocol: 'private',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return anObject.klass && anObject.klass.className;
+return self}, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},globals.Set)})},
+args: ["anObject"],
+source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<return anObject.klass && anObject.klass.className>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "collect:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+var collection;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+collection=_st(self._class())._new();
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(collection)._add_(_st(aBlock)._value_(each));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=collection;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},globals.Set)})},
+args: ["aBlock"],
+source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
+messageSends: ["new", "class", "do:", "add:", "value:"],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "detect:ifNone:",
+protocol: 'enumerating',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+var $early={};
+try {
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aBlock)._value_(each);
+if(smalltalk.assert($1)){
+throw $early=[each];
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$2=_st(anotherBlock)._value();
+return $2;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Set)})},
+args: ["aBlock", "anotherBlock"],
+source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
+messageSends: ["do:", "ifTrue:", "value:", "value"],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var el, keys, i;
+		el = self['@fastBuckets'];
+		keys = Object.keys(el);
+		for (i = 0; i < keys.length; ++i) {
+			var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
+			if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
+			else { store._do_(aBlock); }
+		}
+		el = self['@slowBucketStores'];
+		for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
+		self['@defaultBucket']._do_(aBlock);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Set)})},
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09<\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = self['@fastBuckets'];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = self['@slowBucketStores'];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09self['@defaultBucket']._do_(aBlock);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includes:",
+protocol: 'testing',
+fn: function (anObject){
+var self=this;
+var bucket;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+bucket=self._bucketsOfElement_(anObject);
+$2=_st(bucket)._second();
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st(bucket)._third();
+$4=_st(bucket)._first();
+$ctx1.sendIdx["first"]=1;
+$1=_st($3)._includes_($4);
+} else {
+var primitiveBucket;
+primitiveBucket=$receiver;
+$1=self._includes_in_(_st(bucket)._first(),primitiveBucket);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},globals.Set)})},
+args: ["anObject"],
+source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
+messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includes:in:",
+protocol: 'private',
+fn: function (anObject,anotherObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return anObject in anotherObject.store;
+return self}, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
+args: ["anObject", "anotherObject"],
+source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+($ctx1.supercall = true, globals.Set.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@defaultBucket"]=[];
+self._initializeSlowBucketStores();
+$1=self._removeAll();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Set)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
+messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeSlowBucketStores",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $ArrayBucketStore(){return globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($ArrayBucketStore())._hashBlock_((function(x){
+return smalltalk.withContext(function($ctx2) {
+return self._classNameOf_(x);
+}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
+$ctx1.sendIdx["hashBlock:"]=1;
+self["@slowBucketStores"]=[$1,_st($ArrayBucketStore())._hashBlock_((function(x){
+return smalltalk.withContext(function($ctx2) {
+return self._jsConstructorNameOf_(x);
+}, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))];
+return self}, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},globals.Set)})},
+args: [],
+source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
+messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"],
+referencedClasses: ["ArrayBucketStore"]
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "jsConstructorNameOf:",
+protocol: 'private',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return anObject.constructor && anObject.constructor.name;
+return self}, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},globals.Set)})},
+args: ["anObject"],
+source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.Set.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
+$ctx1.supercall = false;
+$ctx1.sendIdx["printOn:"]=1;
+_st(aStream)._nextPutAll_(" (");
+$ctx1.sendIdx["nextPutAll:"]=1;
+self._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._printOn_(aStream);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aStream)._nextPutAll_(" ");
+$ctx2.sendIdx["nextPutAll:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(aStream)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Set)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
+messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove:ifAbsent:",
+protocol: 'adding/removing',
+fn: function (anObject,aBlock){
+var self=this;
+var bucket;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$5,$1,$receiver;
+var $early={};
+try {
+bucket=self._bucketsOfElement_(anObject);
+$2=_st(bucket)._second();
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st(bucket)._third();
+$4=_st(bucket)._first();
+$ctx1.sendIdx["first"]=1;
+_st($3)._remove_ifAbsent_($4,(function(){
+return smalltalk.withContext(function($ctx2) {
+$5=_st(aBlock)._value();
+throw $early=[$5];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+self["@size"]=_st(self["@size"]).__minus((1));
+$1=self["@size"];
+} else {
+var primitiveBucket;
+primitiveBucket=$receiver;
+$1=self._remove_in_(_st(bucket)._first(),primitiveBucket);
+};
+return $1;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},globals.Set)})},
+args: ["anObject", "aBlock"],
+source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
+messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "remove:in:",
+protocol: 'private',
+fn: function (anObject,anotherObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+if (delete anotherObject.store[anObject]) self['@size']--;
+return self}, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
+args: ["anObject", "anotherObject"],
+source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeAll",
+protocol: 'adding/removing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		self['@fastBuckets'] = {
+			'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
+			'number': { store: Object.create(null), fn: Number },
+			'string': { store: Object.create(null) }
+		};
+		self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
+		self['@defaultBucket']._removeAll();
+		self['@size'] = 0;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Set)})},
+args: [],
+source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self['@defaultBucket']._removeAll();\x0a\x09\x09self['@size'] = 0;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "select:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+var collection;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+collection=_st(self._class())._new();
+self._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(aBlock)._value_(each);
+if(smalltalk.assert($1)){
+return _st(collection)._add_(each);
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$2=collection;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},globals.Set)})},
+args: ["aBlock"],
+source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each ] ].\x0a\x09^ collection",
+messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"],
+referencedClasses: []
+}),
+globals.Set);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "size",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@size"];
+return $1;
+},
+args: [],
+source: "size\x0a\x09^ size",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Set);
+
+
+
+smalltalk.addClass('Queue', globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
+globals.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.Queue.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@read"]=_st($OrderedCollection())._new();
+$ctx1.sendIdx["new"]=1;
+self["@write"]=_st($OrderedCollection())._new();
+self["@readIndex"]=(1);
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Queue)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
+messageSends: ["initialize", "new"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.Queue);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._nextIfAbsent_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._error_("Cannot read from empty Queue.");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"next",{},globals.Queue)})},
+args: [],
+source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
+messageSends: ["nextIfAbsent:", "error:"],
+referencedClasses: []
+}),
+globals.Queue);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextIfAbsent:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+var result;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+var $early={};
+try {
+result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(self["@write"])._isEmpty();
+if(smalltalk.assert($1)){
+$2=_st(self["@readIndex"]).__gt((1));
+if(smalltalk.assert($2)){
+self["@read"]=[];
+self["@read"];
+self["@readIndex"]=(1);
+self["@readIndex"];
+};
+$3=_st(aBlock)._value();
+throw $early=[$3];
+};
+self["@read"]=self["@write"];
+self["@read"];
+self["@readIndex"]=(1);
+self["@readIndex"];
+self["@write"]=_st($OrderedCollection())._new();
+self["@write"];
+return _st(self["@read"])._first();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+_st(self["@read"])._at_put_(self["@readIndex"],nil);
+self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
+$4=result;
+return $4;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},globals.Queue)})},
+args: ["aBlock"],
+source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result",
+messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.Queue);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPut:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@write"])._add_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Queue)})},
+args: ["anObject"],
+source: "nextPut: anObject\x0a\x09write add: anObject",
+messageSends: ["add:"],
+referencedClasses: []
+}),
+globals.Queue);
+
+
+
+smalltalk.addClass('RegularExpression', globals.Object, [], 'Kernel-Collections');
+globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compile:",
+protocol: 'evaluating',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.compile(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.RegularExpression)})},
+args: ["aString"],
+source: "compile: aString\x0a\x09<return self.compile(aString)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.RegularExpression);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exec:",
+protocol: 'evaluating',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.exec(aString) || nil;
+return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},globals.RegularExpression)})},
+args: ["aString"],
+source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.RegularExpression);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "test:",
+protocol: 'evaluating',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.test(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},globals.RegularExpression)})},
+args: ["aString"],
+source: "test: aString\x0a\x09<return self.test(aString)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.RegularExpression);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromString:",
+protocol: 'instance creation',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._fromString_flag_(aString,"");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.RegularExpression.klass)})},
+args: ["aString"],
+source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
+messageSends: ["fromString:flag:"],
+referencedClasses: []
+}),
+globals.RegularExpression.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromString:flag:",
+protocol: 'instance creation',
+fn: function (aString,anotherString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return new RegExp(aString, anotherString);
+return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},globals.RegularExpression.klass)})},
+args: ["aString", "anotherString"],
+source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.RegularExpression.klass);
+
+
+smalltalk.addClass('Stream', globals.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
+globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "<<",
+protocol: 'writing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._write_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},globals.Stream)})},
+args: ["anObject"],
+source: "<< anObject\x0a\x09self write: anObject",
+messageSends: ["write:"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "atEnd",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._position()).__eq(self._size());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.Stream)})},
+args: [],
+source: "atEnd\x0a\x09^ self position = self size",
+messageSends: ["=", "position", "size"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "atStart",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._position()).__eq((0));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"atStart",{},globals.Stream)})},
+args: [],
+source: "atStart\x0a\x09^ self position = 0",
+messageSends: ["=", "position"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "close",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "close",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "collection",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@collection"];
+return $1;
+},
+args: [],
+source: "collection\x0a\x09^ collection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contents",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"contents",{},globals.Stream)})},
+args: [],
+source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
+messageSends: ["copyFrom:to:", "collection", "streamSize"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._atEnd();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aBlock)._value_(self._next());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Stream)})},
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
+messageSends: ["whileFalse:", "atEnd", "value:", "next"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "flush",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "flush",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isEmpty",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._size()).__eq((0));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Stream)})},
+args: [],
+source: "isEmpty\x0a\x09^ self size = 0",
+messageSends: ["=", "size"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next",
+protocol: 'reading',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$4,$3,$1;
+$2=self._atEnd();
+if(smalltalk.assert($2)){
+$1=nil;
+} else {
+$4=self._position();
+$ctx1.sendIdx["position"]=1;
+$3=_st($4).__plus((1));
+self._position_($3);
+$1=_st(self["@collection"])._at_(self._position());
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"next",{},globals.Stream)})},
+args: [],
+source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position ]",
+messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next:",
+protocol: 'reading',
+fn: function (anInteger){
+var self=this;
+var tempCollection;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+tempCollection=_st(_st(self._collection())._class())._new();
+_st(anInteger)._timesRepeat_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=self._atEnd();
+if(! smalltalk.assert($1)){
+return _st(tempCollection)._add_(self._next());
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$2=tempCollection;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.Stream)})},
+args: ["anInteger"],
+source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next ]].\x0a\x09^ tempCollection",
+messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPut:",
+protocol: 'writing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3,$4;
+$2=self._position();
+$ctx1.sendIdx["position"]=1;
+$1=_st($2).__plus((1));
+self._position_($1);
+$3=self._collection();
+$4=self._position();
+$ctx1.sendIdx["position"]=2;
+_st($3)._at_put_($4,anObject);
+self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
+return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Stream)})},
+args: ["anObject"],
+source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)",
+messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutAll:",
+protocol: 'writing',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aCollection)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._nextPut_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},globals.Stream)})},
+args: ["aCollection"],
+source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
+messageSends: ["do:", "nextPut:"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutString:",
+protocol: 'writing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._nextPut_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.Stream)})},
+args: ["aString"],
+source: "nextPutString: aString\x0a\x09self nextPut: aString",
+messageSends: ["nextPut:"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "peek",
+protocol: 'reading',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._atEnd();
+if(! smalltalk.assert($2)){
+$1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"peek",{},globals.Stream)})},
+args: [],
+source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
+messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "position",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@position"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@position"]=(0);
+$1=self["@position"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"position",{},globals.Stream)})},
+args: [],
+source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "position:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@position"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "position: anInteger\x0a\x09position := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reset",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._position_((0));
+return self}, function($ctx1) {$ctx1.fill(self,"reset",{},globals.Stream)})},
+args: [],
+source: "reset\x0a\x09self position: 0",
+messageSends: ["position:"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resetContents",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._reset();
+self._setStreamSize_((0));
+return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},globals.Stream)})},
+args: [],
+source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
+messageSends: ["reset", "setStreamSize:"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setCollection:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+self["@collection"]=aCollection;
+return self},
+args: ["aCollection"],
+source: "setCollection: aCollection\x0a\x09collection := aCollection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setStreamSize:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@streamSize"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setToEnd",
+protocol: 'positioning',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._position_(self._size());
+return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},globals.Stream)})},
+args: [],
+source: "setToEnd\x0a\x09self position: self size",
+messageSends: ["position:", "size"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "size",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._streamSize();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Stream)})},
+args: [],
+source: "size\x0a\x09^ self streamSize",
+messageSends: ["streamSize"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "skip:",
+protocol: 'positioning',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
+return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},globals.Stream)})},
+args: ["anInteger"],
+source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
+messageSends: ["position:", "min:max:", "+", "position", "size"],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "streamSize",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@streamSize"];
+return $1;
+},
+args: [],
+source: "streamSize\x0a\x09^ streamSize",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Stream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "write:",
+protocol: 'writing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(anObject)._putOn_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},globals.Stream)})},
+args: ["anObject"],
+source: "write: anObject\x0a\x09anObject putOn: self",
+messageSends: ["putOn:"],
+referencedClasses: []
+}),
+globals.Stream);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._setCollection_(aCollection);
+_st($2)._setStreamSize_(_st(aCollection)._size());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.Stream.klass)})},
+args: ["aCollection"],
+source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
+messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
+referencedClasses: []
+}),
+globals.Stream.klass);
+
+
+smalltalk.addClass('StringStream', globals.Stream, [], 'Kernel-Collections');
+globals.StringStream.comment="I am a Stream specific to `String` objects.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cr",
+protocol: 'writing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._nextPutAll_(_st($String())._cr());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.StringStream)})},
+args: [],
+source: "cr\x0a\x09^ self nextPutAll: String cr",
+messageSends: ["nextPutAll:", "cr"],
+referencedClasses: ["String"]
+}),
+globals.StringStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "crlf",
+protocol: 'writing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._nextPutAll_(_st($String())._crlf());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.StringStream)})},
+args: [],
+source: "crlf\x0a\x09^ self nextPutAll: String crlf",
+messageSends: ["nextPutAll:", "crlf"],
+referencedClasses: ["String"]
+}),
+globals.StringStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lf",
+protocol: 'writing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._nextPutAll_(_st($String())._lf());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.StringStream)})},
+args: [],
+source: "lf\x0a\x09^ self nextPutAll: String lf",
+messageSends: ["nextPutAll:", "lf"],
+referencedClasses: ["String"]
+}),
+globals.StringStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next:",
+protocol: 'reading',
+fn: function (anInteger){
+var self=this;
+var tempCollection;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+tempCollection=_st(_st(self._collection())._class())._new();
+_st(anInteger)._timesRepeat_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=self._atEnd();
+if(! smalltalk.assert($1)){
+tempCollection=_st(tempCollection).__comma(self._next());
+return tempCollection;
+};
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$2=tempCollection;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.StringStream)})},
+args: ["anInteger"],
+source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next ]].\x0a\x09^ tempCollection",
+messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"],
+referencedClasses: []
+}),
+globals.StringStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPut:",
+protocol: 'writing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._nextPutAll_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.StringStream)})},
+args: ["aString"],
+source: "nextPut: aString\x0a\x09self nextPutAll: aString",
+messageSends: ["nextPutAll:"],
+referencedClasses: []
+}),
+globals.StringStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutAll:",
+protocol: 'writing',
+fn: function (aString){
+var self=this;
+var pre,post;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
+$1=self._atEnd();
+if(smalltalk.assert($1)){
+$3=self._collection();
+$ctx1.sendIdx["collection"]=1;
+$2=_st($3).__comma(aString);
+$ctx1.sendIdx[","]=1;
+self._setCollection_($2);
+$ctx1.sendIdx["setCollection:"]=1;
+} else {
+$4=self._collection();
+$ctx1.sendIdx["collection"]=2;
+$5=self._position();
+$ctx1.sendIdx["position"]=1;
+pre=_st($4)._copyFrom_to_((1),$5);
+$ctx1.sendIdx["copyFrom:to:"]=1;
+pre;
+$6=self._collection();
+$ctx1.sendIdx["collection"]=3;
+$9=self._position();
+$ctx1.sendIdx["position"]=2;
+$8=_st($9).__plus((1));
+$ctx1.sendIdx["+"]=2;
+$10=_st(aString)._size();
+$ctx1.sendIdx["size"]=1;
+$7=_st($8).__plus($10);
+$ctx1.sendIdx["+"]=1;
+$11=_st(self._collection())._size();
+$ctx1.sendIdx["size"]=2;
+post=_st($6)._copyFrom_to_($7,$11);
+post;
+$12=_st(_st(pre).__comma(aString)).__comma(post);
+$ctx1.sendIdx[","]=2;
+self._setCollection_($12);
+};
+$14=self._position();
+$ctx1.sendIdx["position"]=3;
+$13=_st($14).__plus(_st(aString)._size());
+self._position_($13);
+self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},globals.StringStream)})},
+args: ["aString"],
+source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
+messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"],
+referencedClasses: []
+}),
+globals.StringStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextPutString:",
+protocol: 'writing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._nextPutAll_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.StringStream)})},
+args: ["aString"],
+source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
+messageSends: ["nextPutAll:"],
+referencedClasses: []
+}),
+globals.StringStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "space",
+protocol: 'writing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._nextPut_(" ");
+return self}, function($ctx1) {$ctx1.fill(self,"space",{},globals.StringStream)})},
+args: [],
+source: "space\x0a\x09self nextPut: ' '",
+messageSends: ["nextPut:"],
+referencedClasses: []
+}),
+globals.StringStream);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tab",
+protocol: 'writing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._nextPutAll_(_st($String())._tab());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"tab",{},globals.StringStream)})},
+args: [],
+source: "tab\x0a\x09^ self nextPutAll: String tab",
+messageSends: ["nextPutAll:", "tab"],
+referencedClasses: ["String"]
+}),
+globals.StringStream);
+
+
+});

+ 2332 - 0
src/Kernel-Collections.st

@@ -0,0 +1,2332 @@
+Smalltalk createPackage: 'Kernel-Collections'!
+Object subclass: #Association
+	instanceVariableNames: 'key value'
+	package: 'Kernel-Collections'!
+!Association commentStamp!
+I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.
+
+Instances can be created with the class-side method `#key:value:`!
+
+!Association methodsFor: 'accessing'!
+
+key
+	^ key
+!
+
+key: aKey
+	key := aKey
+!
+
+value
+	^ value
+!
+
+value: aValue
+	value := aValue
+! !
+
+!Association methodsFor: 'comparing'!
+
+= anAssociation
+	^ self class = anAssociation class and: [
+		self key = anAssociation key and: [
+		self value = anAssociation value ]]
+! !
+
+!Association methodsFor: 'printing'!
+
+printOn: aStream
+	self key printOn: aStream.
+	aStream nextPutAll: ' -> '.
+	self value printOn: aStream
+! !
+
+!Association class methodsFor: 'instance creation'!
+
+key: aKey value: aValue
+		^ self new
+		key: aKey;
+		value: aValue;
+		yourself
+! !
+
+Object subclass: #BucketStore
+	instanceVariableNames: 'buckets hashBlock'
+	package: 'Kernel-Collections'!
+!BucketStore commentStamp!
+I am an helper class for hash-based stores.
+
+I hold buckets which are selected by a hash, specified using `#hashBlock:`.
+The hash can be any object, and
+it is used as a JS property (that is, in ES5
+its toString() value counts).
+
+## API
+I maintain a list of buckets. Client code can use this API:
+ - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)
+ - `#do:` (to enumerate all elements of all buckets)
+ - `#removeAll` (to remove all buckets)
+
+Client code itself should add/remove elements
+in a bucket. The `nil` object should not be put into any bucket.
+
+Types of buckets are the responsibility of subclasses via `#newBucket`.!
+
+!BucketStore methodsFor: 'accessing'!
+
+bucketOfElement: anObject
+	<
+		var hash = self['@hashBlock'](anObject);
+		if (!!hash) return null;
+		var buckets = self['@buckets'],
+			bucket = buckets[hash];
+		if (!!bucket) { bucket = buckets[hash] = self._newBucket(); }
+		return bucket;
+	>
+!
+
+hashBlock: aBlock
+	hashBlock := aBlock
+! !
+
+!BucketStore methodsFor: 'adding/removing'!
+
+removeAll
+	<self['@buckets'] = Object.create(null);>
+! !
+
+!BucketStore methodsFor: 'enumerating'!
+
+do: aBlock
+	<
+		var buckets = self['@buckets'];
+		var keys = Object.keys(buckets);
+		for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
+	>
+! !
+
+!BucketStore methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	self removeAll
+! !
+
+!BucketStore methodsFor: 'private'!
+
+newBucket
+	self subclassResponsibility
+! !
+
+!BucketStore class methodsFor: 'instance creation'!
+
+hashBlock: aBlock
+	^ self new
+		hashBlock: aBlock;
+		yourself
+! !
+
+BucketStore subclass: #ArrayBucketStore
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!ArrayBucketStore commentStamp!
+I am a concrete `BucketStore` with buckets being instance of `Array`.!
+
+!ArrayBucketStore methodsFor: 'private'!
+
+newBucket
+	^ #()
+! !
+
+Object subclass: #Collection
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!Collection commentStamp!
+I am the abstract superclass of all classes that represent a group of elements.
+
+I provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.!
+
+!Collection methodsFor: 'accessing'!
+
+occurrencesOf: anObject
+	"Answer how many of the receiver's elements are equal to anObject."
+
+	| tally |
+	tally := 0.
+	self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].
+	^ tally
+!
+
+size
+	self subclassResponsibility
+! !
+
+!Collection methodsFor: 'adding/removing'!
+
+add: anObject
+	self subclassResponsibility
+!
+
+addAll: aCollection
+	aCollection do: [ :each |
+		self add: each ].
+	^ aCollection
+!
+
+anyOne
+	"Answer a representative sample of the receiver. This method can
+	be helpful when needing to preinfer the nature of the contents of 
+	semi-homogeneous collections."
+
+	self ifEmpty: [ self error: 'Collection is empty' ].
+	self do: [ :each | ^ each ]
+!
+
+remove: anObject
+	^ self remove: anObject ifAbsent: [ self errorNotFound ]
+!
+
+remove: anObject ifAbsent: aBlock
+	self subclassResponsibility
+!
+
+removeAll
+	self subclassResponsibility
+! !
+
+!Collection methodsFor: 'converting'!
+
+asArray
+	^ Array withAll: self
+!
+
+asJSON
+	^ self asArray collect: [ :each | each asJSON ]
+!
+
+asOrderedCollection
+	^ self asArray
+!
+
+asSet
+	^ Set withAll: self
+! !
+
+!Collection methodsFor: 'copying'!
+
+, aCollection
+	^ self copy
+		addAll: aCollection;
+		yourself
+!
+
+copyWith: anObject
+	^ self copy add: anObject; yourself
+!
+
+copyWithAll: aCollection
+	^ self copy addAll: aCollection; yourself
+!
+
+copyWithoutAll: aCollection
+	"Answer a copy of the receiver that does not contain any elements
+	equal to those in aCollection."
+
+	^ self reject: [ :each | aCollection includes: each ]
+! !
+
+!Collection methodsFor: 'enumerating'!
+
+allSatisfy: aBlock
+	"Evaluate aBlock with the elements of the receiver.
+	If aBlock returns false for any element return false.
+	Otherwise return true."
+
+	self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].
+	^ true
+!
+
+anySatisfy: aBlock
+	"Evaluate aBlock with the elements of the receiver.
+	If aBlock returns true for any element return true.
+	Otherwise return false."
+
+	self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].
+	^ false
+!
+
+collect: aBlock
+	| stream |
+	stream := self class new writeStream.
+	self do: [ :each |
+		stream nextPut: (aBlock value: each) ].
+	^ stream contents
+!
+
+detect: aBlock
+	^ self detect: aBlock ifNone: [ self errorNotFound ]
+!
+
+detect: aBlock ifNone: anotherBlock
+	self subclassResponsibility
+!
+
+do: aBlock
+	self subclassResponsibility
+!
+
+do: aBlock separatedBy: anotherBlock
+	| actionBeforeElement |
+	actionBeforeElement := [ actionBeforeElement := anotherBlock ].
+	self do: [ :each |
+		actionBeforeElement value.
+		aBlock value: each ]
+!
+
+inject: anObject into: aBlock
+	| result |
+	result := anObject.
+	self do: [ :each |
+		result := aBlock value: result value: each ].
+	^ result
+!
+
+intersection: aCollection
+	"Answer the set theoretic intersection of two collections."
+
+	| set outputSet |
+	
+	set := self asSet.
+	outputSet := Set new.
+	
+	aCollection do: [ :each |
+		((set includes: each) and: [ (outputSet includes: each) not ])
+			ifTrue: [
+				outputSet add: each ]].
+		
+	^ self class withAll: outputSet asArray
+!
+
+noneSatisfy: aBlock
+	"Evaluate aBlock with the elements of the receiver.
+	If aBlock returns false for all elements return true.
+	Otherwise return false"
+
+	self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].
+	^ true
+!
+
+reject: aBlock
+	^ self select: [ :each | (aBlock value: each) = false ]
+!
+
+select: aBlock
+	| stream |
+	stream := self class new writeStream.
+	self do: [ :each |
+		(aBlock value: each) ifTrue: [
+		stream nextPut: each ] ].
+	^ stream contents
+!
+
+select: selectBlock thenCollect: collectBlock
+	| stream |
+	stream := self class new writeStream.
+	self do: [ :each |
+		(selectBlock value: each) ifTrue: [
+		stream nextPut: (collectBlock value: each) ] ].
+	^ stream contents
+! !
+
+!Collection methodsFor: 'error handling'!
+
+errorNotFound
+	self error: 'Object is not in the collection'
+! !
+
+!Collection methodsFor: 'streaming'!
+
+putOn: aStream
+	self do: [ :each | each putOn: aStream ]
+! !
+
+!Collection methodsFor: 'testing'!
+
+contains: aBlock
+	self deprecatedAPI.
+
+	^ self anySatisfy: aBlock
+!
+
+ifEmpty: aBlock
+	"Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. 
+	Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: 
+		self classifyMethodAs:
+			(myProtocol ifEmpty: ['As yet unclassified'])"
+	^ self isEmpty
+		ifTrue: aBlock
+		ifFalse: [ self ]
+!
+
+ifEmpty: aBlock ifNotEmpty: anotherBlock
+	^ self isEmpty
+		ifTrue: aBlock
+		ifFalse: anotherBlock
+!
+
+ifNotEmpty: aBlock
+	^ self notEmpty
+		ifTrue: aBlock
+		ifFalse: [ self ]
+!
+
+ifNotEmpty: aBlock ifEmpty: anotherBlock
+	^ self notEmpty
+		ifTrue: aBlock
+		ifFalse: anotherBlock
+!
+
+includes: anObject
+	^ self anySatisfy: [ :each | each = anObject ]
+!
+
+isEmpty
+	^ self size = 0
+!
+
+notEmpty
+	^ self isEmpty not
+! !
+
+!Collection class methodsFor: 'helios'!
+
+heliosClass
+	^ 'collection'
+! !
+
+!Collection class methodsFor: 'instance creation'!
+
+new: anInteger
+	^ self new
+!
+
+with: anObject
+		^ self new
+		add: anObject;
+		yourself
+!
+
+with: anObject with: anotherObject
+		^ self new
+		add: anObject;
+		add: anotherObject;
+		yourself
+!
+
+with: firstObject with: secondObject with: thirdObject
+		^ self new
+		add: firstObject;
+		add: secondObject;
+		add: thirdObject;
+		yourself
+!
+
+withAll: aCollection
+		^ self new
+		addAll: aCollection;
+		yourself
+! !
+
+Collection subclass: #IndexableCollection
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!IndexableCollection commentStamp!
+I am a key-value store collection, that is,
+I store values under indexes.
+
+As a rule of thumb, if a collection has `#at:` and `#at:put:`,
+it is an IndexableCollection.!
+
+!IndexableCollection methodsFor: 'accessing'!
+
+at: anIndex
+	"Lookup the given index in the receiver.
+	If it is present, answer the value stored at anIndex.
+	Otherwise, raise an error."
+
+	^ self at: anIndex ifAbsent: [ self errorNotFound ]
+!
+
+at: anIndex ifAbsent: aBlock
+	"Lookup the given index in the receiver.
+	If it is present, answer the value stored at anIndex.
+	Otherwise, answer the value of aBlock."
+
+	self subclassResponsibility
+!
+
+at: aKey ifAbsentPut: aBlock
+	^ self at: aKey ifAbsent: [
+		self at: aKey put: aBlock value ]
+!
+
+at: anIndex ifPresent: aBlock
+	"Lookup the given index in the receiver.
+	If it is present, answer the value of evaluating aBlock with the value stored at anIndex.
+	Otherwise, answer nil."
+
+	^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]
+!
+
+at: anIndex ifPresent: aBlock ifAbsent: anotherBlock
+	"Lookup the given index in the receiver.
+	If it is present, answer the value of evaluating aBlock with the value stored at anIndex.
+	Otherwise, answer the value of anotherBlock."
+
+	self subclassResponsibility
+!
+
+at: anIndex put: anObject
+	"Store anObject under the given index in the receiver."
+
+	self subclassResponsibility
+!
+
+indexOf: anObject
+	"Lookup index at which anObject is stored in the receiver.
+	If not present, raise an error."
+
+	^ self indexOf: anObject ifAbsent: [ self errorNotFound ]
+!
+
+indexOf: anObject ifAbsent: aBlock
+	"Lookup index at which anObject is stored in the receiver.
+	If not present, return value of executing aBlock."
+
+	self subclassResponsibility
+! !
+
+!IndexableCollection methodsFor: 'enumarating'!
+
+with: anotherCollection do: aBlock
+	"Calls aBlock with every value from self
+	and with indetically-indexed value from anotherCollection"
+
+	self withIndexDo: [ :each :index |
+		aBlock value: each value: (anotherCollection at: index) ]
+!
+
+withIndexDo: aBlock
+	"Calls aBlock with every value from self
+	and with its index as the second argument"
+
+	self subclassResponsibility
+! !
+
+IndexableCollection subclass: #AssociativeCollection
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!AssociativeCollection commentStamp!
+I am a base class for object-indexed collections (Dictionary et.al.).!
+
+!AssociativeCollection methodsFor: 'accessing'!
+
+associations
+	| associations |
+	associations := #().
+	self associationsDo: [ :each | associations add: each ].
+	^ associations
+!
+
+at: aKey ifPresent: aBlock ifAbsent: anotherBlock
+	"Lookup the given key in the receiver.
+	If it is present, answer the value of evaluating the oneArgBlock 
+	with the value associated with the key, otherwise answer the value 
+	of absentBlock."
+	
+	^ (self includesKey: aKey)
+		ifTrue: [ aBlock value: (self at: aKey) ]
+		ifFalse: [ anotherBlock value ]
+!
+
+indexOf: anObject ifAbsent: aBlock
+	^ self keys 
+		detect: [ :each | (self at: each) = anObject ] 
+		ifNone: aBlock
+!
+
+keyAtValue: anObject
+	^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]
+!
+
+keyAtValue: anObject ifAbsent: aBlock
+	^ self indexOf: anObject ifAbsent: aBlock
+!
+
+keys
+	self subclassResponsibility
+!
+
+size
+	^ self keys size
+!
+
+values
+	self subclassResponsibility
+! !
+
+!AssociativeCollection methodsFor: 'adding/removing'!
+
+add: anAssociation
+	self at: anAssociation key put: anAssociation value
+!
+
+addAll: anAssociativeCollection
+	super addAll: anAssociativeCollection associations.
+	^ anAssociativeCollection
+!
+
+remove: aKey ifAbsent: aBlock
+	^ self removeKey: aKey ifAbsent: aBlock
+!
+
+removeAll
+	^ self keys do: [ :each | self removeKey: each ]
+!
+
+removeKey: aKey
+	^ self remove: aKey
+!
+
+removeKey: aKey ifAbsent: aBlock
+	self subclassResponsibility
+! !
+
+!AssociativeCollection methodsFor: 'comparing'!
+
+= anAssocitativeCollection
+	self class = anAssocitativeCollection class ifFalse: [ ^ false ].
+	self size = anAssocitativeCollection size ifFalse: [ ^ false ].
+	^ self associations = anAssocitativeCollection associations
+! !
+
+!AssociativeCollection methodsFor: 'converting'!
+
+asDictionary
+	^ Dictionary from: self associations
+!
+
+asHashedCollection
+	^ HashedCollection from: self associations
+!
+
+asJSON
+	| hash |
+	hash := HashedCollection new.
+	self keysAndValuesDo: [ :key :value |
+		hash at: key put: value asJSON ].
+	^ hash
+! !
+
+!AssociativeCollection methodsFor: 'copying'!
+
+deepCopy
+	| copy |
+	copy := self class new.
+	self keysAndValuesDo: [ :key :value |
+		copy at: key put: value deepCopy ].
+	^ copy
+!
+
+shallowCopy
+	| copy |
+	copy := self class new.
+	self keysAndValuesDo: [ :key :value |
+		copy at: key put: value ].
+	^ copy
+! !
+
+!AssociativeCollection methodsFor: 'enumerating'!
+
+associationsDo: aBlock
+	self keysAndValuesDo: [ :key :value |
+		aBlock value: (Association key: key value: value) ]
+!
+
+collect: aBlock
+	| newDict |
+	newDict := self class new.
+	self keysAndValuesDo: [ :key :value |
+		newDict at: key put: (aBlock value: value) ].
+	^ newDict
+!
+
+detect: aBlock ifNone: anotherBlock
+	^ self values detect: aBlock ifNone: anotherBlock
+!
+
+do: aBlock
+	self valuesDo: aBlock
+!
+
+includes: anObject
+	^ self values includes: anObject
+!
+
+keysAndValuesDo: aBlock
+	self keysDo: [ :each |
+		aBlock value: each value: (self at: each) ]
+!
+
+keysDo: aBlock
+	self subclassResponsibility
+!
+
+select: aBlock
+	| newDict |
+	newDict := self class new.
+	self keysAndValuesDo: [ :key :value |
+		(aBlock value: value) ifTrue: [ newDict at: key put: value ]].
+	^ newDict
+!
+
+valuesDo: aBlock
+	self subclassResponsibility
+!
+
+withIndexDo: aBlock
+	self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]
+! !
+
+!AssociativeCollection methodsFor: 'printing'!
+
+printOn: aStream
+	super printOn: aStream.
+	
+	aStream nextPutAll: ' ('.
+	self associations
+		do: [ :each | each printOn: aStream ]
+		separatedBy: [ aStream nextPutAll: ' , ' ].
+	aStream nextPutAll: ')'
+! !
+
+!AssociativeCollection methodsFor: 'testing'!
+
+includesKey: aKey
+	self subclassResponsibility
+! !
+
+!AssociativeCollection class methodsFor: 'instance creation'!
+
+from: aCollection
+	| newCollection |
+	newCollection := self new.
+	aCollection do: [ :each | newCollection add: each ].
+	^ newCollection
+!
+
+fromPairs: aCollection
+	"This message is poorly named and has been replaced by #from:"
+	^ self from: aCollection
+!
+
+newFromPairs: aCollection
+	"Accept an array of elements where every two elements form an 
+	association - the odd element being the key, and the even element the value."
+	
+	| newCollection |
+	
+	aCollection size even ifFalse: [ 
+		self error: '#newFromPairs only accepts arrays of an even length' ].
+		
+	newCollection := self new.
+	( 1 to: aCollection size by: 2 ) do: [ :each | 
+		newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].
+		
+	^ newCollection
+! !
+
+AssociativeCollection subclass: #Dictionary
+	instanceVariableNames: 'keys values'
+	package: 'Kernel-Collections'!
+!Dictionary commentStamp!
+I represent a set of elements that can be viewed from one of two perspectives: a set of associations,
+or a container of values that are externally named where the name can be any object that responds to `=`.
+
+The external name is referred to as the key.!
+
+!Dictionary methodsFor: 'accessing'!
+
+at: aKey ifAbsent: aBlock
+	<
+		var index = self._positionOfKey_(aKey);
+		return index >>=0 ? self['@values'][index] : aBlock._value();
+	>
+!
+
+at: aKey put: aValue
+	<
+		var index = self._positionOfKey_(aKey);
+		if(index === -1) {
+			var keys = self['@keys'];
+			index = keys.length;
+			keys.push(aKey);
+		}
+
+		return self['@values'][index] = aValue;
+	>
+!
+
+indexOf: anObject ifAbsent: aBlock
+	| index |
+	index := values 
+		indexOf: anObject 
+		ifAbsent: [ 0 ].
+	^ index = 0 
+		ifTrue: [ aBlock value ] 
+		ifFalse: [ keys at: index ]
+!
+
+keys
+	^ keys copy
+!
+
+values
+	^ values
+! !
+
+!Dictionary methodsFor: 'adding/removing'!
+
+removeAll
+	keys removeAll.
+	values removeAll
+!
+
+removeKey: aKey ifAbsent: aBlock
+	<
+		var index = self._positionOfKey_(aKey);
+		if(index === -1) {
+			return aBlock._value()
+		} else {
+			var keys = self['@keys'], values = self['@values'];
+			var value = values[index], l = keys.length;
+			keys[index] = keys[l-1];
+			keys.pop();
+			values[index] = values[l-1];
+			values.pop();
+			return value;
+		}
+	>
+! !
+
+!Dictionary methodsFor: 'enumerating'!
+
+keysAndValuesDo: aBlock
+	^ keys with: values do: aBlock
+!
+
+keysDo: aBlock
+	^ keys do: aBlock
+!
+
+valuesDo: aBlock
+	^ values do: aBlock
+! !
+
+!Dictionary methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	keys := #().
+	values := #()
+! !
+
+!Dictionary methodsFor: 'private'!
+
+positionOfKey: anObject
+	<
+		var keys = self['@keys'];
+		for(var i=0;i<keys.length;i++){
+			if(keys[i].__eq(anObject)) { return i;}
+		}
+		return -1;
+	>
+! !
+
+!Dictionary methodsFor: 'testing'!
+
+includesKey: aKey
+	< return self._positionOfKey_(aKey) >>= 0; >
+! !
+
+AssociativeCollection subclass: #HashedCollection
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!HashedCollection commentStamp!
+I am a traditional JavaScript object, or a Smalltalk `Dictionary`.
+
+Unlike a `Dictionary`, I can only have strings as keys.!
+
+!HashedCollection methodsFor: 'accessing'!
+
+at: aKey ifAbsent: aBlock
+	^ (self includesKey: aKey)
+		ifTrue: [ self basicAt: aKey ]
+		ifFalse: [ aBlock value ]
+!
+
+at: aKey put: aValue
+	^ self basicAt: aKey put: aValue
+!
+
+keys
+	<return Object.keys(self)>
+!
+
+values
+	<
+		return self._keys().map(function(key){
+			return self._at_(key);
+		});
+	>
+! !
+
+!HashedCollection methodsFor: 'adding/removing'!
+
+removeKey: aKey ifAbsent: aBlock
+	^ self
+		at: aKey
+		ifPresent: [ :removed | self basicDelete: aKey. removed ]
+		ifAbsent: [ aBlock value ]
+! !
+
+!HashedCollection methodsFor: 'enumerating'!
+
+keysDo: aBlock
+	self keys do: aBlock
+!
+
+valuesDo: aBlock
+	self values do: aBlock
+! !
+
+!HashedCollection methodsFor: 'testing'!
+
+includesKey: aKey
+	<return self.hasOwnProperty(aKey)>
+! !
+
+IndexableCollection subclass: #SequenceableCollection
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!SequenceableCollection commentStamp!
+I am an IndexableCollection
+with numeric indexes starting with 1.!
+
+!SequenceableCollection methodsFor: 'accessing'!
+
+allButFirst
+	^ self copyFrom: 2 to: self size
+!
+
+allButLast
+	^ self copyFrom: 1 to: self size - 1
+!
+
+atRandom
+	^ self at: self size atRandom
+!
+
+first
+	^ self at: 1
+!
+
+first: aNumber
+	"Answer the first `aNumber` elements of the receiver.
+	Raise an error if there are not enough elements in the receiver."
+
+	self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].
+
+	^ self copyFrom: 1 to: aNumber
+!
+
+fourth
+	^ self at: 4
+!
+
+indexOf: anObject ifAbsent: aBlock
+	<
+		self = self._numericallyIndexable();
+		for(var i=0; i < self.length; i++) {
+			if(_st(self[i]).__eq(anObject)) {return i+1}
+		};
+		return aBlock._value();
+	>
+!
+
+indexOf: anObject startingAt: start
+	"Answer the index of the first occurence of anElement after start
+	within the receiver. If the receiver does not contain anElement,
+	answer 0."
+	^ self indexOf: anObject startingAt: start ifAbsent: [ 0 ]
+!
+
+indexOf: anObject startingAt: start ifAbsent: aBlock
+	<
+		self = self._numericallyIndexable();
+		for(var i=start - 1; i < self.length; i++){
+			if(_st(self[i]).__eq(anObject)) {return i+1}
+		}
+		return aBlock._value();
+	>
+!
+
+last
+	^ self at: self size
+!
+
+last: aNumber
+	"Answer the last aNumber elements of the receiver.
+	Raise an error if there are not enough elements in the receiver."
+
+	self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].
+
+	^ self copyFrom: self size - aNumber + 1 to: self size
+!
+
+second
+	^ self at: 2
+!
+
+third
+	^ self at: 3
+! !
+
+!SequenceableCollection methodsFor: 'adding/removing'!
+
+addLast: anObject
+	self add: anObject
+!
+
+removeLast
+	^ self remove: self last
+! !
+
+!SequenceableCollection methodsFor: 'comparing'!
+
+= aCollection
+	(self class = aCollection class and: [
+		self size = aCollection size ]) ifFalse: [ ^ false ].
+	self withIndexDo: [ :each :i |
+				(aCollection at: i) = each ifFalse: [ ^ false ]].
+	^ true
+! !
+
+!SequenceableCollection methodsFor: 'converting'!
+
+reversed
+	self subclassResponsibility
+! !
+
+!SequenceableCollection methodsFor: 'copying'!
+
+copyFrom: anIndex to: anotherIndex
+	| range newCollection |
+	range := anIndex to: anotherIndex.
+	newCollection := self class new: range size.
+	range withIndexDo: [ :each :i |
+		newCollection at: i put: (self at: each) ].
+	^ newCollection
+!
+
+deepCopy
+	| newCollection |
+	newCollection := self class new: self size.
+	self withIndexDo: [ :each :index |
+		newCollection at: index put: each deepCopy ].
+	^ newCollection
+!
+
+shallowCopy
+	| newCollection |
+	newCollection := self class new: self size.
+	self withIndexDo: [ :each :index |
+		newCollection at: index put: each ].
+	^ newCollection
+! !
+
+!SequenceableCollection methodsFor: 'enumerating'!
+
+detect: aBlock ifNone: anotherBlock
+	<
+		self = self._numericallyIndexable();
+		for(var i = 0; i < self.length; i++)
+			if(aBlock._value_(self[i]))
+				return self[i];
+		return anotherBlock._value();
+	>
+!
+
+do: aBlock
+	<
+		self = self._numericallyIndexable();
+		for(var i=0; i < self.length; i++) {
+			aBlock._value_(self[i]);
+		}
+	>
+!
+
+with: anotherCollection do: aBlock
+	<
+		self = self._numericallyIndexable();
+		anotherCollection = anotherCollection._numericallyIndexable();
+		for(var i=0; i<self.length; i++) {
+			aBlock._value_value_(self[i], anotherCollection[i]);
+		}
+	>
+!
+
+withIndexDo: aBlock
+	<
+		self = self._numericallyIndexable();
+		for(var i=0; i < self.length; i++) {
+			aBlock._value_value_(self[i], i+1);
+		}
+	>
+! !
+
+!SequenceableCollection methodsFor: 'private'!
+
+numericallyIndexable
+	"This is an internal converting message.
+	It answeres a representation of the receiver
+	that can use foo[i] in JavaScript code.
+	
+	It fixes IE8, where boxed String is unable
+	to numerically index its characters,
+	but primitive string can."
+	
+	self subclassResponsibility
+! !
+
+!SequenceableCollection methodsFor: 'streaming'!
+
+newStream
+	^ self streamClass on: self
+!
+
+readStream
+	"For Pharo compatibility"
+	
+	^ self stream
+!
+
+stream
+	^ self newStream
+!
+
+streamClass
+	^ self class streamClass
+!
+
+writeStream
+	"For Pharo compatibility"
+	
+	^ self stream
+! !
+
+!SequenceableCollection methodsFor: 'testing'!
+
+beginsWith: prefix
+	self size < prefix size ifTrue: [ ^ false ].
+	^ (self first: prefix size) = prefix
+!
+
+endsWith: suffix
+	self size < suffix size ifTrue: [ ^ false ].
+	^ (self last: suffix size) = suffix
+!
+
+includes: anObject
+	^ (self indexOf: anObject ifAbsent: [ nil ]) notNil
+! !
+
+!SequenceableCollection class methodsFor: 'accessing'!
+
+streamClass
+		^ Stream
+! !
+
+!SequenceableCollection class methodsFor: 'streaming'!
+
+streamContents: aBlock
+	| stream |
+	stream := (self streamClass on: self new).
+	aBlock value: stream.
+	^ stream contents
+! !
+
+SequenceableCollection subclass: #Array
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!Array commentStamp!
+I represent a collection of objects ordered by the collector. The size of arrays is dynamic.
+
+I am directly mapped to JavaScript Number.
+
+*Note* In Amber, `OrderedCollection` is an alias for `Array`.!
+
+!Array methodsFor: 'accessing'!
+
+at: anIndex ifAbsent: aBlock
+	<
+		return anIndex >>= 1 && anIndex <= self.length
+			? self[anIndex - 1]
+			: aBlock._value()
+	>
+!
+
+at: anIndex ifPresent: aBlock ifAbsent: anotherBlock
+	<
+		return anIndex >>= 1 && anIndex <= self.length
+			? aBlock._value_(self[anIndex - 1])
+			: anotherBlock._value()
+	>
+!
+
+at: anIndex put: anObject
+	<return self[anIndex - 1] = anObject>
+!
+
+size
+	<return self.length>
+! !
+
+!Array methodsFor: 'adding/removing'!
+
+add: anObject
+	<self.push(anObject); return anObject;>
+!
+
+addFirst: anObject
+	<self.unshift(anObject); return anObject;>
+!
+
+remove: anObject ifAbsent: aBlock
+	| index |
+	index := self indexOf: anObject ifAbsent: [ 0 ].
+	^ index = 0
+		ifFalse: [ self removeIndex: index. anObject ]
+		ifTrue: [ aBlock value ]
+!
+
+removeAll
+	<self.length = 0>
+!
+
+removeFrom: aNumber to: anotherNumber
+	<self.splice(aNumber -1, anotherNumber - aNumber + 1)>
+!
+
+removeIndex: anInteger
+	<self.splice(anInteger - 1, 1)>
+!
+
+removeLast
+	<return self.pop();>
+! !
+
+!Array methodsFor: 'converting'!
+
+asJavascript
+	^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'
+!
+
+reversed
+	<return self._copy().reverse()>
+! !
+
+!Array methodsFor: 'enumerating'!
+
+collect: aBlock
+	"Optimized version"
+	
+	<return self.map(function(each) {return aBlock._value_(each)})>
+!
+
+join: aString
+	<return self.join(aString)>
+!
+
+select: aBlock
+	"Optimized version"
+	
+	<
+		var result = self.klass._new();
+		for(var i=0; i<self.length; i++) {
+			if(aBlock._value_(self[i])) {
+				result.push(self[i]);
+			}
+		}
+		return result;
+	>
+!
+
+sort
+	^ self sort: [ :a :b | a < b ]
+!
+
+sort: aBlock
+	<
+		return self.sort(function(a, b) {
+			if(aBlock._value_value_(a,b)) {return -1} else {return 1}
+		})
+	>
+!
+
+sorted
+	^ self copy sort
+!
+
+sorted: aBlock
+	^ self copy sort: aBlock
+! !
+
+!Array methodsFor: 'printing'!
+
+printOn: aStream
+	super printOn: aStream.
+	
+	aStream nextPutAll: ' ('.
+	self 
+		do: [ :each | each printOn: aStream ]
+		separatedBy: [ aStream nextPutAll: ' ' ].
+	aStream nextPutAll: ')'
+! !
+
+!Array methodsFor: 'private'!
+
+numericallyIndexable
+	^ self
+! !
+
+!Array class methodsFor: 'instance creation'!
+
+new: anInteger
+	<return new Array(anInteger)>
+!
+
+with: anObject
+		^ (self new: 1)
+		at: 1 put: anObject;
+		yourself
+!
+
+with: anObject with: anObject2
+		^ (self new: 2)
+		at: 1 put: anObject;
+		at: 2 put: anObject2;
+		yourself
+!
+
+with: anObject with: anObject2 with: anObject3
+		^ (self new: 3)
+		at: 1 put: anObject;
+		at: 2 put: anObject2;
+		at: 3 put: anObject3;
+		yourself
+!
+
+withAll: aCollection
+	| instance index |
+	index := 1.
+	instance := self new: aCollection size.
+	aCollection do: [ :each |
+		instance at: index put: each.
+		index := index + 1 ].
+	^ instance
+! !
+
+SequenceableCollection subclass: #CharacterArray
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!CharacterArray commentStamp!
+I am the abstract superclass of string-like collections.!
+
+!CharacterArray methodsFor: 'accessing'!
+
+at: anIndex put: anObject
+	self errorReadOnly
+! !
+
+!CharacterArray methodsFor: 'adding/removing'!
+
+add: anObject
+	self errorReadOnly
+!
+
+remove: anObject
+	self errorReadOnly
+! !
+
+!CharacterArray methodsFor: 'converting'!
+
+asLowercase
+	^ self class fromString: self asString asLowercase
+!
+
+asNumber
+	^ self asString asNumber
+!
+
+asString
+	^ self subclassResponsibility
+!
+
+asSymbol
+	^ self asString
+!
+
+asUppercase
+	^ self class fromString: self asString asUppercase
+! !
+
+!CharacterArray methodsFor: 'copying'!
+
+, aString
+	^ self asString, aString asString
+! !
+
+!CharacterArray methodsFor: 'error handling'!
+
+errorReadOnly
+	self error: 'Object is read-only'
+! !
+
+!CharacterArray methodsFor: 'printing'!
+
+printOn: aStream
+	self asString printOn: aStream
+! !
+
+!CharacterArray methodsFor: 'streaming'!
+
+putOn: aStream
+	aStream nextPutString: self
+! !
+
+!CharacterArray class methodsFor: 'instance creation'!
+
+fromString: aString
+	self subclassResponsibility
+! !
+
+CharacterArray subclass: #String
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!String commentStamp!
+I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.
+
+String inherits many useful methods from its hierarchy, such as
+	`Collection >> #,`!
+
+!String methodsFor: 'accessing'!
+
+asciiValue
+	<return self.charCodeAt(0);>
+!
+
+at: anIndex ifAbsent: aBlock
+	<return String(self)[anIndex - 1] || aBlock._value()>
+!
+
+at: anIndex ifPresent: aBlock ifAbsent: anotherBlock
+	<
+		var result = String(self)[anIndex - 1];
+		return result ? aBlock._value_(result) : anotherBlock._value();
+	>
+!
+
+charCodeAt: anInteger
+	<return self.charCodeAt(anInteger - 1)>
+!
+
+identityHash
+	^ self, 's'
+!
+
+size
+	<return self.length>
+! !
+
+!String methodsFor: 'comparing'!
+
+< aString
+	<return String(self) < aString._asString()>
+!
+
+<= aString
+	<return String(self) <= aString._asString()>
+!
+
+= aString
+	<
+		return aString !!= null &&
+			typeof aString._isString === "function" &&
+			aString._isString() &&
+			String(self) === String(aString)
+	>
+!
+
+== aString
+	^ self = aString
+!
+
+> aString
+	<return String(self) >> aString._asString()>
+!
+
+>= aString
+	<return String(self) >>= aString._asString()>
+! !
+
+!String methodsFor: 'converting'!
+
+asJSON
+	^ self
+!
+
+asJavascript
+	<
+		if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
+			return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
+		else
+			return "\"" + self + "\"";
+	>
+!
+
+asLowercase
+	<return self.toLowerCase()>
+!
+
+asMutator
+	"Answer a setter selector. For example,
+	#name asMutator returns #name:"
+
+	self last = ':' ifFalse: [  ^ self, ':' ].
+	^ self
+!
+
+asNumber
+	<return Number(self)>
+!
+
+asRegexp
+	^ RegularExpression fromString: self
+!
+
+asSelector
+	<return smalltalk.selector(self)>
+!
+
+asString
+	^ self
+!
+
+asSymbol
+	^ self
+!
+
+asUppercase
+	<return self.toUpperCase()>
+!
+
+capitalized
+	^ self isEmpty
+		ifTrue: [ self ]
+		ifFalse: [ self first asUppercase, self allButFirst ]
+!
+
+crlfSanitized
+	^ self lines join: String lf
+!
+
+escaped
+	<return escape(self)>
+!
+
+reversed
+	<return self.split("").reverse().join("")>
+!
+
+unescaped
+	<return unescape(self)>
+!
+
+uriComponentDecoded
+	<return decodeURIComponent(self)>
+!
+
+uriComponentEncoded
+	<return encodeURIComponent(self)>
+!
+
+uriDecoded
+	<return decodeURI(self)>
+!
+
+uriEncoded
+	<return encodeURI(self)>
+! !
+
+!String methodsFor: 'copying'!
+
+, aString
+	<return String(self) + aString>
+!
+
+copyFrom: anIndex to: anotherIndex
+	<return self.substring(anIndex - 1, anotherIndex)>
+!
+
+deepCopy
+	^ self shallowCopy
+!
+
+shallowCopy
+	^ self class fromString: self
+! !
+
+!String methodsFor: 'evaluating'!
+
+value: anObject 
+	^ anObject perform: self
+! !
+
+!String methodsFor: 'printing'!
+
+printNl
+	<console.log(self)>
+!
+
+printOn: aStream
+	aStream 
+		nextPutAll: '''';
+		nextPutAll: self;
+		nextPutAll: ''''
+! !
+
+!String methodsFor: 'private'!
+
+numericallyIndexable
+	<return String(self)>
+! !
+
+!String methodsFor: 'regular expressions'!
+
+match: aRegexp
+	<return self.search(aRegexp) !!= -1>
+!
+
+matchesOf: aRegularExpression
+	<return self.match(aRegularExpression)>
+!
+
+replace: aString with: anotherString
+	^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString
+!
+
+replaceRegexp: aRegexp with: aString
+	<return self.replace(aRegexp, aString)>
+!
+
+trimBoth
+	^ self trimBoth: '\s'
+!
+
+trimBoth: separators
+	^ (self trimLeft: separators) trimRight: separators
+!
+
+trimLeft
+	^ self trimLeft: '\s'
+!
+
+trimLeft: separators
+	^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''
+!
+
+trimRight
+	^ self trimRight: '\s'
+!
+
+trimRight: separators
+	^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''
+! !
+
+!String methodsFor: 'split join'!
+
+join: aCollection
+	^ String
+		streamContents: [ :stream | aCollection
+				do: [ :each | stream nextPutAll: each asString ]
+				separatedBy: [ stream nextPutAll: self ]]
+!
+
+lineIndicesDo: aBlock
+	"execute aBlock with 3 arguments for each line:
+	- start index of line
+	- end index of line without line delimiter
+	- end index of line including line delimiter(s) CR, LF or CRLF"
+	
+	| cr lf start sz nextLF nextCR |
+	start := 1.
+	sz := self size.
+	cr := String cr.
+	nextCR := self indexOf: cr startingAt: 1.
+	lf := String lf.
+	nextLF := self indexOf: lf startingAt: 1.
+	[ start <= sz ] whileTrue: [ 
+		(nextLF = 0 and: [ nextCR = 0 ])
+			ifTrue: [ "No more CR, nor LF, the string is over"
+					aBlock value: start value: sz value: sz.
+					^ self ].
+		(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])
+			ifTrue: [ "Found a LF"
+					aBlock value: start value: nextLF - 1 value: nextLF.
+					start := 1 + nextLF.
+					nextLF := self indexOf: lf startingAt: start ]
+			ifFalse: [ 1 + nextCR = nextLF
+				ifTrue: [ "Found a CR-LF pair"
+					aBlock value: start value: nextCR - 1 value: nextLF.
+					start := 1 + nextLF.
+					nextCR := self indexOf: cr startingAt: start.
+					nextLF := self indexOf: lf startingAt: start ]
+				ifFalse: [ "Found a CR"
+					aBlock value: start value: nextCR - 1 value: nextCR.
+					start := 1 + nextCR.
+					nextCR := self indexOf: cr startingAt: start ] ]]
+!
+
+lineNumber: anIndex
+	"Answer a string containing the characters in the given line number."
+
+	| lineCount |
+	lineCount := 0.
+	self lineIndicesDo: [ :start :endWithoutDelimiters :end |
+		(lineCount := lineCount + 1) = anIndex ifTrue: [ ^ self copyFrom: start to: endWithoutDelimiters ]].
+	^ nil
+!
+
+lines
+	"Answer an array of lines composing this receiver without the line ending delimiters."
+
+	| lines |
+	lines := Array new.
+	self linesDo: [ :aLine | lines add: aLine ].
+	^ lines
+!
+
+linesDo: aBlock
+	"Execute aBlock with each line in this string. The terminating line
+	delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock"
+
+	self lineIndicesDo: [ :start :endWithoutDelimiters :end |
+		aBlock value: (self copyFrom: start to: endWithoutDelimiters) ]
+!
+
+subStrings: aString
+	^ self tokenize: aString
+!
+
+tokenize: aString
+	<return self.split(aString)>
+! !
+
+!String methodsFor: 'testing'!
+
+includesSubString: subString
+	<return self.indexOf(subString) !!= -1>
+!
+
+isCapitalized
+	^ self first asUppercase == self first
+!
+
+isImmutable
+	^ true
+!
+
+isString
+	^ true
+!
+
+isVowel
+	"Answer true if the receiver is a one character string containing a voyel"
+	
+	^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]
+! !
+
+!String class methodsFor: 'accessing'!
+
+cr
+	<return '\r'>
+!
+
+crlf
+	<return '\r\n'>
+!
+
+esc
+	^ self fromCharCode: 27
+!
+
+lf
+	<return '\n'>
+!
+
+space
+	<return ' '>
+!
+
+streamClass
+		^ StringStream
+!
+
+tab
+	<return '\t'>
+! !
+
+!String class methodsFor: 'instance creation'!
+
+fromCharCode: anInteger
+	<return String.fromCharCode(anInteger)>
+!
+
+fromString: aString
+		<return String(aString)>
+!
+
+value: aUTFCharCode
+
+	<return String.fromCharCode(aUTFCharCode);>
+! !
+
+!String class methodsFor: 'random'!
+
+random
+	"Returns random alphanumeric string beginning with letter"
+	<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>
+!
+
+randomNotIn: aString
+	| result |
+	[ result := self random. aString includesSubString: result ] whileTrue.
+	^ result
+! !
+
+Collection subclass: #Set
+	instanceVariableNames: 'defaultBucket slowBucketStores fastBuckets size'
+	package: 'Kernel-Collections'!
+!Set commentStamp!
+I represent an unordered set of objects without duplicates.
+
+## Implementation notes
+
+I put elements into different stores based on their type.
+The goal is to store some elements into native JS object property names to be fast.
+
+If an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,
+I store it as a property name in an empty (== Object.create(null)) JS object, different for each type
+(for simplicity, nil/null/undefined is treated as one and included with the two booleans).
+
+If element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,
+one hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less
+instances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.
+
+As a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,
+which is an `Array`.!
+
+!Set methodsFor: 'accessing'!
+
+size
+	^ size
+! !
+
+!Set methodsFor: 'adding/removing'!
+
+add: anObject
+	| bucket |
+	bucket := self bucketsOfElement: anObject.
+	^ bucket second
+		ifNil: [
+			| object slowBucket |
+			object := bucket first.
+			slowBucket := bucket third.
+			slowBucket 
+				indexOf: object 
+				ifAbsent: [ 
+					slowBucket add: object. 
+					size := size + 1 ].
+			object ]
+		ifNotNil: [ :primitiveBucket | 
+			self 
+				add: bucket first 
+				in: primitiveBucket ]
+!
+
+remove: anObject ifAbsent: aBlock
+	| bucket |
+	bucket := self bucketsOfElement: anObject.
+	^ bucket second
+		ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]
+		ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]
+!
+
+removeAll
+	<
+		self['@fastBuckets'] = {
+			'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
+			'number': { store: Object.create(null), fn: Number },
+			'string': { store: Object.create(null) }
+		};
+		self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
+		self['@defaultBucket']._removeAll();
+		self['@size'] = 0;
+	>
+! !
+
+!Set methodsFor: 'comparing'!
+
+= aCollection
+	self class = aCollection class ifFalse: [ ^ false ].
+	self size = aCollection size ifFalse: [ ^ false ].
+	self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].
+	^ true
+! !
+
+!Set methodsFor: 'enumerating'!
+
+collect: aBlock
+	| collection |
+	collection := self class new.
+	self do: [ :each | collection add: (aBlock value: each) ].
+	^ collection
+!
+
+detect: aBlock ifNone: anotherBlock
+	self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].
+	^ anotherBlock value
+!
+
+do: aBlock
+	<
+		var el, keys, i;
+		el = self['@fastBuckets'];
+		keys = Object.keys(el);
+		for (i = 0; i < keys.length; ++i) {
+			var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
+			if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
+			else { store._do_(aBlock); }
+		}
+		el = self['@slowBucketStores'];
+		for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
+		self['@defaultBucket']._do_(aBlock);
+	>
+!
+
+select: aBlock
+	| collection |
+	collection := self class new.
+	self do: [ :each |
+		(aBlock value: each) ifTrue: [
+			collection add: each ] ].
+	^ collection
+! !
+
+!Set methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	
+	defaultBucket := #().
+	self
+		initializeSlowBucketStores;
+		removeAll
+!
+
+initializeSlowBucketStores
+	slowBucketStores := {
+		ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].
+		ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]
+	}
+! !
+
+!Set methodsFor: 'printing'!
+
+printOn: aStream
+	super printOn: aStream.
+	
+	aStream nextPutAll: ' ('.
+	self 
+		do: [ :each | each printOn: aStream ]
+		separatedBy: [ aStream nextPutAll: ' ' ].
+	aStream nextPutAll: ')'
+! !
+
+!Set methodsFor: 'private'!
+
+add: anObject in: anotherObject
+	<
+		if (anObject in anotherObject.store) { return false; }
+		self['@size']++;
+		return anotherObject.store[anObject] = true;
+	>
+!
+
+bucketsOfElement: anObject
+	"Find the appropriate bucket for `anObject`.
+	For optimization purposes, directly answer an array with: 
+	- the object to be store
+	- the primitive bucket
+	- the slow bucket"
+	
+	<
+		var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
+		if ((type = typeof prim) === "object") {
+			if (anObject !!== nil) {
+				bucket = null;
+				self['@slowBucketStores'].some(function (store) {
+					return bucket = store._bucketOfElement_(anObject);
+				});
+				return [ anObject, null, bucket || self['@defaultBucket'] ];
+			}
+			
+			// include nil to well-known objects under 'boolean' fastBucket
+			prim = null;
+			type = 'boolean';
+		}
+		return [ prim, self['@fastBuckets'][type] ];
+	>
+!
+
+classNameOf: anObject
+	"Answer the class name of `anObject`, or `undefined` 
+	if `anObject` is not an Smalltalk object"
+	
+	<return anObject.klass && anObject.klass.className>
+!
+
+includes: anObject in: anotherObject
+	<return anObject in anotherObject.store>
+!
+
+jsConstructorNameOf: anObject
+	<return anObject.constructor && anObject.constructor.name>
+!
+
+remove: anObject in: anotherObject
+	<if (delete anotherObject.store[anObject]) self['@size']-->
+! !
+
+!Set methodsFor: 'testing'!
+
+includes: anObject
+	| bucket |
+	bucket := self bucketsOfElement: anObject.
+	^ bucket second
+		ifNil: [ bucket third includes: bucket first ]
+		ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]
+! !
+
+Object subclass: #Queue
+	instanceVariableNames: 'read readIndex write'
+	package: 'Kernel-Collections'!
+!Queue commentStamp!
+I am a one-sided queue.
+
+## Usage
+
+Use `#nextPut:` to add items to the queue.
+Use `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.
+
+## Implementation notes
+
+A Queue uses two OrderedCollections inside,
+`read` is at the front, is not modified and only read using `readIndex`.
+`write` is at the back and is appended new items.
+When `read` is exhausted, `write` is promoted to `read` and new `write` is created.
+
+As a consequence, no data moving is done by me, write appending may do data moving
+when growing `write`, but this is left to engine to implement as good as it chooses to.!
+
+!Queue methodsFor: 'accessing'!
+
+next
+	^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]
+!
+
+nextIfAbsent: aBlock
+	| result |
+	result := read at: readIndex ifAbsent: [
+		write isEmpty ifTrue: [
+			readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].
+			^ aBlock value ].
+		read := write.
+		readIndex := 1.
+		write := OrderedCollection new.
+		read first ].
+	read at: readIndex put: nil.
+	readIndex := readIndex + 1.
+	^ result
+!
+
+nextPut: anObject
+	write add: anObject
+! !
+
+!Queue methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	read := OrderedCollection new.
+	write := OrderedCollection new.
+	readIndex := 1
+! !
+
+Object subclass: #RegularExpression
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!RegularExpression commentStamp!
+I represent a regular expression object. My instances are JavaScript `RegExp` object.!
+
+!RegularExpression methodsFor: 'evaluating'!
+
+compile: aString
+	<return self.compile(aString)>
+!
+
+exec: aString
+	<return self.exec(aString) || nil>
+!
+
+test: aString
+	<return self.test(aString)>
+! !
+
+!RegularExpression class methodsFor: 'instance creation'!
+
+fromString: aString
+		^ self fromString: aString flag: ''
+!
+
+fromString: aString flag: anotherString
+	<return new RegExp(aString, anotherString)>
+! !
+
+Object subclass: #Stream
+	instanceVariableNames: 'collection position streamSize'
+	package: 'Kernel-Collections'!
+!Stream commentStamp!
+I represent an accessor for a sequence of objects. This sequence is referred to as my "contents".
+My instances are read/write streams to the contents sequence collection.!
+
+!Stream methodsFor: 'accessing'!
+
+collection
+	^ collection
+!
+
+contents
+	^ self collection
+		copyFrom: 1
+		to: self streamSize
+!
+
+position
+	^ position ifNil: [ position := 0 ]
+!
+
+position: anInteger
+	position := anInteger
+!
+
+setCollection: aCollection
+	collection := aCollection
+!
+
+setStreamSize: anInteger
+	streamSize := anInteger
+!
+
+size
+	^ self streamSize
+!
+
+streamSize
+	^ streamSize
+! !
+
+!Stream methodsFor: 'actions'!
+
+close
+!
+
+flush
+!
+
+reset
+	self position: 0
+!
+
+resetContents
+	self reset.
+	self setStreamSize: 0
+! !
+
+!Stream methodsFor: 'enumerating'!
+
+do: aBlock
+	[ self atEnd ] whileFalse: [ aBlock value: self next ]
+! !
+
+!Stream methodsFor: 'positioning'!
+
+setToEnd
+	self position: self size
+!
+
+skip: anInteger
+	self position: ((self position + anInteger) min: self size max: 0)
+! !
+
+!Stream methodsFor: 'reading'!
+
+next
+	^ self atEnd
+		ifTrue: [ nil ]
+		ifFalse: [
+			self position: self position + 1.
+			collection at: self position ]
+!
+
+next: anInteger
+	| tempCollection |
+	tempCollection := self collection class new.
+	anInteger timesRepeat: [
+		self atEnd ifFalse: [
+		tempCollection add: self next ]].
+	^ tempCollection
+!
+
+peek
+	^ self atEnd ifFalse: [
+		self collection at: self position + 1 ]
+! !
+
+!Stream methodsFor: 'testing'!
+
+atEnd
+	^ self position = self size
+!
+
+atStart
+	^ self position = 0
+!
+
+isEmpty
+	^ self size = 0
+! !
+
+!Stream methodsFor: 'writing'!
+
+<< anObject
+	self write: anObject
+!
+
+nextPut: anObject
+	self position: self position + 1.
+	self collection at: self position put: anObject.
+	self setStreamSize: (self streamSize max: self position)
+!
+
+nextPutAll: aCollection
+	aCollection do: [ :each |
+		self nextPut: each ]
+!
+
+nextPutString: aString
+	self nextPut: aString
+!
+
+write: anObject
+	anObject putOn: self
+! !
+
+!Stream class methodsFor: 'instance creation'!
+
+on: aCollection
+		^ self new
+		setCollection: aCollection;
+		setStreamSize: aCollection size;
+		yourself
+! !
+
+Stream subclass: #StringStream
+	instanceVariableNames: ''
+	package: 'Kernel-Collections'!
+!StringStream commentStamp!
+I am a Stream specific to `String` objects.!
+
+!StringStream methodsFor: 'reading'!
+
+next: anInteger
+	| tempCollection |
+	tempCollection := self collection class new.
+	anInteger timesRepeat: [
+		self atEnd ifFalse: [
+		tempCollection := tempCollection, self next ]].
+	^ tempCollection
+! !
+
+!StringStream methodsFor: 'writing'!
+
+cr
+	^ self nextPutAll: String cr
+!
+
+crlf
+	^ self nextPutAll: String crlf
+!
+
+lf
+	^ self nextPutAll: String lf
+!
+
+nextPut: aString
+	self nextPutAll: aString
+!
+
+nextPutAll: aString
+	| pre post |
+	self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [
+		pre := self collection copyFrom: 1 to: self position.
+		post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.
+		self setCollection: pre, aString, post
+	].
+	self position: self position + aString size.
+	self setStreamSize: (self streamSize max: self position)
+!
+
+nextPutString: aString
+	self nextPutAll: aString
+!
+
+space
+	self nextPut: ' '
+!
+
+tab
+	^ self nextPutAll: String tab
+! !
+

+ 596 - 0
src/Kernel-Exceptions.js

@@ -0,0 +1,596 @@
+define("amber_core/Kernel-Exceptions", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Kernel-Exceptions');
+smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('Error', globals.Object, ['messageText'], 'Kernel-Exceptions');
+globals.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "beHandled",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.amberHandled = true;
+return self}, function($ctx1) {$ctx1.fill(self,"beHandled",{},globals.Error)})},
+args: [],
+source: "beHandled\x0a\x09<self.amberHandled = true>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "beUnhandled",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.amberHandled = false;
+return self}, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},globals.Error)})},
+args: [],
+source: "beUnhandled\x0a\x09<self.amberHandled = false>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.context;
+return self}, function($ctx1) {$ctx1.fill(self,"context",{},globals.Error)})},
+args: [],
+source: "context\x0a\x09<return self.context>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Error)})},
+args: [],
+source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
+messageSends: ["messageText:", ",", "name", "class"],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSmalltalkError",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.smalltalkError === true;
+return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},globals.Error)})},
+args: [],
+source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "jsStack",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.stack;
+return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},globals.Error)})},
+args: [],
+source: "jsStack\x0a\x09<return self.stack>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@messageText"];
+return $1;
+},
+args: [],
+source: "messageText\x0a\x09^ messageText",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageText:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@messageText"]=aString;
+return self},
+args: ["aString"],
+source: "messageText: aString\x0a\x09messageText := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resignal",
+protocol: 'signaling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		self.amberHandled = false;
+		throw(self);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"resignal",{},globals.Error)})},
+args: [],
+source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "signal",
+protocol: 'signaling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		self.amberHandled = false;
+		self.context = smalltalk.getThisContext(); 
+		self.smalltalkError = true; throw(self)
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error)})},
+args: [],
+source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = smalltalk.getThisContext(); \x0a\x09\x09self.smalltalkError = true; throw(self)\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "signal:",
+protocol: 'signaling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._messageText_(aString);
+self._signal();
+return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error)})},
+args: ["aString"],
+source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
+messageSends: ["messageText:", "signal"],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "signalerContext",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._signalerContextFrom_(self._context());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"signalerContext",{},globals.Error)})},
+args: [],
+source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
+messageSends: ["signalerContextFrom:", "context"],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "signalerContextFrom:",
+protocol: 'accessing',
+fn: function (aContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+$1=_st(aContext)._findContextSuchThat_((function(context){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(context)._receiver();
+$ctx2.sendIdx["receiver"]=1;
+$3=_st($4).__eq_eq(self);
+$ctx2.sendIdx["=="]=1;
+$2=_st($3)._or_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(context)._receiver()).__eq_eq(self._class());
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+return _st($2)._not();
+}, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Error)})},
+args: ["aContext"],
+source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
+messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"],
+referencedClasses: []
+}),
+globals.Error);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "wasHandled",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.amberHandled || false;
+return self}, function($ctx1) {$ctx1.fill(self,"wasHandled",{},globals.Error)})},
+args: [],
+source: "wasHandled\x0a\x09<return self.amberHandled || false>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+protocol: 'helios',
+fn: function (){
+var self=this;
+return "exception";
+},
+args: [],
+source: "heliosClass\x0a\x09^ 'exception'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Error.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "signal",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._new())._signal();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error.klass)})},
+args: [],
+source: "signal\x0a\x09^ self new signal",
+messageSends: ["signal", "new"],
+referencedClasses: []
+}),
+globals.Error.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "signal:",
+protocol: 'instance creation',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._new())._signal_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error.klass)})},
+args: ["aString"],
+source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
+messageSends: ["signal:", "new"],
+referencedClasses: []
+}),
+globals.Error.klass);
+
+
+smalltalk.addClass('Halt', globals.Error, [], 'Kernel-Exceptions');
+globals.Halt.comment="I am provided to support `Object>>#halt`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "Halt encountered";
+},
+args: [],
+source: "messageText\x0a\x09^ 'Halt encountered'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Halt);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "signalerContextFrom:",
+protocol: 'accessing',
+fn: function (aContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+$1=_st(aContext)._findContextSuchThat_((function(context){
+return smalltalk.withContext(function($ctx2) {
+$4=_st(context)._receiver();
+$ctx2.sendIdx["receiver"]=1;
+$3=_st($4).__eq_eq(self);
+$ctx2.sendIdx["=="]=1;
+$2=_st($3)._or_((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(_st(_st(context)._receiver()).__eq_eq(self._class()))._or_((function(){
+return smalltalk.withContext(function($ctx4) {
+return _st(_st(_st(context)._method())._selector()).__eq("halt");
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})}));
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
+$ctx2.sendIdx["or:"]=1;
+return _st($2)._not();
+}, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Halt)})},
+args: ["aContext"],
+source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
+messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"],
+referencedClasses: []
+}),
+globals.Halt);
+
+
+
+smalltalk.addClass('JavaScriptException', globals.Error, ['exception'], 'Kernel-Exceptions');
+globals.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "context:",
+protocol: 'accessing',
+fn: function (aMethodContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.context = aMethodContext;
+return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},globals.JavaScriptException)})},
+args: ["aMethodContext"],
+source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<self.context = aMethodContext>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JavaScriptException);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exception",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@exception"];
+return $1;
+},
+args: [],
+source: "exception\x0a\x09^ exception",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JavaScriptException);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exception:",
+protocol: 'accessing',
+fn: function (anException){
+var self=this;
+self["@exception"]=anException;
+return self},
+args: ["anException"],
+source: "exception: anException\x0a\x09exception := anException",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JavaScriptException);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return 'JavaScript exception: ' + self["@exception"].toString();
+return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.JavaScriptException)})},
+args: [],
+source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JavaScriptException);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (anException){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._exception_(anException);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},globals.JavaScriptException.klass)})},
+args: ["anException"],
+source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
+messageSends: ["exception:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.JavaScriptException.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:context:",
+protocol: 'instance creation',
+fn: function (anException,aMethodContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._exception_(anException);
+_st($2)._context_(aMethodContext);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},globals.JavaScriptException.klass)})},
+args: ["anException", "aMethodContext"],
+source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
+messageSends: ["exception:", "new", "context:", "yourself"],
+referencedClasses: []
+}),
+globals.JavaScriptException.klass);
+
+
+smalltalk.addClass('MessageNotUnderstood', globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
+globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "message",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@message"];
+return $1;
+},
+args: [],
+source: "message\x0a\x09^ message",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MessageNotUnderstood);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "message:",
+protocol: 'accessing',
+fn: function (aMessage){
+var self=this;
+self["@message"]=aMessage;
+return self},
+args: ["aMessage"],
+source: "message: aMessage\x0a\x09message := aMessage",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MessageNotUnderstood);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageText",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.MessageNotUnderstood)})},
+args: [],
+source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
+messageSends: [",", "asString", "receiver", "selector", "message"],
+referencedClasses: []
+}),
+globals.MessageNotUnderstood);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@receiver"];
+return $1;
+},
+args: [],
+source: "receiver\x0a\x09^ receiver",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MessageNotUnderstood);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@receiver"]=anObject;
+return self},
+args: ["anObject"],
+source: "receiver: anObject\x0a\x09receiver := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MessageNotUnderstood);
+
+
+
+smalltalk.addClass('NonBooleanReceiver', globals.Error, ['object'], 'Kernel-Exceptions');
+globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "object",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@object"];
+return $1;
+},
+args: [],
+source: "object\x0a\x09^ object",
+messageSends: [],
+referencedClasses: []
+}),
+globals.NonBooleanReceiver);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "object:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@object"]=anObject;
+return self},
+args: ["anObject"],
+source: "object: anObject\x0a\x09object := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.NonBooleanReceiver);
+
+
+
+smalltalk.addClass('PackageCommitError', globals.Error, [], 'Kernel-Exceptions');
+globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
+
+});

+ 226 - 0
src/Kernel-Exceptions.st

@@ -0,0 +1,226 @@
+Smalltalk createPackage: 'Kernel-Exceptions'!
+Object subclass: #Error
+	instanceVariableNames: 'messageText'
+	package: 'Kernel-Exceptions'!
+!Error commentStamp!
+From the ANSI standard:
+
+This protocol describes the behavior of instances of class `Error`.
+These are used to represent error conditions that prevent the normal continuation of processing.
+Actual error exceptions used by an application may be subclasses of this class.
+As `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.!
+
+!Error methodsFor: 'accessing'!
+
+beHandled
+	<self.amberHandled = true>
+!
+
+beUnhandled
+	<self.amberHandled = false>
+!
+
+context
+	<return self.context>
+!
+
+jsStack
+	<return self.stack>
+!
+
+messageText
+	^ messageText
+!
+
+messageText: aString
+	messageText := aString
+!
+
+signalerContext
+	^ self signalerContextFrom: self context
+!
+
+signalerContextFrom: aContext
+	"Find the first sender of signal(:), the first context which is neither 
+	for an instance method nor for a class side method of Exception (or subclass).
+	This will make sure that the same context is found for both, `Error signal` 
+	and `Error new signal`"
+
+	^ aContext findContextSuchThat: [ :context |
+		(context receiver == self 
+		or: [ context receiver == self class ]) not ]
+! !
+
+!Error methodsFor: 'initialization'!
+
+initialize
+	self messageText: 'Errorclass: ', (self class name).
+! !
+
+!Error methodsFor: 'signaling'!
+
+resignal
+	"Resignal the receiver without changing its exception context"
+	
+	<
+		self.amberHandled = false;
+		throw(self);
+	>
+!
+
+signal
+	<
+		self.amberHandled = false;
+		self.context = smalltalk.getThisContext(); 
+		self.smalltalkError = true; throw(self)
+	>
+!
+
+signal: aString
+	self messageText: aString.
+	self signal
+! !
+
+!Error methodsFor: 'testing'!
+
+isSmalltalkError
+	<return self.smalltalkError === true>
+!
+
+wasHandled
+	<return self.amberHandled || false>
+! !
+
+!Error class methodsFor: 'helios'!
+
+heliosClass
+	^ 'exception'
+! !
+
+!Error class methodsFor: 'instance creation'!
+
+signal
+	^ self new signal
+!
+
+signal: aString
+	^ self new
+		signal: aString
+! !
+
+Error subclass: #Halt
+	instanceVariableNames: ''
+	package: 'Kernel-Exceptions'!
+!Halt commentStamp!
+I am provided to support `Object>>#halt`.!
+
+!Halt methodsFor: 'accessing'!
+
+messageText
+	^ 'Halt encountered'
+!
+
+signalerContextFrom: aContext
+	"specialized version to find the proper context to open the debugger on.
+	This will find the first context whose method is no longer on `Halt` or 
+	`Halt class` nor is `#halt` method itself."
+	
+	^ aContext findContextSuchThat: [ :context |
+		(context receiver == self 
+		or: [ (context receiver == self class) 
+		or: [ context method selector = #halt ]]) not ]
+! !
+
+Error subclass: #JavaScriptException
+	instanceVariableNames: 'exception'
+	package: 'Kernel-Exceptions'!
+!JavaScriptException commentStamp!
+A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.
+See `boot.js` `inContext()` and `BlockClosure >> on:do:`!
+
+!JavaScriptException methodsFor: 'accessing'!
+
+context: aMethodContext
+	"Set the context from the outside.
+	See boot.js `inContext()` exception handling"
+	
+	<self.context = aMethodContext>
+!
+
+exception
+	^ exception
+!
+
+exception: anException
+	exception := anException
+!
+
+messageText
+	<return 'JavaScript exception: ' + self["@exception"].toString()>
+! !
+
+!JavaScriptException class methodsFor: 'instance creation'!
+
+on: anException
+	^ self new
+		exception: anException;
+		yourself
+!
+
+on: anException context: aMethodContext
+	^ self new
+		exception: anException;
+		context: aMethodContext;
+		yourself
+! !
+
+Error subclass: #MessageNotUnderstood
+	instanceVariableNames: 'message receiver'
+	package: 'Kernel-Exceptions'!
+!MessageNotUnderstood commentStamp!
+This exception is provided to support `Object>>doesNotUnderstand:`.!
+
+!MessageNotUnderstood methodsFor: 'accessing'!
+
+message
+	^ message
+!
+
+message: aMessage
+	message := aMessage
+!
+
+messageText
+	^ self receiver asString, ' does not understand #', self message selector
+!
+
+receiver
+	^ receiver
+!
+
+receiver: anObject
+	receiver := anObject
+! !
+
+Error subclass: #NonBooleanReceiver
+	instanceVariableNames: 'object'
+	package: 'Kernel-Exceptions'!
+!NonBooleanReceiver commentStamp!
+NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.!
+
+!NonBooleanReceiver methodsFor: 'accessing'!
+
+object
+	^ object
+!
+
+object: anObject
+	object := anObject
+! !
+
+Error subclass: #PackageCommitError
+	instanceVariableNames: ''
+	package: 'Kernel-Exceptions'!
+!PackageCommitError commentStamp!
+I get signaled when an attempt to commit a package has failed.!
+

+ 2544 - 0
src/Kernel-ImportExport.js

@@ -0,0 +1,2544 @@
+define("amber_core/Kernel-ImportExport", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Kernel-ImportExport');
+smalltalk.packages["Kernel-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('AbstractExporter', globals.Object, [], 'Kernel-ImportExport');
+globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "chunkEscape:",
+protocol: 'convenience',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},globals.AbstractExporter)})},
+args: ["aString"],
+source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
+messageSends: ["trimBoth", "replace:with:"],
+referencedClasses: []
+}),
+globals.AbstractExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classNameFor:",
+protocol: 'convenience',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1;
+$2=_st(aClass)._isMetaclass();
+if(smalltalk.assert($2)){
+$3=_st(_st(aClass)._instanceClass())._name();
+$ctx1.sendIdx["name"]=1;
+$1=_st($3).__comma(" class");
+} else {
+$4=_st(aClass)._isNil();
+if(smalltalk.assert($4)){
+$1="nil";
+} else {
+$1=_st(aClass)._name();
+};
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractExporter)})},
+args: ["aClass"],
+source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
+messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
+referencedClasses: []
+}),
+globals.AbstractExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackage:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.AbstractExporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.AbstractExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "extensionMethodsOfPackage:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+var result;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+result=_st($OrderedCollection())._new();
+_st(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(result)._addAll_(_st(each)._methods());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=result;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},globals.AbstractExporter)})},
+args: ["aPackage"],
+source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result",
+messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"],
+referencedClasses: ["OrderedCollection"]
+}),
+globals.AbstractExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "extensionProtocolsOfPackage:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+var extensionName,result;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+$1=_st(aPackage)._name();
+$ctx1.sendIdx["name"]=1;
+extensionName="*".__comma($1);
+result=_st($OrderedCollection())._new();
+_st(_st(_st(_st($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(a)._name();
+$ctx2.sendIdx["name"]=2;
+return _st($2).__lt(_st(b)._name());
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st([each,_st(each)._class()])._do_((function(behavior){
+return smalltalk.withContext(function($ctx3) {
+$3=_st(_st(behavior)._protocols())._includes_(extensionName);
+if(smalltalk.assert($3)){
+return _st(result)._add_(_st($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
+};
+}, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)})}));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+$ctx1.sendIdx["do:"]=1;
+$4=result;
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},globals.AbstractExporter)})},
+args: ["aPackage"],
+source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
+messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"],
+referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"]
+}),
+globals.AbstractExporter);
+
+
+
+smalltalk.addClass('ChunkExporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
+globals.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportCategoryEpilogueOf:on:",
+protocol: 'output',
+fn: function (aCategory,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._nextPutAll_(" !");
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=1;
+$1=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)})},
+args: ["aCategory", "aStream"],
+source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
+messageSends: ["nextPutAll:", "lf"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportCategoryPrologueOf:on:",
+protocol: 'output',
+fn: function (aCategory,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2;
+$1="!".__comma(self._classNameFor_(_st(aCategory)._theClass()));
+$ctx1.sendIdx[","]=1;
+_st(aStream)._nextPutAll_($1);
+$ctx1.sendIdx["nextPutAll:"]=1;
+$3=_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!");
+$ctx1.sendIdx[","]=2;
+$2=_st(aStream)._nextPutAll_($3);
+return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)})},
+args: ["aCategory", "aStream"],
+source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
+messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportDefinitionOf:on:",
+protocol: 'output',
+fn: function (aClass,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
+$1=self._classNameFor_(_st(aClass)._superclass());
+$ctx1.sendIdx["classNameFor:"]=1;
+_st(aStream)._nextPutAll_($1);
+$ctx1.sendIdx["nextPutAll:"]=1;
+$3=self._classNameFor_(aClass);
+$ctx1.sendIdx["classNameFor:"]=2;
+$2=" subclass: #".__comma($3);
+$ctx1.sendIdx[","]=1;
+_st(aStream)._nextPutAll_($2);
+$ctx1.sendIdx["nextPutAll:"]=2;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=1;
+_st(aStream)._tab();
+$ctx1.sendIdx["tab"]=1;
+$4=_st(aStream)._nextPutAll_("instanceVariableNames: '");
+$ctx1.sendIdx["nextPutAll:"]=3;
+_st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(aStream)._nextPutAll_(each);
+$ctx2.sendIdx["nextPutAll:"]=4;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aStream)._nextPutAll_(" ");
+$ctx2.sendIdx["nextPutAll:"]=5;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(aStream)._nextPutAll_("'");
+$ctx1.sendIdx["nextPutAll:"]=6;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=2;
+_st(aStream)._tab();
+$6="package: '".__comma(_st(aClass)._category());
+$ctx1.sendIdx[","]=3;
+$5=_st($6).__comma("'!");
+$ctx1.sendIdx[","]=2;
+_st(aStream)._nextPutAll_($5);
+$ctx1.sendIdx["nextPutAll:"]=7;
+$7=_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=3;
+$9=_st(aClass)._comment();
+$ctx1.sendIdx["comment"]=1;
+$8=_st($9)._notEmpty();
+if(smalltalk.assert($8)){
+$11="!".__comma(self._classNameFor_(aClass));
+$ctx1.sendIdx[","]=5;
+$10=_st($11).__comma(" commentStamp!");
+$ctx1.sendIdx[","]=4;
+_st(aStream)._nextPutAll_($10);
+$ctx1.sendIdx["nextPutAll:"]=8;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=4;
+_st(aStream)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
+$12=_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=5;
+$12;
+};
+_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)})},
+args: ["aClass", "aStream"],
+source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf",
+messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportMetaDefinitionOf:on:",
+protocol: 'output',
+fn: function (aClass,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$5,$4,$6,$7;
+$3=_st(aClass)._class();
+$ctx1.sendIdx["class"]=1;
+$2=_st($3)._instanceVariableNames();
+$ctx1.sendIdx["instanceVariableNames"]=1;
+$1=_st($2)._isEmpty();
+if(! smalltalk.assert($1)){
+$5=_st(aClass)._class();
+$ctx1.sendIdx["class"]=2;
+$4=self._classNameFor_($5);
+_st(aStream)._nextPutAll_($4);
+$ctx1.sendIdx["nextPutAll:"]=1;
+$6=_st(aStream)._nextPutAll_(" instanceVariableNames: '");
+$ctx1.sendIdx["nextPutAll:"]=2;
+$6;
+_st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(aStream)._nextPutAll_(each);
+$ctx2.sendIdx["nextPutAll:"]=3;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aStream)._nextPutAll_(" ");
+$ctx2.sendIdx["nextPutAll:"]=4;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+_st(aStream)._nextPutAll_("'!");
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=1;
+$7=_st(aStream)._lf();
+$7;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)})},
+args: ["aClass", "aStream"],
+source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]",
+messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportMethod:on:",
+protocol: 'output',
+fn: function (aMethod,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=1;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=2;
+_st(aStream)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._lf();
+$1=_st(aStream)._nextPutAll_("!");
+return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.ChunkExporter)})},
+args: ["aMethod", "aStream"],
+source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
+messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackage:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._exportPackageDefinitionOf_on_(aPackage,aStream);
+_st(_st(aPackage)._sortedClasses())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+self._exportDefinitionOf_on_(each,aStream);
+$1=self._ownMethodProtocolsOfClass_(each);
+$ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
+self._exportProtocols_on_($1,aStream);
+$ctx2.sendIdx["exportProtocols:on:"]=1;
+self._exportMetaDefinitionOf_on_(each,aStream);
+return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(_st(each)._class()),aStream);
+$ctx2.sendIdx["exportProtocols:on:"]=2;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self exportPackageDefinitionOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
+messageSends: ["exportPackageDefinitionOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackageDefinitionOf:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st("Smalltalk createPackage: '".__comma(_st(aPackage)._name())).__comma("'!");
+$ctx1.sendIdx[","]=1;
+_st(aStream)._nextPutAll_($1);
+$2=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", ",", "name", "lf"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportProtocol:on:",
+protocol: 'output',
+fn: function (aProtocol,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._exportProtocolPrologueOf_on_(aProtocol,aStream);
+_st(_st(aProtocol)._methods())._do_((function(method){
+return smalltalk.withContext(function($ctx2) {
+return self._exportMethod_on_(method,aStream);
+}, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)})}));
+self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
+return self}, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)})},
+args: ["aProtocol", "aStream"],
+source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream",
+messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportProtocolEpilogueOf:on:",
+protocol: 'output',
+fn: function (aProtocol,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._nextPutAll_(" !");
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=1;
+$1=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)})},
+args: ["aProtocol", "aStream"],
+source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
+messageSends: ["nextPutAll:", "lf"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportProtocolPrologueOf:on:",
+protocol: 'output',
+fn: function (aProtocol,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2;
+$1="!".__comma(self._classNameFor_(_st(aProtocol)._theClass()));
+$ctx1.sendIdx[","]=1;
+_st(aStream)._nextPutAll_($1);
+$ctx1.sendIdx["nextPutAll:"]=1;
+$3=_st(" methodsFor: '".__comma(_st(aProtocol)._name())).__comma("'!");
+$ctx1.sendIdx[","]=2;
+$2=_st(aStream)._nextPutAll_($3);
+return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)})},
+args: ["aProtocol", "aStream"],
+source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
+messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportProtocols:on:",
+protocol: 'output',
+fn: function (aCollection,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aCollection)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._exportProtocol_on_(each,aStream);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},globals.ChunkExporter)})},
+args: ["aCollection", "aStream"],
+source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
+messageSends: ["do:", "exportProtocol:on:"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "extensionCategoriesOfPackage:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+var name,map,result;
+function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
+function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+name=_st(aPackage)._name();
+result=_st($OrderedCollection())._new();
+$ctx1.sendIdx["new"]=1;
+_st(_st($Package())._sortedClasses_(_st($Smalltalk())._classes()))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st([each,_st(each)._class()])._do_((function(aClass){
+return smalltalk.withContext(function($ctx3) {
+map=_st($Dictionary())._new();
+map;
+_st(aClass)._protocolsDo_((function(category,methods){
+return smalltalk.withContext(function($ctx4) {
+$1=_st(category).__eq("*".__comma(name));
+if(smalltalk.assert($1)){
+return _st(map)._at_put_(category,methods);
+};
+}, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)})}));
+return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx4) {
+return _st(a).__lt_eq(b);
+}, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)})})))._collect_((function(category){
+return smalltalk.withContext(function($ctx4) {
+return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
+}, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)})})));
+}, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)})}));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["do:"]=1;
+$2=result;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},globals.ChunkExporter)})},
+args: ["aPackage"],
+source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
+messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
+referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"]
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ownCategoriesOfClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+var map;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+map=_st($Dictionary())._new();
+_st(aClass)._protocolsDo_((function(each,methods){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(each)._match_("^\x5c*");
+if(! smalltalk.assert($1)){
+return _st(map)._at_put_(each,methods);
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)})}));
+$2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+return _st(a).__lt_eq(b);
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})})))._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st($MethodCategory())._name_theClass_methods_(each,aClass,_st(map)._at_(each));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},globals.ChunkExporter)})},
+args: ["aClass"],
+source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]",
+messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
+referencedClasses: ["Dictionary", "MethodCategory"]
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ownCategoriesOfMetaClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._ownCategoriesOfClass_(_st(aClass)._class());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},globals.ChunkExporter)})},
+args: ["aClass"],
+source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
+messageSends: ["ownCategoriesOfClass:", "class"],
+referencedClasses: []
+}),
+globals.ChunkExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ownMethodProtocolsOfClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(aClass)._ownProtocols())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st($ExportMethodProtocol())._name_theClass_(each,aClass);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},globals.ChunkExporter)})},
+args: ["aClass"],
+source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]",
+messageSends: ["collect:", "ownProtocols", "name:theClass:"],
+referencedClasses: ["ExportMethodProtocol"]
+}),
+globals.ChunkExporter);
+
+
+
+smalltalk.addClass('Exporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
+globals.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classNameFor:",
+protocol: 'convenience',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1;
+$2=_st(aClass)._isMetaclass();
+if(smalltalk.assert($2)){
+$3=_st(_st(aClass)._instanceClass())._name();
+$ctx1.sendIdx["name"]=1;
+$1=_st($3).__comma(".klass");
+} else {
+$4=_st(aClass)._isNil();
+if(smalltalk.assert($4)){
+$1="nil";
+} else {
+$1=_st(aClass)._name();
+};
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.Exporter)})},
+args: ["aClass"],
+source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
+messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportDefinitionOf:on:",
+protocol: 'output',
+fn: function (aClass,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$5,$4,$6,$8,$7,$9,$11,$10,$12;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=1;
+_st(aStream)._nextPutAll_("smalltalk.addClass(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+$3=self._classNameFor_(aClass);
+$ctx1.sendIdx["classNameFor:"]=1;
+$2="'".__comma($3);
+$ctx1.sendIdx[","]=2;
+$1=_st($2).__comma("', ");
+$ctx1.sendIdx[","]=1;
+_st(aStream)._nextPutAll_($1);
+$ctx1.sendIdx["nextPutAll:"]=2;
+$5=self._classNameFor_(_st(aClass)._superclass());
+$ctx1.sendIdx["classNameFor:"]=2;
+$4="globals.".__comma($5);
+$ctx1.sendIdx[","]=3;
+_st(aStream)._nextPutAll_($4);
+$ctx1.sendIdx["nextPutAll:"]=3;
+$6=_st(aStream)._nextPutAll_(", [");
+$ctx1.sendIdx["nextPutAll:"]=4;
+_st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$8="'".__comma(each);
+$ctx2.sendIdx[","]=5;
+$7=_st($8).__comma("'");
+$ctx2.sendIdx[","]=4;
+return _st(aStream)._nextPutAll_($7);
+$ctx2.sendIdx["nextPutAll:"]=5;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aStream)._nextPutAll_(", ");
+$ctx2.sendIdx["nextPutAll:"]=6;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+_st(aStream)._nextPutAll_("], '");
+$ctx1.sendIdx["nextPutAll:"]=7;
+_st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
+$ctx1.sendIdx["nextPutAll:"]=8;
+$9=_st(aStream)._nextPutAll_(");");
+$ctx1.sendIdx["nextPutAll:"]=9;
+$11=_st(aClass)._comment();
+$ctx1.sendIdx["comment"]=1;
+$10=_st($11)._notEmpty();
+if(smalltalk.assert($10)){
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=2;
+_st(aStream)._nextPutAll_("globals.");
+$ctx1.sendIdx["nextPutAll:"]=10;
+_st(aStream)._nextPutAll_(self._classNameFor_(aClass));
+$ctx1.sendIdx["nextPutAll:"]=11;
+_st(aStream)._nextPutAll_(".comment=");
+$ctx1.sendIdx["nextPutAll:"]=12;
+_st(aStream)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
+$ctx1.sendIdx["nextPutAll:"]=13;
+$12=_st(aStream)._nextPutAll_(";");
+$12;
+};
+_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)})},
+args: ["aClass", "aStream"],
+source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'globals.', (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ', ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09nextPutAll: 'globals.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09nextPutAll: ';' ].\x0a\x09aStream lf",
+messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportMetaDefinitionOf:on:",
+protocol: 'output',
+fn: function (aClass,aStream){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$6,$5,$4,$7,$9,$8;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=1;
+$3=_st(aClass)._class();
+$ctx1.sendIdx["class"]=1;
+$2=_st($3)._instanceVariableNames();
+$ctx1.sendIdx["instanceVariableNames"]=1;
+$1=_st($2)._isEmpty();
+if(! smalltalk.assert($1)){
+$6=_st(aClass)._class();
+$ctx1.sendIdx["class"]=2;
+$5=self._classNameFor_($6);
+$4="globals.".__comma($5);
+$ctx1.sendIdx[","]=1;
+_st(aStream)._nextPutAll_($4);
+$ctx1.sendIdx["nextPutAll:"]=1;
+$7=_st(aStream)._nextPutAll_(".iVarNames = [");
+$ctx1.sendIdx["nextPutAll:"]=2;
+$7;
+_st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$9="'".__comma(each);
+$ctx2.sendIdx[","]=3;
+$8=_st($9).__comma("'");
+$ctx2.sendIdx[","]=2;
+return _st(aStream)._nextPutAll_($8);
+$ctx2.sendIdx["nextPutAll:"]=3;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(aStream)._nextPutAll_(",");
+$ctx2.sendIdx["nextPutAll:"]=4;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+_st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
+};
+return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)})},
+args: ["aClass", "aStream"],
+source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: 'globals.', (self classNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]",
+messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", ",", "classNameFor:", "do:separatedBy:"],
+referencedClasses: ["String"]
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportMethod:on:",
+protocol: 'output',
+fn: function (aMethod,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$18,$17,$19;
+_st(aStream)._nextPutAll_("smalltalk.addMethod(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=1;
+_st(aStream)._nextPutAll_("smalltalk.method({");
+$ctx1.sendIdx["nextPutAll:"]=2;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=2;
+$3=_st(_st(aMethod)._selector())._asJavascript();
+$ctx1.sendIdx["asJavascript"]=1;
+$2="selector: ".__comma($3);
+$ctx1.sendIdx[","]=2;
+$1=_st($2).__comma(",");
+$ctx1.sendIdx[","]=1;
+_st(aStream)._nextPutAll_($1);
+$ctx1.sendIdx["nextPutAll:"]=3;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=3;
+$5="protocol: '".__comma(_st(aMethod)._protocol());
+$ctx1.sendIdx[","]=4;
+$4=_st($5).__comma("',");
+$ctx1.sendIdx[","]=3;
+_st(aStream)._nextPutAll_($4);
+$ctx1.sendIdx["nextPutAll:"]=4;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=4;
+$7="fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource());
+$ctx1.sendIdx[","]=6;
+$6=_st($7).__comma(",");
+$ctx1.sendIdx[","]=5;
+_st(aStream)._nextPutAll_($6);
+$ctx1.sendIdx["nextPutAll:"]=5;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=5;
+$10=_st(_st(aMethod)._arguments())._asJavascript();
+$ctx1.sendIdx["asJavascript"]=2;
+$9="args: ".__comma($10);
+$ctx1.sendIdx[","]=8;
+$8=_st($9).__comma(",");
+$ctx1.sendIdx[","]=7;
+_st(aStream)._nextPutAll_($8);
+$ctx1.sendIdx["nextPutAll:"]=6;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=6;
+$13=_st(_st(aMethod)._source())._asJavascript();
+$ctx1.sendIdx["asJavascript"]=3;
+$12="source: ".__comma($13);
+$ctx1.sendIdx[","]=10;
+$11=_st($12).__comma(",");
+$ctx1.sendIdx[","]=9;
+_st(aStream)._nextPutAll_($11);
+$ctx1.sendIdx["nextPutAll:"]=7;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=7;
+$16=_st(_st(aMethod)._messageSends())._asJavascript();
+$ctx1.sendIdx["asJavascript"]=4;
+$15="messageSends: ".__comma($16);
+$ctx1.sendIdx[","]=12;
+$14=_st($15).__comma(",");
+$ctx1.sendIdx[","]=11;
+_st(aStream)._nextPutAll_($14);
+$ctx1.sendIdx["nextPutAll:"]=8;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=8;
+$18="referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript());
+$ctx1.sendIdx[","]=13;
+$17=_st(aStream)._nextPutAll_($18);
+$ctx1.sendIdx["nextPutAll:"]=9;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=9;
+_st(aStream)._nextPutAll_("}),");
+$ctx1.sendIdx["nextPutAll:"]=10;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=10;
+_st(aStream)._nextPutAll_("globals.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
+$ctx1.sendIdx["nextPutAll:"]=11;
+_st(aStream)._nextPutAll_(");");
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=11;
+$19=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.Exporter)})},
+args: ["aMethod", "aStream"],
+source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09\x22nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x22\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'globals.', (self classNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
+messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackage:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._exportPackagePrologueOf_on_(aPackage,aStream);
+self._exportPackageDefinitionOf_on_(aPackage,aStream);
+$1=self._exportPackageTransportOf_on_(aPackage,aStream);
+_st(_st(aPackage)._sortedClasses())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+self._exportDefinitionOf_on_(each,aStream);
+$2=_st(each)._ownMethods();
+$ctx2.sendIdx["ownMethods"]=1;
+_st($2)._do_((function(method){
+return smalltalk.withContext(function($ctx3) {
+return self._exportMethod_on_(method,aStream);
+$ctx3.sendIdx["exportMethod:on:"]=1;
+}, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)})}));
+$ctx2.sendIdx["do:"]=2;
+self._exportMetaDefinitionOf_on_(each,aStream);
+return _st(_st(_st(each)._class())._ownMethods())._do_((function(method){
+return smalltalk.withContext(function($ctx3) {
+return self._exportMethod_on_(method,aStream);
+$ctx3.sendIdx["exportMethod:on:"]=2;
+}, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)})}));
+$ctx2.sendIdx["do:"]=3;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["do:"]=1;
+_st(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._exportMethod_on_(each,aStream);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
+self._exportPackageEpilogueOf_on_(aPackage,aStream);
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
+messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackageDefinitionOf:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+_st(aStream)._nextPutAll_("smalltalk.addPackage(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+$1=_st("'".__comma(_st(aPackage)._name())).__comma("');");
+$ctx1.sendIdx[","]=1;
+_st(aStream)._nextPutAll_($1);
+$2=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", ",", "name", "lf"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackageEpilogueOf:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
+$1=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '})(global_smalltalk,global_nil,global__st);';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", "lf"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackagePrologueOf:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._nextPutAll_("(function(smalltalk,nil,_st){");
+$1=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '(function(smalltalk,nil,_st){';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", "lf"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackageTransportOf:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._nextPutAll_("smalltalk.packages[");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
+$ctx1.sendIdx["nextPutAll:"]=2;
+_st(aStream)._nextPutAll_("].transport = ");
+$ctx1.sendIdx["nextPutAll:"]=3;
+_st(aStream)._nextPutAll_(_st(_st(aPackage)._transport())._asJSONString());
+$ctx1.sendIdx["nextPutAll:"]=4;
+_st(aStream)._nextPutAll_(";");
+$1=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ownMethodsOfClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(a)._selector();
+$ctx2.sendIdx["selector"]=1;
+return _st($2).__lt_eq(_st(b)._selector());
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._reject_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(each)._protocol())._match_("^\x5c*");
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},globals.Exporter)})},
+args: ["aClass"],
+source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])\x0a\x09\x09reject: [ :each | (each protocol match: '^\x5c*') ]",
+messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ownMethodsOfMetaClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._ownMethodsOfClass_(_st(aClass)._class());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},globals.Exporter)})},
+args: ["aClass"],
+source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
+messageSends: ["ownMethodsOfClass:", "class"],
+referencedClasses: []
+}),
+globals.Exporter);
+
+
+
+smalltalk.addClass('AmdExporter', globals.Exporter, ['namespace'], 'Kernel-ImportExport');
+globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "amdNamesOfPackages:",
+protocol: 'private',
+fn: function (anArray){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st(_st(anArray)._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$2=self._amdNamespaceOfPackage_(each);
+$ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
+return _st($2)._notNil();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma(_st(each)._name());
+$ctx2.sendIdx[","]=1;
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},globals.AmdExporter)})},
+args: ["anArray"],
+source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
+messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"],
+referencedClasses: []
+}),
+globals.AmdExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "amdNamespaceOfPackage:",
+protocol: 'private',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$1;
+$4=_st(aPackage)._transport();
+$ctx1.sendIdx["transport"]=1;
+$3=_st($4)._type();
+$2=_st($3).__eq("amd");
+if(smalltalk.assert($2)){
+$1=_st(_st(aPackage)._transport())._namespace();
+} else {
+$1=nil;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},globals.AmdExporter)})},
+args: ["aPackage"],
+source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
+messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"],
+referencedClasses: []
+}),
+globals.AmdExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackageEpilogueOf:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._nextPutAll_("});");
+$1=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", "lf"],
+referencedClasses: []
+}),
+globals.AmdExporter);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackagePrologueOf:on:",
+protocol: 'output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aStream)._nextPutAll_("define(\x22");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
+$ctx1.sendIdx["nextPutAll:"]=2;
+_st(aStream)._nextPutAll_("/");
+$ctx1.sendIdx["nextPutAll:"]=3;
+_st(aStream)._nextPutAll_(_st(aPackage)._name());
+$ctx1.sendIdx["nextPutAll:"]=4;
+_st(aStream)._nextPutAll_("\x22, ");
+$ctx1.sendIdx["nextPutAll:"]=5;
+_st(aStream)._nextPutAll_(_st(["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
+$ctx1.sendIdx["nextPutAll:"]=6;
+_st(aStream)._nextPutAll_(", function(smalltalk,nil,_st, globals){");
+$1=_st(aStream)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)})},
+args: ["aPackage", "aStream"],
+source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (#('amber_vm/smalltalk' 'amber_vm/nil' 'amber_vm/_st' 'amber_vm/globals'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;\x0a\x09\x09nextPutAll: ', function(smalltalk,nil,_st, globals){';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", "amdNamespaceOfPackage:", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"],
+referencedClasses: []
+}),
+globals.AmdExporter);
+
+
+
+smalltalk.addClass('ChunkParser', globals.Object, ['stream', 'last'], 'Kernel-ImportExport');
+globals.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a    ChunkParser new\x0a        stream: aStream;\x0a        nextChunk";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "last",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@last"];
+return $1;
+},
+args: [],
+source: "last\x0a\x09^ last",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ChunkParser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "nextChunk",
+protocol: 'reading',
+fn: function (){
+var self=this;
+var char,result,chunk;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+var $early={};
+try {
+result=""._writeStream();
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+char=_st(self["@stream"])._next();
+$ctx2.sendIdx["next"]=1;
+char;
+return _st(char)._notNil();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(char).__eq("!");
+$ctx2.sendIdx["="]=1;
+if(smalltalk.assert($1)){
+$2=_st(_st(self["@stream"])._peek()).__eq("!");
+if(smalltalk.assert($2)){
+_st(self["@stream"])._next();
+} else {
+self["@last"]=_st(_st(result)._contents())._trimBoth();
+$3=self["@last"];
+throw $early=[$3];
+};
+};
+return _st(result)._nextPut_(char);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+self["@last"]=nil;
+$4=self["@last"];
+return $4;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},globals.ChunkParser)})},
+args: [],
+source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[ char := stream next.\x0a\x09\x09char notNil ] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [ stream next \x22skipping the escape double\x22 ]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22",
+messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"],
+referencedClasses: []
+}),
+globals.ChunkParser);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "stream:",
+protocol: 'accessing',
+fn: function (aStream){
+var self=this;
+self["@stream"]=aStream;
+return self},
+args: ["aStream"],
+source: "stream: aStream\x0a\x09stream := aStream",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ChunkParser);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._new())._stream_(aStream);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},globals.ChunkParser.klass)})},
+args: ["aStream"],
+source: "on: aStream\x0a\x09^ self new stream: aStream",
+messageSends: ["stream:", "new"],
+referencedClasses: []
+}),
+globals.ChunkParser.klass);
+
+
+smalltalk.addClass('ExportMethodProtocol', globals.Object, ['name', 'theClass'], 'Kernel-ImportExport');
+globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methods",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=_st(_st(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(a)._selector();
+$ctx2.sendIdx["selector"]=1;
+return _st($2).__lt_eq(_st(b)._selector());
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methods",{},globals.ExportMethodProtocol)})},
+args: [],
+source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
+messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"],
+referencedClasses: []
+}),
+globals.ExportMethodProtocol);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@name"];
+return $1;
+},
+args: [],
+source: "name\x0a\x09^ name",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ExportMethodProtocol);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@name"]=aString;
+return self},
+args: ["aString"],
+source: "name: aString\x0a\x09name := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ExportMethodProtocol);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@theClass"];
+return $1;
+},
+args: [],
+source: "theClass\x0a\x09^ theClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ExportMethodProtocol);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@theClass"]=aClass;
+return self},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ExportMethodProtocol);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name:theClass:",
+protocol: 'instance creation',
+fn: function (aString,aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._name_(aString);
+_st($2)._theClass_(aClass);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},globals.ExportMethodProtocol.klass)})},
+args: ["aString", "aClass"],
+source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
+messageSends: ["name:", "new", "theClass:", "yourself"],
+referencedClasses: []
+}),
+globals.ExportMethodProtocol.klass);
+
+
+smalltalk.addClass('Importer', globals.Object, ['lastSection', 'lastChunk'], 'Kernel-ImportExport');
+globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a    Importer new import: aString";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "import:",
+protocol: 'fileIn',
+fn: function (aStream){
+var self=this;
+var chunk,result,parser,lastEmpty;
+function $ChunkParser(){return globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
+function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+parser=_st($ChunkParser())._on_(aStream);
+lastEmpty=false;
+self["@lastSection"]="n/a, not started";
+self["@lastChunk"]=nil;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+_st((function(){
+return smalltalk.withContext(function($ctx3) {
+chunk=_st(parser)._nextChunk();
+chunk;
+return _st(chunk)._isNil();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx3) {
+$1=_st(chunk)._isEmpty();
+if(smalltalk.assert($1)){
+lastEmpty=true;
+return lastEmpty;
+} else {
+self["@lastSection"]=chunk;
+self["@lastSection"];
+result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
+result;
+$2=lastEmpty;
+if(smalltalk.assert($2)){
+lastEmpty=false;
+lastEmpty;
+return _st(result)._scanFrom_(parser);
+};
+};
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
+self["@lastSection"]="n/a, finished";
+return self["@lastSection"];
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(e){
+return smalltalk.withContext(function($ctx2) {
+self["@lastChunk"]=_st(parser)._last();
+self["@lastChunk"];
+return _st(e)._signal();
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},globals.Importer)})},
+args: ["aStream"],
+source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [ lastEmpty := true ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e signal ].",
+messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "signal"],
+referencedClasses: ["ChunkParser", "Compiler", "Error"]
+}),
+globals.Importer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lastChunk",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@lastChunk"];
+return $1;
+},
+args: [],
+source: "lastChunk\x0a\x09^ lastChunk",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Importer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lastSection",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@lastSection"];
+return $1;
+},
+args: [],
+source: "lastSection\x0a\x09^ lastSection",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Importer);
+
+
+
+smalltalk.addClass('PackageHandler', globals.InterfacingObject, [], 'Kernel-ImportExport');
+globals.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ajaxPutAt:data:onSuccess:onError:",
+protocol: 'private',
+fn: function (aURL,aString,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._ajax_(globals.HashedCollection._newFromPairs_(["url",aURL,"type","PUT","data",aString,"contentType","text/plain;charset=UTF-8","success",aBlock,"error",anotherBlock]));
+return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
+args: ["aURL", "aString", "aBlock", "anotherBlock"],
+source: "ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock\x0a\x09self\x0a\x09\x09ajax: #{\x0a\x09\x09\x09'url' -> aURL.\x0a\x09\x09\x09'type' -> 'PUT'.\x0a\x09\x09\x09'data' -> aString.\x0a\x09\x09\x09'contentType' -> 'text/plain;charset=UTF-8'.\x0a\x09\x09\x09'success' -> aBlock.\x0a\x09\x09\x09'error' -> anotherBlock\x0a\x09\x09}",
+messageSends: ["ajax:"],
+referencedClasses: []
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "chunkContentsFor:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($String())._streamContents_((function(str){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._chunkExporter())._exportPackage_on_(aPackage,str);
+}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},globals.PackageHandler)})},
+args: ["aPackage"],
+source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
+messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"],
+referencedClasses: ["String"]
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "chunkExporter",
+protocol: 'factory',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._chunkExporterClass())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},globals.PackageHandler)})},
+args: [],
+source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
+messageSends: ["new", "chunkExporterClass"],
+referencedClasses: []
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "chunkExporterClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $ChunkExporter(){return globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
+return $ChunkExporter();
+},
+args: [],
+source: "chunkExporterClass\x0a\x09^ ChunkExporter",
+messageSends: [],
+referencedClasses: ["ChunkExporter"]
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commit:",
+protocol: 'committing',
+fn: function (aPackage){
+var self=this;
+function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+self._commit_onSuccess_onError_(aPackage,(function(){
+}),(function(error){
+return smalltalk.withContext(function($ctx2) {
+$1=_st($PackageCommitError())._new();
+$2=$1;
+$3=_st("Commiting failed with reason: \x22".__comma(_st(error)._responseText())).__comma("\x22");
+$ctx2.sendIdx[","]=1;
+_st($2)._messageText_($3);
+$4=_st($1)._signal();
+return $4;
+}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},globals.PackageHandler)})},
+args: ["aPackage"],
+source: "commit: aPackage\x0a\x09self \x0a\x09\x09commit: aPackage\x0a\x09\x09onSuccess: []\x0a\x09\x09onError: [ :error |\x0a\x09\x09\x09PackageCommitError new\x0a\x09\x09\x09\x09messageText: 'Commiting failed with reason: \x22' , (error responseText) , '\x22';\x0a\x09\x09\x09\x09signal ]",
+messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"],
+referencedClasses: ["PackageCommitError"]
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commit:onSuccess:onError:",
+protocol: 'committing',
+fn: function (aPackage,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
+return smalltalk.withContext(function($ctx3) {
+_st(aPackage)._beClean();
+return _st(aBlock)._value();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),anotherBlock);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),anotherBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
+args: ["aPackage", "aBlock", "anotherBlock"],
+source: "commit: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09commitJsFileFor: aPackage \x0a\x09\x09onSuccess: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09commitStFileFor: aPackage \x0a\x09\x09\x09\x09onSuccess: [ aPackage beClean. aBlock value ]\x0a\x09\x09\x09\x09onError: anotherBlock ] \x0a\x09\x09onError: anotherBlock",
+messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"],
+referencedClasses: []
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitJsFileFor:onSuccess:onError:",
+protocol: 'committing',
+fn: function (aPackage,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(_st(self._commitPathJsFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
+$ctx1.sendIdx[","]=2;
+$1=_st($2).__comma(".js");
+$ctx1.sendIdx[","]=1;
+self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
+args: ["aPackage", "aBlock", "anotherBlock"],
+source: "commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
+messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"],
+referencedClasses: []
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathJsFor:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.PackageHandler)})},
+args: ["aPackage"],
+source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathStFor:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},globals.PackageHandler)})},
+args: ["aPackage"],
+source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitStFileFor:onSuccess:onError:",
+protocol: 'committing',
+fn: function (aPackage,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(_st(self._commitPathStFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
+$ctx1.sendIdx[","]=2;
+$1=_st($2).__comma(".st");
+$ctx1.sendIdx[","]=1;
+self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
+args: ["aPackage", "aBlock", "anotherBlock"],
+source: "commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
+messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"],
+referencedClasses: []
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "contentsFor:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($String())._streamContents_((function(str){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._exporter())._exportPackage_on_(aPackage,str);
+}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},globals.PackageHandler)})},
+args: ["aPackage"],
+source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
+messageSends: ["streamContents:", "exportPackage:on:", "exporter"],
+referencedClasses: ["String"]
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exporter",
+protocol: 'factory',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._exporterClass())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"exporter",{},globals.PackageHandler)})},
+args: [],
+source: "exporter\x0a\x09^ self exporterClass new",
+messageSends: ["new", "exporterClass"],
+referencedClasses: []
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exporterClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Exporter(){return globals.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
+return $Exporter();
+},
+args: [],
+source: "exporterClass\x0a\x09^ Exporter",
+messageSends: [],
+referencedClasses: ["Exporter"]
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "load:",
+protocol: 'loading',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.PackageHandler)})},
+args: ["aPackage"],
+source: "load: aPackage\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.PackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onCommitError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4;
+$1=_st($PackageCommitError())._new();
+$2=$1;
+$3=_st("Commiting failed with reason: \x22".__comma(_st(anError)._responseText())).__comma("\x22");
+$ctx1.sendIdx[","]=1;
+_st($2)._messageText_($3);
+$4=_st($1)._signal();
+return self}, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},globals.PackageHandler)})},
+args: ["anError"],
+source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
+messageSends: ["messageText:", "new", ",", "responseText", "signal"],
+referencedClasses: ["PackageCommitError"]
+}),
+globals.PackageHandler);
+
+
+
+smalltalk.addClass('AmdPackageHandler', globals.PackageHandler, [], 'Kernel-ImportExport');
+globals.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathJsFor:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._toUrl_(self._namespaceFor_(aPackage));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.AmdPackageHandler)})},
+args: ["aPackage"],
+source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
+messageSends: ["toUrl:", "namespaceFor:"],
+referencedClasses: []
+}),
+globals.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathStFor:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+var path,pathWithout;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2;
+$1=_st(self._namespaceFor_(aPackage)).__comma("/_source");
+$ctx1.sendIdx[","]=1;
+path=self._toUrl_($1);
+pathWithout=self._commitPathJsFor_(aPackage);
+$3=_st(path).__eq(_st(pathWithout).__comma("/_source"));
+if(smalltalk.assert($3)){
+$2=pathWithout;
+} else {
+$2=path;
+};
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},globals.AmdPackageHandler)})},
+args: ["aPackage"],
+source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]",
+messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="],
+referencedClasses: []
+}),
+globals.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exporterClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $AmdExporter(){return globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
+return $AmdExporter();
+},
+args: [],
+source: "exporterClass\x0a\x09^ AmdExporter",
+messageSends: [],
+referencedClasses: ["AmdExporter"]
+}),
+globals.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "load:",
+protocol: 'loading',
+fn: function (aPackage){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$receiver;
+$1=_st($Smalltalk())._amdRequire();
+if(($receiver = $1) == null || $receiver.isNil){
+self._error_("AMD loader not present");
+} else {
+var require;
+require=$receiver;
+$3=_st(_st(self._namespaceFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
+$ctx1.sendIdx[","]=1;
+$2=_st($Array())._new_($3);
+_st(require)._value_($2);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.AmdPackageHandler)})},
+args: ["aPackage"],
+source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array new: (self namespaceFor: aPackage), '/', aPackage name ) ]",
+messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "new:", ",", "namespaceFor:", "name"],
+referencedClasses: ["Smalltalk", "Array"]
+}),
+globals.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "namespaceFor:",
+protocol: 'committing',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(aPackage)._transport())._namespace();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},globals.AmdPackageHandler)})},
+args: ["aPackage"],
+source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
+messageSends: ["namespace", "transport"],
+referencedClasses: []
+}),
+globals.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "toUrl:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=_st($Smalltalk())._amdRequire();
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._error_("AMD loader not present");
+} else {
+var require;
+require=$receiver;
+$1=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},globals.AmdPackageHandler)})},
+args: ["aString"],
+source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
+messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.AmdPackageHandler);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultNamespace",
+protocol: 'commit paths',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._defaultAmdNamespace();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageHandler.klass)})},
+args: [],
+source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
+messageSends: ["defaultAmdNamespace"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.AmdPackageHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultNamespace:",
+protocol: 'commit paths',
+fn: function (aString){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Smalltalk())._defaultAmdNamespace_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},globals.AmdPackageHandler.klass)})},
+args: ["aString"],
+source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
+messageSends: ["defaultAmdNamespace:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.AmdPackageHandler.klass);
+
+
+smalltalk.addClass('PackageTransport', globals.Object, ['package'], 'Kernel-ImportExport');
+globals.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=globals.HashedCollection._newFromPairs_(["type",self._type()]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.PackageTransport)})},
+args: [],
+source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
+messageSends: ["type"],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commit",
+protocol: 'committing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._commitHandler())._commit_(self._package());
+return self}, function($ctx1) {$ctx1.fill(self,"commit",{},globals.PackageTransport)})},
+args: [],
+source: "commit\x0a\x09self commitHandler commit: self package",
+messageSends: ["commit:", "commitHandler", "package"],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitHandler",
+protocol: 'factory',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._commitHandlerClass())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitHandler",{},globals.PackageTransport)})},
+args: [],
+source: "commitHandler\x0a\x09^ self commitHandlerClass new",
+messageSends: ["new", "commitHandlerClass"],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitHandlerClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},globals.PackageTransport)})},
+args: [],
+source: "commitHandlerClass\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitOnSuccess:onError:",
+protocol: 'committing',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageTransport)})},
+args: ["aBlock", "anotherBlock"],
+source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
+messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "definition",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "";
+},
+args: [],
+source: "definition\x0a\x09^ ''",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "load",
+protocol: 'loading',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._commitHandler())._load_(self._package());
+return self}, function($ctx1) {$ctx1.fill(self,"load",{},globals.PackageTransport)})},
+args: [],
+source: "load\x0a\x09self commitHandler load: self package",
+messageSends: ["load:", "commitHandler", "package"],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "package",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@package"];
+return $1;
+},
+args: [],
+source: "package\x0a\x09^ package",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "package:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+self["@package"]=aPackage;
+return self},
+args: ["aPackage"],
+source: "package: aPackage\x0a\x09package := aPackage",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupFromJson:",
+protocol: 'initialization',
+fn: function (anObject){
+var self=this;
+return self},
+args: ["anObject"],
+source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "type",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._type();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"type",{},globals.PackageTransport)})},
+args: [],
+source: "type\x0a\x09^ self class type",
+messageSends: ["type", "class"],
+referencedClasses: []
+}),
+globals.PackageTransport);
+
+
+globals.PackageTransport.klass.iVarNames = ['registry'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classRegisteredFor:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@registry"])._at_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},globals.PackageTransport.klass)})},
+args: ["aString"],
+source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
+messageSends: ["at:"],
+referencedClasses: []
+}),
+globals.PackageTransport.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultType",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $AmdPackageTransport(){return globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($AmdPackageTransport())._type();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultType",{},globals.PackageTransport.klass)})},
+args: [],
+source: "defaultType\x0a\x09^ AmdPackageTransport type",
+messageSends: ["type"],
+referencedClasses: ["AmdPackageTransport"]
+}),
+globals.PackageTransport.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "for:",
+protocol: 'instance creation',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._classRegisteredFor_(aString))._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},globals.PackageTransport.klass)})},
+args: ["aString"],
+source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
+messageSends: ["new", "classRegisteredFor:"],
+referencedClasses: []
+}),
+globals.PackageTransport.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromJson:",
+protocol: 'instance creation',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2,$receiver;
+if(($receiver = anObject) == null || $receiver.isNil){
+$1=self._for_(self._defaultType());
+$ctx1.sendIdx["for:"]=1;
+return $1;
+} else {
+anObject;
+};
+$3=self._for_(_st(anObject)._type());
+_st($3)._setupFromJson_(anObject);
+$4=_st($3)._yourself();
+$2=$4;
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},globals.PackageTransport.klass)})},
+args: ["anObject"],
+source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself",
+messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"],
+referencedClasses: []
+}),
+globals.PackageTransport.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@registry"]=globals.HashedCollection._newFromPairs_([]);
+self._register();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.PackageTransport.klass)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.\x0a\x09self register",
+messageSends: ["initialize", "register"],
+referencedClasses: []
+}),
+globals.PackageTransport.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "register",
+protocol: 'registration',
+fn: function (){
+var self=this;
+function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
+return smalltalk.withContext(function($ctx1) { 
+_st($PackageTransport())._register_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"register",{},globals.PackageTransport.klass)})},
+args: [],
+source: "register\x0a\x09PackageTransport register: self",
+messageSends: ["register:"],
+referencedClasses: ["PackageTransport"]
+}),
+globals.PackageTransport.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "register:",
+protocol: 'registration',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(aClass)._type();
+$ctx1.sendIdx["type"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(self["@registry"])._at_put_(_st(aClass)._type(),aClass);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},globals.PackageTransport.klass)})},
+args: ["aClass"],
+source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
+messageSends: ["ifNotNil:", "type", "at:put:"],
+referencedClasses: []
+}),
+globals.PackageTransport.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "type",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return nil;
+},
+args: [],
+source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PackageTransport.klass);
+
+
+smalltalk.addClass('AmdPackageTransport', globals.PackageTransport, ['namespace'], 'Kernel-ImportExport');
+globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=($ctx1.supercall = true, globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply(_st(self), []));
+$ctx1.supercall = false;
+_st($2)._at_put_("amdNamespace",self._namespace());
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.AmdPackageTransport)})},
+args: [],
+source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
+messageSends: ["at:put:", "asJSON", "namespace", "yourself"],
+referencedClasses: []
+}),
+globals.AmdPackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitHandlerClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $AmdPackageHandler(){return globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
+return $AmdPackageHandler();
+},
+args: [],
+source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
+messageSends: [],
+referencedClasses: ["AmdPackageHandler"]
+}),
+globals.AmdPackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultNamespace",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._defaultAmdNamespace();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageTransport)})},
+args: [],
+source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
+messageSends: ["defaultAmdNamespace"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.AmdPackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "definition",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$1=_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+_st(stream)._nextPutAll_(_st(self._class())._name());
+$ctx2.sendIdx["nextPutAll:"]=1;
+_st(stream)._nextPutAll_(" namespace: ");
+$ctx2.sendIdx["nextPutAll:"]=2;
+$3=_st("'".__comma(self._namespace())).__comma("'");
+$ctx2.sendIdx[","]=1;
+$2=_st(stream)._nextPutAll_($3);
+return $2;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"definition",{},globals.AmdPackageTransport)})},
+args: [],
+source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]",
+messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"],
+referencedClasses: ["String"]
+}),
+globals.AmdPackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "namespace",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@namespace"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._defaultNamespace();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"namespace",{},globals.AmdPackageTransport)})},
+args: [],
+source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
+messageSends: ["ifNil:", "defaultNamespace"],
+referencedClasses: []
+}),
+globals.AmdPackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "namespace:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@namespace"]=aString;
+return self},
+args: ["aString"],
+source: "namespace: aString\x0a\x09namespace := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AmdPackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+($ctx1.supercall = true, globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
+$ctx1.supercall = false;
+_st(aStream)._nextPutAll_(" (AMD Namespace: ");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._nextPutAll_(self._namespace());
+$ctx1.sendIdx["nextPutAll:"]=2;
+$1=_st(aStream)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AmdPackageTransport)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
+messageSends: ["printOn:", "nextPutAll:", "namespace"],
+referencedClasses: []
+}),
+globals.AmdPackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setPath:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(require)._basicAt_("config"))._value_(globals.HashedCollection._newFromPairs_(["paths",globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
+return self}, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},globals.AmdPackageTransport)})},
+args: ["aString"],
+source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
+messageSends: ["value:", "basicAt:", "namespace"],
+referencedClasses: []
+}),
+globals.AmdPackageTransport);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupFromJson:",
+protocol: 'initialization',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._namespace_(_st(anObject)._at_("amdNamespace"));
+return self}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},globals.AmdPackageTransport)})},
+args: ["anObject"],
+source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
+messageSends: ["namespace:", "at:"],
+referencedClasses: []
+}),
+globals.AmdPackageTransport);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "namespace:",
+protocol: 'instance creation',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._namespace_(aString);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},globals.AmdPackageTransport.klass)})},
+args: ["aString"],
+source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
+messageSends: ["namespace:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.AmdPackageTransport.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "type",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "amd";
+},
+args: [],
+source: "type\x0a\x09^ 'amd'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.AmdPackageTransport.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commit",
+protocol: '*Kernel-ImportExport',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._transport())._commit();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commit",{},globals.Package)})},
+args: [],
+source: "commit\x0a\x09^ self transport commit",
+messageSends: ["commit", "transport"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "load",
+protocol: '*Kernel-ImportExport',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._transport())._load();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"load",{},globals.Package)})},
+args: [],
+source: "load\x0a\x09^ self transport load",
+messageSends: ["load", "transport"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "loadFromNamespace:",
+protocol: '*Kernel-ImportExport',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._transport();
+_st($2)._namespace_(aString);
+$3=_st($2)._load();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},globals.Package)})},
+args: ["aString"],
+source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
+messageSends: ["namespace:", "transport", "load"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "load:",
+protocol: '*Kernel-ImportExport',
+fn: function (aPackageName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._named_(aPackageName))._load();
+return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},globals.Package.klass)})},
+args: ["aPackageName"],
+source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
+messageSends: ["load", "named:"],
+referencedClasses: []
+}),
+globals.Package.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "load:fromNamespace:",
+protocol: '*Kernel-ImportExport',
+fn: function (aPackageName,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._named_(aPackageName))._loadFromNamespace_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},globals.Package.klass)})},
+args: ["aPackageName", "aString"],
+source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
+messageSends: ["loadFromNamespace:", "named:"],
+referencedClasses: []
+}),
+globals.Package.klass);
+
+});

+ 948 - 0
src/Kernel-ImportExport.st

@@ -0,0 +1,948 @@
+Smalltalk createPackage: 'Kernel-ImportExport'!
+Object subclass: #AbstractExporter
+	instanceVariableNames: ''
+	package: 'Kernel-ImportExport'!
+!AbstractExporter commentStamp!
+I am an abstract exporter for Amber source code.
+
+## API
+
+Use `#exportPackage:on:` to export a given package on a Stream.!
+
+!AbstractExporter methodsFor: 'accessing'!
+
+extensionMethodsOfPackage: aPackage
+	| result |
+	
+	result := OrderedCollection new.
+	
+	(self extensionProtocolsOfPackage: aPackage) do: [ :each |
+		result addAll: each methods ].
+		
+	^ result
+!
+
+extensionProtocolsOfPackage: aPackage
+	| extensionName result |
+	
+	extensionName := '*', aPackage name.
+	result := OrderedCollection new.
+	
+	"The classes must be loaded since it is extensions only.
+	Therefore topological sorting (dependency resolution) does not matter here.
+	Not sorting topologically improves the speed by a number of magnitude.
+	
+	Not to shuffle diffs, classes are sorted by their name."
+	
+	(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |
+		{each. each class} do: [ :behavior |
+			(behavior protocols includes: extensionName) ifTrue: [
+				result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].
+
+	^ result
+! !
+
+!AbstractExporter methodsFor: 'convenience'!
+
+chunkEscape: aString
+	"Replace all occurrences of !! with !!!! and trim at both ends."
+
+	^ (aString replace: '!!' with: '!!!!') trimBoth
+!
+
+classNameFor: aClass
+	^ aClass isMetaclass
+		ifTrue: [ aClass instanceClass name, ' class' ]
+		ifFalse: [
+			aClass isNil
+				ifTrue: [ 'nil' ]
+				ifFalse: [ aClass name ] ]
+! !
+
+!AbstractExporter methodsFor: 'output'!
+
+exportPackage: aPackage on: aStream
+	self subclassResponsibility
+! !
+
+AbstractExporter subclass: #ChunkExporter
+	instanceVariableNames: ''
+	package: 'Kernel-ImportExport'!
+!ChunkExporter commentStamp!
+I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.
+
+I do not output any compiled code.!
+
+!ChunkExporter methodsFor: 'accessing'!
+
+extensionCategoriesOfPackage: aPackage
+	"Issue #143: sort protocol alphabetically"
+
+	| name map result |
+	name := aPackage name.
+	result := OrderedCollection new.
+	(Package sortedClasses: Smalltalk classes) do: [ :each |
+		{each. each class} do: [ :aClass |
+			map := Dictionary new.
+			aClass protocolsDo: [ :category :methods |
+				category = ('*', name) ifTrue: [ map at: category put: methods ] ].
+			result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |
+				MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].
+	^ result
+!
+
+ownCategoriesOfClass: aClass
+	"Answer the protocols of aClass that are not package extensions"
+	
+	"Issue #143: sort protocol alphabetically"
+
+	| map |
+	map := Dictionary new.
+	aClass protocolsDo: [ :each :methods |
+		(each match: '^\*') ifFalse: [ map at: each put: methods ] ].
+	^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |
+		MethodCategory name: each theClass: aClass methods: (map at: each) ]
+!
+
+ownCategoriesOfMetaClass: aClass
+	"Issue #143: sort protocol alphabetically"
+
+	^ self ownCategoriesOfClass: aClass class
+!
+
+ownMethodProtocolsOfClass: aClass
+	"Answer a collection of ExportMethodProtocol object of aClass that are not package extensions"
+	
+	^ aClass ownProtocols collect: [ :each |
+		ExportMethodProtocol name: each theClass: aClass ]
+! !
+
+!ChunkExporter methodsFor: 'output'!
+
+exportCategoryEpilogueOf: aCategory on: aStream
+	aStream nextPutAll: ' !!'; lf; lf
+!
+
+exportCategoryPrologueOf: aCategory on: aStream
+	aStream
+		nextPutAll: '!!', (self classNameFor: aCategory theClass);
+		nextPutAll: ' methodsFor: ''', aCategory name, '''!!'
+!
+
+exportDefinitionOf: aClass on: aStream
+	"Chunk format."
+
+	aStream
+		nextPutAll: (self classNameFor: aClass superclass);
+		nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;
+		tab; nextPutAll: 'instanceVariableNames: '''.
+	aClass instanceVariableNames
+		do: [ :each | aStream nextPutAll: each ]
+		separatedBy: [ aStream nextPutAll: ' ' ].
+	aStream
+		nextPutAll: ''''; lf;
+		tab; nextPutAll: 'package: ''', aClass category, '''!!'; lf.
+	aClass comment notEmpty ifTrue: [
+		aStream
+		nextPutAll: '!!', (self classNameFor: aClass), ' commentStamp!!';lf;
+		nextPutAll: (self chunkEscape: aClass comment), '!!';lf ].
+	aStream lf
+!
+
+exportMetaDefinitionOf: aClass on: aStream
+
+	aClass class instanceVariableNames isEmpty ifFalse: [
+		aStream
+			nextPutAll: (self classNameFor: aClass class);
+			nextPutAll: ' instanceVariableNames: '''.
+		aClass class instanceVariableNames
+			do: [ :each | aStream nextPutAll: each ]
+			separatedBy: [ aStream nextPutAll: ' ' ].
+		aStream
+			nextPutAll: '''!!'; lf; lf ]
+!
+
+exportMethod: aMethod on: aStream
+	aStream
+		lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;
+		nextPutAll: '!!'
+!
+
+exportPackage: aPackage on: aStream
+
+	self exportPackageDefinitionOf: aPackage on: aStream.
+	
+	aPackage sortedClasses do: [ :each |
+		self exportDefinitionOf: each on: aStream.
+		
+		self 
+			exportProtocols: (self ownMethodProtocolsOfClass: each)
+			on: aStream.
+			
+		self exportMetaDefinitionOf: each on: aStream.
+		
+		self 
+			exportProtocols: (self ownMethodProtocolsOfClass: each class)
+			on: aStream ].
+			
+	self 
+		exportProtocols: (self extensionProtocolsOfPackage: aPackage)
+		on: aStream
+!
+
+exportPackageDefinitionOf: aPackage on: aStream
+	aStream
+		nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!!';
+		lf
+!
+
+exportProtocol: aProtocol on: aStream
+	self exportProtocolPrologueOf: aProtocol on: aStream.
+	aProtocol methods do: [ :method | 
+		self exportMethod: method on: aStream ].
+	self exportProtocolEpilogueOf: aProtocol on: aStream
+!
+
+exportProtocolEpilogueOf: aProtocol on: aStream
+	aStream nextPutAll: ' !!'; lf; lf
+!
+
+exportProtocolPrologueOf: aProtocol on: aStream
+	aStream
+		nextPutAll: '!!', (self classNameFor: aProtocol theClass);
+		nextPutAll: ' methodsFor: ''', aProtocol name, '''!!'
+!
+
+exportProtocols: aCollection on: aStream
+	aCollection do: [ :each |
+		self exportProtocol: each on: aStream ]
+! !
+
+AbstractExporter subclass: #Exporter
+	instanceVariableNames: ''
+	package: 'Kernel-ImportExport'!
+!Exporter commentStamp!
+I am responsible for outputting Amber code into a JavaScript string.
+
+The generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.
+
+## Use case
+
+I am typically used to save code outside of the Amber runtime (committing to disk, etc.).!
+
+!Exporter methodsFor: 'accessing'!
+
+ownMethodsOfClass: aClass
+	"Issue #143: sort methods alphabetically"
+
+	^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])
+		reject: [ :each | (each protocol match: '^\*') ]
+!
+
+ownMethodsOfMetaClass: aClass
+	"Issue #143: sort methods alphabetically"
+
+	^ self ownMethodsOfClass: aClass class
+! !
+
+!Exporter methodsFor: 'convenience'!
+
+classNameFor: aClass
+	^ aClass isMetaclass
+		ifTrue: [ aClass instanceClass name, '.klass' ]
+		ifFalse: [
+			aClass isNil
+				ifTrue: [ 'nil' ]
+				ifFalse: [ aClass name ] ]
+! !
+
+!Exporter methodsFor: 'output'!
+
+exportDefinitionOf: aClass on: aStream
+	aStream
+		lf;
+		nextPutAll: 'smalltalk.addClass(';
+		nextPutAll: '''', (self classNameFor: aClass), ''', ';
+		nextPutAll: 'globals.', (self classNameFor: aClass superclass);
+		nextPutAll: ', ['.
+	aClass instanceVariableNames
+		do: [ :each | aStream nextPutAll: '''', each, '''' ]
+		separatedBy: [ aStream nextPutAll: ', ' ].
+	aStream
+		nextPutAll: '], ''';
+		nextPutAll: aClass category, '''';
+		nextPutAll: ');'.
+	aClass comment notEmpty ifTrue: [
+		aStream
+			lf;
+		nextPutAll: 'globals.';
+		nextPutAll: (self classNameFor: aClass);
+		nextPutAll: '.comment=';
+		nextPutAll: aClass comment asJavascript;
+		nextPutAll: ';' ].
+	aStream lf
+!
+
+exportMetaDefinitionOf: aClass on: aStream
+	aStream lf.
+	aClass class instanceVariableNames isEmpty ifFalse: [
+		aStream
+		nextPutAll: 'globals.', (self classNameFor: aClass class);
+		nextPutAll: '.iVarNames = ['.
+		aClass class instanceVariableNames
+		do: [ :each | aStream nextPutAll: '''', each, '''' ]
+		separatedBy: [ aStream nextPutAll: ',' ].
+		aStream nextPutAll: '];', String lf ]
+!
+
+exportMethod: aMethod on: aStream
+	aStream
+		nextPutAll: 'smalltalk.addMethod(';lf;
+		"nextPutAll: aMethod selector asSelector asJavascript, ',';lf;"
+		nextPutAll: 'smalltalk.method({';lf;
+		nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;
+		nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;
+		nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;
+		nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;
+		nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;
+		nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;
+		nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.
+	aStream
+		lf;
+		nextPutAll: '}),';lf;
+		nextPutAll: 'globals.', (self classNameFor: aMethod methodClass);
+		nextPutAll: ');';lf;lf
+!
+
+exportPackage: aPackage on: aStream
+	
+	self 
+		exportPackagePrologueOf: aPackage on: aStream;
+		exportPackageDefinitionOf: aPackage on: aStream;
+		exportPackageTransportOf: aPackage on: aStream.
+	
+	aPackage sortedClasses do: [ :each |
+		self exportDefinitionOf: each on: aStream.
+		each ownMethods do: [ :method |
+			self exportMethod: method on: aStream ].
+			
+		self exportMetaDefinitionOf: each on: aStream.
+		each class ownMethods do: [ :method |
+			self exportMethod: method on: aStream ] ].
+			
+	(self extensionMethodsOfPackage: aPackage) do: [ :each |
+		self exportMethod: each on: aStream ].
+		
+	self exportPackageEpilogueOf: aPackage on: aStream
+!
+
+exportPackageDefinitionOf: aPackage on: aStream
+	aStream
+		nextPutAll: 'smalltalk.addPackage(';
+		nextPutAll: '''', aPackage name, ''');';
+		lf
+!
+
+exportPackageEpilogueOf: aPackage on: aStream
+	aStream
+		nextPutAll: '})(global_smalltalk,global_nil,global__st);';
+		lf
+!
+
+exportPackagePrologueOf: aPackage on: aStream
+	aStream
+		nextPutAll: '(function(smalltalk,nil,_st){';
+		lf
+!
+
+exportPackageTransportOf: aPackage on: aStream
+	aStream
+		nextPutAll: 'smalltalk.packages[';
+		nextPutAll: aPackage name asJavascript;
+		nextPutAll: '].transport = ';
+		nextPutAll: aPackage transport asJSONString;
+		nextPutAll: ';';
+		lf
+! !
+
+Exporter subclass: #AmdExporter
+	instanceVariableNames: 'namespace'
+	package: 'Kernel-ImportExport'!
+!AmdExporter commentStamp!
+I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.!
+
+!AmdExporter methodsFor: 'output'!
+
+exportPackageEpilogueOf: aPackage on: aStream
+	aStream
+		nextPutAll: '});';
+		lf
+!
+
+exportPackagePrologueOf: aPackage on: aStream
+	aStream
+		nextPutAll: 'define("';
+		nextPutAll: (self amdNamespaceOfPackage: aPackage);
+		nextPutAll: '/';
+		nextPutAll: aPackage name;
+		nextPutAll: '", ';
+		nextPutAll: (#('amber_vm/smalltalk' 'amber_vm/nil' 'amber_vm/_st' 'amber_vm/globals'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;
+		nextPutAll: ', function(smalltalk,nil,_st, globals){';
+		lf
+! !
+
+!AmdExporter methodsFor: 'private'!
+
+amdNamesOfPackages: anArray
+	^ (anArray
+		select: [ :each | (self amdNamespaceOfPackage: each) notNil ])
+		collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]
+!
+
+amdNamespaceOfPackage: aPackage
+	^ (aPackage transport type = 'amd')
+		ifTrue: [ aPackage transport namespace ]
+		ifFalse: [ nil ]
+! !
+
+Object subclass: #ChunkParser
+	instanceVariableNames: 'stream last'
+	package: 'Kernel-ImportExport'!
+!ChunkParser commentStamp!
+I am responsible for parsing aStream contents in the chunk format.
+
+## API
+
+    ChunkParser new
+        stream: aStream;
+        nextChunk!
+
+!ChunkParser methodsFor: 'accessing'!
+
+last
+	^ last
+!
+
+stream: aStream
+	stream := aStream
+! !
+
+!ChunkParser methodsFor: 'reading'!
+
+nextChunk
+	"The chunk format (Smalltalk Interchange Format or Fileout format)
+	is a trivial format but can be a bit tricky to understand:
+		- Uses the exclamation mark as delimiter of chunks.
+		- Inside a chunk a normal exclamation mark must be doubled.
+		- A non empty chunk must be a valid Smalltalk expression.
+		- A chunk on top level with a preceding empty chunk is an instruction chunk:
+			- The object created by the expression then takes over reading chunks.
+
+	This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil."
+
+	| char result chunk |
+	result := '' writeStream.
+		[ char := stream next.
+		char notNil ] whileTrue: [
+				char = '!!' ifTrue: [
+						stream peek = '!!'
+								ifTrue: [ stream next "skipping the escape double" ]
+								ifFalse: [ ^ last := result contents trimBoth "chunk end marker found" ]].
+				result nextPut: char ].
+	^ last := nil "a chunk needs to end with !!"
+! !
+
+!ChunkParser class methodsFor: 'instance creation'!
+
+on: aStream
+	^ self new stream: aStream
+! !
+
+Object subclass: #ExportMethodProtocol
+	instanceVariableNames: 'name theClass'
+	package: 'Kernel-ImportExport'!
+!ExportMethodProtocol commentStamp!
+I am an abstraction for a method protocol in a class / metaclass.
+
+I know of my class, name and methods.
+I am used when exporting a package.!
+
+!ExportMethodProtocol methodsFor: 'accessing'!
+
+methods
+	^ (self theClass methodsInProtocol: self name)
+		sorted: [ :a :b | a selector <= b selector ]
+!
+
+name
+	^ name
+!
+
+name: aString
+	name := aString
+!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
+! !
+
+!ExportMethodProtocol class methodsFor: 'instance creation'!
+
+name: aString theClass: aClass
+	^ self new
+		name: aString;
+		theClass: aClass;
+		yourself
+! !
+
+Object subclass: #Importer
+	instanceVariableNames: 'lastSection lastChunk'
+	package: 'Kernel-ImportExport'!
+!Importer commentStamp!
+I can import Amber code from a string in the chunk format.
+
+## API
+
+    Importer new import: aString!
+
+!Importer methodsFor: 'accessing'!
+
+lastChunk
+	^ lastChunk
+!
+
+lastSection
+	^ lastSection
+! !
+
+!Importer methodsFor: 'fileIn'!
+
+import: aStream
+	| chunk result parser lastEmpty |
+	parser := ChunkParser on: aStream.
+	lastEmpty := false.
+	lastSection := 'n/a, not started'.
+	lastChunk := nil.
+	[
+	[ chunk := parser nextChunk.
+	chunk isNil ] whileFalse: [
+		chunk isEmpty
+			ifTrue: [ lastEmpty := true ]
+			ifFalse: [
+				lastSection := chunk.
+				result := Compiler new evaluateExpression: chunk.
+				lastEmpty
+						ifTrue: [
+									lastEmpty := false.
+									result scanFrom: parser ]] ].
+	lastSection := 'n/a, finished'
+	] on: Error do: [:e | lastChunk := parser last. e signal ].
+! !
+
+InterfacingObject subclass: #PackageHandler
+	instanceVariableNames: ''
+	package: 'Kernel-ImportExport'!
+!PackageHandler commentStamp!
+I am responsible for handling package loading and committing.
+
+I should not be used directly. Instead, use the corresponding `Package` methods.!
+
+!PackageHandler methodsFor: 'accessing'!
+
+chunkContentsFor: aPackage
+	^ String streamContents: [ :str |
+		self chunkExporter exportPackage: aPackage on: str ]
+!
+
+chunkExporterClass
+	^ ChunkExporter
+!
+
+commitPathJsFor: aPackage
+	self subclassResponsibility
+!
+
+commitPathStFor: aPackage
+	self subclassResponsibility
+!
+
+contentsFor: aPackage
+	^ String streamContents: [ :str |
+		self exporter exportPackage: aPackage on: str ]
+!
+
+exporterClass
+	^ Exporter
+! !
+
+!PackageHandler methodsFor: 'committing'!
+
+commit: aPackage
+	self 
+		commit: aPackage
+		onSuccess: []
+		onError: [ :error |
+			PackageCommitError new
+				messageText: 'Commiting failed with reason: "' , (error responseText) , '"';
+				signal ]
+!
+
+commit: aPackage onSuccess: aBlock onError: anotherBlock
+	self 
+		commitJsFileFor: aPackage 
+		onSuccess: [
+			self 
+				commitStFileFor: aPackage 
+				onSuccess: [ aPackage beClean. aBlock value ]
+				onError: anotherBlock ] 
+		onError: anotherBlock
+!
+
+commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock
+	self 
+		ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'
+		data: (self contentsFor: aPackage)
+		onSuccess: aBlock
+		onError: anotherBlock
+!
+
+commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock
+	self 
+		ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'
+		data: (self chunkContentsFor: aPackage)
+		onSuccess: aBlock
+		onError: anotherBlock
+! !
+
+!PackageHandler methodsFor: 'error handling'!
+
+onCommitError: anError
+	PackageCommitError new
+		messageText: 'Commiting failed with reason: "' , (anError responseText) , '"';
+		signal
+! !
+
+!PackageHandler methodsFor: 'factory'!
+
+chunkExporter
+	^ self chunkExporterClass new
+!
+
+exporter
+	^ self exporterClass new
+! !
+
+!PackageHandler methodsFor: 'loading'!
+
+load: aPackage
+	self subclassResponsibility
+! !
+
+!PackageHandler methodsFor: 'private'!
+
+ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock
+	self
+		ajax: #{
+			'url' -> aURL.
+			'type' -> 'PUT'.
+			'data' -> aString.
+			'contentType' -> 'text/plain;charset=UTF-8'.
+			'success' -> aBlock.
+			'error' -> anotherBlock
+		}
+! !
+
+PackageHandler subclass: #AmdPackageHandler
+	instanceVariableNames: ''
+	package: 'Kernel-ImportExport'!
+!AmdPackageHandler commentStamp!
+I am responsible for handling package loading and committing.
+
+I should not be used directly. Instead, use the corresponding `Package` methods.!
+
+!AmdPackageHandler methodsFor: 'accessing'!
+
+commitPathJsFor: aPackage
+	^ self toUrl: (self namespaceFor: aPackage)
+!
+
+commitPathStFor: aPackage
+	"If _source is not mapped, .st will be committed to .js path.
+	It is recommended not to use _source as it can be deprecated."
+	
+	| path pathWithout |
+	path := self toUrl: (self namespaceFor: aPackage), '/_source'.
+	pathWithout := self commitPathJsFor: aPackage.
+	^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]
+!
+
+exporterClass
+	^ AmdExporter
+! !
+
+!AmdPackageHandler methodsFor: 'committing'!
+
+namespaceFor: aPackage
+	^ aPackage transport namespace
+! !
+
+!AmdPackageHandler methodsFor: 'loading'!
+
+load: aPackage
+	Smalltalk amdRequire
+		ifNil: [ self error: 'AMD loader not present' ]
+		ifNotNil: [ :require |
+			require value: (Array new: (self namespaceFor: aPackage), '/', aPackage name ) ]
+! !
+
+!AmdPackageHandler methodsFor: 'private'!
+
+toUrl: aString
+	^ Smalltalk amdRequire
+		ifNil: [ self error: 'AMD loader not present' ]
+		ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]
+! !
+
+!AmdPackageHandler class methodsFor: 'commit paths'!
+
+defaultNamespace
+	^ Smalltalk defaultAmdNamespace
+!
+
+defaultNamespace: aString
+	Smalltalk defaultAmdNamespace: aString
+! !
+
+Object subclass: #PackageTransport
+	instanceVariableNames: 'package'
+	package: 'Kernel-ImportExport'!
+!PackageTransport commentStamp!
+I represent the transport mechanism used to commit a package.
+
+My concrete subclasses have a `#handler` to which committing is delegated.!
+
+!PackageTransport methodsFor: 'accessing'!
+
+commitHandlerClass
+	self subclassResponsibility
+!
+
+definition
+	^ ''
+!
+
+package
+	^ package
+!
+
+package: aPackage
+	package := aPackage
+!
+
+type
+	^ self class type
+! !
+
+!PackageTransport methodsFor: 'committing'!
+
+commit
+	self commitHandler commit: self package
+!
+
+commitOnSuccess: aBlock onError: anotherBlock
+	self commitHandler 
+		commit: self package
+		onSuccess: aBlock
+		onError: anotherBlock
+! !
+
+!PackageTransport methodsFor: 'converting'!
+
+asJSON
+	^ #{ 'type' -> self type }
+! !
+
+!PackageTransport methodsFor: 'factory'!
+
+commitHandler
+	^ self commitHandlerClass new
+! !
+
+!PackageTransport methodsFor: 'initialization'!
+
+setupFromJson: anObject
+	"no op. override if needed in subclasses"
+! !
+
+!PackageTransport methodsFor: 'loading'!
+
+load
+	self commitHandler load: self package
+! !
+
+PackageTransport class instanceVariableNames: 'registry'!
+
+!PackageTransport class methodsFor: 'accessing'!
+
+classRegisteredFor: aString
+	^ registry at: aString
+!
+
+defaultType
+	^ AmdPackageTransport type
+!
+
+type
+	"Override in subclasses"
+	^ nil
+! !
+
+!PackageTransport class methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	registry := #{}.
+	self register
+! !
+
+!PackageTransport class methodsFor: 'instance creation'!
+
+for: aString
+	^ (self classRegisteredFor: aString) new
+!
+
+fromJson: anObject
+	anObject ifNil: [ ^ self for: self defaultType ].
+	
+	^ (self for: anObject type)
+		setupFromJson: anObject;
+		yourself
+! !
+
+!PackageTransport class methodsFor: 'registration'!
+
+register
+	PackageTransport register: self
+!
+
+register: aClass
+	aClass type ifNotNil: [
+		registry at: aClass type put: aClass ]
+! !
+
+PackageTransport subclass: #AmdPackageTransport
+	instanceVariableNames: 'namespace'
+	package: 'Kernel-ImportExport'!
+!AmdPackageTransport commentStamp!
+I am the default transport for committing packages.
+
+See `AmdExporter` and `AmdPackageHandler`.!
+
+!AmdPackageTransport methodsFor: 'accessing'!
+
+commitHandlerClass
+	^ AmdPackageHandler
+!
+
+definition
+	^ String streamContents: [ :stream |
+		stream 
+			nextPutAll: self class name;
+			nextPutAll: ' namespace: ';
+			nextPutAll: '''', self namespace, '''' ]
+!
+
+namespace
+	^ namespace ifNil: [ self defaultNamespace ]
+!
+
+namespace: aString
+	namespace := aString
+! !
+
+!AmdPackageTransport methodsFor: 'actions'!
+
+setPath: aString
+	"Set the path the the receiver's `namespace`"
+	
+	(require basicAt: 'config') value: #{
+		'paths' -> #{
+			self namespace -> aString
+		}
+	}.
+! !
+
+!AmdPackageTransport methodsFor: 'converting'!
+
+asJSON
+	^ super asJSON
+		at: 'amdNamespace' put: self namespace;
+		yourself
+! !
+
+!AmdPackageTransport methodsFor: 'defaults'!
+
+defaultNamespace
+	^ Smalltalk defaultAmdNamespace
+! !
+
+!AmdPackageTransport methodsFor: 'initialization'!
+
+setupFromJson: anObject
+	self namespace: (anObject at: 'amdNamespace')
+! !
+
+!AmdPackageTransport methodsFor: 'printing'!
+
+printOn: aStream
+	super printOn: aStream.
+	aStream
+		nextPutAll: ' (AMD Namespace: ';
+		nextPutAll: self namespace;
+		nextPutAll: ')'
+! !
+
+!AmdPackageTransport class methodsFor: 'accessing'!
+
+type
+	^ 'amd'
+! !
+
+!AmdPackageTransport class methodsFor: 'instance creation'!
+
+namespace: aString
+	^ self new
+		namespace: aString;
+		yourself
+! !
+
+!Package methodsFor: '*Kernel-ImportExport'!
+
+commit
+	^ self transport commit
+!
+
+load
+	^ self transport load
+!
+
+loadFromNamespace: aString
+	^ self transport
+		namespace: aString;
+		load
+! !
+
+!Package class methodsFor: '*Kernel-ImportExport'!
+
+load: aPackageName
+	(self named: aPackageName) load
+!
+
+load: aPackageName fromNamespace: aString
+	(self named: aPackageName) loadFromNamespace: aString
+! !
+

+ 3720 - 0
src/Kernel-Infrastructure.js

@@ -0,0 +1,3720 @@
+define("amber_core/Kernel-Infrastructure", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Kernel-Infrastructure');
+smalltalk.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('ConsoleErrorHandler', globals.Object, [], 'Kernel-Infrastructure');
+globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(anError)._context();
+$ctx1.sendIdx["context"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+self._logErrorContext_(_st(anError)._context());
+};
+self._logError_(anError);
+return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ConsoleErrorHandler)})},
+args: ["anError"],
+source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
+messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"],
+referencedClasses: []
+}),
+globals.ConsoleErrorHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "log:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(console)._log_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},globals.ConsoleErrorHandler)})},
+args: ["aString"],
+source: "log: aString\x0a\x09console log: aString",
+messageSends: ["log:"],
+referencedClasses: []
+}),
+globals.ConsoleErrorHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "logContext:",
+protocol: 'private',
+fn: function (aContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(aContext)._home();
+$ctx1.sendIdx["home"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+self._logContext_(_st(aContext)._home());
+};
+self._log_(_st(aContext)._asString());
+return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},globals.ConsoleErrorHandler)})},
+args: ["aContext"],
+source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
+messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"],
+referencedClasses: []
+}),
+globals.ConsoleErrorHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "logError:",
+protocol: 'private',
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._log_(_st(anError)._messageText());
+return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},globals.ConsoleErrorHandler)})},
+args: ["anError"],
+source: "logError: anError\x0a\x09self log: anError messageText",
+messageSends: ["log:", "messageText"],
+referencedClasses: []
+}),
+globals.ConsoleErrorHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "logErrorContext:",
+protocol: 'private',
+fn: function (aContext){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+if(($receiver = aContext) == null || $receiver.isNil){
+aContext;
+} else {
+$1=_st(aContext)._home();
+$ctx1.sendIdx["home"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+self._logContext_(_st(aContext)._home());
+};
+};
+return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},globals.ConsoleErrorHandler)})},
+args: ["aContext"],
+source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
+messageSends: ["ifNotNil:", "home", "logContext:"],
+referencedClasses: []
+}),
+globals.ConsoleErrorHandler);
+
+
+globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
+return smalltalk.withContext(function($ctx1) { 
+_st($ErrorHandler())._registerIfNone_(self._new());
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleErrorHandler.klass)})},
+args: [],
+source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
+messageSends: ["registerIfNone:", "new"],
+referencedClasses: ["ErrorHandler"]
+}),
+globals.ConsoleErrorHandler.klass);
+
+
+smalltalk.addClass('InterfacingObject', globals.Object, [], 'Kernel-Infrastructure');
+globals.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a    self alert: 'Hey, there is a problem'.\x0a    self confirm: 'Affirmative?'.\x0a    self prompt: 'Your name:'.\x0a\x0a    self ajax: #{\x0a        'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a    }.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ajax:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($PlatformInterface())._ajax_(anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.InterfacingObject)})},
+args: ["anObject"],
+source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject",
+messageSends: ["ajax:"],
+referencedClasses: ["PlatformInterface"]
+}),
+globals.InterfacingObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "alert:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($PlatformInterface())._alert_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.InterfacingObject)})},
+args: ["aString"],
+source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
+messageSends: ["alert:"],
+referencedClasses: ["PlatformInterface"]
+}),
+globals.InterfacingObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($PlatformInterface())._confirm_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.InterfacingObject)})},
+args: ["aString"],
+source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
+messageSends: ["confirm:"],
+referencedClasses: ["PlatformInterface"]
+}),
+globals.InterfacingObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "prompt:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($PlatformInterface())._prompt_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.InterfacingObject)})},
+args: ["aString"],
+source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
+messageSends: ["prompt:"],
+referencedClasses: ["PlatformInterface"]
+}),
+globals.InterfacingObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "prompt:default:",
+protocol: 'actions',
+fn: function (aString,defaultString){
+var self=this;
+function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($PlatformInterface())._prompt_default_(aString,defaultString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},globals.InterfacingObject)})},
+args: ["aString", "defaultString"],
+source: "prompt: aString default: defaultString\x0a\x09^ PlatformInterface prompt: aString default: defaultString",
+messageSends: ["prompt:default:"],
+referencedClasses: ["PlatformInterface"]
+}),
+globals.InterfacingObject);
+
+
+
+smalltalk.addClass('Environment', globals.InterfacingObject, [], 'Kernel-Infrastructure');
+globals.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addInstVarNamed:to:",
+protocol: 'compiling',
+fn: function (aString,aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$5;
+$1=self._classBuilder();
+$2=_st(aClass)._superclass();
+$3=_st(aClass)._name();
+$ctx1.sendIdx["name"]=1;
+$4=_st(_st(aClass)._instanceVariableNames())._copy();
+_st($4)._add_(aString);
+$5=_st($4)._yourself();
+_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,_st(_st(aClass)._package())._name());
+return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},globals.Environment)})},
+args: ["aString", "aClass"],
+source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
+messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "allSelectors",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($Smalltalk())._vm())._allSelectors();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Environment)})},
+args: [],
+source: "allSelectors\x0a\x09^ Smalltalk vm allSelectors",
+messageSends: ["allSelectors", "vm"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "availableClassNames",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($Smalltalk())._classes())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._name();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},globals.Environment)})},
+args: [],
+source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
+messageSends: ["collect:", "classes", "name"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "availablePackageNames",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($Smalltalk())._packages())._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._name();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},globals.Environment)})},
+args: [],
+source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
+messageSends: ["collect:", "packages", "name"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "availableProtocolsFor:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+var protocols;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+protocols=_st(aClass)._protocols();
+$1=_st(aClass)._superclass();
+$ctx1.sendIdx["superclass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+_st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
+};
+$2=_st(_st(_st(protocols)._asSet())._asArray())._sort();
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},globals.Environment)})},
+args: ["aClass"],
+source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray sort",
+messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classBuilder",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($ClassBuilder())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classBuilder",{},globals.Environment)})},
+args: [],
+source: "classBuilder\x0a\x09^ ClassBuilder new",
+messageSends: ["new"],
+referencedClasses: ["ClassBuilder"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classNamed:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=_st(_st($Smalltalk())._globals())._at_(_st(aString)._asSymbol());
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._error_("Invalid class name");
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},globals.Environment)})},
+args: ["aString"],
+source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
+messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._classes();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Environment)})},
+args: [],
+source: "classes\x0a\x09^ Smalltalk classes",
+messageSends: ["classes"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPackage:onSuccess:onError:",
+protocol: 'actions',
+fn: function (aPackage,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.Environment)})},
+args: ["aPackage", "aBlock", "anotherBlock"],
+source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
+messageSends: ["commitOnSuccess:onError:", "transport"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileClassComment:for:",
+protocol: 'compiling',
+fn: function (aString,aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aClass)._comment_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},globals.Environment)})},
+args: ["aString", "aClass"],
+source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
+messageSends: ["comment:"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileClassDefinition:",
+protocol: 'compiling',
+fn: function (aString){
+var self=this;
+function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+return smalltalk.withContext(function($ctx1) { 
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._evaluate_for_(aString,_st($DoIt())._new());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
+return smalltalk.withContext(function($ctx2) {
+return self._alert_(_st(error)._messageText());
+}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},globals.Environment)})},
+args: ["aString"],
+source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
+messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"],
+referencedClasses: ["DoIt", "Error"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compileMethod:for:protocol:",
+protocol: 'compiling',
+fn: function (sourceCode,class_,protocol){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(class_)._compile_protocol_(sourceCode,protocol);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},globals.Environment)})},
+args: ["sourceCode", "class", "protocol"],
+source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
+messageSends: ["compile:protocol:"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copyClass:to:",
+protocol: 'actions',
+fn: function (aClass,aClassName){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=_st(_st($Smalltalk())._globals())._at_(aClassName);
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+$2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
+$ctx1.sendIdx[","]=1;
+self._error_($2);
+};
+_st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
+return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)})},
+args: ["aClass", "aClassName"],
+source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
+messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"],
+referencedClasses: ["Smalltalk", "ClassBuilder"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doItReceiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($DoIt())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},globals.Environment)})},
+args: [],
+source: "doItReceiver\x0a\x09^ DoIt new",
+messageSends: ["new"],
+referencedClasses: ["DoIt"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:for:",
+protocol: 'evaluating',
+fn: function (aString,anObject){
+var self=this;
+function $Evaluator(){return globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Evaluator())._evaluate_for_(aString,anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Environment)})},
+args: ["aString", "anObject"],
+source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
+messageSends: ["evaluate:for:"],
+referencedClasses: ["Evaluator"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:on:do:",
+protocol: 'error handling',
+fn: function (aBlock,anErrorClass,exceptionBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(aBlock)._tryCatch_((function(exception){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
+if(smalltalk.assert($1)){
+return _st(exceptionBlock)._value_(exception);
+} else {
+return _st(exception)._signal();
+};
+}, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},globals.Environment)})},
+args: ["aBlock", "anErrorClass", "exceptionBlock"],
+source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
+messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "signal"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspect:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Inspector())._inspect_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Environment)})},
+args: ["anObject"],
+source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
+messageSends: ["inspect:"],
+referencedClasses: ["Inspector"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "moveClass:toPackage:",
+protocol: 'actions',
+fn: function (aClass,aPackageName){
+var self=this;
+var package_;
+function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+package_=_st($Package())._named_(aPackageName);
+$1=package_;
+if(($receiver = $1) == null || $receiver.isNil){
+self._error_("Invalid package name");
+} else {
+$1;
+};
+$2=_st(package_).__eq_eq(_st(aClass)._package());
+if(smalltalk.assert($2)){
+return self;
+};
+_st(aClass)._package_(package_);
+return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},globals.Environment)})},
+args: ["aClass", "aPackageName"],
+source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package",
+messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
+referencedClasses: ["Package"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "moveMethod:toClass:",
+protocol: 'actions',
+fn: function (aMethod,aClassName){
+var self=this;
+var destinationClass;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1,$5,$4;
+destinationClass=self._classNamed_(aClassName);
+$2=destinationClass;
+$3=_st(aMethod)._methodClass();
+$ctx1.sendIdx["methodClass"]=1;
+$1=_st($2).__eq_eq($3);
+if(smalltalk.assert($1)){
+return self;
+};
+$5=_st(aMethod)._methodClass();
+$ctx1.sendIdx["methodClass"]=2;
+$4=_st($5)._isMetaclass();
+if(smalltalk.assert($4)){
+destinationClass=_st(destinationClass)._class();
+destinationClass;
+};
+_st(destinationClass)._compile_protocol_(_st(aMethod)._source(),_st(aMethod)._protocol());
+_st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
+return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},globals.Environment)})},
+args: ["aMethod", "aClassName"],
+source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass class ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
+messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "moveMethod:toProtocol:",
+protocol: 'actions',
+fn: function (aMethod,aProtocol){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aMethod)._protocol_(aProtocol);
+return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},globals.Environment)})},
+args: ["aMethod", "aProtocol"],
+source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
+messageSends: ["protocol:"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "packages",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._packages();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"packages",{},globals.Environment)})},
+args: [],
+source: "packages\x0a\x09^ Smalltalk packages",
+messageSends: ["packages"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerErrorHandler:",
+protocol: 'services',
+fn: function (anErrorHandler){
+var self=this;
+function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
+return smalltalk.withContext(function($ctx1) { 
+_st($ErrorHandler())._register_(anErrorHandler);
+return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},globals.Environment)})},
+args: ["anErrorHandler"],
+source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
+messageSends: ["register:"],
+referencedClasses: ["ErrorHandler"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerFinder:",
+protocol: 'services',
+fn: function (aFinder){
+var self=this;
+function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Finder())._register_(aFinder);
+return self}, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},globals.Environment)})},
+args: ["aFinder"],
+source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
+messageSends: ["register:"],
+referencedClasses: ["Finder"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerInspector:",
+protocol: 'services',
+fn: function (anInspector){
+var self=this;
+function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Inspector())._register_(anInspector);
+return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},globals.Environment)})},
+args: ["anInspector"],
+source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
+messageSends: ["register:"],
+referencedClasses: ["Inspector"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerProgressHandler:",
+protocol: 'services',
+fn: function (aProgressHandler){
+var self=this;
+function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
+return smalltalk.withContext(function($ctx1) { 
+_st($ProgressHandler())._register_(aProgressHandler);
+return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},globals.Environment)})},
+args: ["aProgressHandler"],
+source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
+messageSends: ["register:"],
+referencedClasses: ["ProgressHandler"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerTranscript:",
+protocol: 'services',
+fn: function (aTranscript){
+var self=this;
+function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Transcript())._register_(aTranscript);
+return self}, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},globals.Environment)})},
+args: ["aTranscript"],
+source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
+messageSends: ["register:"],
+referencedClasses: ["Transcript"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeClass:",
+protocol: 'actions',
+fn: function (aClass){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Smalltalk())._removeClass_(aClass);
+return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.Environment)})},
+args: ["aClass"],
+source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
+messageSends: ["removeClass:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeMethod:",
+protocol: 'actions',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
+return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},globals.Environment)})},
+args: ["aMethod"],
+source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
+messageSends: ["removeCompiledMethod:", "methodClass"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeProtocol:from:",
+protocol: 'actions',
+fn: function (aString,aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(aClass)._removeCompiledMethod_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},globals.Environment)})},
+args: ["aString", "aClass"],
+source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
+messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renameClass:to:",
+protocol: 'actions',
+fn: function (aClass,aClassName){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+$1=_st(_st($Smalltalk())._globals())._at_(aClassName);
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+$2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
+$ctx1.sendIdx[","]=1;
+self._error_($2);
+};
+_st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
+return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)})},
+args: ["aClass", "aClassName"],
+source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
+messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"],
+referencedClasses: ["Smalltalk", "ClassBuilder"]
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renameProtocol:to:in:",
+protocol: 'actions',
+fn: function (aString,anotherString,aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._protocol_(anotherString);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},globals.Environment)})},
+args: ["aString", "anotherString", "aClass"],
+source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
+messageSends: ["do:", "methodsInProtocol:", "protocol:"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setClassCommentOf:to:",
+protocol: 'actions',
+fn: function (aClass,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aClass)._comment_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},globals.Environment)})},
+args: ["aClass", "aString"],
+source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
+messageSends: ["comment:"],
+referencedClasses: []
+}),
+globals.Environment);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "systemAnnouncer",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},globals.Environment)})},
+args: [],
+source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
+messageSends: ["current", "at:", "globals"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Environment);
+
+
+
+smalltalk.addClass('JSObjectProxy', globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
+globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making  JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$3;
+$2=_st(anObject)._class();
+$ctx1.sendIdx["class"]=1;
+$1=_st($2).__eq_eq(self._class());
+if(! smalltalk.assert($1)){
+return false;
+};
+$3=self._compareJSObjectWith_(_st(anObject)._jsObject());
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.JSObjectProxy)})},
+args: ["anObject"],
+source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ self compareJSObjectWith: anObject jsObject",
+messageSends: ["ifFalse:", "==", "class", "compareJSObjectWith:", "jsObject"],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addObjectVariablesTo:",
+protocol: 'proxy',
+fn: function (aDictionary){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		for(var i in self['@jsObject']) {
+			aDictionary._at_put_(i, self['@jsObject'][i]);
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},globals.JSObjectProxy)})},
+args: ["aDictionary"],
+source: "addObjectVariablesTo: aDictionary\x0a\x09<\x0a\x09\x09for(var i in self['@jsObject']) {\x0a\x09\x09\x09aDictionary._at_put_(i, self['@jsObject'][i]);\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'enumerating',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@jsObject"];
+return $1;
+},
+args: [],
+source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self['@jsObject'][aString];
+return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.JSObjectProxy)})},
+args: ["aString"],
+source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsent:",
+protocol: 'accessing',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var obj = self['@jsObject'];
+		return aString in obj ? obj[aString] : aBlock._value();
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)})},
+args: ["aString", "aBlock"],
+source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifPresent:",
+protocol: 'accessing',
+fn: function (aString,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var obj = self['@jsObject'];
+		return aString in obj ? aBlock._value_(obj[aString]) : nil;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)})},
+args: ["aString", "aBlock"],
+source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifPresent:ifAbsent:",
+protocol: 'accessing',
+fn: function (aString,aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var obj = self['@jsObject'];
+		return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.JSObjectProxy)})},
+args: ["aString", "aBlock", "anotherBlock"],
+source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:put:",
+protocol: 'accessing',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self['@jsObject'][aString] = anObject;
+return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.JSObjectProxy)})},
+args: ["aString", "anObject"],
+source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compareJSObjectWith:",
+protocol: 'private',
+fn: function (aJSObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self["@jsObject"] === aJSObject;
+return self}, function($ctx1) {$ctx1.fill(self,"compareJSObjectWith:",{aJSObject:aJSObject},globals.JSObjectProxy)})},
+args: ["aJSObject"],
+source: "compareJSObjectWith: aJSObject\x0a \x09<return self[\x22@jsObject\x22] === aJSObject>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doesNotUnderstand:",
+protocol: 'proxy',
+fn: function (aMessage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
+if(($receiver = $2) == null || $receiver.isNil){
+$1=($ctx1.supercall = true, globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]));
+$ctx1.supercall = false;
+} else {
+var jsSelector;
+jsSelector=$receiver;
+$1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.JSObjectProxy)})},
+args: ["aMessage"],
+source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptSelector)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments ]",
+messageSends: ["ifNil:ifNotNil:", "lookupProperty:", "asJavaScriptSelector", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forwardMessage:withArguments:",
+protocol: 'proxy',
+fn: function (aString,anArray){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return smalltalk.send(self._jsObject(), aString, anArray);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},globals.JSObjectProxy)})},
+args: ["aString", "anArray"],
+source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectOn:",
+protocol: 'proxy',
+fn: function (anInspector){
+var self=this;
+var variables;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+variables=_st($Dictionary())._new();
+_st(variables)._at_put_("#self",self._jsObject());
+_st(anInspector)._setLabel_(self._printString());
+self._addObjectVariablesTo_(variables);
+_st(anInspector)._setVariables_(variables);
+return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.JSObjectProxy)})},
+args: ["anInspector"],
+source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09self addObjectVariablesTo: variables.\x0a\x09anInspector setVariables: variables",
+messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
+referencedClasses: ["Dictionary"]
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "jsObject",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@jsObject"];
+return $1;
+},
+args: [],
+source: "jsObject\x0a\x09^ jsObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "jsObject:",
+protocol: 'accessing',
+fn: function (aJSObject){
+var self=this;
+self["@jsObject"]=aJSObject;
+return self},
+args: ["aJSObject"],
+source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keysAndValuesDo:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var o = self['@jsObject'];
+		for(var i in o) {
+			aBlock._value_value_(i, o[i]);
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.JSObjectProxy)})},
+args: ["aBlock"],
+source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "lookupProperty:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return aString in self._jsObject() ? aString : nil;
+return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},globals.JSObjectProxy)})},
+args: ["aString"],
+source: "lookupProperty: aString\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<return aString in self._jsObject() ? aString : nil>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aStream)._nextPutAll_(self._printString());
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.JSObjectProxy)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
+messageSends: ["nextPutAll:", "printString"],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printString",
+protocol: 'printing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var js = self['@jsObject'];
+		return js.toString
+			? js.toString()
+			: Object.prototype.toString.call(js)
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"printString",{},globals.JSObjectProxy)})},
+args: [],
+source: "printString\x0a\x09<\x0a\x09\x09var js = self['@jsObject'];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.JSObjectProxy);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (aJSObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._jsObject_(aJSObject);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},globals.JSObjectProxy.klass)})},
+args: ["aJSObject"],
+source: "on: aJSObject\x0a\x09^ self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
+messageSends: ["jsObject:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.JSObjectProxy.klass);
+
+
+smalltalk.addClass('NullProgressHandler', globals.Object, [], 'Kernel-Infrastructure');
+globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:on:displaying:",
+protocol: 'progress handling',
+fn: function (aBlock,aCollection,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aCollection)._do_(aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.NullProgressHandler)})},
+args: ["aBlock", "aCollection", "aString"],
+source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
+messageSends: ["do:"],
+referencedClasses: []
+}),
+globals.NullProgressHandler);
+
+
+globals.NullProgressHandler.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
+return smalltalk.withContext(function($ctx1) { 
+_st($ProgressHandler())._registerIfNone_(self._new());
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.NullProgressHandler.klass)})},
+args: [],
+source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
+messageSends: ["registerIfNone:", "new"],
+referencedClasses: ["ProgressHandler"]
+}),
+globals.NullProgressHandler.klass);
+
+
+smalltalk.addClass('Organizer', globals.Object, [], 'Kernel-Infrastructure');
+globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addElement:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.elements.addElement(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},globals.Organizer)})},
+args: ["anObject"],
+source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Organizer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "elements",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._basicAt_("elements"))._copy();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"elements",{},globals.Organizer)})},
+args: [],
+source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
+messageSends: ["copy", "basicAt:"],
+referencedClasses: []
+}),
+globals.Organizer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeElement:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.elements.removeElement(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},globals.Organizer)})},
+args: ["anObject"],
+source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Organizer);
+
+
+
+smalltalk.addClass('ClassOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
+globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addElement:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ProtocolAdded(){return globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+($ctx1.supercall = true, globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply(_st(self), [aString]));
+$ctx1.supercall = false;
+$1=_st($ProtocolAdded())._new();
+_st($1)._protocol_(aString);
+_st($1)._theClass_(self._theClass());
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},globals.ClassOrganizer)})},
+args: ["aString"],
+source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
+messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
+referencedClasses: ["SystemAnnouncer", "ProtocolAdded"]
+}),
+globals.ClassOrganizer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeElement:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ProtocolRemoved(){return globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+($ctx1.supercall = true, globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply(_st(self), [aString]));
+$ctx1.supercall = false;
+$1=_st($ProtocolRemoved())._new();
+_st($1)._protocol_(aString);
+_st($1)._theClass_(self._theClass());
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},globals.ClassOrganizer)})},
+args: ["aString"],
+source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
+messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
+referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"]
+}),
+globals.ClassOrganizer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "theClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ return self.theClass ;
+return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},globals.ClassOrganizer)})},
+args: [],
+source: "theClass\x0a\x09< return self.theClass >",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ClassOrganizer);
+
+
+
+smalltalk.addClass('PackageOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
+globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
+
+
+smalltalk.addClass('Package', globals.Object, ['transport', 'dirty'], 'Kernel-Infrastructure');
+globals.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a    Smalltalk current packageAt: 'Kernel'\x0a    Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicName:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.pkgName = aString;
+return self}, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},globals.Package)})},
+args: ["aString"],
+source: "basicName: aString\x0a\x09<self.pkgName = aString>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicTransport",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.transport;
+return self}, function($ctx1) {$ctx1.fill(self,"basicTransport",{},globals.Package)})},
+args: [],
+source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.transport>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "beClean",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $PackageClean(){return globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self["@dirty"]=false;
+$1=_st($PackageClean())._new();
+_st($1)._package_(self);
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"beClean",{},globals.Package)})},
+args: [],
+source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
+messageSends: ["announce:", "current", "package:", "new", "yourself"],
+referencedClasses: ["SystemAnnouncer", "PackageClean"]
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "beDirty",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $PackageClean(){return globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self["@dirty"]=true;
+$1=_st($PackageClean())._new();
+_st($1)._package_(self);
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"beDirty",{},globals.Package)})},
+args: [],
+source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
+messageSends: ["announce:", "current", "package:", "new", "yourself"],
+referencedClasses: ["SystemAnnouncer", "PackageClean"]
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classTemplate",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$4,$2,$5,$6,$7,$1;
+$1=_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+_st(stream)._nextPutAll_("Object");
+$ctx2.sendIdx["nextPutAll:"]=1;
+_st(stream)._nextPutAll_(" subclass: #NameOfSubclass");
+$ctx2.sendIdx["nextPutAll:"]=2;
+$3=_st($String())._lf();
+$ctx2.sendIdx["lf"]=1;
+$4=_st($String())._tab();
+$ctx2.sendIdx["tab"]=1;
+$2=_st($3).__comma($4);
+$ctx2.sendIdx[","]=1;
+_st(stream)._nextPutAll_($2);
+$ctx2.sendIdx["nextPutAll:"]=3;
+$5=_st(stream)._nextPutAll_("instanceVariableNames: ''");
+$ctx2.sendIdx["nextPutAll:"]=4;
+$5;
+$6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
+$ctx2.sendIdx[","]=2;
+_st(stream)._nextPutAll_($6);
+$ctx2.sendIdx["nextPutAll:"]=5;
+_st(stream)._nextPutAll_("package: '");
+$ctx2.sendIdx["nextPutAll:"]=6;
+_st(stream)._nextPutAll_(self._name());
+$ctx2.sendIdx["nextPutAll:"]=7;
+$7=_st(stream)._nextPutAll_("'");
+return $7;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classTemplate",{},globals.Package)})},
+args: [],
+source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]",
+messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"],
+referencedClasses: ["String"]
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classes",
+protocol: 'classes',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._organization())._elements();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Package)})},
+args: [],
+source: "classes\x0a\x09^ self organization elements",
+messageSends: ["elements", "organization"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "definition",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$4,$5,$3,$7,$6,$8,$9,$1;
+$1=_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+$2=_st(self._class())._name();
+$ctx2.sendIdx["name"]=1;
+_st(stream)._nextPutAll_($2);
+$ctx2.sendIdx["nextPutAll:"]=1;
+$4=_st($String())._lf();
+$ctx2.sendIdx["lf"]=1;
+$5=_st($String())._tab();
+$ctx2.sendIdx["tab"]=1;
+$3=_st($4).__comma($5);
+$ctx2.sendIdx[","]=1;
+_st(stream)._nextPutAll_($3);
+$ctx2.sendIdx["nextPutAll:"]=2;
+_st(stream)._nextPutAll_(" named: ");
+$ctx2.sendIdx["nextPutAll:"]=3;
+$7="'".__comma(self._name());
+$ctx2.sendIdx[","]=3;
+$6=_st($7).__comma("'");
+$ctx2.sendIdx[","]=2;
+_st(stream)._nextPutAll_($6);
+$ctx2.sendIdx["nextPutAll:"]=4;
+$8=_st(_st($String())._lf()).__comma(_st($String())._tab());
+$ctx2.sendIdx[","]=4;
+_st(stream)._nextPutAll_($8);
+$ctx2.sendIdx["nextPutAll:"]=5;
+_st(stream)._nextPutAll_(" transport: (");
+$ctx2.sendIdx["nextPutAll:"]=6;
+$9=_st(stream)._nextPutAll_(_st(_st(self._transport())._definition()).__comma(")"));
+return $9;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Package)})},
+args: [],
+source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: ' named: ';\x0a\x09\x09\x09nextPutAll: '''', self name, '''';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll:  ' transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]",
+messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "definition", "transport"],
+referencedClasses: ["String"]
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isDirty",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@dirty"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isDirty",{},globals.Package)})},
+args: [],
+source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isPackage",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isPackage\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "loadDependencies",
+protocol: 'dependencies',
+fn: function (){
+var self=this;
+var classes,packages;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+classes=self._loadDependencyClasses();
+$2=_st(_st(classes)._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._package();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asSet();
+_st($2)._remove_ifAbsent_(self,(function(){
+}));
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},globals.Package)})},
+args: [],
+source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^ (classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself",
+messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "loadDependencyClasses",
+protocol: 'dependencies',
+fn: function (){
+var self=this;
+var starCategoryName;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $4,$3,$2,$6,$5,$7,$1;
+starCategoryName="*".__comma(self._name());
+$ctx1.sendIdx[","]=1;
+$4=self._classes();
+$ctx1.sendIdx["classes"]=1;
+$3=_st($4)._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._superclass();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$2=_st($3)._asSet();
+_st($2)._remove_ifAbsent_(nil,(function(){
+}));
+_st($2)._addAll_(_st(_st($Smalltalk())._classes())._select_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$6=_st(each)._protocols();
+$ctx2.sendIdx["protocols"]=1;
+$5=_st($6).__comma(_st(_st(each)._class())._protocols());
+return _st($5)._includes_(starCategoryName);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})})));
+$7=_st($2)._yourself();
+$1=$7;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},globals.Package)})},
+args: [],
+source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
+messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.pkgName;
+return self}, function($ctx1) {$ctx1.fill(self,"name",{},globals.Package)})},
+args: [],
+source: "name\x0a\x09<return self.pkgName>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "name:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._basicName_(aString);
+self._beDirty();
+return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},globals.Package)})},
+args: ["aString"],
+source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
+messageSends: ["basicName:", "beDirty"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "organization",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_("organization");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Package)})},
+args: [],
+source: "organization\x0a\x09^ self basicAt: 'organization'",
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+($ctx1.supercall = true, globals.Package.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
+$ctx1.supercall = false;
+_st(aStream)._nextPutAll_(" (");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._nextPutAll_(self._name());
+$ctx1.sendIdx["nextPutAll:"]=2;
+$1=_st(aStream)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Package)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
+messageSends: ["printOn:", "nextPutAll:", "name"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setupClasses",
+protocol: 'classes',
+fn: function (){
+var self=this;
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._classes();
+_st($1)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($ClassBuilder())._new())._setupClass_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["do:"]=1;
+$2=_st($1)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._initialize();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},globals.Package)})},
+args: [],
+source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
+messageSends: ["do:", "classes", "setupClass:", "new", "initialize"],
+referencedClasses: ["ClassBuilder"]
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sortedClasses",
+protocol: 'classes',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._sortedClasses_(self._classes());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},globals.Package)})},
+args: [],
+source: "sortedClasses\x0a\x09\x22Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143).\x22\x0a\x0a\x09^ self class sortedClasses: self classes",
+messageSends: ["sortedClasses:", "class", "classes"],
+referencedClasses: []
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transport",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1,$receiver;
+$2=self["@transport"];
+if(($receiver = $2) == null || $receiver.isNil){
+$3=_st($PackageTransport())._fromJson_(self._basicTransport());
+_st($3)._package_(self);
+$4=_st($3)._yourself();
+self["@transport"]=$4;
+$1=self["@transport"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"transport",{},globals.Package)})},
+args: [],
+source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
+messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"],
+referencedClasses: ["PackageTransport"]
+}),
+globals.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transport:",
+protocol: 'accessing',
+fn: function (aPackageTransport){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@transport"]=aPackageTransport;
+_st(aPackageTransport)._package_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},globals.Package)})},
+args: ["aPackageTransport"],
+source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
+messageSends: ["package:"],
+referencedClasses: []
+}),
+globals.Package);
+
+
+globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "named:",
+protocol: 'accessing',
+fn: function (aPackageName){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st($Smalltalk())._createPackage_(aPackageName);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},globals.Package.klass)})},
+args: ["aPackageName"],
+source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
+messageSends: ["packageAt:ifAbsent:", "createPackage:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Package.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "named:ifAbsent:",
+protocol: 'accessing',
+fn: function (aPackageName,aBlock){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},globals.Package.klass)})},
+args: ["aPackageName", "aBlock"],
+source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
+messageSends: ["packageAt:ifAbsent:"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Package.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "named:transport:",
+protocol: 'accessing',
+fn: function (aPackageName,aTransport){
+var self=this;
+var package_;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+package_=self._named_(aPackageName);
+_st(package_)._transport_(aTransport);
+$1=package_;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},globals.Package.klass)})},
+args: ["aPackageName", "aTransport"],
+source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
+messageSends: ["named:", "transport:"],
+referencedClasses: []
+}),
+globals.Package.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sortedClasses:",
+protocol: 'sorting',
+fn: function (classes){
+var self=this;
+var children,others,nodes,expandedClasses;
+function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4;
+children=[];
+others=[];
+_st(classes)._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(classes)._includes_(_st(each)._superclass());
+if(smalltalk.assert($1)){
+return _st(others)._add_(each);
+} else {
+return _st(children)._add_(each);
+$ctx2.sendIdx["add:"]=1;
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$ctx1.sendIdx["do:"]=1;
+nodes=_st(children)._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
+nodes=_st(nodes)._sorted_((function(a,b){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(a)._theClass();
+$ctx2.sendIdx["theClass"]=1;
+$2=_st($3)._name();
+$ctx2.sendIdx["name"]=1;
+return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
+}, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)})}));
+expandedClasses=_st($Array())._new();
+_st(nodes)._do_((function(aNode){
+return smalltalk.withContext(function($ctx2) {
+return _st(aNode)._traverseClassesWith_(expandedClasses);
+}, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)})}));
+$4=expandedClasses;
+return $4;
+}, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},globals.Package.klass)})},
+args: ["classes"],
+source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [ :each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [ children add: each ]\x0a\x09\x09\x09ifTrue: [ others add: each ]].\x0a\x09nodes := children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0 ].\x0a\x09nodes := nodes sorted: [ :a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses ].\x0a\x09^ expandedClasses",
+messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
+referencedClasses: ["ClassSorterNode", "Array"]
+}),
+globals.Package.klass);
+
+
+smalltalk.addClass('PackageStateObserver', globals.Object, [], 'Kernel-Infrastructure');
+globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announcer",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($SystemAnnouncer())._current();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.PackageStateObserver)})},
+args: [],
+source: "announcer\x0a\x09^ SystemAnnouncer current",
+messageSends: ["current"],
+referencedClasses: ["SystemAnnouncer"]
+}),
+globals.PackageStateObserver);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeSystem",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
+function $ClassAnnouncement(){return globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
+function $MethodAnnouncement(){return globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
+function $ProtocolAnnouncement(){return globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._announcer();
+_st($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
+$ctx1.sendIdx["on:send:to:"]=1;
+_st($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
+$ctx1.sendIdx["on:send:to:"]=2;
+_st($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
+$ctx1.sendIdx["on:send:to:"]=3;
+$2=_st($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.PackageStateObserver)})},
+args: [],
+source: "observeSystem\x0a\x09self announcer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassAnnouncement\x0a\x09\x09send: #onClassModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodAnnouncement\x0a\x09\x09send: #onMethodModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolAnnouncement\x0a\x09\x09send: #onProtocolModification:\x0a\x09\x09to: self",
+messageSends: ["on:send:to:", "announcer"],
+referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"]
+}),
+globals.PackageStateObserver);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onClassModification:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(anAnnouncement)._theClass();
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+var theClass;
+theClass=$receiver;
+_st(_st(theClass)._package())._beDirty();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)})},
+args: ["anAnnouncement"],
+source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass |\x0a\x09\x09theClass package beDirty ]",
+messageSends: ["ifNotNil:", "theClass", "beDirty", "package"],
+referencedClasses: []
+}),
+globals.PackageStateObserver);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onMethodModification:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=_st(_st(anAnnouncement)._method())._package();
+if(($receiver = $1) == null || $receiver.isNil){
+$1;
+} else {
+var package_;
+package_=$receiver;
+_st(package_)._beDirty();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)})},
+args: ["anAnnouncement"],
+source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
+messageSends: ["ifNotNil:", "package", "method", "beDirty"],
+referencedClasses: []
+}),
+globals.PackageStateObserver);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPackageAdded:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(anAnnouncement)._package())._beDirty();
+return self}, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)})},
+args: ["anAnnouncement"],
+source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
+messageSends: ["beDirty", "package"],
+referencedClasses: []
+}),
+globals.PackageStateObserver);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onProtocolModification:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(_st(_st(anAnnouncement)._theClass())._package())._beDirty();
+return self}, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)})},
+args: ["anAnnouncement"],
+source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement theClass package beDirty",
+messageSends: ["beDirty", "package", "theClass"],
+referencedClasses: []
+}),
+globals.PackageStateObserver);
+
+
+globals.PackageStateObserver.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "current",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@current"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@current"]=self._new();
+$1=self["@current"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"current",{},globals.PackageStateObserver.klass)})},
+args: [],
+source: "current\x0a\x09^ current ifNil: [ current := self new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: []
+}),
+globals.PackageStateObserver.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._current())._observeSystem();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.PackageStateObserver.klass)})},
+args: [],
+source: "initialize\x0a\x09self current observeSystem",
+messageSends: ["observeSystem", "current"],
+referencedClasses: []
+}),
+globals.PackageStateObserver.klass);
+
+
+smalltalk.addClass('PlatformInterface', globals.Object, [], 'Kernel-Infrastructure');
+globals.PlatformInterface.comment="I am single entry point to UI and environment interface.\x0aMy `initialize` tries several options (for now, browser environment only) to set myself up.\x0a\x0a## API\x0a\x0a    PlatformInterface alert: 'Hey, there is a problem'.\x0a    PlatformInterface confirm: 'Affirmative?'.\x0a    PlatformInterface prompt: 'Your name:'.\x0a\x0a    PlatformInterface ajax: #{\x0a        'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a    }.";
+
+globals.PlatformInterface.klass.iVarNames = ['worker'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ajax:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@worker"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._error_("ajax: not available");
+} else {
+$1=_st(self["@worker"])._ajax_(anObject);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.PlatformInterface.klass)})},
+args: ["anObject"],
+source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
+messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"],
+referencedClasses: []
+}),
+globals.PlatformInterface.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "alert:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@worker"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._error_("alert: not available");
+} else {
+$1=_st(self["@worker"])._alert_(aString);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.PlatformInterface.klass)})},
+args: ["aString"],
+source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
+messageSends: ["ifNotNil:ifNil:", "alert:", "error:"],
+referencedClasses: []
+}),
+globals.PlatformInterface.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "confirm:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@worker"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._error_("confirm: not available");
+} else {
+$1=_st(self["@worker"])._confirm_(aString);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.PlatformInterface.klass)})},
+args: ["aString"],
+source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
+messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"],
+referencedClasses: []
+}),
+globals.PlatformInterface.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "existsGlobal:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
+return true;
+}),(function(){
+return false;
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},globals.PlatformInterface.klass)})},
+args: ["aString"],
+source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
+messageSends: ["at:ifPresent:ifAbsent:", "globals"],
+referencedClasses: ["PlatformInterface"]
+}),
+globals.PlatformInterface.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "globals",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return (new Function('return this'))();;
+return self}, function($ctx1) {$ctx1.fill(self,"globals",{},globals.PlatformInterface.klass)})},
+args: [],
+source: "globals\x0a\x09<return (new Function('return this'))();>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PlatformInterface.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+var candidate;
+function $BrowserInterface(){return globals.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+($ctx1.supercall = true, globals.PlatformInterface.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+if(($receiver = $BrowserInterface()) == null || $receiver.isNil){
+$BrowserInterface();
+} else {
+candidate=_st($BrowserInterface())._new();
+candidate;
+$1=_st(candidate)._isAvailable();
+if(smalltalk.assert($1)){
+self._setWorker_(candidate);
+return self;
+};
+};
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},globals.PlatformInterface.klass)})},
+args: [],
+source: "initialize\x0a\x09| candidate |\x0a\x09\x0a\x09super initialize.\x0a\x09\x0a\x09BrowserInterface ifNotNil: [\x0a\x09\x09candidate := BrowserInterface new.\x0a\x09\x09candidate isAvailable ifTrue: [ self setWorker: candidate. ^ self ]\x0a\x09]",
+messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"],
+referencedClasses: ["BrowserInterface"]
+}),
+globals.PlatformInterface.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "prompt:",
+protocol: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@worker"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._error_("prompt: not available");
+} else {
+$1=_st(self["@worker"])._prompt_(aString);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.PlatformInterface.klass)})},
+args: ["aString"],
+source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
+messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"],
+referencedClasses: []
+}),
+globals.PlatformInterface.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "prompt:default:",
+protocol: 'actions',
+fn: function (aString,defaultString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@worker"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._error_("prompt: not available");
+} else {
+$1=_st(self["@worker"])._prompt_default_(aString,defaultString);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},globals.PlatformInterface.klass)})},
+args: ["aString", "defaultString"],
+source: "prompt: aString default: defaultString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString default: defaultString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
+messageSends: ["ifNotNil:ifNil:", "prompt:default:", "error:"],
+referencedClasses: []
+}),
+globals.PlatformInterface.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "setWorker:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@worker"]=anObject;
+return self},
+args: ["anObject"],
+source: "setWorker: anObject\x0a\x09worker := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.PlatformInterface.klass);
+
+
+smalltalk.addClass('Service', globals.Object, [], 'Kernel-Infrastructure');
+globals.Service.comment="I implement the basic behavior for class registration to a service.\x0a\x0aSee the `Transcript` class for a concrete service.\x0a\x0a## API\x0a\x0aUse class-side methods `#register:` and `#registerIfNone:` to register classes to a specific service.";
+
+globals.Service.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "current",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@current"];
+return $1;
+},
+args: [],
+source: "current\x0a\x09^ current",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Service.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._shouldNotImplement();
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.Service.klass)})},
+args: [],
+source: "new\x0a\x09self shouldNotImplement",
+messageSends: ["shouldNotImplement"],
+referencedClasses: []
+}),
+globals.Service.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "register:",
+protocol: 'registration',
+fn: function (anObject){
+var self=this;
+self["@current"]=anObject;
+return self},
+args: ["anObject"],
+source: "register: anObject\x0a\x09current := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Service.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "registerIfNone:",
+protocol: 'registration',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$receiver;
+$1=self._current();
+if(($receiver = $1) == null || $receiver.isNil){
+self._register_(anObject);
+} else {
+$1;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},globals.Service.klass)})},
+args: ["anObject"],
+source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
+messageSends: ["ifNil:", "current", "register:"],
+referencedClasses: []
+}),
+globals.Service.klass);
+
+
+smalltalk.addClass('ErrorHandler', globals.Service, [], 'Kernel-Infrastructure');
+globals.ErrorHandler.comment="I am the service used to handle Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aRegistered service instances must implement `#handleError:` to perform an action on the thrown exception.";
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._handleUnhandledError_(anError);
+return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ErrorHandler.klass)})},
+args: ["anError"],
+source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
+messageSends: ["handleUnhandledError:"],
+referencedClasses: []
+}),
+globals.ErrorHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "handleUnhandledError:",
+protocol: 'error handling',
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(anError)._wasHandled();
+if(smalltalk.assert($1)){
+return self;
+};
+$2=_st(self._current())._handleError_(anError);
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},globals.ErrorHandler.klass)})},
+args: ["anError"],
+source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
+messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"],
+referencedClasses: []
+}),
+globals.ErrorHandler.klass);
+
+
+smalltalk.addClass('Finder', globals.Service, [], 'Kernel-Infrastructure');
+globals.Finder.comment="I am the service responsible for finding classes/methods.\x0a__There is no default finder.__\x0a\x0a## API\x0a\x0aUse `#browse` on an object to find it.";
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "findClass:",
+protocol: 'finding',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._current())._findClass_(aClass);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},globals.Finder.klass)})},
+args: ["aClass"],
+source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
+messageSends: ["findClass:", "current"],
+referencedClasses: []
+}),
+globals.Finder.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "findMethod:",
+protocol: 'finding',
+fn: function (aCompiledMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._current())._findMethod_(aCompiledMethod);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},globals.Finder.klass)})},
+args: ["aCompiledMethod"],
+source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
+messageSends: ["findMethod:", "current"],
+referencedClasses: []
+}),
+globals.Finder.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "findString:",
+protocol: 'finding',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._current())._findString_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},globals.Finder.klass)})},
+args: ["aString"],
+source: "findString: aString\x0a\x09^ self current findString: aString",
+messageSends: ["findString:", "current"],
+referencedClasses: []
+}),
+globals.Finder.klass);
+
+
+smalltalk.addClass('Inspector', globals.Service, [], 'Kernel-Infrastructure');
+globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspect:",
+protocol: 'inspecting',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._current())._inspect_(anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Inspector.klass)})},
+args: ["anObject"],
+source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
+messageSends: ["inspect:", "current"],
+referencedClasses: []
+}),
+globals.Inspector.klass);
+
+
+smalltalk.addClass('ProgressHandler', globals.Service, [], 'Kernel-Infrastructure');
+globals.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aRegistered instances must implement `#do:on:displaying:`.\x0a\x0aThe default behavior is to simply iterate over the collection, using `NullProgressHandler`.";
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:on:displaying:",
+protocol: 'progress handling',
+fn: function (aBlock,aCollection,aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._current())._do_on_displaying_(aBlock,aCollection,aString);
+return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.ProgressHandler.klass)})},
+args: ["aBlock", "aCollection", "aString"],
+source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
+messageSends: ["do:on:displaying:", "current"],
+referencedClasses: []
+}),
+globals.ProgressHandler.klass);
+
+
+smalltalk.addClass('Transcript', globals.Service, [], 'Kernel-Infrastructure');
+globals.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a    Transcript \x0a        show: 'hello world';\x0a        cr;\x0a        show: anObject.";
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "clear",
+protocol: 'printing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._current())._clear();
+return self}, function($ctx1) {$ctx1.fill(self,"clear",{},globals.Transcript.klass)})},
+args: [],
+source: "clear\x0a\x09self current clear",
+messageSends: ["clear", "current"],
+referencedClasses: []
+}),
+globals.Transcript.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cr",
+protocol: 'printing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self._current())._show_(_st($String())._cr());
+return self}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.Transcript.klass)})},
+args: [],
+source: "cr\x0a\x09self current show: String cr",
+messageSends: ["show:", "current", "cr"],
+referencedClasses: ["String"]
+}),
+globals.Transcript.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspect:",
+protocol: 'printing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._show_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Transcript.klass)})},
+args: ["anObject"],
+source: "inspect: anObject\x0a\x09self show: anObject",
+messageSends: ["show:"],
+referencedClasses: []
+}),
+globals.Transcript.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "open",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._current())._open();
+return self}, function($ctx1) {$ctx1.fill(self,"open",{},globals.Transcript.klass)})},
+args: [],
+source: "open\x0a\x09self current open",
+messageSends: ["open", "current"],
+referencedClasses: []
+}),
+globals.Transcript.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "show:",
+protocol: 'printing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._current())._show_(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.Transcript.klass)})},
+args: ["anObject"],
+source: "show: anObject\x0a\x09self current show: anObject",
+messageSends: ["show:", "current"],
+referencedClasses: []
+}),
+globals.Transcript.klass);
+
+
+smalltalk.addClass('Setting', globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
+globals.Setting.comment="I represent a setting accessible via `Smalltalk settings`.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: 'defaultValue'`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultValue",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@defaultValue"];
+return $1;
+},
+args: [],
+source: "defaultValue\x0a\x09^ defaultValue",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Setting);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultValue:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@defaultValue"]=anObject;
+return self},
+args: ["anObject"],
+source: "defaultValue: anObject\x0a\x09defaultValue := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Setting);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@key"];
+return $1;
+},
+args: [],
+source: "key\x0a\x09^ key",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Setting);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "key:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@key"]=anObject;
+return self},
+args: ["anObject"],
+source: "key: anObject\x0a\x09key := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Setting);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._defaultValue();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value",{},globals.Setting)})},
+args: [],
+source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
+messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Setting);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($Smalltalk())._settings())._at_put_(self._key(),aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:",{aString:aString},globals.Setting)})},
+args: ["aString"],
+source: "value: aString\x0a\x09^ Smalltalk settings at: self key put: aString",
+messageSends: ["at:put:", "settings", "key"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.Setting);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsent:",
+protocol: 'instance creation',
+fn: function (aString,anotherString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=($ctx1.supercall = true, globals.Setting.klass.superclass.fn.prototype._new.apply(_st(self), []));
+$ctx1.supercall = false;
+_st($2)._key_(aString);
+_st($2)._defaultValue_(anotherString);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,anotherString:anotherString},globals.Setting.klass)})},
+args: ["aString", "anotherString"],
+source: "at: aString ifAbsent: anotherString\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: anotherString;\x0a\x09\x09yourself",
+messageSends: ["key:", "new", "defaultValue:", "yourself"],
+referencedClasses: []
+}),
+globals.Setting.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._shouldNotImplement();
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.Setting.klass)})},
+args: [],
+source: "new\x0a\x09self shouldNotImplement",
+messageSends: ["shouldNotImplement"],
+referencedClasses: []
+}),
+globals.Setting.klass);
+
+
+smalltalk.addClass('SmalltalkImage', globals.Object, [], 'Kernel-Infrastructure');
+globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `smalltalk` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addGlobalJsVariable:",
+protocol: 'globals',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._globalJsVariables())._add_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)})},
+args: ["aString"],
+source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
+messageSends: ["add:", "globalJsVariables"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "amdRequire",
+protocol: 'accessing amd',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._vm())._at_("amdRequire");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"amdRequire",{},globals.SmalltalkImage)})},
+args: [],
+source: "amdRequire\x0a\x09^ self vm at: 'amdRequire'",
+messageSends: ["at:", "vm"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asSmalltalkException:",
+protocol: 'error handling',
+fn: function (anObject){
+var self=this;
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(anObject)._isKindOf_($Error());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(smalltalk.assert($2)){
+$1=anObject;
+} else {
+$1=_st($JavaScriptException())._on_(anObject);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},globals.SmalltalkImage)})},
+args: ["anObject"],
+source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
+messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"],
+referencedClasses: ["Error", "JavaScriptException"]
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._deprecatedAPI();
+$1=_st(self._globals())._at_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.SmalltalkImage)})},
+args: ["aString"],
+source: "at: aString\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString",
+messageSends: ["deprecatedAPI", "at:", "globals"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:ifAbsent:",
+protocol: 'accessing',
+fn: function (aKey,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._includesKey_(aKey);
+if(smalltalk.assert($2)){
+$1=self._at_(aKey);
+} else {
+$1=_st(aBlock)._value();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.SmalltalkImage)})},
+args: ["aKey", "aBlock"],
+source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self at: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
+messageSends: ["ifTrue:ifFalse:", "includesKey:", "at:", "value"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "at:put:",
+protocol: 'accessing',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._deprecatedAPI();
+$1=_st(self._globals())._at_put_(aString,anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.SmalltalkImage)})},
+args: ["aString", "anObject"],
+source: "at: aString put: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString put: anObject",
+messageSends: ["deprecatedAPI", "at:put:", "globals"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicCreatePackage:",
+protocol: 'private',
+fn: function (packageName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.addPackage(packageName);
+return self}, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},globals.SmalltalkImage)})},
+args: ["packageName"],
+source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicParse:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+function $SmalltalkParser(){return globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($SmalltalkParser())._parse_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},globals.SmalltalkImage)})},
+args: ["aString"],
+source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
+messageSends: ["parse:"],
+referencedClasses: ["SmalltalkParser"]
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classes",
+protocol: 'classes',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.classes();
+return self}, function($ctx1) {$ctx1.fill(self,"classes",{},globals.SmalltalkImage)})},
+args: [],
+source: "classes\x0a\x09<return smalltalk.classes()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "createPackage:",
+protocol: 'packages',
+fn: function (packageName){
+var self=this;
+var package_,announcement;
+function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+package_=self._basicCreatePackage_(packageName);
+$1=_st($PackageAdded())._new();
+_st($1)._package_(package_);
+$2=_st($1)._yourself();
+announcement=$2;
+_st(_st($SystemAnnouncer())._current())._announce_(announcement);
+$3=package_;
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},globals.SmalltalkImage)})},
+args: ["packageName"],
+source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
+messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"],
+referencedClasses: ["PackageAdded", "SystemAnnouncer"]
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "createPackage:properties:",
+protocol: 'private',
+fn: function (packageName,aDict){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self._deprecatedAPI();
+$1=_st(aDict)._isEmpty();
+if(! smalltalk.assert($1)){
+self._error_("createPackage:properties: called with nonempty properties");
+};
+$2=self._createPackage_(packageName);
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},globals.SmalltalkImage)})},
+args: ["packageName", "aDict"],
+source: "createPackage: packageName properties: aDict\x0a\x09\x22Needed to import .st files: they begin with this call.\x22\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a\x09^ self createPackage: packageName",
+messageSends: ["deprecatedAPI", "ifFalse:", "isEmpty", "error:", "createPackage:"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "current",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._deprecatedAPI();
+return self;
+}, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage)})},
+args: [],
+source: "current\x0a\x09\x22Backward compatibility for Smalltalk current ...\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self",
+messageSends: ["deprecatedAPI"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultAmdNamespace",
+protocol: 'accessing amd',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1="transport.defaultAmdNamespace"._settingValue();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},globals.SmalltalkImage)})},
+args: [],
+source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
+messageSends: ["settingValue"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultAmdNamespace:",
+protocol: 'accessing amd',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+"transport.defaultAmdNamespace"._settingValue_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},globals.SmalltalkImage)})},
+args: ["aString"],
+source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
+messageSends: ["settingValue:"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deleteClass:",
+protocol: 'private',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.removeClass(aClass);
+return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},globals.SmalltalkImage)})},
+args: ["aClass"],
+source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<smalltalk.removeClass(aClass)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deleteGlobalJsVariable:",
+protocol: 'globals',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
+}));
+return self}, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)})},
+args: ["aString"],
+source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
+messageSends: ["remove:ifAbsent:", "globalJsVariables"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deletePackage:",
+protocol: 'private',
+fn: function (packageName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+delete smalltalk.packages[packageName];
+return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},globals.SmalltalkImage)})},
+args: ["packageName"],
+source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete smalltalk.packages[packageName]>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "globalJsVariables",
+protocol: 'globals',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.globalJsVariables;
+return self}, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},globals.SmalltalkImage)})},
+args: [],
+source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return smalltalk.globalJsVariables>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "globals",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return globals;
+return self}, function($ctx1) {$ctx1.fill(self,"globals",{},globals.SmalltalkImage)})},
+args: [],
+source: "globals\x0a\x09\x22Future compatibility to be able to use Smalltalk globals at: ...\x22\x0a\x09<return globals>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "includesKey:",
+protocol: 'accessing',
+fn: function (aKey){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.hasOwnProperty(aKey);
+return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.SmalltalkImage)})},
+args: ["aKey"],
+source: "includesKey: aKey\x0a\x09<return smalltalk.hasOwnProperty(aKey)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSmalltalkObject:",
+protocol: 'testing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return typeof anObject.klass !== 'undefined';
+return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},globals.SmalltalkImage)})},
+args: ["anObject"],
+source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<return typeof anObject.klass !== 'undefined'>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "packageAt:",
+protocol: 'packages',
+fn: function (packageName){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.packages[packageName];
+return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},globals.SmalltalkImage)})},
+args: ["packageName"],
+source: "packageAt: packageName\x0a\x09<return smalltalk.packages[packageName]>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "packageAt:ifAbsent:",
+protocol: 'packages',
+fn: function (packageName,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._packageAt_(packageName);
+$1=_st($2)._ifNil_(aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},globals.SmalltalkImage)})},
+args: ["packageName", "aBlock"],
+source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
+messageSends: ["ifNil:", "packageAt:"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "packages",
+protocol: 'packages',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return Object.keys(smalltalk.packages).map(function(k) {
+			return smalltalk.packages[k];
+		})
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"packages",{},globals.SmalltalkImage)})},
+args: [],
+source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys(smalltalk.packages).map(function(k) {\x0a\x09\x09\x09return smalltalk.packages[k];\x0a\x09\x09})\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parse:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+var result;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+result=self._basicParse_(aString);
+return result;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._tryCatch_((function(ex){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._parseError_parsing_(ex,aString))._signal();
+}, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
+$2=result;
+_st($2)._source_(aString);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},globals.SmalltalkImage)})},
+args: ["aString"],
+source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
+messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "parseError:parsing:",
+protocol: 'error handling',
+fn: function (anException,aString){
+var self=this;
+function $ParseError(){return globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$8,$7,$6,$9,$5,$4,$3,$1;
+$2=_st($ParseError())._new();
+$8=_st(anException)._basicAt_("line");
+$ctx1.sendIdx["basicAt:"]=1;
+$7="Parse error on line ".__comma($8);
+$6=_st($7).__comma(" column ");
+$ctx1.sendIdx[","]=4;
+$9=_st(anException)._basicAt_("column");
+$ctx1.sendIdx["basicAt:"]=2;
+$5=_st($6).__comma($9);
+$ctx1.sendIdx[","]=3;
+$4=_st($5).__comma(" : Unexpected character ");
+$ctx1.sendIdx[","]=2;
+$3=_st($4).__comma(_st(anException)._basicAt_("found"));
+$ctx1.sendIdx[","]=1;
+$1=_st($2)._messageText_($3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},globals.SmalltalkImage)})},
+args: ["anException", "aString"],
+source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
+messageSends: ["messageText:", "new", ",", "basicAt:"],
+referencedClasses: ["ParseError"]
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pseudoVariableNames",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=["self", "super", "nil", "true", "false", "thisContext"];
+return $1;
+},
+args: [],
+source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "readJSObject:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.readJSObject(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},globals.SmalltalkImage)})},
+args: ["anObject"],
+source: "readJSObject: anObject\x0a\x09<return smalltalk.readJSObject(anObject)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removeClass:",
+protocol: 'classes',
+fn: function (aClass){
+var self=this;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $ClassRemoved(){return globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=_st(aClass)._isMetaclass();
+if(smalltalk.assert($1)){
+self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
+};
+self._deleteClass_(aClass);
+$2=_st($ClassRemoved())._new();
+_st($2)._theClass_(aClass);
+$3=_st($2)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($3);
+return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.SmalltalkImage)})},
+args: ["aClass"],
+source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
+messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"],
+referencedClasses: ["SystemAnnouncer", "ClassRemoved"]
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "removePackage:",
+protocol: 'packages',
+fn: function (packageName){
+var self=this;
+var pkg;
+return smalltalk.withContext(function($ctx1) { 
+pkg=self._packageAt_ifAbsent_(packageName,(function(){
+return smalltalk.withContext(function($ctx2) {
+return self._error_("Missing package: ".__comma(packageName));
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+_st(_st(pkg)._classes())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._removeClass_(each);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
+self._deletePackage_(packageName);
+return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},globals.SmalltalkImage)})},
+args: ["packageName"],
+source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self deletePackage: packageName",
+messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renamePackage:to:",
+protocol: 'packages',
+fn: function (packageName,newName){
+var self=this;
+var pkg;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$receiver;
+pkg=self._packageAt_ifAbsent_(packageName,(function(){
+return smalltalk.withContext(function($ctx2) {
+$1="Missing package: ".__comma(packageName);
+$ctx2.sendIdx[","]=1;
+return self._error_($1);
+$ctx2.sendIdx["error:"]=1;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$2=self._packageAt_(newName);
+if(($receiver = $2) == null || $receiver.isNil){
+$2;
+} else {
+self._error_("Already exists a package called: ".__comma(newName));
+};
+_st(self._at_("packages"))._at_put_(newName,pkg);
+_st(pkg)._name_(newName);
+self._deletePackage_(packageName);
+return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},globals.SmalltalkImage)})},
+args: ["packageName", "newName"],
+source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09(self at: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
+messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reservedWords",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.reservedWords;
+return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},globals.SmalltalkImage)})},
+args: [],
+source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return smalltalk.reservedWords>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "settings",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $SmalltalkSettings(){return globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
+return $SmalltalkSettings();
+},
+args: [],
+source: "settings\x0a\x09^ SmalltalkSettings",
+messageSends: [],
+referencedClasses: ["SmalltalkSettings"]
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "version",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "0.13.0-pre";
+},
+args: [],
+source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.13.0-pre'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "vm",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk;
+return self}, function($ctx1) {$ctx1.fill(self,"vm",{},globals.SmalltalkImage)})},
+args: [],
+source: "vm\x0a\x09\x22Future compatibility to be able to use Smalltalk vm ...\x22\x0a\x09<return smalltalk>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.SmalltalkImage);
+
+
+globals.SmalltalkImage.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "current",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@current"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@current"]=($ctx1.supercall = true, globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply(_st(self), []));
+$ctx1.supercall = false;
+$1=self["@current"];
+} else {
+self._deprecatedAPI();
+$1=self["@current"];
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage.klass)})},
+args: [],
+source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
+messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"],
+referencedClasses: []
+}),
+globals.SmalltalkImage.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(globals)._at_put_("Smalltalk",self._current());
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.SmalltalkImage.klass)})},
+args: [],
+source: "initialize\x0a\x09globals at: 'Smalltalk' put: self current",
+messageSends: ["at:put:", "current"],
+referencedClasses: []
+}),
+globals.SmalltalkImage.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._shouldNotImplement();
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.SmalltalkImage.klass)})},
+args: [],
+source: "new\x0a\x09self shouldNotImplement",
+messageSends: ["shouldNotImplement"],
+referencedClasses: []
+}),
+globals.SmalltalkImage.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "do:displayingProgress:",
+protocol: '*Kernel-Infrastructure',
+fn: function (aBlock,aString){
+var self=this;
+function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
+return smalltalk.withContext(function($ctx1) { 
+_st($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
+return self}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},globals.SequenceableCollection)})},
+args: ["aBlock", "aString"],
+source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
+messageSends: ["do:on:displaying:"],
+referencedClasses: ["ProgressHandler"]
+}),
+globals.SequenceableCollection);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJavaScriptSelector",
+protocol: '*Kernel-Infrastructure',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._replace_with_("^([a-zA-Z0-9]*).*$","$1");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},globals.String)})},
+args: [],
+source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^ self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
+messageSends: ["replace:with:"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asSetting",
+protocol: '*Kernel-Infrastructure',
+fn: function (){
+var self=this;
+function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Setting())._at_ifAbsent_(self,nil);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asSetting",{},globals.String)})},
+args: [],
+source: "asSetting\x0a\x09^ Setting at: self ifAbsent: nil",
+messageSends: ["at:ifAbsent:"],
+referencedClasses: ["Setting"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asSettingIfAbsent:",
+protocol: '*Kernel-Infrastructure',
+fn: function (aString){
+var self=this;
+function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Setting())._at_ifAbsent_(self,aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "asSettingIfAbsent: aString\x0a\x09^ Setting at: self ifAbsent: aString",
+messageSends: ["at:ifAbsent:"],
+referencedClasses: ["Setting"]
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "settingValue",
+protocol: '*Kernel-Infrastructure',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._asSetting())._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"settingValue",{},globals.String)})},
+args: [],
+source: "settingValue\x0a\x09^ self asSetting value",
+messageSends: ["value", "asSetting"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "settingValue:",
+protocol: '*Kernel-Infrastructure',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._asSetting())._value_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"settingValue:",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "settingValue: aString\x0a\x09^ self asSetting value: aString",
+messageSends: ["value:", "asSetting"],
+referencedClasses: []
+}),
+globals.String);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "settingValueIfAbsent:",
+protocol: '*Kernel-Infrastructure',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._asSettingIfAbsent_(aString))._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aString:aString},globals.String)})},
+args: ["aString"],
+source: "settingValueIfAbsent: aString\x0a\x09^ (self asSettingIfAbsent: aString) value",
+messageSends: ["value", "asSettingIfAbsent:"],
+referencedClasses: []
+}),
+globals.String);
+
+});

+ 1402 - 0
src/Kernel-Infrastructure.st

@@ -0,0 +1,1402 @@
+Smalltalk createPackage: 'Kernel-Infrastructure'!
+Object subclass: #ConsoleErrorHandler
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!ConsoleErrorHandler commentStamp!
+I am manage Smalltalk errors, displaying the stack in the console.!
+
+!ConsoleErrorHandler methodsFor: 'error handling'!
+
+handleError: anError
+	anError context ifNotNil: [ self logErrorContext: anError context ].
+	self logError: anError
+! !
+
+!ConsoleErrorHandler methodsFor: 'private'!
+
+log: aString
+	console log: aString
+!
+
+logContext: aContext
+	aContext home ifNotNil: [
+		self logContext: aContext home ].
+	self log: aContext asString
+!
+
+logError: anError
+	self log: anError messageText
+!
+
+logErrorContext: aContext
+	aContext ifNotNil: [
+		aContext home ifNotNil: [
+			self logContext: aContext home ]]
+! !
+
+ConsoleErrorHandler class instanceVariableNames: 'current'!
+
+!ConsoleErrorHandler class methodsFor: 'initialization'!
+
+initialize
+	ErrorHandler registerIfNone: self new
+! !
+
+Object subclass: #InterfacingObject
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!InterfacingObject commentStamp!
+I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.
+
+## API
+
+    self alert: 'Hey, there is a problem'.
+    self confirm: 'Affirmative?'.
+    self prompt: 'Your name:'.
+
+    self ajax: #{
+        'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'
+    }.!
+
+!InterfacingObject methodsFor: 'actions'!
+
+ajax: anObject
+	^ PlatformInterface ajax: anObject
+!
+
+alert: aString
+	^ PlatformInterface alert: aString
+!
+
+confirm: aString
+	^ PlatformInterface confirm: aString
+!
+
+prompt: aString
+	^ PlatformInterface prompt: aString
+!
+
+prompt: aString default: defaultString
+	^ PlatformInterface prompt: aString default: defaultString
+! !
+
+InterfacingObject subclass: #Environment
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!Environment commentStamp!
+I provide an unified entry point to manipulate Amber packages, classes and methods.
+
+Typical use cases include IDEs, remote access and restricting browsing.!
+
+!Environment methodsFor: 'accessing'!
+
+allSelectors
+	^ Smalltalk vm allSelectors
+!
+
+availableClassNames
+	^ Smalltalk classes 
+		collect: [ :each | each name ]
+!
+
+availablePackageNames
+	^ Smalltalk packages 
+		collect: [ :each | each name ]
+!
+
+availableProtocolsFor: aClass
+	| protocols |
+	
+	protocols := aClass protocols.
+	aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].
+	^ protocols asSet asArray sort
+!
+
+classBuilder
+	^ ClassBuilder new
+!
+
+classNamed: aString
+	^ (Smalltalk globals at: aString asSymbol)
+		ifNil: [ self error: 'Invalid class name' ]
+!
+
+classes
+	^ Smalltalk classes
+!
+
+doItReceiver
+	^ DoIt new
+!
+
+packages
+	^ Smalltalk packages
+!
+
+systemAnnouncer
+	^ (Smalltalk globals at: #SystemAnnouncer) current
+! !
+
+!Environment methodsFor: 'actions'!
+
+commitPackage: aPackage onSuccess: aBlock onError: anotherBlock
+	aPackage transport
+		commitOnSuccess: aBlock
+		onError: anotherBlock
+!
+
+copyClass: aClass to: aClassName
+	(Smalltalk globals at: aClassName)
+		ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].
+		
+	ClassBuilder new copyClass: aClass named: aClassName
+!
+
+inspect: anObject
+	Inspector inspect: anObject
+!
+
+moveClass: aClass toPackage: aPackageName
+	| package |
+	
+	package := Package named: aPackageName.
+	package ifNil: [ self error: 'Invalid package name' ].
+	package == aClass package ifTrue: [ ^ self ].
+	
+	aClass package: package
+!
+
+moveMethod: aMethod toClass: aClassName
+	| destinationClass |
+	
+	destinationClass := self classNamed: aClassName.
+	destinationClass == aMethod methodClass ifTrue: [ ^ self ].
+	
+	aMethod methodClass isMetaclass ifTrue: [ 
+		destinationClass := destinationClass class ].
+	
+	destinationClass 
+		compile: aMethod source
+		protocol: aMethod protocol.
+	aMethod methodClass 
+		removeCompiledMethod: aMethod
+!
+
+moveMethod: aMethod toProtocol: aProtocol
+	aMethod protocol: aProtocol
+!
+
+removeClass: aClass
+	Smalltalk removeClass: aClass
+!
+
+removeMethod: aMethod
+	aMethod methodClass removeCompiledMethod: aMethod
+!
+
+removeProtocol: aString from: aClass
+	(aClass methodsInProtocol: aString)
+		do: [ :each | aClass removeCompiledMethod: each ]
+!
+
+renameClass: aClass to: aClassName
+	(Smalltalk globals at: aClassName)
+		ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].
+		
+	ClassBuilder new renameClass: aClass to: aClassName
+!
+
+renameProtocol: aString to: anotherString in: aClass
+	(aClass methodsInProtocol: aString)
+		do: [ :each | each protocol: anotherString ]
+!
+
+setClassCommentOf: aClass to: aString
+	aClass comment: aString
+! !
+
+!Environment methodsFor: 'compiling'!
+
+addInstVarNamed: aString to: aClass
+	self classBuilder
+		addSubclassOf: aClass superclass 
+		named: aClass name 
+		instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
+		package: aClass package name
+!
+
+compileClassComment: aString for: aClass
+	aClass comment: aString
+!
+
+compileClassDefinition: aString
+	[ self evaluate: aString for: DoIt new ]
+		on: Error
+		do: [ :error | self alert: error messageText ]
+!
+
+compileMethod: sourceCode for: class protocol: protocol
+	^ class
+		compile: sourceCode
+		protocol: protocol
+! !
+
+!Environment methodsFor: 'error handling'!
+
+evaluate: aBlock on: anErrorClass do: exceptionBlock
+	"Evaluate a block and catch exceptions happening on the environment stack"
+	
+	aBlock tryCatch: [ :exception | 
+		(exception isKindOf: (self classNamed: anErrorClass name))
+			ifTrue: [ exceptionBlock value: exception ]
+ 			ifFalse: [ exception signal ] ]
+! !
+
+!Environment methodsFor: 'evaluating'!
+
+evaluate: aString for: anObject
+	^ Evaluator evaluate: aString for: anObject
+! !
+
+!Environment methodsFor: 'services'!
+
+registerErrorHandler: anErrorHandler
+	ErrorHandler register: anErrorHandler
+!
+
+registerFinder: aFinder
+	Finder register: aFinder
+!
+
+registerInspector: anInspector
+	Inspector register: anInspector
+!
+
+registerProgressHandler: aProgressHandler
+	ProgressHandler register: aProgressHandler
+!
+
+registerTranscript: aTranscript
+	Transcript register: aTranscript
+! !
+
+ProtoObject subclass: #JSObjectProxy
+	instanceVariableNames: 'jsObject'
+	package: 'Kernel-Infrastructure'!
+!JSObjectProxy commentStamp!
+I handle sending messages to JavaScript objects, making  JavaScript object accessing from Amber fully transparent.
+My instances make intensive use of `#doesNotUnderstand:`.
+
+My instances are automatically created by Amber whenever a message is sent to a JavaScript object.
+
+## Usage examples
+
+JSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.
+
+	window alert: 'hello world'.
+	window inspect.
+	(window jQuery: 'body') append: 'hello world'
+
+Amber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.
+
+## Message conversion rules
+
+- `someUser name` becomes `someUser.name`
+- `someUser name: 'John'` becomes `someUser name = "John"`
+- `console log: 'hello world'` becomes `console.log('hello world')`
+- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`
+
+__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.!
+
+!JSObjectProxy methodsFor: 'accessing'!
+
+at: aString
+	<return self['@jsObject'][aString]>
+!
+
+at: aString ifAbsent: aBlock
+	"return the aString property or evaluate aBlock if the property is not defined on the object"
+	<
+		var obj = self['@jsObject'];
+		return aString in obj ? obj[aString] : aBlock._value();
+	>
+!
+
+at: aString ifPresent: aBlock
+	"return the evaluation of aBlock with the value if the property is defined or return nil"
+	<
+		var obj = self['@jsObject'];
+		return aString in obj ? aBlock._value_(obj[aString]) : nil;
+	>
+!
+
+at: aString ifPresent: aBlock ifAbsent: anotherBlock
+	"return the evaluation of aBlock with the value if the property is defined
+	or return value of anotherBlock"
+	<
+		var obj = self['@jsObject'];
+		return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
+	>
+!
+
+at: aString put: anObject
+	<return self['@jsObject'][aString] = anObject>
+!
+
+jsObject
+	^ jsObject
+!
+
+jsObject: aJSObject
+	jsObject := aJSObject
+!
+
+lookupProperty: aString
+	"Looks up a property in JS object.
+	Answer the property if it is present, or nil if it is not present."
+	
+	<return aString in self._jsObject() ? aString : nil>
+! !
+
+!JSObjectProxy methodsFor: 'comparing'!
+
+= anObject
+	anObject class == self class ifFalse: [ ^ false ].
+	^ self compareJSObjectWith: anObject jsObject
+! !
+
+!JSObjectProxy methodsFor: 'enumerating'!
+
+asJSON
+	"Answers the receiver in a stringyfy-friendly fashion"
+
+	^ jsObject
+!
+
+keysAndValuesDo: aBlock
+	<
+		var o = self['@jsObject'];
+		for(var i in o) {
+			aBlock._value_value_(i, o[i]);
+		}
+	>
+! !
+
+!JSObjectProxy methodsFor: 'printing'!
+
+printOn: aStream
+	aStream nextPutAll: self printString
+!
+
+printString
+	<
+		var js = self['@jsObject'];
+		return js.toString
+			? js.toString()
+			: Object.prototype.toString.call(js)
+	>
+! !
+
+!JSObjectProxy methodsFor: 'private'!
+
+compareJSObjectWith: aJSObject
+ 	<return self["@jsObject"] === aJSObject>
+! !
+
+!JSObjectProxy methodsFor: 'proxy'!
+
+addObjectVariablesTo: aDictionary
+	<
+		for(var i in self['@jsObject']) {
+			aDictionary._at_put_(i, self['@jsObject'][i]);
+		}
+	>
+!
+
+doesNotUnderstand: aMessage
+	^ (self lookupProperty: aMessage selector asJavaScriptSelector)
+		ifNil: [ super doesNotUnderstand: aMessage ]
+		ifNotNil: [ :jsSelector | 
+			self 
+				forwardMessage: jsSelector 
+				withArguments: aMessage arguments ]
+!
+
+forwardMessage: aString withArguments: anArray
+	<
+		return smalltalk.send(self._jsObject(), aString, anArray);
+	>
+!
+
+inspectOn: anInspector
+	| variables |
+	variables := Dictionary new.
+	variables at: '#self' put: self jsObject.
+	anInspector setLabel: self printString.
+	self addObjectVariablesTo: variables.
+	anInspector setVariables: variables
+! !
+
+!JSObjectProxy class methodsFor: 'instance creation'!
+
+on: aJSObject
+	^ self new
+		jsObject: aJSObject;
+		yourself
+! !
+
+Object subclass: #NullProgressHandler
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!NullProgressHandler commentStamp!
+I am the default progress handler. I do not display any progress, and simply iterate over the collection.!
+
+!NullProgressHandler methodsFor: 'progress handling'!
+
+do: aBlock on: aCollection displaying: aString
+	aCollection do: aBlock
+! !
+
+NullProgressHandler class instanceVariableNames: 'current'!
+
+!NullProgressHandler class methodsFor: 'initialization'!
+
+initialize
+	ProgressHandler registerIfNone: self new
+! !
+
+Object subclass: #Organizer
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!Organizer commentStamp!
+I represent categorization information. 
+
+## API
+
+Use `#addElement:` and `#removeElement:` to manipulate instances.!
+
+!Organizer methodsFor: 'accessing'!
+
+addElement: anObject
+	<self.elements.addElement(anObject)>
+!
+
+elements
+	^ (self basicAt: 'elements') copy
+!
+
+removeElement: anObject
+	<self.elements.removeElement(anObject)>
+! !
+
+Organizer subclass: #ClassOrganizer
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!ClassOrganizer commentStamp!
+I am an organizer specific to classes. I hold method categorization information for classes.!
+
+!ClassOrganizer methodsFor: 'accessing'!
+
+addElement: aString
+	super addElement: aString.
+
+	SystemAnnouncer current announce: (ProtocolAdded new
+		protocol: aString;
+		theClass: self theClass;
+		yourself)
+!
+
+removeElement: aString
+	super removeElement: aString.
+
+	SystemAnnouncer current announce: (ProtocolRemoved new
+		protocol: aString;
+		theClass: self theClass;
+		yourself)
+!
+
+theClass
+	< return self.theClass >
+! !
+
+Organizer subclass: #PackageOrganizer
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!PackageOrganizer commentStamp!
+I am an organizer specific to packages. I hold classes categorization information.!
+
+Object subclass: #Package
+	instanceVariableNames: 'transport dirty'
+	package: 'Kernel-Infrastructure'!
+!Package commentStamp!
+I am similar to a "class category" typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.
+
+Each package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.
+
+## API
+
+Packages are manipulated through "Smalltalk current", like for example finding one based on a name or with `Package class >> #name` directly:
+
+    Smalltalk current packageAt: 'Kernel'
+    Package named: 'Kernel'
+
+A package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports "class extensions" so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.
+
+You can fetch a package from the server:
+
+	Package load: 'Additional-Examples'!
+
+!Package methodsFor: 'accessing'!
+
+beClean
+	dirty := false.
+	
+	SystemAnnouncer current announce: (PackageClean new
+		package: self;
+		yourself)
+!
+
+beDirty
+	dirty := true.
+	
+	SystemAnnouncer current announce: (PackageClean new
+		package: self;
+		yourself)
+!
+
+classTemplate
+	^ String streamContents: [ :stream |
+		stream
+			nextPutAll: 'Object';
+			nextPutAll: ' subclass: #NameOfSubclass';
+			nextPutAll: String lf, String tab;
+			nextPutAll: 'instanceVariableNames: '''''.
+		stream
+			nextPutAll: '''', String lf, String tab;
+			nextPutAll: 'package: ''';
+			nextPutAll: self name;
+			nextPutAll: '''' ]
+!
+
+definition
+	^ String streamContents: [ :stream |
+		stream 
+			nextPutAll: self class name;
+			nextPutAll: String lf, String tab;
+			nextPutAll: ' named: ';
+			nextPutAll: '''', self name, '''';
+			nextPutAll: String lf, String tab;
+			nextPutAll:  ' transport: (';
+			nextPutAll: self transport definition, ')' ]
+!
+
+name
+	<return self.pkgName>
+!
+
+name: aString
+	self basicName: aString.
+	self beDirty
+!
+
+organization
+	^ self basicAt: 'organization'
+!
+
+transport
+	^ transport ifNil: [ 
+		transport := (PackageTransport fromJson: self basicTransport)
+			package: self;
+			yourself ]
+!
+
+transport: aPackageTransport
+	transport := aPackageTransport.
+	aPackageTransport package: self
+! !
+
+!Package methodsFor: 'classes'!
+
+classes
+	^ self organization elements
+!
+
+setupClasses
+	self classes
+		do: [ :each | ClassBuilder new setupClass: each ];
+		do: [ :each | each initialize ]
+!
+
+sortedClasses
+	"Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)."
+
+	^ self class sortedClasses: self classes
+! !
+
+!Package methodsFor: 'dependencies'!
+
+loadDependencies
+	"Returns list of packages that need to be loaded
+	before loading this package."
+	
+	| classes packages |
+	classes := self loadDependencyClasses.
+	^ (classes collect: [ :each | each package ]) asSet
+		remove: self ifAbsent: [];
+		yourself
+!
+
+loadDependencyClasses
+	"Returns classes needed at the time of loading a package.
+	These are all that are used to subclass
+	and to define an extension method"
+	
+	| starCategoryName |
+	starCategoryName := '*', self name.
+	^ (self classes collect: [ :each | each superclass ]) asSet
+		remove: nil ifAbsent: [];
+		addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);
+		yourself
+! !
+
+!Package methodsFor: 'printing'!
+
+printOn: aStream
+	super printOn: aStream.
+	aStream 
+		nextPutAll: ' (';
+		nextPutAll: self name;
+		nextPutAll: ')'
+! !
+
+!Package methodsFor: 'private'!
+
+basicName: aString
+	<self.pkgName = aString>
+!
+
+basicTransport
+	"Answer the transport literal JavaScript object as setup in the JavaScript file, if any"
+	
+	<return self.transport>
+! !
+
+!Package methodsFor: 'testing'!
+
+isDirty
+	^ dirty ifNil: [ false ]
+!
+
+isPackage
+	^ true
+! !
+
+Package class instanceVariableNames: 'defaultCommitPathJs defaultCommitPathSt'!
+
+!Package class methodsFor: 'accessing'!
+
+named: aPackageName
+	^ Smalltalk 
+		packageAt: aPackageName
+		ifAbsent: [ 
+			Smalltalk createPackage: aPackageName ]
+!
+
+named: aPackageName ifAbsent: aBlock
+	^ Smalltalk packageAt: aPackageName ifAbsent: aBlock
+!
+
+named: aPackageName transport: aTransport
+	| package |
+	
+	package := self named: aPackageName.
+	package transport: aTransport.
+	
+	^ package
+! !
+
+!Package class methodsFor: 'sorting'!
+
+sortedClasses: classes
+	"Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)"
+
+	| children others nodes expandedClasses |
+	children := #().
+	others := #().
+	classes do: [ :each |
+		(classes includes: each superclass)
+			ifFalse: [ children add: each ]
+			ifTrue: [ others add: each ]].
+	nodes := children collect: [ :each |
+		ClassSorterNode on: each classes: others level: 0 ].
+	nodes := nodes sorted: [ :a :b | a theClass name <= b theClass name ].
+	expandedClasses := Array new.
+	nodes do: [ :aNode |
+		aNode traverseClassesWith: expandedClasses ].
+	^ expandedClasses
+! !
+
+Object subclass: #PackageStateObserver
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!PackageStateObserver commentStamp!
+My current instance listens for any changes in the system that might affect the state of a package (being dirty).!
+
+!PackageStateObserver methodsFor: 'accessing'!
+
+announcer
+	^ SystemAnnouncer current
+! !
+
+!PackageStateObserver methodsFor: 'actions'!
+
+observeSystem
+	self announcer
+		on: PackageAdded
+		send: #onPackageAdded:
+		to: self;
+		
+		on: ClassAnnouncement
+		send: #onClassModification:
+		to: self;
+		
+		on: MethodAnnouncement
+		send: #onMethodModification:
+		to: self;
+		
+		on: ProtocolAnnouncement
+		send: #onProtocolModification:
+		to: self
+! !
+
+!PackageStateObserver methodsFor: 'reactions'!
+
+onClassModification: anAnnouncement
+	anAnnouncement theClass ifNotNil: [ :theClass |
+		theClass package beDirty ]
+!
+
+onMethodModification: anAnnouncement
+	anAnnouncement method package ifNotNil: [ :package | package beDirty ]
+!
+
+onPackageAdded: anAnnouncement
+	anAnnouncement package beDirty
+!
+
+onProtocolModification: anAnnouncement
+	anAnnouncement theClass package beDirty
+! !
+
+PackageStateObserver class instanceVariableNames: 'current'!
+
+!PackageStateObserver class methodsFor: 'accessing'!
+
+current
+	^ current ifNil: [ current := self new ]
+! !
+
+!PackageStateObserver class methodsFor: 'initialization'!
+
+initialize
+	self current observeSystem
+! !
+
+Object subclass: #PlatformInterface
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!PlatformInterface commentStamp!
+I am single entry point to UI and environment interface.
+My `initialize` tries several options (for now, browser environment only) to set myself up.
+
+## API
+
+    PlatformInterface alert: 'Hey, there is a problem'.
+    PlatformInterface confirm: 'Affirmative?'.
+    PlatformInterface prompt: 'Your name:'.
+
+    PlatformInterface ajax: #{
+        'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'
+    }.!
+
+PlatformInterface class instanceVariableNames: 'worker'!
+
+!PlatformInterface class methodsFor: 'accessing'!
+
+globals
+	<return (new Function('return this'))();>
+!
+
+setWorker: anObject
+	worker := anObject
+! !
+
+!PlatformInterface class methodsFor: 'actions'!
+
+ajax: anObject
+	^ worker
+		ifNotNil: [ worker ajax: anObject ]
+		ifNil: [ self error: 'ajax: not available' ]
+!
+
+alert: aString
+	^ worker
+		ifNotNil: [ worker alert: aString ]
+		ifNil: [ self error: 'alert: not available' ]
+!
+
+confirm: aString
+	^ worker
+		ifNotNil: [ worker confirm: aString ]
+		ifNil: [ self error: 'confirm: not available' ]
+!
+
+existsGlobal: aString
+	^ PlatformInterface globals 
+		at: aString 
+		ifPresent: [ true ] 
+		ifAbsent: [ false ]
+!
+
+prompt: aString
+	^ worker
+		ifNotNil: [ worker prompt: aString ]
+		ifNil: [ self error: 'prompt: not available' ]
+!
+
+prompt: aString default: defaultString
+	^ worker
+		ifNotNil: [ worker prompt: aString default: defaultString ]
+		ifNil: [ self error: 'prompt: not available' ]
+! !
+
+!PlatformInterface class methodsFor: 'initialization'!
+
+initialize
+	| candidate |
+	
+	super initialize.
+	
+	BrowserInterface ifNotNil: [
+		candidate := BrowserInterface new.
+		candidate isAvailable ifTrue: [ self setWorker: candidate. ^ self ]
+	]
+! !
+
+Object subclass: #Service
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!Service commentStamp!
+I implement the basic behavior for class registration to a service.
+
+See the `Transcript` class for a concrete service.
+
+## API
+
+Use class-side methods `#register:` and `#registerIfNone:` to register classes to a specific service.!
+
+Service class instanceVariableNames: 'current'!
+
+!Service class methodsFor: 'accessing'!
+
+current
+	^ current
+! !
+
+!Service class methodsFor: 'instance creation'!
+
+new
+	self shouldNotImplement
+! !
+
+!Service class methodsFor: 'registration'!
+
+register: anObject
+	current := anObject
+!
+
+registerIfNone: anObject
+	self current ifNil: [ self register: anObject ]
+! !
+
+Service subclass: #ErrorHandler
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!ErrorHandler commentStamp!
+I am the service used to handle Smalltalk errors.
+See `boot.js` `handleError()` function.
+
+Registered service instances must implement `#handleError:` to perform an action on the thrown exception.!
+
+!ErrorHandler class methodsFor: 'error handling'!
+
+handleError: anError
+	self handleUnhandledError: anError
+!
+
+handleUnhandledError: anError
+	anError wasHandled ifTrue: [ ^ self ].
+	
+	^ self current handleError: anError
+! !
+
+Service subclass: #Finder
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!Finder commentStamp!
+I am the service responsible for finding classes/methods.
+__There is no default finder.__
+
+## API
+
+Use `#browse` on an object to find it.!
+
+!Finder class methodsFor: 'finding'!
+
+findClass: aClass
+	^ self current findClass: aClass
+!
+
+findMethod: aCompiledMethod
+	^ self current findMethod: aCompiledMethod
+!
+
+findString: aString
+	^ self current findString: aString
+! !
+
+Service subclass: #Inspector
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!Inspector commentStamp!
+I am the service responsible for inspecting objects.
+
+The default inspector object is the transcript.!
+
+!Inspector class methodsFor: 'inspecting'!
+
+inspect: anObject
+	^ self current inspect: anObject
+! !
+
+Service subclass: #ProgressHandler
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!ProgressHandler commentStamp!
+I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.
+
+Registered instances must implement `#do:on:displaying:`.
+
+The default behavior is to simply iterate over the collection, using `NullProgressHandler`.!
+
+!ProgressHandler class methodsFor: 'progress handling'!
+
+do: aBlock on: aCollection displaying: aString
+	self current do: aBlock on: aCollection displaying: aString
+! !
+
+Service subclass: #Transcript
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!Transcript commentStamp!
+I am a facade for Transcript actions.
+
+I delegate actions to the currently registered transcript.
+
+## API
+
+    Transcript 
+        show: 'hello world';
+        cr;
+        show: anObject.!
+
+!Transcript class methodsFor: 'instance creation'!
+
+open
+	self current open
+! !
+
+!Transcript class methodsFor: 'printing'!
+
+clear
+	self current clear
+!
+
+cr
+	self current show: String cr
+!
+
+inspect: anObject
+	self show: anObject
+!
+
+show: anObject
+	self current show: anObject
+! !
+
+Object subclass: #Setting
+	instanceVariableNames: 'key value defaultValue'
+	package: 'Kernel-Infrastructure'!
+!Setting commentStamp!
+I represent a setting accessible via `Smalltalk settings`.
+
+## API
+
+A `Setting` value can be read using `value` and set using `value:`.
+
+Settings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: 'defaultValue'`.!
+
+!Setting methodsFor: 'accessing'!
+
+defaultValue
+	^ defaultValue
+!
+
+defaultValue: anObject
+	defaultValue := anObject
+!
+
+key
+	^ key
+!
+
+key: anObject
+	key := anObject
+!
+
+value
+	^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]
+!
+
+value: aString
+	^ Smalltalk settings at: self key put: aString
+! !
+
+!Setting class methodsFor: 'instance creation'!
+
+at: aString ifAbsent: anotherString
+	^ super new
+		key: aString;
+		defaultValue: anotherString;
+		yourself
+!
+
+new
+	self shouldNotImplement
+! !
+
+Object subclass: #SmalltalkImage
+	instanceVariableNames: ''
+	package: 'Kernel-Infrastructure'!
+!SmalltalkImage commentStamp!
+I represent the Smalltalk system, wrapping
+operations of variable `smalltalk` declared in `support/boot.js`.
+
+## API
+
+I have only one instance, accessed with global variable `Smalltalk`.
+
+The `smalltalk` object holds all class and packages defined in the system.
+
+## Classes
+
+Classes can be accessed using the following methods:
+
+- `#classes` answers the full list of Smalltalk classes in the system
+- `#at:` answers a specific class or `nil`
+
+## Packages
+
+Packages can be accessed using the following methods:
+
+- `#packages` answers the full list of packages
+- `#packageAt:` answers a specific package or `nil`
+
+## Parsing
+
+The `#parse:` method is used to parse Amber source code.
+It requires the `Compiler` package and the `support/parser.js` parser file in order to work.!
+
+!SmalltalkImage methodsFor: 'accessing'!
+
+at: aString
+	self deprecatedAPI.
+	^ self globals at: aString
+!
+
+at: aKey ifAbsent: aBlock
+	^ (self includesKey: aKey)
+		ifTrue: [ self at: aKey ]
+		ifFalse: [ aBlock value ]
+!
+
+at: aString put: anObject
+	self deprecatedAPI.
+	^ self globals at: aString put: anObject
+!
+
+current
+	"Backward compatibility for Smalltalk current ..."
+	self deprecatedAPI.
+	^ self
+!
+
+globals
+	"Future compatibility to be able to use Smalltalk globals at: ..."
+	<return globals>
+!
+
+includesKey: aKey
+	<return smalltalk.hasOwnProperty(aKey)>
+!
+
+parse: aString
+	| result |
+	
+	[ result := self basicParse: aString ] 
+		tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].
+		
+	^ result
+		source: aString;
+		yourself
+!
+
+pseudoVariableNames
+	^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')
+!
+
+readJSObject: anObject
+	<return smalltalk.readJSObject(anObject)>
+!
+
+reservedWords
+	"JavaScript reserved words"
+	<return smalltalk.reservedWords>
+!
+
+settings
+	^ SmalltalkSettings
+!
+
+version
+	"Answer the version string of Amber"
+	
+	^ '0.13.0-pre'
+!
+
+vm
+	"Future compatibility to be able to use Smalltalk vm ..."
+	<return smalltalk>
+! !
+
+!SmalltalkImage methodsFor: 'accessing amd'!
+
+amdRequire
+	^ self vm at: 'amdRequire'
+!
+
+defaultAmdNamespace
+	^ 'transport.defaultAmdNamespace' settingValue
+!
+
+defaultAmdNamespace: aString
+	'transport.defaultAmdNamespace' settingValue: aString
+! !
+
+!SmalltalkImage methodsFor: 'classes'!
+
+classes
+	<return smalltalk.classes()>
+!
+
+removeClass: aClass
+	aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!!' ].
+	
+	self deleteClass: aClass.
+	
+	SystemAnnouncer current
+		announce: (ClassRemoved new
+			theClass: aClass;
+			yourself)
+! !
+
+!SmalltalkImage methodsFor: 'error handling'!
+
+asSmalltalkException: anObject
+	"A JavaScript exception may be thrown.
+	We then need to convert it back to a Smalltalk object"
+	
+	^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])
+		ifTrue: [ anObject ]
+		ifFalse: [ JavaScriptException on: anObject ]
+!
+
+parseError: anException parsing: aString
+	^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')
+! !
+
+!SmalltalkImage methodsFor: 'globals'!
+
+addGlobalJsVariable: aString
+	self globalJsVariables add: aString
+!
+
+deleteGlobalJsVariable: aString
+	self globalJsVariables remove: aString ifAbsent:[]
+!
+
+globalJsVariables
+	"Array of global JavaScript variables"
+	<return smalltalk.globalJsVariables>
+! !
+
+!SmalltalkImage methodsFor: 'packages'!
+
+createPackage: packageName
+	| package announcement |
+	
+	package := self basicCreatePackage: packageName.
+	
+	announcement := PackageAdded new
+		package: package;
+		yourself.
+		
+	SystemAnnouncer current announce: announcement.
+	
+	^ package
+!
+
+packageAt: packageName
+	<return smalltalk.packages[packageName]>
+!
+
+packageAt: packageName ifAbsent: aBlock
+	^ (self packageAt: packageName) ifNil: aBlock
+!
+
+packages
+	"Return all Package instances in the system."
+
+	<
+		return Object.keys(smalltalk.packages).map(function(k) {
+			return smalltalk.packages[k];
+		})
+	>
+!
+
+removePackage: packageName
+	"Removes a package and all its classes."
+
+	| pkg |
+	pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].
+	pkg classes do: [ :each |
+			self removeClass: each ].
+	self deletePackage: packageName
+!
+
+renamePackage: packageName to: newName
+	"Rename a package."
+
+	| pkg |
+	pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].
+	(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].
+	(self at: 'packages') at: newName put: pkg.
+	pkg name: newName.
+	self deletePackage: packageName.
+! !
+
+!SmalltalkImage methodsFor: 'private'!
+
+basicCreatePackage: packageName
+	"Create and bind a new bare package with given name and return it."
+	<return smalltalk.addPackage(packageName)>
+!
+
+basicParse: aString
+	^ SmalltalkParser parse: aString
+!
+
+createPackage: packageName properties: aDict
+	"Needed to import .st files: they begin with this call."
+	self deprecatedAPI.
+	
+	aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].
+	^ self createPackage: packageName
+!
+
+deleteClass: aClass
+	"Deletes a class by deleting its binding only. Use #removeClass instead"
+	
+	<smalltalk.removeClass(aClass)>
+!
+
+deletePackage: packageName
+	"Deletes a package by deleting its binding, but does not check if it contains classes etc.
+	To remove a package, use #removePackage instead."
+
+	<delete smalltalk.packages[packageName]>
+! !
+
+!SmalltalkImage methodsFor: 'testing'!
+
+isSmalltalkObject: anObject
+	"Consider anObject a Smalltalk object if it has a 'klass' property.
+	Note that this may be unaccurate"
+	
+	<return typeof anObject.klass !!== 'undefined'>
+! !
+
+SmalltalkImage class instanceVariableNames: 'current'!
+
+!SmalltalkImage class methodsFor: 'initialization'!
+
+initialize
+	globals at: 'Smalltalk' put: self current
+! !
+
+!SmalltalkImage class methodsFor: 'instance creation'!
+
+current
+	^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]
+!
+
+new
+	self shouldNotImplement
+! !
+
+!SequenceableCollection methodsFor: '*Kernel-Infrastructure'!
+
+do: aBlock displayingProgress: aString
+	ProgressHandler 
+		do: aBlock 
+		on: self 
+		displaying: aString
+! !
+
+!String methodsFor: '*Kernel-Infrastructure'!
+
+asJavaScriptSelector
+	"Return first keyword of the selector, without trailing colon."
+	^ self replace: '^([a-zA-Z0-9]*).*$' with: '$1'
+!
+
+asSetting
+	^ Setting at: self ifAbsent: nil
+!
+
+asSettingIfAbsent: aString
+	^ Setting at: self ifAbsent: aString
+!
+
+settingValue
+	^ self asSetting value
+!
+
+settingValue: aString
+	^ self asSetting value: aString
+!
+
+settingValueIfAbsent: aString
+	^ (self asSettingIfAbsent: aString) value
+! !
+

+ 2110 - 0
src/Kernel-Methods.js

@@ -0,0 +1,2110 @@
+define("amber_core/Kernel-Methods", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Kernel-Methods');
+smalltalk.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('BlockClosure', globals.Object, [], 'Kernel-Methods');
+globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a    My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a    Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a    Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a    Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a    I provide the `#on:do:` method for handling exceptions.\x0a\x0a    Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "applyTo:arguments:",
+protocol: 'evaluating',
+fn: function (anObject,aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.apply(anObject, aCollection);
+return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.BlockClosure)})},
+args: ["anObject", "aCollection"],
+source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asCompiledMethod:",
+protocol: 'converting',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.method({selector:aString, fn:self});;
+return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},globals.BlockClosure)})},
+args: ["aString"],
+source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compiledSource",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.toString();
+return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},globals.BlockClosure)})},
+args: [],
+source: "compiledSource\x0a\x09<return self.toString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "currySelf",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return function () {
+			var args = [ this ];
+			args.push.apply(args, arguments);
+			return self.apply(null, args);
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.BlockClosure)})},
+args: [],
+source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ensure:",
+protocol: 'evaluating',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+try{return self._value()}finally{aBlock._value()};
+return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},globals.BlockClosure)})},
+args: ["aBlock"],
+source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fork",
+protocol: 'timeout/interval',
+fn: function (){
+var self=this;
+function $ForkPool(){return globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($ForkPool())._default())._fork_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"fork",{},globals.BlockClosure)})},
+args: [],
+source: "fork\x0a\x09ForkPool default fork: self",
+messageSends: ["fork:", "default"],
+referencedClasses: ["ForkPool"]
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'evaluating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return new self();
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.BlockClosure)})},
+args: [],
+source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newValue:",
+protocol: 'evaluating',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._newWithValues_([anObject]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},globals.BlockClosure)})},
+args: ["anObject"],
+source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
+messageSends: ["newWithValues:"],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newValue:value:",
+protocol: 'evaluating',
+fn: function (anObject,anObject2){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._newWithValues_([anObject,anObject2]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},globals.BlockClosure)})},
+args: ["anObject", "anObject2"],
+source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
+messageSends: ["newWithValues:"],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newValue:value:value:",
+protocol: 'evaluating',
+fn: function (anObject,anObject2,anObject3){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._newWithValues_([anObject,anObject2,anObject3]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.BlockClosure)})},
+args: ["anObject", "anObject2", "anObject3"],
+source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
+messageSends: ["newWithValues:"],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "newWithValues:",
+protocol: 'evaluating',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var object = Object.create(self.prototype);
+		var result = self.apply(object, aCollection);
+		return typeof result === "object" ? result : object;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},globals.BlockClosure)})},
+args: ["aCollection"],
+source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "numArgs",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.length;
+return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.BlockClosure)})},
+args: [],
+source: "numArgs\x0a\x09<return self.length>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:do:",
+protocol: 'error handling',
+fn: function (anErrorClass,aBlock){
+var self=this;
+function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$1=self._tryCatch_((function(error){
+var smalltalkError;
+return smalltalk.withContext(function($ctx2) {
+smalltalkError=_st($Smalltalk())._asSmalltalkException_(error);
+smalltalkError;
+$2=_st(smalltalkError)._isKindOf_(anErrorClass);
+if(smalltalk.assert($2)){
+return _st(aBlock)._value_(smalltalkError);
+} else {
+return _st(smalltalkError)._resignal();
+};
+}, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},globals.BlockClosure)})},
+args: ["anErrorClass", "aBlock"],
+source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
+messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"],
+referencedClasses: ["Smalltalk"]
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return nil;
+},
+args: [],
+source: "receiver\x0a\x09^ nil",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "timeToRun",
+protocol: 'evaluating',
+fn: function (){
+var self=this;
+function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Date())._millisecondsToRun_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"timeToRun",{},globals.BlockClosure)})},
+args: [],
+source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
+messageSends: ["millisecondsToRun:"],
+referencedClasses: ["Date"]
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tryCatch:",
+protocol: 'error handling',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		try {
+			return self._value();
+		} catch(error) {
+			return aBlock._value_(error);
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},globals.BlockClosure)})},
+args: ["aBlock"],
+source: "tryCatch: aBlock\x0a\x09<\x0a\x09\x09try {\x0a\x09\x09\x09return self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'evaluating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self();;
+return self}, function($ctx1) {$ctx1.fill(self,"value",{},globals.BlockClosure)})},
+args: [],
+source: "value\x0a\x09<return self();>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'evaluating',
+fn: function (anArg){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self(anArg);;
+return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},globals.BlockClosure)})},
+args: ["anArg"],
+source: "value: anArg\x0a\x09<return self(anArg);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:",
+protocol: 'evaluating',
+fn: function (firstArg,secondArg){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self(firstArg, secondArg);;
+return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},globals.BlockClosure)})},
+args: ["firstArg", "secondArg"],
+source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:value:",
+protocol: 'evaluating',
+fn: function (firstArg,secondArg,thirdArg){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self(firstArg, secondArg, thirdArg);;
+return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},globals.BlockClosure)})},
+args: ["firstArg", "secondArg", "thirdArg"],
+source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valueWithInterval:",
+protocol: 'timeout/interval',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var interval = setInterval(self, aNumber);
+		return globals.Timeout._on_(interval);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},globals.BlockClosure)})},
+args: ["aNumber"],
+source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(interval);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valueWithPossibleArguments:",
+protocol: 'evaluating',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.apply(null, aCollection);;
+return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.BlockClosure)})},
+args: ["aCollection"],
+source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valueWithTimeout:",
+protocol: 'timeout/interval',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var timeout = setTimeout(self, aNumber);
+		return globals.Timeout._on_(timeout);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},globals.BlockClosure)})},
+args: ["aNumber"],
+source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(timeout);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "whileFalse",
+protocol: 'controlling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._whileFalse_((function(){
+}));
+return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},globals.BlockClosure)})},
+args: [],
+source: "whileFalse\x0a\x09self whileFalse: []",
+messageSends: ["whileFalse:"],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "whileFalse:",
+protocol: 'controlling',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+while(!smalltalk.assert(self._value())) {aBlock._value()};
+return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},globals.BlockClosure)})},
+args: ["aBlock"],
+source: "whileFalse: aBlock\x0a\x09<while(!smalltalk.assert(self._value())) {aBlock._value()}>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "whileTrue",
+protocol: 'controlling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._whileTrue_((function(){
+}));
+return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},globals.BlockClosure)})},
+args: [],
+source: "whileTrue\x0a\x09self whileTrue: []",
+messageSends: ["whileTrue:"],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "whileTrue:",
+protocol: 'controlling',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+while(smalltalk.assert(self._value())) {aBlock._value()};
+return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},globals.BlockClosure)})},
+args: ["aBlock"],
+source: "whileTrue: aBlock\x0a\x09<while(smalltalk.assert(self._value())) {aBlock._value()}>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.BlockClosure);
+
+
+
+smalltalk.addClass('CompiledMethod', globals.Object, [], 'Kernel-Methods');
+globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a    Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.args || [];
+return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.CompiledMethod)})},
+args: [],
+source: "arguments\x0a\x09<return self.args || []>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "browse",
+protocol: 'browsing',
+fn: function (){
+var self=this;
+function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Finder())._findMethod_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"browse",{},globals.CompiledMethod)})},
+args: [],
+source: "browse\x0a\x09Finder findMethod: self",
+messageSends: ["findMethod:"],
+referencedClasses: ["Finder"]
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "category",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._protocol();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"category",{},globals.CompiledMethod)})},
+args: [],
+source: "category\x0a\x09^ self protocol",
+messageSends: ["protocol"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultProtocol",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return "as yet unclassified";
+},
+args: [],
+source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fn",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_("fn");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"fn",{},globals.CompiledMethod)})},
+args: [],
+source: "fn\x0a\x09^ self basicAt: 'fn'",
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fn:",
+protocol: 'accessing',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._basicAt_put_("fn",aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},globals.CompiledMethod)})},
+args: ["aBlock"],
+source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
+messageSends: ["basicAt:put:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isCompiledMethod",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isCompiledMethod\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isOverridden",
+protocol: 'testing',
+fn: function (){
+var self=this;
+var selector;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+var $early={};
+try {
+selector=self._selector();
+_st(self._methodClass())._allSubclassesDo_((function(each){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(each)._includesSelector_(selector);
+if(smalltalk.assert($1)){
+throw $early=[true];
+};
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return false;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},globals.CompiledMethod)})},
+args: [],
+source: "isOverridden\x0a\x09| selector |\x0a    \x0a    selector := self selector.\x0a    self methodClass allSubclassesDo: [ :each |\x0a\x09    (each includesSelector: selector)\x0a        \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
+messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isOverride",
+protocol: 'testing',
+fn: function (){
+var self=this;
+var superclass;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+$1=self._methodClass();
+$ctx1.sendIdx["methodClass"]=1;
+superclass=_st($1)._superclass();
+$ctx1.sendIdx["superclass"]=1;
+$2=superclass;
+if(($receiver = $2) == null || $receiver.isNil){
+return false;
+} else {
+$2;
+};
+$3=_st(_st(_st(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},globals.CompiledMethod)})},
+args: [],
+source: "isOverride\x0a\x09| superclass |\x0a    \x0a    superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a    ^ (self methodClass superclass lookupSelector: self selector) notNil",
+messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "messageSends",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_("messageSends");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.CompiledMethod)})},
+args: [],
+source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_("methodClass");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodClass",{},globals.CompiledMethod)})},
+args: [],
+source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "package",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$5,$4,$6,$receiver;
+$1=self._methodClass();
+$ctx1.sendIdx["methodClass"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return nil;
+} else {
+$1;
+};
+$3=self._protocol();
+$ctx1.sendIdx["protocol"]=1;
+$2=_st($3)._beginsWith_("*");
+if(! smalltalk.assert($2)){
+$5=self._methodClass();
+$ctx1.sendIdx["methodClass"]=2;
+$4=_st($5)._package();
+$ctx1.sendIdx["package"]=1;
+return $4;
+};
+$6=_st($Package())._named_ifAbsent_(_st(self._protocol())._allButFirst(),(function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._methodClass())._package();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
+return $6;
+}, function($ctx1) {$ctx1.fill(self,"package",{},globals.CompiledMethod)})},
+args: [],
+source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09self methodClass ifNil: [ ^ nil ].\x0a\x09\x0a\x09(self protocol beginsWith: '*') ifFalse: [\x0a\x09\x09^ self methodClass package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: self protocol allButFirst\x0a\x09\x09ifAbsent: [ self methodClass package ]",
+messageSends: ["ifNil:", "methodClass", "ifFalse:", "beginsWith:", "protocol", "package", "named:ifAbsent:", "allButFirst"],
+referencedClasses: ["Package"]
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "protocol",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._basicAt_("protocol");
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._defaultProtocol();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"protocol",{},globals.CompiledMethod)})},
+args: [],
+source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
+messageSends: ["ifNil:", "basicAt:", "defaultProtocol"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "protocol:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+var oldProtocol;
+function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
+function $MethodMoved(){return globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$receiver;
+oldProtocol=self._protocol();
+self._basicAt_put_("protocol",aString);
+$1=_st($MethodMoved())._new();
+_st($1)._method_(self);
+_st($1)._oldProtocol_(oldProtocol);
+$2=_st($1)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($2);
+$3=self._methodClass();
+if(($receiver = $3) == null || $receiver.isNil){
+$3;
+} else {
+var methodClass;
+methodClass=$receiver;
+_st(_st(methodClass)._organization())._addElement_(aString);
+_st(methodClass)._removeProtocolIfEmpty_(oldProtocol);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},globals.CompiledMethod)})},
+args: ["aString"],
+source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
+messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"],
+referencedClasses: ["SystemAnnouncer", "MethodMoved"]
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "referencedClasses",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_("referencedClasses");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},globals.CompiledMethod)})},
+args: [],
+source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicAt_("selector");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selector",{},globals.CompiledMethod)})},
+args: [],
+source: "selector\x0a\x09^ self basicAt: 'selector'",
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._basicAt_put_("selector",aString);
+return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.CompiledMethod)})},
+args: ["aString"],
+source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
+messageSends: ["basicAt:put:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendTo:arguments:",
+protocol: 'evaluating',
+fn: function (anObject,aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._fn())._applyTo_arguments_(anObject,aCollection);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.CompiledMethod)})},
+args: ["anObject", "aCollection"],
+source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
+messageSends: ["applyTo:arguments:", "fn"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self._basicAt_("source");
+if(($receiver = $2) == null || $receiver.isNil){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"source",{},globals.CompiledMethod)})},
+args: [],
+source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
+messageSends: ["ifNil:", "basicAt:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "source:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._basicAt_put_("source",aString);
+return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},globals.CompiledMethod)})},
+args: ["aString"],
+source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
+messageSends: ["basicAt:put:"],
+referencedClasses: []
+}),
+globals.CompiledMethod);
+
+
+
+smalltalk.addClass('ForkPool', globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
+globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "addWorker",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@worker"])._valueWithTimeout_((0));
+self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
+return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},globals.ForkPool)})},
+args: [],
+source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
+messageSends: ["valueWithTimeout:", "+"],
+referencedClasses: []
+}),
+globals.ForkPool);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultMaxPoolSize",
+protocol: 'defaults',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._defaultMaxPoolSize();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},globals.ForkPool)})},
+args: [],
+source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
+messageSends: ["defaultMaxPoolSize", "class"],
+referencedClasses: []
+}),
+globals.ForkPool);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fork:",
+protocol: 'actions',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@poolSize"]).__lt(self._maxPoolSize());
+if(smalltalk.assert($1)){
+self._addWorker();
+};
+_st(self["@queue"])._nextPut_(aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},globals.ForkPool)})},
+args: ["aBlock"],
+source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
+messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"],
+referencedClasses: []
+}),
+globals.ForkPool);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.ForkPool.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@poolSize"]=(0);
+self["@queue"]=_st($Queue())._new();
+self["@worker"]=self._makeWorker();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ForkPool)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
+messageSends: ["initialize", "new", "makeWorker"],
+referencedClasses: ["Queue"]
+}),
+globals.ForkPool);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "makeWorker",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+var sentinel;
+function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+sentinel=_st($Object())._new();
+$1=(function(){
+var block;
+return smalltalk.withContext(function($ctx2) {
+self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
+self["@poolSize"];
+block=_st(self["@queue"])._nextIfAbsent_((function(){
+return sentinel;
+}));
+block;
+$2=_st(block).__eq_eq(sentinel);
+if(! smalltalk.assert($2)){
+return _st((function(){
+return smalltalk.withContext(function($ctx3) {
+return _st(block)._value();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}))._ensure_((function(){
+return smalltalk.withContext(function($ctx3) {
+return self._addWorker();
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
+};
+}, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)})});
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},globals.ForkPool)})},
+args: [],
+source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]",
+messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"],
+referencedClasses: ["Object"]
+}),
+globals.ForkPool);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "maxPoolSize",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@maxPoolSize"];
+if(($receiver = $2) == null || $receiver.isNil){
+$1=self._defaultMaxPoolSize();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},globals.ForkPool)})},
+args: [],
+source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
+messageSends: ["ifNil:", "defaultMaxPoolSize"],
+referencedClasses: []
+}),
+globals.ForkPool);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "maxPoolSize:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+self["@maxPoolSize"]=anInteger;
+return self},
+args: ["anInteger"],
+source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ForkPool);
+
+
+globals.ForkPool.klass.iVarNames = ['default'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "default",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1,$receiver;
+$2=self["@default"];
+if(($receiver = $2) == null || $receiver.isNil){
+self["@default"]=self._new();
+$1=self["@default"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"default",{},globals.ForkPool.klass)})},
+args: [],
+source: "default\x0a\x09^ default ifNil: [ default := self new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: []
+}),
+globals.ForkPool.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultMaxPoolSize",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return (100);
+},
+args: [],
+source: "defaultMaxPoolSize\x0a\x09^ 100",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ForkPool.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resetDefault",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+self["@default"]=nil;
+return self},
+args: [],
+source: "resetDefault\x0a\x09default := nil",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ForkPool.klass);
+
+
+smalltalk.addClass('Message', globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
+globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@arguments"];
+return $1;
+},
+args: [],
+source: "arguments\x0a\x09^ arguments",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Message);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments:",
+protocol: 'accessing',
+fn: function (anArray){
+var self=this;
+self["@arguments"]=anArray;
+return self},
+args: ["anArray"],
+source: "arguments: anArray\x0a\x09arguments := anArray",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Message);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+($ctx1.supercall = true, globals.Message.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
+$ctx1.supercall = false;
+_st(aStream)._nextPutAll_("(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._nextPutAll_(self._selector());
+$ctx1.sendIdx["nextPutAll:"]=2;
+$1=_st(aStream)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Message)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
+messageSends: ["printOn:", "nextPutAll:", "selector"],
+referencedClasses: []
+}),
+globals.Message);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@selector"];
+return $1;
+},
+args: [],
+source: "selector\x0a\x09^ selector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Message);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@selector"]=aString;
+return self},
+args: ["aString"],
+source: "selector: aString\x0a\x09selector := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Message);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendTo:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(anObject)._perform_withArguments_(self._selector(),self._arguments());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},globals.Message)})},
+args: ["anObject"],
+source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
+messageSends: ["perform:withArguments:", "selector", "arguments"],
+referencedClasses: []
+}),
+globals.Message);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:arguments:",
+protocol: 'instance creation',
+fn: function (aString,anArray){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._selector_(aString);
+_st($2)._arguments_(anArray);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},globals.Message.klass)})},
+args: ["aString", "anArray"],
+source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
+messageSends: ["selector:", "new", "arguments:", "yourself"],
+referencedClasses: []
+}),
+globals.Message.klass);
+
+
+smalltalk.addClass('MessageSend', globals.Object, ['receiver', 'message'], 'Kernel-Methods');
+globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@message"])._arguments();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MessageSend)})},
+args: [],
+source: "arguments\x0a\x09^ message arguments",
+messageSends: ["arguments"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arguments:",
+protocol: 'accessing',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@message"])._arguments_(aCollection);
+return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.MessageSend)})},
+args: ["aCollection"],
+source: "arguments: aCollection\x0a\x09message arguments: aCollection",
+messageSends: ["arguments:"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.MessageSend.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@message"]=_st($Message())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.MessageSend)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
+messageSends: ["initialize", "new"],
+referencedClasses: ["Message"]
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+($ctx1.supercall = true, globals.MessageSend.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
+$ctx1.supercall = false;
+_st(aStream)._nextPutAll_("(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._nextPutAll_(self._receiver());
+$ctx1.sendIdx["nextPutAll:"]=2;
+_st(aStream)._nextPutAll_(" >> ");
+$ctx1.sendIdx["nextPutAll:"]=3;
+_st(aStream)._nextPutAll_(self._selector());
+$ctx1.sendIdx["nextPutAll:"]=4;
+$1=_st(aStream)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MessageSend)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
+messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@receiver"];
+return $1;
+},
+args: [],
+source: "receiver\x0a\x09^ receiver",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@receiver"]=anObject;
+return self},
+args: ["anObject"],
+source: "receiver: anObject\x0a\x09receiver := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@message"])._selector();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MessageSend)})},
+args: [],
+source: "selector\x0a\x09^ message selector",
+messageSends: ["selector"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@message"])._selector_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.MessageSend)})},
+args: ["aString"],
+source: "selector: aString\x0a\x09message selector: aString",
+messageSends: ["selector:"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'evaluating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@message"])._sendTo_(self._receiver());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value",{},globals.MessageSend)})},
+args: [],
+source: "value\x0a\x09^ message sendTo: self receiver",
+messageSends: ["sendTo:", "receiver"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:",
+protocol: 'evaluating',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self["@message"];
+_st($2)._arguments_([anObject]);
+$3=_st($2)._sendTo_(self._receiver());
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.MessageSend)})},
+args: ["anObject"],
+source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
+messageSends: ["arguments:", "sendTo:", "receiver"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:",
+protocol: 'evaluating',
+fn: function (firstArgument,secondArgument){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self["@message"];
+_st($2)._arguments_([firstArgument,secondArgument]);
+$3=_st($2)._sendTo_(self._receiver());
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.MessageSend)})},
+args: ["firstArgument", "secondArgument"],
+source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
+messageSends: ["arguments:", "sendTo:", "receiver"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value:value:value:",
+protocol: 'evaluating',
+fn: function (firstArgument,secondArgument,thirdArgument){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self["@message"];
+_st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
+$3=_st($2)._sendTo_(self._receiver());
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.MessageSend)})},
+args: ["firstArgument", "secondArgument", "thirdArgument"],
+source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
+messageSends: ["arguments:", "sendTo:", "receiver"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "valueWithPossibleArguments:",
+protocol: 'evaluating',
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._arguments_(aCollection);
+$1=self._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.MessageSend)})},
+args: ["aCollection"],
+source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
+messageSends: ["arguments:", "value"],
+referencedClasses: []
+}),
+globals.MessageSend);
+
+
+
+smalltalk.addClass('MethodContext', globals.Object, [], 'Kernel-Methods');
+globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
+$2=self._isBlockContext();
+if(smalltalk.assert($2)){
+$3="a block (in ".__comma(_st(self._methodContext())._asString());
+$ctx1.sendIdx[","]=2;
+$1=_st($3).__comma(")");
+$ctx1.sendIdx[","]=1;
+} else {
+var methodClass;
+methodClass=_st(self._method())._methodClass();
+methodClass;
+$5=methodClass;
+$7=self._receiver();
+$ctx1.sendIdx["receiver"]=1;
+$6=_st($7)._class();
+$ctx1.sendIdx["class"]=1;
+$4=_st($5).__eq($6);
+if(smalltalk.assert($4)){
+$11=self._receiver();
+$ctx1.sendIdx["receiver"]=2;
+$10=_st($11)._class();
+$ctx1.sendIdx["class"]=2;
+$9=_st($10)._name();
+$ctx1.sendIdx["name"]=1;
+$8=_st($9).__comma(" >> ");
+$ctx1.sendIdx[","]=4;
+$12=self._selector();
+$ctx1.sendIdx["selector"]=1;
+$1=_st($8).__comma($12);
+$ctx1.sendIdx[","]=3;
+} else {
+$16=_st(_st(self._receiver())._class())._name();
+$ctx1.sendIdx["name"]=2;
+$15=_st($16).__comma("(");
+$14=_st($15).__comma(_st(methodClass)._name());
+$ctx1.sendIdx[","]=7;
+$13=_st($14).__comma(") >> ");
+$ctx1.sendIdx[","]=6;
+$1=_st($13).__comma(self._selector());
+$ctx1.sendIdx[","]=5;
+};
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.MethodContext)})},
+args: [],
+source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
+messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicReceiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.receiver;
+return self}, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},globals.MethodContext)})},
+args: [],
+source: "basicReceiver\x0a\x09<return self.receiver>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluatedSelector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.evaluatedSelector;
+return self}, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},globals.MethodContext)})},
+args: [],
+source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "findContextSuchThat:",
+protocol: 'accessing',
+fn: function (testBlock){
+var self=this;
+var context;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+var $early={};
+try {
+context=self;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(context)._isNil();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(testBlock)._value_(context);
+if(smalltalk.assert($1)){
+$2=context;
+throw $early=[$2];
+};
+context=_st(context)._outerContext();
+return context;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return nil;
+}
+catch(e) {if(e===$early)return e[0]; throw e}
+}, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},globals.MethodContext)})},
+args: ["testBlock"],
+source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`.  \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
+messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "home",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.homeContext;
+return self}, function($ctx1) {$ctx1.fill(self,"home",{},globals.MethodContext)})},
+args: [],
+source: "home\x0a\x09<return self.homeContext>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "index",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.index || 0;
+return self}, function($ctx1) {$ctx1.fill(self,"index",{},globals.MethodContext)})},
+args: [],
+source: "index\x0a\x09<return self.index || 0>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBlockContext",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._selector())._isNil();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},globals.MethodContext)})},
+args: [],
+source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
+messageSends: ["isNil", "selector"],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "locals",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.locals || {};
+return self}, function($ctx1) {$ctx1.fill(self,"locals",{},globals.MethodContext)})},
+args: [],
+source: "locals\x0a\x09<return self.locals || {}>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "method",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var method,lookupClass,receiverClass,supercall;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
+$1=self._methodContext();
+$ctx1.sendIdx["methodContext"]=1;
+if(($receiver = $1) == null || $receiver.isNil){
+return nil;
+} else {
+$1;
+};
+$3=self._methodContext();
+$ctx1.sendIdx["methodContext"]=2;
+$2=_st($3)._receiver();
+receiverClass=_st($2)._class();
+$4=receiverClass;
+$6=self._methodContext();
+$ctx1.sendIdx["methodContext"]=3;
+$5=_st($6)._selector();
+$ctx1.sendIdx["selector"]=1;
+method=_st($4)._lookupSelector_($5);
+$ctx1.sendIdx["lookupSelector:"]=1;
+$7=self._outerContext();
+if(($receiver = $7) == null || $receiver.isNil){
+supercall=false;
+} else {
+var outer;
+outer=$receiver;
+supercall=_st(outer)._supercall();
+};
+$9=supercall;
+if(smalltalk.assert($9)){
+$8=_st(_st(_st(method)._methodClass())._superclass())._lookupSelector_(_st(self._methodContext())._selector());
+} else {
+$8=method;
+};
+return $8;
+}, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},globals.MethodContext)})},
+args: [],
+source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
+messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodContext",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$2,$receiver;
+$1=self._isBlockContext();
+if(! smalltalk.assert($1)){
+return self;
+};
+$3=self._outerContext();
+if(($receiver = $3) == null || $receiver.isNil){
+$2=$3;
+} else {
+var outer;
+outer=$receiver;
+$2=_st(outer)._methodContext();
+};
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"methodContext",{},globals.MethodContext)})},
+args: [],
+source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
+messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "outerContext",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.outerContext || self.homeContext;
+return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},globals.MethodContext)})},
+args: [],
+source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+($ctx1.supercall = true, globals.MethodContext.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
+$ctx1.supercall = false;
+_st(aStream)._nextPutAll_("(");
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._nextPutAll_(self._asString());
+$ctx1.sendIdx["nextPutAll:"]=2;
+$1=_st(aStream)._nextPutAll_(")");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MethodContext)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
+messageSends: ["printOn:", "nextPutAll:", "asString"],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+$2=_st(self._isBlockContext())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=self._outerContext();
+$ctx2.sendIdx["outerContext"]=1;
+return _st($3)._notNil();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(smalltalk.assert($2)){
+$1=_st(self._outerContext())._receiver();
+} else {
+$1=self._basicReceiver();
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.MethodContext)})},
+args: [],
+source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
+messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "selector",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		if(self.selector) {
+			return smalltalk.convertSelector(self.selector);
+		} else {
+			return nil;
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MethodContext)})},
+args: [],
+source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.convertSelector(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendIndexAt:",
+protocol: 'accessing',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.sendIdx[aSelector] || 0;
+return self}, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},globals.MethodContext)})},
+args: ["aSelector"],
+source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sendIndexes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.sendIdx;
+return self}, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.MethodContext)})},
+args: [],
+source: "sendIndexes\x0a\x09<return self.sendIdx>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "supercall",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.supercall == true;
+return self}, function($ctx1) {$ctx1.fill(self,"supercall",{},globals.MethodContext)})},
+args: [],
+source: "supercall\x0a\x09<return self.supercall == true>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "temps",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._deprecatedAPI();
+$1=self._locals();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"temps",{},globals.MethodContext)})},
+args: [],
+source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
+messageSends: ["deprecatedAPI", "locals"],
+referencedClasses: []
+}),
+globals.MethodContext);
+
+
+
+smalltalk.addClass('NativeFunction', globals.Object, [], 'Kernel-Methods');
+globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "constructor:",
+protocol: 'instance creation',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var nativeFunc=eval(aString);
+		return new nativeFunc();
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},globals.NativeFunction.klass)})},
+args: ["aString"],
+source: "constructor: aString\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.NativeFunction.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "constructor:value:",
+protocol: 'instance creation',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var nativeFunc=eval(aString);
+		return new nativeFunc(anObject);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},globals.NativeFunction.klass)})},
+args: ["aString", "anObject"],
+source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.NativeFunction.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "constructor:value:value:",
+protocol: 'instance creation',
+fn: function (aString,anObject,anObject2){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var nativeFunc=eval(aString);
+		return new nativeFunc(anObject,anObject2);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},globals.NativeFunction.klass)})},
+args: ["aString", "anObject", "anObject2"],
+source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.NativeFunction.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "constructor:value:value:value:",
+protocol: 'instance creation',
+fn: function (aString,anObject,anObject2,anObject3){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var nativeFunc=eval(aString);
+		return new nativeFunc(anObject,anObject2, anObject3);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.NativeFunction.klass)})},
+args: ["aString", "anObject", "anObject2", "anObject3"],
+source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.NativeFunction.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exists:",
+protocol: 'testing',
+fn: function (aString){
+var self=this;
+function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($PlatformInterface())._existsGlobal_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},globals.NativeFunction.klass)})},
+args: ["aString"],
+source: "exists: aString\x0a\x09^ PlatformInterface existsGlobal: aString",
+messageSends: ["existsGlobal:"],
+referencedClasses: ["PlatformInterface"]
+}),
+globals.NativeFunction.klass);
+
+
+smalltalk.addClass('Timeout', globals.Object, ['rawTimeout'], 'Kernel-Methods');
+globals.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "clearInterval",
+protocol: 'timeout/interval',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var interval = self["@rawTimeout"];
+		clearInterval(interval);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},globals.Timeout)})},
+args: [],
+source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Timeout);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "clearTimeout",
+protocol: 'timeout/interval',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var timeout = self["@rawTimeout"];
+		clearTimeout(timeout);
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},globals.Timeout)})},
+args: [],
+source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Timeout);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "rawTimeout:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@rawTimeout"]=anObject;
+return self},
+args: ["anObject"],
+source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Timeout);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:",
+protocol: 'instance creation',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._rawTimeout_(anObject);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},globals.Timeout.klass)})},
+args: ["anObject"],
+source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
+messageSends: ["rawTimeout:", "new", "yourself"],
+referencedClasses: []
+}),
+globals.Timeout.klass);
+
+});

+ 784 - 0
src/Kernel-Methods.st

@@ -0,0 +1,784 @@
+Smalltalk createPackage: 'Kernel-Methods'!
+Object subclass: #BlockClosure
+	instanceVariableNames: ''
+	package: 'Kernel-Methods'!
+!BlockClosure commentStamp!
+I represent a lexical closure.
+I am is directly mapped to JavaScript Function.
+
+## API
+
+1. Evaluation
+
+    My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.
+
+    Example: ` [ :x | x + 1 ] value: 3 "Answers 4" `
+
+2. Control structures
+
+    Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).
+
+    Example: `aBlock whileTrue: [ ... ]`
+
+3. Error handling
+
+    I provide the `#on:do:` method for handling exceptions.
+
+    Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `!
+
+!BlockClosure methodsFor: 'accessing'!
+
+compiledSource
+	<return self.toString()>
+!
+
+numArgs
+	<return self.length>
+!
+
+receiver
+	^ nil
+! !
+
+!BlockClosure methodsFor: 'controlling'!
+
+whileFalse
+	self whileFalse: []
+!
+
+whileFalse: aBlock
+	<while(!!smalltalk.assert(self._value())) {aBlock._value()}>
+!
+
+whileTrue
+	self whileTrue: []
+!
+
+whileTrue: aBlock
+	<while(smalltalk.assert(self._value())) {aBlock._value()}>
+! !
+
+!BlockClosure methodsFor: 'converting'!
+
+asCompiledMethod: aString
+	<return smalltalk.method({selector:aString, fn:self});>
+!
+
+currySelf
+	"Transforms [ :selfarg :x :y | stcode ] block
+	which represents JS function (selfarg, x, y, ...) {jscode}
+	into function (x, y, ...) {jscode} that takes selfarg from 'this'.
+	IOW, it is usable as JS method and first arg takes the receiver."
+	
+	<
+		return function () {
+			var args = [ this ];
+			args.push.apply(args, arguments);
+			return self.apply(null, args);
+		}
+	>
+! !
+
+!BlockClosure methodsFor: 'error handling'!
+
+on: anErrorClass do: aBlock
+	"All exceptions thrown in the Smalltalk stack are cought.
+	Convert all JS exceptions to JavaScriptException instances."
+	
+	^ self tryCatch: [ :error | | smalltalkError |
+		smalltalkError := Smalltalk asSmalltalkException: error.
+		(smalltalkError isKindOf: anErrorClass)
+		ifTrue: [ aBlock value: smalltalkError ]
+		ifFalse: [ smalltalkError resignal ] ]
+!
+
+tryCatch: aBlock
+	<
+		try {
+			return self._value();
+		} catch(error) {
+			return aBlock._value_(error);
+		}
+	>
+! !
+
+!BlockClosure methodsFor: 'evaluating'!
+
+applyTo: anObject arguments: aCollection
+	<return self.apply(anObject, aCollection)>
+!
+
+ensure: aBlock
+	<try{return self._value()}finally{aBlock._value()}>
+!
+
+new
+	"Use the receiver as a JS constructor.
+	*Do not* use this method to instanciate Smalltalk objects!!"
+	<return new self()>
+!
+
+newValue: anObject
+	^ self newWithValues: { anObject }
+!
+
+newValue: anObject value: anObject2
+	^ self newWithValues: { anObject. anObject2 }.
+!
+
+newValue: anObject value: anObject2 value: anObject3
+	^ self newWithValues: { anObject. anObject2. anObject3 }.
+!
+
+newWithValues: aCollection
+	"Simulates JS new operator by combination of Object.create and .apply"
+	<
+		var object = Object.create(self.prototype);
+		var result = self.apply(object, aCollection);
+		return typeof result === "object" ? result : object;
+	>
+!
+
+timeToRun
+	"Answer the number of milliseconds taken to execute this block."
+
+	^ Date millisecondsToRun: self
+!
+
+value
+	<return self();>
+!
+
+value: anArg
+	<return self(anArg);>
+!
+
+value: firstArg value: secondArg
+	<return self(firstArg, secondArg);>
+!
+
+value: firstArg value: secondArg value: thirdArg
+	<return self(firstArg, secondArg, thirdArg);>
+!
+
+valueWithPossibleArguments: aCollection
+	<return self.apply(null, aCollection);>
+! !
+
+!BlockClosure methodsFor: 'timeout/interval'!
+
+fork
+	ForkPool default fork: self
+!
+
+valueWithInterval: aNumber
+	<
+		var interval = setInterval(self, aNumber);
+		return globals.Timeout._on_(interval);
+	>
+!
+
+valueWithTimeout: aNumber
+	<
+		var timeout = setTimeout(self, aNumber);
+		return globals.Timeout._on_(timeout);
+	>
+! !
+
+Object subclass: #CompiledMethod
+	instanceVariableNames: ''
+	package: 'Kernel-Methods'!
+!CompiledMethod commentStamp!
+I represent a class method of the system. I hold the source and compiled code of a class method.
+
+## API
+My instances can be accessed using `Behavior >> #methodAt:`
+
+    Object methodAt: 'asString'
+
+Source code access:
+
+	(String methodAt: 'lines') source
+
+Referenced classes:
+
+	(String methodAt: 'lines') referencedClasses
+
+Messages sent from an instance:
+	
+	(String methodAt: 'lines') messageSends!
+
+!CompiledMethod methodsFor: 'accessing'!
+
+arguments
+	<return self.args || []>
+!
+
+category
+	^ self protocol
+!
+
+fn
+	^ self basicAt: 'fn'
+!
+
+fn: aBlock
+	self basicAt: 'fn' put: aBlock
+!
+
+messageSends
+	^ self basicAt: 'messageSends'
+!
+
+methodClass
+	^ self basicAt: 'methodClass'
+!
+
+package
+	"Answer the package the receiver belongs to:
+	- if it is an extension method, answer the corresponding package
+	- else answer the `methodClass` package"
+	
+	self methodClass ifNil: [ ^ nil ].
+	
+	(self protocol beginsWith: '*') ifFalse: [
+		^ self methodClass package ].
+		
+	^ Package 
+		named: self protocol allButFirst
+		ifAbsent: [ self methodClass package ]
+!
+
+protocol
+	^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]
+!
+
+protocol: aString
+	| oldProtocol |
+	oldProtocol := self protocol.
+	self basicAt: 'protocol' put: aString.
+
+	SystemAnnouncer current announce: (MethodMoved new
+		method: self;
+		oldProtocol: oldProtocol;
+		yourself).
+
+	self methodClass ifNotNil: [ :methodClass |
+		methodClass organization addElement: aString.
+		methodClass removeProtocolIfEmpty: oldProtocol ]
+!
+
+referencedClasses
+	^ self basicAt: 'referencedClasses'
+!
+
+selector
+	^ self basicAt: 'selector'
+!
+
+selector: aString
+	self basicAt: 'selector' put: aString
+!
+
+source
+	^ (self basicAt: 'source') ifNil: [ '' ]
+!
+
+source: aString
+	self basicAt: 'source' put: aString
+! !
+
+!CompiledMethod methodsFor: 'browsing'!
+
+browse
+	Finder findMethod: self
+! !
+
+!CompiledMethod methodsFor: 'defaults'!
+
+defaultProtocol
+	^ 'as yet unclassified'
+! !
+
+!CompiledMethod methodsFor: 'evaluating'!
+
+sendTo: anObject arguments: aCollection
+	^ self fn applyTo: anObject arguments: aCollection
+! !
+
+!CompiledMethod methodsFor: 'testing'!
+
+isCompiledMethod
+	^ true
+!
+
+isOverridden
+	| selector |
+    
+    selector := self selector.
+    self methodClass allSubclassesDo: [ :each |
+	    (each includesSelector: selector)
+        	ifTrue: [ ^ true ] ].
+	^ false
+!
+
+isOverride
+	| superclass |
+    
+    superclass := self methodClass superclass.
+	superclass ifNil: [ ^ false ].
+	
+    ^ (self methodClass superclass lookupSelector: self selector) notNil
+! !
+
+Object subclass: #ForkPool
+	instanceVariableNames: 'poolSize maxPoolSize queue worker'
+	package: 'Kernel-Methods'!
+!ForkPool commentStamp!
+I am responsible for handling forked blocks.
+The pool size sets the maximum concurrent forked blocks.
+
+## API
+
+The default instance is accessed with `#default`.
+The maximum concurrent forked blocks can be set with `#maxPoolSize:`.
+
+Forking is done via `BlockClosure >> #fork`!
+
+!ForkPool methodsFor: 'accessing'!
+
+maxPoolSize
+	^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]
+!
+
+maxPoolSize: anInteger
+	maxPoolSize := anInteger
+! !
+
+!ForkPool methodsFor: 'actions'!
+
+fork: aBlock
+	poolSize < self maxPoolSize ifTrue: [ self addWorker ].
+	queue nextPut: aBlock
+! !
+
+!ForkPool methodsFor: 'defaults'!
+
+defaultMaxPoolSize
+	^ self class defaultMaxPoolSize
+! !
+
+!ForkPool methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	
+	poolSize := 0.
+	queue := Queue new.
+	worker := self makeWorker
+!
+
+makeWorker
+	| sentinel |
+	sentinel := Object new.
+	^ [ | block |
+		poolSize := poolSize - 1.
+		block := queue nextIfAbsent: [ sentinel ].
+		block == sentinel ifFalse: [
+			[ block value ] ensure: [ self addWorker ] ]]
+! !
+
+!ForkPool methodsFor: 'private'!
+
+addWorker
+	worker valueWithTimeout: 0.
+	poolSize := poolSize + 1
+! !
+
+ForkPool class instanceVariableNames: 'default'!
+
+!ForkPool class methodsFor: 'accessing'!
+
+default
+	^ default ifNil: [ default := self new ]
+!
+
+defaultMaxPoolSize
+	^ 100
+!
+
+resetDefault
+	default := nil
+! !
+
+Object subclass: #Message
+	instanceVariableNames: 'selector arguments'
+	package: 'Kernel-Methods'!
+!Message commentStamp!
+In general, the system does not use instances of me for efficiency reasons.
+However, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.
+This instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.
+
+See boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`
+
+## API
+
+Besides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.!
+
+!Message methodsFor: 'accessing'!
+
+arguments
+	^ arguments
+!
+
+arguments: anArray
+	arguments := anArray
+!
+
+selector
+	^ selector
+!
+
+selector: aString
+	selector := aString
+! !
+
+!Message methodsFor: 'actions'!
+
+sendTo: anObject
+	^ anObject perform: self selector withArguments: self arguments
+! !
+
+!Message methodsFor: 'printing'!
+
+printOn: aStream
+	super printOn: aStream.
+	aStream
+		nextPutAll: '(';
+		nextPutAll: self selector;
+		nextPutAll: ')'
+! !
+
+!Message class methodsFor: 'instance creation'!
+
+selector: aString arguments: anArray
+	^ self new
+		selector: aString;
+		arguments: anArray;
+		yourself
+! !
+
+Object subclass: #MessageSend
+	instanceVariableNames: 'receiver message'
+	package: 'Kernel-Methods'!
+!MessageSend commentStamp!
+I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. 
+
+## API
+
+Use `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.!
+
+!MessageSend methodsFor: 'accessing'!
+
+arguments
+	^ message arguments
+!
+
+arguments: aCollection
+	message arguments: aCollection
+!
+
+receiver
+	^ receiver
+!
+
+receiver: anObject
+	receiver := anObject
+!
+
+selector
+	^ message selector
+!
+
+selector: aString
+	message selector: aString
+! !
+
+!MessageSend methodsFor: 'evaluating'!
+
+value
+	^ message sendTo: self receiver
+!
+
+value: anObject
+	^ message 
+		arguments: { anObject };
+		sendTo: self receiver
+!
+
+value: firstArgument value: secondArgument
+	^ message 
+		arguments: { firstArgument. secondArgument };
+		sendTo: self receiver
+!
+
+value: firstArgument value: secondArgument value: thirdArgument
+	^ message 
+		arguments: { firstArgument. secondArgument. thirdArgument };
+		sendTo: self receiver
+!
+
+valueWithPossibleArguments: aCollection
+	self arguments: aCollection.
+	^ self value
+! !
+
+!MessageSend methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	message := Message new
+! !
+
+!MessageSend methodsFor: 'printing'!
+
+printOn: aStream
+	super printOn: aStream.
+	aStream
+		nextPutAll: '(';
+		nextPutAll: self receiver;
+		nextPutAll: ' >> ';
+		nextPutAll: self selector;
+		nextPutAll: ')'
+! !
+
+Object subclass: #MethodContext
+	instanceVariableNames: ''
+	package: 'Kernel-Methods'!
+!MethodContext commentStamp!
+I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.
+
+My instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.!
+
+!MethodContext methodsFor: 'accessing'!
+
+basicReceiver
+	<return self.receiver>
+!
+
+evaluatedSelector
+	<return self.evaluatedSelector>
+!
+
+findContextSuchThat: testBlock
+	"Search self and my sender chain for first one that satisfies `testBlock`.  
+	Answer `nil` if none satisfy"
+
+	| context |
+	
+	context := self.
+	[ context isNil] whileFalse: [
+		(testBlock value: context) 
+			ifTrue: [ ^ context ].
+		context := context outerContext ].
+
+	^ nil
+!
+
+home
+	<return self.homeContext>
+!
+
+index
+	<return self.index || 0>
+!
+
+locals
+	<return self.locals || {}>
+!
+
+method
+	| method lookupClass receiverClass supercall |
+	
+	self methodContext ifNil: [ ^ nil ].
+
+	receiverClass := self methodContext receiver class.
+	method := receiverClass lookupSelector: self methodContext selector.
+	supercall := self outerContext 
+		ifNil: [ false ]
+		ifNotNil: [ :outer | outer supercall ].
+
+	^ supercall
+		ifFalse: [ method ]
+		ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]
+!
+
+methodContext
+	self isBlockContext ifFalse: [ ^ self ].
+	
+	^ self outerContext ifNotNil: [ :outer |
+		outer methodContext ]
+!
+
+outerContext
+	<return self.outerContext || self.homeContext>
+!
+
+receiver
+	^ (self isBlockContext and: [ self outerContext notNil ])
+		ifTrue: [ self outerContext receiver ]
+		ifFalse: [ self basicReceiver ]
+!
+
+selector
+	<
+		if(self.selector) {
+			return smalltalk.convertSelector(self.selector);
+		} else {
+			return nil;
+		}
+	>
+!
+
+sendIndexAt: aSelector
+	<return self.sendIdx[aSelector] || 0>
+!
+
+sendIndexes
+	<return self.sendIdx>
+!
+
+supercall
+	<return self.supercall == true>
+!
+
+temps
+	self deprecatedAPI.
+	
+	^ self locals
+! !
+
+!MethodContext methodsFor: 'converting'!
+
+asString
+	^ self isBlockContext
+		ifTrue: [ 'a block (in ', self methodContext asString, ')' ]
+		ifFalse: [ 
+			| methodClass |
+			methodClass := self method methodClass.
+			methodClass = self receiver class 
+				ifTrue: [ self receiver class name, ' >> ', self selector ]
+				ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]
+! !
+
+!MethodContext methodsFor: 'printing'!
+
+printOn: aStream
+	super printOn: aStream.
+	aStream 
+		nextPutAll: '(';
+		nextPutAll: self asString;
+		nextPutAll: ')'
+! !
+
+!MethodContext methodsFor: 'testing'!
+
+isBlockContext
+	"Block context do not have selectors."
+	
+	^ self selector isNil
+! !
+
+Object subclass: #NativeFunction
+	instanceVariableNames: ''
+	package: 'Kernel-Methods'!
+!NativeFunction commentStamp!
+I am a wrapper around native functions, such as `WebSocket`.
+For 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.
+
+## API
+
+See the class-side `instance creation` methods for instance creation.
+
+Created instances will most probably be instance of `JSObjectProxy`.
+
+## Usage example:
+
+	| ws |
+	ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.
+	ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]!
+
+!NativeFunction class methodsFor: 'instance creation'!
+
+constructor: aString
+	<
+		var nativeFunc=eval(aString);
+		return new nativeFunc();
+	>
+!
+
+constructor: aString value:anObject
+	<
+		var nativeFunc=eval(aString);
+		return new nativeFunc(anObject);
+	>
+!
+
+constructor: aString value:anObject value: anObject2
+	<
+		var nativeFunc=eval(aString);
+		return new nativeFunc(anObject,anObject2);
+	>
+!
+
+constructor: aString value:anObject value: anObject2 value:anObject3
+	<
+		var nativeFunc=eval(aString);
+		return new nativeFunc(anObject,anObject2, anObject3);
+	>
+! !
+
+!NativeFunction class methodsFor: 'testing'!
+
+exists: aString
+	^ PlatformInterface existsGlobal: aString
+! !
+
+Object subclass: #Timeout
+	instanceVariableNames: 'rawTimeout'
+	package: 'Kernel-Methods'!
+!Timeout commentStamp!
+I am wrapping the returns from `set{Timeout,Interval}`.
+
+## Motivation
+
+Number suffices in browsers, but node.js returns an object.!
+
+!Timeout methodsFor: 'accessing'!
+
+rawTimeout: anObject
+	rawTimeout := anObject
+! !
+
+!Timeout methodsFor: 'timeout/interval'!
+
+clearInterval
+	<
+		var interval = self["@rawTimeout"];
+		clearInterval(interval);
+	>
+!
+
+clearTimeout
+	<
+		var timeout = self["@rawTimeout"];
+		clearTimeout(timeout);
+	>
+! !
+
+!Timeout class methodsFor: 'instance creation'!
+
+on: anObject
+	^ self new rawTimeout: anObject; yourself
+! !
+

+ 4242 - 0
src/Kernel-Objects.js

@@ -0,0 +1,4242 @@
+define("amber_core/Kernel-Objects", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals"], function(smalltalk,nil,_st, globals){
+smalltalk.addPackage('Kernel-Objects');
+smalltalk.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
+
+smalltalk.addClass('ProtoObject', globals.nil, [], 'Kernel-Objects');
+globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self.__eq_eq(anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.ProtoObject)})},
+args: ["anObject"],
+source: "= anObject\x0a\x09^ self == anObject",
+messageSends: ["=="],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "==",
+protocol: 'comparing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._identityHash();
+$ctx1.sendIdx["identityHash"]=1;
+$1=_st($2).__eq(_st(anObject)._identityHash());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},globals.ProtoObject)})},
+args: ["anObject"],
+source: "== anObject\x0a\x09^ self identityHash = anObject identityHash",
+messageSends: ["=", "identityHash"],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._printString();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.ProtoObject)})},
+args: [],
+source: "asString\x0a\x09^ self printString",
+messageSends: ["printString"],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "class",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.klass;
+return self}, function($ctx1) {$ctx1.fill(self,"class",{},globals.ProtoObject)})},
+args: [],
+source: "class\x0a\x09<return self.klass>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "doesNotUnderstand:",
+protocol: 'error handling',
+fn: function (aMessage){
+var self=this;
+function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st($MessageNotUnderstood())._new();
+_st($1)._receiver_(self);
+_st($1)._message_(aMessage);
+$2=_st($1)._signal();
+return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.ProtoObject)})},
+args: ["aMessage"],
+source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
+messageSends: ["receiver:", "new", "message:", "signal"],
+referencedClasses: ["MessageNotUnderstood"]
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "evaluate:on:",
+protocol: 'evaluating',
+fn: function (aString,anEvaluator){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(anEvaluator)._evaluate_receiver_(aString,self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},globals.ProtoObject)})},
+args: ["aString", "anEvaluator"],
+source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
+messageSends: ["evaluate:receiver:"],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "identityHash",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var hash=self.identityHash;
+		if (hash) return hash;
+		hash=smalltalk.nextId();
+		Object.defineProperty(self, 'identityHash', {value:hash});
+		return hash;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.ProtoObject)})},
+args: [],
+source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=smalltalk.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "initialize",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspect",
+protocol: 'inspecting',
+fn: function (){
+var self=this;
+function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Inspector())._inspect_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"inspect",{},globals.ProtoObject)})},
+args: [],
+source: "inspect\x0a\x09Inspector inspect: self",
+messageSends: ["inspect:"],
+referencedClasses: ["Inspector"]
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectOn:",
+protocol: 'inspecting',
+fn: function (anInspector){
+var self=this;
+return self},
+args: ["anInspector"],
+source: "inspectOn: anInspector",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instVarAt:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ return self['@'+aString] ;
+return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},globals.ProtoObject)})},
+args: ["aString"],
+source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "instVarAt:put:",
+protocol: 'accessing',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ self['@' + aString] = anObject ;
+return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},globals.ProtoObject)})},
+args: ["aString", "anObject"],
+source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "perform:",
+protocol: 'message handling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._perform_withArguments_(aString,[]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},globals.ProtoObject)})},
+args: ["aString"],
+source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
+messageSends: ["perform:withArguments:"],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "perform:withArguments:",
+protocol: 'message handling',
+fn: function (aString,aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk.send(self, aString._asSelector(), aCollection);
+return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},globals.ProtoObject)})},
+args: ["aString", "aCollection"],
+source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $5,$4,$3,$2,$1;
+$5=self._class();
+$ctx1.sendIdx["class"]=1;
+$4=_st($5)._name();
+$ctx1.sendIdx["name"]=1;
+$3=_st($4)._first();
+$2=_st($3)._isVowel();
+if(smalltalk.assert($2)){
+$1="an ";
+} else {
+$1="a ";
+};
+_st(aStream)._nextPutAll_($1);
+$ctx1.sendIdx["nextPutAll:"]=1;
+_st(aStream)._nextPutAll_(_st(self._class())._name());
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.ProtoObject)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
+messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printString",
+protocol: 'printing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($String())._streamContents_((function(str){
+return smalltalk.withContext(function($ctx2) {
+return self._printOn_(str);
+}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"printString",{},globals.ProtoObject)})},
+args: [],
+source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
+messageSends: ["streamContents:", "printOn:"],
+referencedClasses: ["String"]
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "yourself",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "yourself\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "~=",
+protocol: 'comparing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self.__eq(anObject)).__eq(false);
+$ctx1.sendIdx["="]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},globals.ProtoObject)})},
+args: ["anObject"],
+source: "~= anObject\x0a\x09^ (self = anObject) = false",
+messageSends: ["="],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "~~",
+protocol: 'comparing',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self.__eq_eq(anObject)).__eq(false);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},globals.ProtoObject)})},
+args: ["anObject"],
+source: "~~ anObject\x0a\x09^ (self == anObject) = false",
+messageSends: ["=", "=="],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "class";
+},
+args: [],
+source: "heliosClass\x0a\x09\x22Should be an Helios extension. Unfortunately, since helios can browse remote\x0a\x09environments, we can't extend base classes\x22\x0a\x09\x0a\x09^ 'class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "initialize",
+messageSends: [],
+referencedClasses: []
+}),
+globals.ProtoObject.klass);
+
+
+smalltalk.addClass('Object', globals.ProtoObject, [], 'Kernel-Objects');
+globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "->",
+protocol: 'converting',
+fn: function (anObject){
+var self=this;
+function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Association())._key_value_(self,anObject);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},globals.Object)})},
+args: ["anObject"],
+source: "-> anObject\x0a\x09^ Association key: self value: anObject",
+messageSends: ["key:value:"],
+referencedClasses: ["Association"]
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'converting',
+fn: function (){
+var self=this;
+var variables;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+variables=_st($HashedCollection())._new();
+_st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(variables)._at_put_(each,_st(self._instVarAt_(each))._asJSON());
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+$1=variables;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},globals.Object)})},
+args: [],
+source: "asJSON\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJSON ].\x0a\x09^ variables",
+messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSONString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($JSON())._stringify_(self._asJSON());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJSONString",{},globals.Object)})},
+args: [],
+source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
+messageSends: ["stringify:", "asJSON"],
+referencedClasses: ["JSON"]
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJavascript",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._asString();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Object)})},
+args: [],
+source: "asJavascript\x0a\x09^ self asString",
+messageSends: ["asString"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicAt:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self[aString];
+return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},globals.Object)})},
+args: ["aString"],
+source: "basicAt: aString\x0a\x09<return self[aString]>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicAt:put:",
+protocol: 'accessing',
+fn: function (aString,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self[aString] = anObject;
+return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},globals.Object)})},
+args: ["aString", "anObject"],
+source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicDelete:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+delete self[aString]; return aString;
+return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},globals.Object)})},
+args: ["aString"],
+source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicPerform:",
+protocol: 'message handling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._basicPerform_withArguments_(aString,[]);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},globals.Object)})},
+args: ["aString"],
+source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
+messageSends: ["basicPerform:withArguments:"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "basicPerform:withArguments:",
+protocol: 'message handling',
+fn: function (aString,aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self[aString].apply(self, aCollection);;
+return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},globals.Object)})},
+args: ["aString", "aCollection"],
+source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "browse",
+protocol: 'browsing',
+fn: function (){
+var self=this;
+function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Finder())._findClass_(self._class());
+return self}, function($ctx1) {$ctx1.fill(self,"browse",{},globals.Object)})},
+args: [],
+source: "browse\x0a\x09Finder findClass: self class",
+messageSends: ["findClass:", "class"],
+referencedClasses: ["Finder"]
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._shallowCopy())._postCopy();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"copy",{},globals.Object)})},
+args: [],
+source: "copy\x0a\x09^ self shallowCopy postCopy",
+messageSends: ["postCopy", "shallowCopy"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deepCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var copy = self.klass._new();
+		Object.keys(self).forEach(function (i) {
+		if(/^@.+/.test(i)) {
+			copy[i] = self[i]._deepCopy();
+		}
+		});
+		return copy;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Object)})},
+args: [],
+source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deprecatedAPI",
+protocol: 'error handling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$6,$5,$4,$8,$7,$3,$2;
+$1=console;
+$6=smalltalk.getThisContext()._home();
+$ctx1.sendIdx["home"]=1;
+$5=_st($6)._asString();
+$ctx1.sendIdx["asString"]=1;
+$4=_st($5).__comma(" is deprecated! (in ");
+$8=_st(smalltalk.getThisContext()._home())._home();
+$ctx1.sendIdx["home"]=2;
+$7=_st($8)._asString();
+$3=_st($4).__comma($7);
+$ctx1.sendIdx[","]=2;
+$2=_st($3).__comma(")");
+$ctx1.sendIdx[","]=1;
+_st($1)._warn_($2);
+return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},globals.Object)})},
+args: [],
+source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.",
+messageSends: ["warn:", ",", "asString", "home"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deprecatedAPI:",
+protocol: 'error handling',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$6,$5,$4,$8,$7,$3,$2;
+$1=console;
+$6=smalltalk.getThisContext()._home();
+$ctx1.sendIdx["home"]=1;
+$5=_st($6)._asString();
+$ctx1.sendIdx["asString"]=1;
+$4=_st($5).__comma(" is deprecated! (in ");
+$8=_st(smalltalk.getThisContext()._home())._home();
+$ctx1.sendIdx["home"]=2;
+$7=_st($8)._asString();
+$3=_st($4).__comma($7);
+$ctx1.sendIdx[","]=2;
+$2=_st($3).__comma(")");
+$ctx1.sendIdx[","]=1;
+_st($1)._warn_($2);
+$ctx1.sendIdx["warn:"]=1;
+_st(console)._warn_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},globals.Object)})},
+args: ["aString"],
+source: "deprecatedAPI: aString\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.\x0a\x09console warn: aString",
+messageSends: ["warn:", ",", "asString", "home"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "error:",
+protocol: 'error handling',
+fn: function (aString){
+var self=this;
+function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Error())._signal_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},globals.Object)})},
+args: ["aString"],
+source: "error: aString\x0a\x09Error signal: aString",
+messageSends: ["signal:"],
+referencedClasses: ["Error"]
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "halt",
+protocol: 'error handling',
+fn: function (){
+var self=this;
+function $Halt(){return globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
+return smalltalk.withContext(function($ctx1) { 
+_st($Halt())._signal();
+return self}, function($ctx1) {$ctx1.fill(self,"halt",{},globals.Object)})},
+args: [],
+source: "halt\x0a\x09Halt signal",
+messageSends: ["signal"],
+referencedClasses: ["Halt"]
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNil:",
+protocol: 'testing',
+fn: function (aBlock){
+var self=this;
+return self;
+},
+args: ["aBlock"],
+source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNil:ifNotNil:",
+protocol: 'testing',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(anotherBlock)._value_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)})},
+args: ["aBlock", "anotherBlock"],
+source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
+messageSends: ["value:"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNotNil:",
+protocol: 'testing',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aBlock)._value_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},globals.Object)})},
+args: ["aBlock"],
+source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
+messageSends: ["value:"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNotNil:ifNil:",
+protocol: 'testing',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aBlock)._value_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)})},
+args: ["aBlock", "anotherBlock"],
+source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
+messageSends: ["value:"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "inspectOn:",
+protocol: 'inspecting',
+fn: function (anInspector){
+var self=this;
+var variables;
+function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+variables=_st($Dictionary())._new();
+_st(variables)._at_put_("#self",self);
+$ctx1.sendIdx["at:put:"]=1;
+_st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(variables)._at_put_(each,self._instVarAt_(each));
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+_st(anInspector)._setLabel_(self._printString());
+$1=_st(anInspector)._setVariables_(variables);
+return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.Object)})},
+args: ["anInspector"],
+source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
+messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"],
+referencedClasses: ["Dictionary"]
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBehavior",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isBehavior\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBoolean",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isBoolean\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isClass",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isClass\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isCompiledMethod",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isCompiledMethod\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isImmutable\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isKindOf:",
+protocol: 'testing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._isMemberOf_(aClass);
+if(smalltalk.assert($2)){
+$1=true;
+} else {
+$1=_st(self._class())._inheritsFrom_(aClass);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},globals.Object)})},
+args: ["aClass"],
+source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
+messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isMemberOf:",
+protocol: 'testing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class()).__eq(aClass);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},globals.Object)})},
+args: ["aClass"],
+source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
+messageSends: ["=", "class"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isMetaclass",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isMetaclass\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNil",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isNil\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNumber",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isNumber\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isPackage",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isPackage\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isParseFailure",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isParseFailure\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isString",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isString\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isSymbol",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "isSymbol\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "notNil",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._isNil())._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"notNil",{},globals.Object)})},
+args: [],
+source: "notNil\x0a\x09^ self isNil not",
+messageSends: ["not", "isNil"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "postCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "postCopy",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "putOn:",
+protocol: 'streaming',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aStream)._nextPut_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Object)})},
+args: ["aStream"],
+source: "putOn: aStream\x0a\x09aStream nextPut: self",
+messageSends: ["nextPut:"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "respondsTo:",
+protocol: 'testing',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._class())._canUnderstand_(aSelector);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},globals.Object)})},
+args: ["aSelector"],
+source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
+messageSends: ["canUnderstand:", "class"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shallowCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		var copy = self.klass._new();
+		Object.keys(self).forEach(function(i) {
+		if(/^@.+/.test(i)) {
+			copy[i] = self[i];
+		}
+		});
+		return copy;
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.Object)})},
+args: [],
+source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shouldNotImplement",
+protocol: 'error handling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._error_("This method should not be implemented in ".__comma(_st(self._class())._name()));
+return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},globals.Object)})},
+args: [],
+source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
+messageSends: ["error:", ",", "name", "class"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "size",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._error_("Object not indexable");
+return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Object)})},
+args: [],
+source: "size\x0a\x09self error: 'Object not indexable'",
+messageSends: ["error:"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclassResponsibility",
+protocol: 'error handling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._error_("This method is a responsibility of a subclass");
+return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},globals.Object)})},
+args: [],
+source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
+messageSends: ["error:"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "throw:",
+protocol: 'error handling',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ throw anObject ;
+return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},globals.Object)})},
+args: ["anObject"],
+source: "throw: anObject\x0a\x09< throw anObject >",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "try:catch:",
+protocol: 'error handling',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._deprecatedAPI();
+$1=_st(aBlock)._tryCatch_(anotherBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)})},
+args: ["aBlock", "anotherBlock"],
+source: "try: aBlock catch: anotherBlock\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ aBlock tryCatch: anotherBlock",
+messageSends: ["deprecatedAPI", "tryCatch:"],
+referencedClasses: []
+}),
+globals.Object);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.valueOf();
+return self}, function($ctx1) {$ctx1.fill(self,"value",{},globals.Object)})},
+args: [],
+source: "value\x0a\x09<return self.valueOf()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accessorProtocolWith:",
+protocol: 'helios',
+fn: function (aGenerator){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aGenerator)._accessorProtocolForObject();
+return self}, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)})},
+args: ["aGenerator"],
+source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
+messageSends: ["accessorProtocolForObject"],
+referencedClasses: []
+}),
+globals.Object.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "accessorsSourceCodesWith:",
+protocol: 'helios',
+fn: function (aGenerator){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aGenerator)._accessorsForObject();
+return self}, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)})},
+args: ["aGenerator"],
+source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
+messageSends: ["accessorsForObject"],
+referencedClasses: []
+}),
+globals.Object.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+protocol: 'helios',
+fn: function (){
+var self=this;
+return "class";
+},
+args: [],
+source: "heliosClass\x0a\x09\x22Should be an Helios extension. Unfortunately, since helios can browse remote\x0a\x09environments, we can't extend base classes\x22\x0a\x09\x0a\x09^ 'class'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return self},
+args: [],
+source: "initialize\x0a\x09\x22no op\x22",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Object.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeProtocolWith:",
+protocol: 'helios',
+fn: function (aGenerator){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aGenerator)._initializeProtocolForObject();
+return self}, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)})},
+args: ["aGenerator"],
+source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
+messageSends: ["initializeProtocolForObject"],
+referencedClasses: []
+}),
+globals.Object.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initializeSourceCodesWith:",
+protocol: 'helios',
+fn: function (aGenerator){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aGenerator)._initializeForObject();
+return self}, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)})},
+args: ["aGenerator"],
+source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
+messageSends: ["initializeForObject"],
+referencedClasses: []
+}),
+globals.Object.klass);
+
+
+smalltalk.addClass('Boolean', globals.Object, [], 'Kernel-Objects');
+globals.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a    aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "&",
+protocol: 'controlling',
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		if(self == true) {
+		return aBoolean;
+		} else {
+		return false;
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},globals.Boolean)})},
+args: ["aBoolean"],
+source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return aBoolean != null &&
+			typeof aBoolean._isBoolean === "function" &&
+			aBoolean._isBoolean() &&
+			Boolean(self == true) == aBoolean
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},globals.Boolean)})},
+args: ["aBoolean"],
+source: "= aBoolean\x0a\x09<\x0a\x09\x09return aBoolean != null &&\x0a\x09\x09\x09typeof aBoolean._isBoolean === \x22function\x22 &&\x0a\x09\x09\x09aBoolean._isBoolean() &&\x0a\x09\x09\x09Boolean(self == true) == aBoolean\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "==",
+protocol: 'comparing',
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self.__eq(aBoolean);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},globals.Boolean)})},
+args: ["aBoolean"],
+source: "== aBoolean\x0a\x09^ self = aBoolean",
+messageSends: ["="],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "and:",
+protocol: 'controlling',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self.__eq(true);
+$1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
+return false;
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},globals.Boolean)})},
+args: ["aBlock"],
+source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
+messageSends: ["ifTrue:ifFalse:", "="],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asBit",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+if(smalltalk.assert(self)){
+$1=(1);
+} else {
+$1=(0);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asBit",{},globals.Boolean)})},
+args: [],
+source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
+messageSends: ["ifTrue:ifFalse:"],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "asJSON\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ return self.toString() ;
+return self}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Boolean)})},
+args: [],
+source: "asString\x0a\x09< return self.toString() >",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deepCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "deepCopy\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifFalse:",
+protocol: 'controlling',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._ifTrue_ifFalse_((function(){
+}),aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},globals.Boolean)})},
+args: ["aBlock"],
+source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
+messageSends: ["ifTrue:ifFalse:"],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifFalse:ifTrue:",
+protocol: 'controlling',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)})},
+args: ["aBlock", "anotherBlock"],
+source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
+messageSends: ["ifTrue:ifFalse:"],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifTrue:",
+protocol: 'controlling',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._ifTrue_ifFalse_(aBlock,(function(){
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},globals.Boolean)})},
+args: ["aBlock"],
+source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
+messageSends: ["ifTrue:ifFalse:"],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifTrue:ifFalse:",
+protocol: 'controlling',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		if(self == true) {
+		return aBlock._value();
+		} else {
+		return anotherBlock._value();
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)})},
+args: ["aBlock", "anotherBlock"],
+source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isBoolean",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isBoolean\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isImmutable\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "not",
+protocol: 'controlling',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self.__eq(false);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"not",{},globals.Boolean)})},
+args: [],
+source: "not\x0a\x09^ self = false",
+messageSends: ["="],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "or:",
+protocol: 'controlling',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self.__eq(true);
+$1=_st($2)._ifTrue_ifFalse_((function(){
+return true;
+}),aBlock);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},globals.Boolean)})},
+args: ["aBlock"],
+source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
+messageSends: ["ifTrue:ifFalse:", "="],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aStream)._nextPutAll_(self._asString());
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Boolean)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
+messageSends: ["nextPutAll:", "asString"],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shallowCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "shallowCopy\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "|",
+protocol: 'controlling',
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		if(self == true) {
+		return true;
+		} else {
+		return aBoolean;
+		}
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},globals.Boolean)})},
+args: ["aBoolean"],
+source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Boolean);
+
+
+
+smalltalk.addClass('Date', globals.Object, [], 'Kernel-Objects');
+globals.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "+",
+protocol: 'arithmetic',
+fn: function (aDate){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self + aDate;
+return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},globals.Date)})},
+args: ["aDate"],
+source: "+ aDate\x0a\x09<return self + aDate>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "-",
+protocol: 'arithmetic',
+fn: function (aDate){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self - aDate;
+return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},globals.Date)})},
+args: ["aDate"],
+source: "- aDate\x0a\x09<return self - aDate>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "<",
+protocol: 'comparing',
+fn: function (aDate){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self < aDate;
+return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},globals.Date)})},
+args: ["aDate"],
+source: "< aDate\x0a\x09<return self < aDate>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "<=",
+protocol: 'comparing',
+fn: function (aDate){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self <= aDate;
+return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},globals.Date)})},
+args: ["aDate"],
+source: "<= aDate\x0a\x09<return self <= aDate>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: ">",
+protocol: 'comparing',
+fn: function (aDate){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self > aDate;
+return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},globals.Date)})},
+args: ["aDate"],
+source: "> aDate\x0a\x09<return self >> aDate>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: ">=",
+protocol: 'comparing',
+fn: function (aDate){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self >= aDate;
+return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},globals.Date)})},
+args: ["aDate"],
+source: ">= aDate\x0a\x09<return self >>= aDate>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asDateString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.toDateString();
+return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},globals.Date)})},
+args: [],
+source: "asDateString\x0a\x09<return self.toDateString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asLocaleString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.toLocaleString();
+return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},globals.Date)})},
+args: [],
+source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asMilliseconds",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._time();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},globals.Date)})},
+args: [],
+source: "asMilliseconds\x0a\x09^ self time",
+messageSends: ["time"],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asNumber",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._asMilliseconds();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.Date)})},
+args: [],
+source: "asNumber\x0a\x09^ self asMilliseconds",
+messageSends: ["asMilliseconds"],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.toString();
+return self}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Date)})},
+args: [],
+source: "asString\x0a\x09<return self.toString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asTimeString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.toTimeString();
+return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},globals.Date)})},
+args: [],
+source: "asTimeString\x0a\x09<return self.toTimeString()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "day",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._dayOfWeek();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"day",{},globals.Date)})},
+args: [],
+source: "day\x0a\x09^ self dayOfWeek",
+messageSends: ["dayOfWeek"],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "day:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._dayOfWeek_(aNumber);
+return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
+messageSends: ["dayOfWeek:"],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "dayOfMonth",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.getDate();
+return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},globals.Date)})},
+args: [],
+source: "dayOfMonth\x0a\x09<return self.getDate()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "dayOfMonth:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.setDate(aNumber);
+return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "dayOfWeek",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.getDay() + 1;
+return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},globals.Date)})},
+args: [],
+source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "dayOfWeek:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.setDay(aNumber - 1);
+return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hours",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.getHours();
+return self}, function($ctx1) {$ctx1.fill(self,"hours",{},globals.Date)})},
+args: [],
+source: "hours\x0a\x09<return self.getHours()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "hours:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.setHours(aNumber);
+return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "milliseconds",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.getMilliseconds();
+return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},globals.Date)})},
+args: [],
+source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "milliseconds:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.setMilliseconds(aNumber);
+return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "minutes",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.getMinutes();
+return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},globals.Date)})},
+args: [],
+source: "minutes\x0a\x09<return self.getMinutes()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "minutes:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.setMinutes(aNumber);
+return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "month",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.getMonth() + 1;
+return self}, function($ctx1) {$ctx1.fill(self,"month",{},globals.Date)})},
+args: [],
+source: "month\x0a\x09<return self.getMonth() + 1>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "month:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.setMonth(aNumber - 1);
+return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aStream)._nextPutAll_(self._asString());
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Date)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
+messageSends: ["nextPutAll:", "asString"],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "seconds",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.getSeconds();
+return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},globals.Date)})},
+args: [],
+source: "seconds\x0a\x09<return self.getSeconds()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "seconds:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.setSeconds(aNumber);
+return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "time",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.getTime();
+return self}, function($ctx1) {$ctx1.fill(self,"time",{},globals.Date)})},
+args: [],
+source: "time\x0a\x09<return self.getTime()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "time:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.setTime(aNumber);
+return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "year",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.getFullYear();
+return self}, function($ctx1) {$ctx1.fill(self,"year",{},globals.Date)})},
+args: [],
+source: "year\x0a\x09<return self.getFullYear()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "year:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self.setFullYear(aNumber);
+return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},globals.Date)})},
+args: ["aNumber"],
+source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromMilliseconds:",
+protocol: 'instance creation',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._new_(aNumber);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},globals.Date.klass)})},
+args: ["aNumber"],
+source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
+messageSends: ["new:"],
+referencedClasses: []
+}),
+globals.Date.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromSeconds:",
+protocol: 'instance creation',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._fromMilliseconds_(_st(aNumber).__star((1000)));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},globals.Date.klass)})},
+args: ["aNumber"],
+source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
+messageSends: ["fromMilliseconds:", "*"],
+referencedClasses: []
+}),
+globals.Date.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "fromString:",
+protocol: 'instance creation',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._new_(aString);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.Date.klass)})},
+args: ["aString"],
+source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
+messageSends: ["new:"],
+referencedClasses: []
+}),
+globals.Date.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+protocol: 'helios',
+fn: function (){
+var self=this;
+return "magnitude";
+},
+args: [],
+source: "heliosClass\x0a\x09^ 'magnitude'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "millisecondsToRun:",
+protocol: 'instance creation',
+fn: function (aBlock){
+var self=this;
+var t;
+function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+t=_st($Date())._now();
+$ctx1.sendIdx["now"]=1;
+_st(aBlock)._value();
+$1=_st(_st($Date())._now()).__minus(t);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},globals.Date.klass)})},
+args: ["aBlock"],
+source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
+messageSends: ["now", "value", "-"],
+referencedClasses: ["Date"]
+}),
+globals.Date.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new:",
+protocol: 'instance creation',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return new Date(anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},globals.Date.klass)})},
+args: ["anObject"],
+source: "new: anObject\x0a\x09<return new Date(anObject)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Date.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "now",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._today();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"now",{},globals.Date.klass)})},
+args: [],
+source: "now\x0a\x09^ self today",
+messageSends: ["today"],
+referencedClasses: []
+}),
+globals.Date.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "today",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"today",{},globals.Date.klass)})},
+args: [],
+source: "today\x0a\x09^ self new",
+messageSends: ["new"],
+referencedClasses: []
+}),
+globals.Date.klass);
+
+
+smalltalk.addClass('Number', globals.Object, [], 'Kernel-Objects');
+globals.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [ Transcript show: 'This will be printed 5 times'; cr ].\x0a\x09\x0a\x091 to: 5 do: [ :aNumber| Transcript show: aNumber asString; cr ].\x0a\x09\x0a\x091 to: 10 by: 2 do: [ :aNumber| Transcript show: aNumber asString; cr ].";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "&",
+protocol: 'converting',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self & aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "& aNumber\x0a\x09<return self & aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "*",
+protocol: 'arithmetic',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self * aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "**",
+protocol: 'mathematical functions',
+fn: function (exponent){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._raisedTo_(exponent);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},globals.Number)})},
+args: ["exponent"],
+source: "** exponent\x0a\x09^ self raisedTo: exponent",
+messageSends: ["raisedTo:"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "+",
+protocol: 'arithmetic',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self + aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "-",
+protocol: 'arithmetic',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self - aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "/",
+protocol: 'arithmetic',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self / aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "//",
+protocol: 'arithmetic',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self.__slash(aNumber))._floor();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "// aNumber\x0a\x09^ (self / aNumber) floor",
+messageSends: ["floor", "/"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "<",
+protocol: 'comparing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self < aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "<=",
+protocol: 'comparing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self <= aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		return aNumber != null &&
+			typeof aNumber._isNumber === "function" &&
+			aNumber._isNumber() &&
+			Number(self) == aNumber
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "= aNumber\x0a\x09<\x0a\x09\x09return aNumber != null &&\x0a\x09\x09\x09typeof aNumber._isNumber === \x22function\x22 &&\x0a\x09\x09\x09aNumber._isNumber() &&\x0a\x09\x09\x09Number(self) == aNumber\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: ">",
+protocol: 'comparing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self > aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: ">=",
+protocol: 'comparing',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self >= aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "@",
+protocol: 'converting',
+fn: function (aNumber){
+var self=this;
+function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Point())._x_y_(self,aNumber);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
+messageSends: ["x:y:"],
+referencedClasses: ["Point"]
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "\x5c\x5c",
+protocol: 'arithmetic',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self % aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "abs",
+protocol: 'arithmetic',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.abs(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"abs",{},globals.Number)})},
+args: [],
+source: "abs\x0a\x09<return Math.abs(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arcCos",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.acos(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"arcCos",{},globals.Number)})},
+args: [],
+source: "arcCos\x0a\x09<return Math.acos(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arcSin",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.asin(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"arcSin",{},globals.Number)})},
+args: [],
+source: "arcSin\x0a\x09<return Math.asin(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "arcTan",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.atan(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"arcTan",{},globals.Number)})},
+args: [],
+source: "arcTan\x0a\x09<return Math.atan(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "asJSON\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJavascript",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st("(".__comma(self._printString())).__comma(")");
+$ctx1.sendIdx[","]=1;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Number)})},
+args: [],
+source: "asJavascript\x0a\x09^ '(', self printString, ')'",
+messageSends: [",", "printString"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asNumber",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "asNumber\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asPoint",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Point())._x_y_(self,self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asPoint",{},globals.Number)})},
+args: [],
+source: "asPoint\x0a\x09^ Point x: self y: self",
+messageSends: ["x:y:"],
+referencedClasses: ["Point"]
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asString",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ return String(self) ;
+return self}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Number)})},
+args: [],
+source: "asString\x0a\x09< return String(self) >",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "atRandom",
+protocol: 'converting',
+fn: function (){
+var self=this;
+function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.Number)})},
+args: [],
+source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
+messageSends: ["+", "truncated", "*", "next", "new"],
+referencedClasses: ["Random"]
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ceiling",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.ceil(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"ceiling",{},globals.Number)})},
+args: [],
+source: "ceiling\x0a\x09<return Math.ceil(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "copy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "copy\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cos",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.cos(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"cos",{},globals.Number)})},
+args: [],
+source: "cos\x0a\x09<return Math.cos(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deepCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._copy();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Number)})},
+args: [],
+source: "deepCopy\x0a\x09^ self copy",
+messageSends: ["copy"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "even",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=(0).__eq(self.__backslash_backslash((2)));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"even",{},globals.Number)})},
+args: [],
+source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
+messageSends: ["=", "\x5c\x5c"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "floor",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.floor(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"floor",{},globals.Number)})},
+args: [],
+source: "floor\x0a\x09<return Math.floor(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "identityHash",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._asString()).__comma("n");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.Number)})},
+args: [],
+source: "identityHash\x0a\x09^ self asString, 'n'",
+messageSends: [",", "asString"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isImmutable\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNumber",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isNumber\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isZero",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self.__eq((0));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isZero",{},globals.Number)})},
+args: [],
+source: "isZero\x0a\x09^ self = 0",
+messageSends: ["="],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ln",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.log(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"ln",{},globals.Number)})},
+args: [],
+source: "ln\x0a\x09<return Math.log(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "log",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.log(self) / Math.LN10;;
+return self}, function($ctx1) {$ctx1.fill(self,"log",{},globals.Number)})},
+args: [],
+source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "log:",
+protocol: 'mathematical functions',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.log(self) / Math.log(aNumber);;
+return self}, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "max:",
+protocol: 'arithmetic',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.max(self, aNumber);;
+return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "min:",
+protocol: 'arithmetic',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.min(self, aNumber);;
+return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "negated",
+protocol: 'arithmetic',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=(0).__minus(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"negated",{},globals.Number)})},
+args: [],
+source: "negated\x0a\x09^ 0 - self",
+messageSends: ["-"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "negative",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self.__lt((0));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"negative",{},globals.Number)})},
+args: [],
+source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
+messageSends: ["<"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "odd",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._even())._not();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"odd",{},globals.Number)})},
+args: [],
+source: "odd\x0a\x09^ self even not",
+messageSends: ["not", "even"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "positive",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self.__gt_eq((0));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"positive",{},globals.Number)})},
+args: [],
+source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
+messageSends: [">="],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aStream)._nextPutAll_(self._asString());
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Number)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
+messageSends: ["nextPutAll:", "asString"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printShowingDecimalPlaces:",
+protocol: 'printing',
+fn: function (placesDesired){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self.toFixed(placesDesired);
+return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},globals.Number)})},
+args: ["placesDesired"],
+source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "raisedTo:",
+protocol: 'mathematical functions',
+fn: function (exponent){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.pow(self, exponent);;
+return self}, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},globals.Number)})},
+args: ["exponent"],
+source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "rounded",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.round(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},globals.Number)})},
+args: [],
+source: "rounded\x0a\x09<return Math.round(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sign",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self._isZero();
+if(smalltalk.assert($1)){
+return (0);
+};
+$2=self._positive();
+if(smalltalk.assert($2)){
+return (1);
+} else {
+return (-1);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"sign",{},globals.Number)})},
+args: [],
+source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
+messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sin",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.sin(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"sin",{},globals.Number)})},
+args: [],
+source: "sin\x0a\x09<return Math.sin(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "sqrt",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.sqrt(self);
+return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},globals.Number)})},
+args: [],
+source: "sqrt\x0a\x09<return Math.sqrt(self)>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "squared",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self.__star(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"squared",{},globals.Number)})},
+args: [],
+source: "squared\x0a\x09^ self * self",
+messageSends: ["*"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "tan",
+protocol: 'mathematical functions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.tan(self);;
+return self}, function($ctx1) {$ctx1.fill(self,"tan",{},globals.Number)})},
+args: [],
+source: "tan\x0a\x09<return Math.tan(self);>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "timesRepeat:",
+protocol: 'enumerating',
+fn: function (aBlock){
+var self=this;
+var count;
+return smalltalk.withContext(function($ctx1) { 
+count=(1);
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(count).__gt(self);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(aBlock)._value();
+count=_st(count).__plus((1));
+return count;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},globals.Number)})},
+args: ["aBlock"],
+source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
+messageSends: ["whileFalse:", ">", "value", "+"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "to:",
+protocol: 'converting',
+fn: function (aNumber){
+var self=this;
+var array,first,last,count;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+first=self._truncated();
+$ctx1.sendIdx["truncated"]=1;
+last=_st(_st(aNumber)._truncated()).__plus((1));
+$ctx1.sendIdx["+"]=1;
+count=(1);
+array=_st($Array())._new();
+_st(_st(last).__minus(first))._timesRepeat_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(array)._at_put_(count,first);
+count=_st(count).__plus((1));
+$ctx2.sendIdx["+"]=2;
+count;
+first=_st(first).__plus((1));
+return first;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+$1=array;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},globals.Number)})},
+args: ["aNumber"],
+source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1 ].\x0a\x09^ array",
+messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"],
+referencedClasses: ["Array"]
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "to:by:",
+protocol: 'converting',
+fn: function (stop,step){
+var self=this;
+var array,value,pos;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+value=self;
+array=_st($Array())._new();
+pos=(1);
+$1=_st(step).__eq((0));
+if(smalltalk.assert($1)){
+self._error_("step must be non-zero");
+};
+$2=_st(step).__lt((0));
+if(smalltalk.assert($2)){
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(value).__gt_eq(stop);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(array)._at_put_(pos,value);
+$ctx2.sendIdx["at:put:"]=1;
+pos=_st(pos).__plus((1));
+$ctx2.sendIdx["+"]=1;
+pos;
+value=_st(value).__plus(step);
+$ctx2.sendIdx["+"]=2;
+return value;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
+$ctx1.sendIdx["whileTrue:"]=1;
+} else {
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(value).__lt_eq(stop);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(array)._at_put_(pos,value);
+pos=_st(pos).__plus((1));
+$ctx2.sendIdx["+"]=3;
+pos;
+value=_st(value).__plus(step);
+return value;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
+};
+$3=array;
+return $3;
+}, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},globals.Number)})},
+args: ["stop", "step"],
+source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]].\x0a\x09^ array",
+messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="],
+referencedClasses: ["Array"]
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "to:by:do:",
+protocol: 'enumerating',
+fn: function (stop,step,aBlock){
+var self=this;
+var value;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+value=self;
+$1=_st(step).__eq((0));
+if(smalltalk.assert($1)){
+self._error_("step must be non-zero");
+};
+$2=_st(step).__lt((0));
+if(smalltalk.assert($2)){
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(value).__gt_eq(stop);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(aBlock)._value_(value);
+$ctx2.sendIdx["value:"]=1;
+value=_st(value).__plus(step);
+$ctx2.sendIdx["+"]=1;
+return value;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
+$ctx1.sendIdx["whileTrue:"]=1;
+} else {
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(value).__lt_eq(stop);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(aBlock)._value_(value);
+value=_st(value).__plus(step);
+return value;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
+};
+return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},globals.Number)})},
+args: ["stop", "step", "aBlock"],
+source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]",
+messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "to:do:",
+protocol: 'enumerating',
+fn: function (stop,aBlock){
+var self=this;
+var nextValue;
+return smalltalk.withContext(function($ctx1) { 
+nextValue=self;
+_st((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(nextValue).__lt_eq(stop);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
+return smalltalk.withContext(function($ctx2) {
+_st(aBlock)._value_(nextValue);
+nextValue=_st(nextValue).__plus((1));
+return nextValue;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},globals.Number)})},
+args: ["stop", "aBlock"],
+source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[ nextValue <= stop ]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[ aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1 ]",
+messageSends: ["whileTrue:", "<=", "value:", "+"],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "truncated",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+		if(self >= 0) {
+			return Math.floor(self);
+		} else {
+			return Math.floor(self * (-1)) * (-1);
+		};
+	;
+return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},globals.Number)})},
+args: [],
+source: "truncated\x0a\x09<\x0a\x09\x09if(self >>= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "|",
+protocol: 'converting',
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self | aNumber;
+return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},globals.Number)})},
+args: ["aNumber"],
+source: "| aNumber\x0a\x09<return self | aNumber>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "e",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.E;;
+return self}, function($ctx1) {$ctx1.fill(self,"e",{},globals.Number.klass)})},
+args: [],
+source: "e\x0a\x09<return Math.E;>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+protocol: 'helios',
+fn: function (){
+var self=this;
+return "magnitude";
+},
+args: [],
+source: "heliosClass\x0a\x09^ 'magnitude'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pi",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.PI;
+return self}, function($ctx1) {$ctx1.fill(self,"pi",{},globals.Number.klass)})},
+args: [],
+source: "pi\x0a\x09<return Math.PI>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Number.klass);
+
+
+smalltalk.addClass('Point', globals.Object, ['x', 'y'], 'Kernel-Objects');
+globals.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "*",
+protocol: 'arithmetic',
+fn: function (aPoint){
+var self=this;
+function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$5,$4,$2,$7,$6,$1;
+$3=self._x();
+$ctx1.sendIdx["x"]=1;
+$5=_st(aPoint)._asPoint();
+$ctx1.sendIdx["asPoint"]=1;
+$4=_st($5)._x();
+$2=_st($3).__star($4);
+$ctx1.sendIdx["*"]=1;
+$7=self._y();
+$ctx1.sendIdx["y"]=1;
+$6=_st($7).__star(_st(_st(aPoint)._asPoint())._y());
+$1=_st($Point())._x_y_($2,$6);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},globals.Point)})},
+args: ["aPoint"],
+source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
+messageSends: ["x:y:", "*", "x", "asPoint", "y"],
+referencedClasses: ["Point"]
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "+",
+protocol: 'arithmetic',
+fn: function (aPoint){
+var self=this;
+function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$5,$4,$2,$7,$6,$1;
+$3=self._x();
+$ctx1.sendIdx["x"]=1;
+$5=_st(aPoint)._asPoint();
+$ctx1.sendIdx["asPoint"]=1;
+$4=_st($5)._x();
+$2=_st($3).__plus($4);
+$ctx1.sendIdx["+"]=1;
+$7=self._y();
+$ctx1.sendIdx["y"]=1;
+$6=_st($7).__plus(_st(_st(aPoint)._asPoint())._y());
+$1=_st($Point())._x_y_($2,$6);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},globals.Point)})},
+args: ["aPoint"],
+source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
+messageSends: ["x:y:", "+", "x", "asPoint", "y"],
+referencedClasses: ["Point"]
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "-",
+protocol: 'arithmetic',
+fn: function (aPoint){
+var self=this;
+function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$5,$4,$2,$7,$6,$1;
+$3=self._x();
+$ctx1.sendIdx["x"]=1;
+$5=_st(aPoint)._asPoint();
+$ctx1.sendIdx["asPoint"]=1;
+$4=_st($5)._x();
+$2=_st($3).__minus($4);
+$ctx1.sendIdx["-"]=1;
+$7=self._y();
+$ctx1.sendIdx["y"]=1;
+$6=_st($7).__minus(_st(_st(aPoint)._asPoint())._y());
+$1=_st($Point())._x_y_($2,$6);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},globals.Point)})},
+args: ["aPoint"],
+source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
+messageSends: ["x:y:", "-", "x", "asPoint", "y"],
+referencedClasses: ["Point"]
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "/",
+protocol: 'arithmetic',
+fn: function (aPoint){
+var self=this;
+function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$5,$4,$2,$7,$6,$1;
+$3=self._x();
+$ctx1.sendIdx["x"]=1;
+$5=_st(aPoint)._asPoint();
+$ctx1.sendIdx["asPoint"]=1;
+$4=_st($5)._x();
+$2=_st($3).__slash($4);
+$ctx1.sendIdx["/"]=1;
+$7=self._y();
+$ctx1.sendIdx["y"]=1;
+$6=_st($7).__slash(_st(_st(aPoint)._asPoint())._y());
+$1=_st($Point())._x_y_($2,$6);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},globals.Point)})},
+args: ["aPoint"],
+source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
+messageSends: ["x:y:", "/", "x", "asPoint", "y"],
+referencedClasses: ["Point"]
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "<",
+protocol: 'comparing',
+fn: function (aPoint){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$4,$1;
+$3=self._x();
+$ctx1.sendIdx["x"]=1;
+$2=_st($3).__lt(_st(aPoint)._x());
+$ctx1.sendIdx["<"]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=self._y();
+$ctx2.sendIdx["y"]=1;
+return _st($4).__lt(_st(aPoint)._y());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},globals.Point)})},
+args: ["aPoint"],
+source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
+messageSends: ["and:", "<", "x", "y"],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "<=",
+protocol: 'comparing',
+fn: function (aPoint){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$4,$1;
+$3=self._x();
+$ctx1.sendIdx["x"]=1;
+$2=_st($3).__lt_eq(_st(aPoint)._x());
+$ctx1.sendIdx["<="]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=self._y();
+$ctx2.sendIdx["y"]=1;
+return _st($4).__lt_eq(_st(aPoint)._y());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},globals.Point)})},
+args: ["aPoint"],
+source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
+messageSends: ["and:", "<=", "x", "y"],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "=",
+protocol: 'comparing',
+fn: function (aPoint){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$5,$4,$7,$6,$1;
+$3=_st(aPoint)._class();
+$ctx1.sendIdx["class"]=1;
+$2=_st($3).__eq(self._class());
+$ctx1.sendIdx["="]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$5=_st(aPoint)._x();
+$ctx2.sendIdx["x"]=1;
+$4=_st($5).__eq(self._x());
+$ctx2.sendIdx["="]=2;
+$7=_st(aPoint)._y();
+$ctx2.sendIdx["y"]=1;
+$6=_st($7).__eq(self._y());
+return _st($4).__and($6);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},globals.Point)})},
+args: ["aPoint"],
+source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
+messageSends: ["and:", "=", "class", "&", "x", "y"],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: ">",
+protocol: 'comparing',
+fn: function (aPoint){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$4,$1;
+$3=self._x();
+$ctx1.sendIdx["x"]=1;
+$2=_st($3).__gt(_st(aPoint)._x());
+$ctx1.sendIdx[">"]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=self._y();
+$ctx2.sendIdx["y"]=1;
+return _st($4).__gt(_st(aPoint)._y());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},globals.Point)})},
+args: ["aPoint"],
+source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
+messageSends: ["and:", ">", "x", "y"],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: ">=",
+protocol: 'comparing',
+fn: function (aPoint){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$4,$1;
+$3=self._x();
+$ctx1.sendIdx["x"]=1;
+$2=_st($3).__gt_eq(_st(aPoint)._x());
+$ctx1.sendIdx[">="]=1;
+$1=_st($2)._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+$4=self._y();
+$ctx2.sendIdx["y"]=1;
+return _st($4).__gt_eq(_st(aPoint)._y());
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},globals.Point)})},
+args: ["aPoint"],
+source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
+messageSends: ["and:", ">=", "x", "y"],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asPoint",
+protocol: 'converting',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "asPoint\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "dist:",
+protocol: 'transforming',
+fn: function (aPoint){
+var self=this;
+var dx,dy;
+return smalltalk.withContext(function($ctx1) { 
+var $3,$2,$1;
+dx=_st(_st(aPoint)._x()).__minus(self["@x"]);
+$ctx1.sendIdx["-"]=1;
+dy=_st(_st(aPoint)._y()).__minus(self["@y"]);
+$3=_st(dx).__star(dx);
+$ctx1.sendIdx["*"]=1;
+$2=_st($3).__plus(_st(dy).__star(dy));
+$1=_st($2)._sqrt();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},globals.Point)})},
+args: ["aPoint"],
+source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
+messageSends: ["-", "x", "y", "sqrt", "+", "*"],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(self["@x"])._printOn_(aStream);
+$ctx1.sendIdx["printOn:"]=1;
+_st(aStream)._nextPutAll_("@");
+$1=_st(_st(self["@y"])._notNil())._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self["@y"])._negative();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+if(smalltalk.assert($1)){
+_st(aStream)._space();
+};
+_st(self["@y"])._printOn_(aStream);
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Point)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [ y negative ]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
+messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "translateBy:",
+protocol: 'transforming',
+fn: function (delta){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(_st(delta)._x()).__plus(self["@x"]);
+$ctx1.sendIdx["+"]=1;
+$1=_st($2).__at(_st(_st(delta)._y()).__plus(self["@y"]));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},globals.Point)})},
+args: ["delta"],
+source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
+messageSends: ["@", "+", "x", "y"],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "x",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@x"];
+return $1;
+},
+args: [],
+source: "x\x0a\x09^ x",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "x:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+self["@x"]=aNumber;
+return self},
+args: ["aNumber"],
+source: "x: aNumber\x0a\x09x := aNumber",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "y",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@y"];
+return $1;
+},
+args: [],
+source: "y\x0a\x09^ y",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Point);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "y:",
+protocol: 'accessing',
+fn: function (aNumber){
+var self=this;
+self["@y"]=aNumber;
+return self},
+args: ["aNumber"],
+source: "y: aNumber\x0a\x09y := aNumber",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Point);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+protocol: 'helios',
+fn: function (){
+var self=this;
+return "magnitude";
+},
+args: [],
+source: "heliosClass\x0a\x09^ 'magnitude'",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Point.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "x:y:",
+protocol: 'instance creation',
+fn: function (aNumber,anotherNumber){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._x_(aNumber);
+_st($2)._y_(anotherNumber);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Point.klass)})},
+args: ["aNumber", "anotherNumber"],
+source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
+messageSends: ["x:", "new", "y:", "yourself"],
+referencedClasses: []
+}),
+globals.Point.klass);
+
+
+smalltalk.addClass('Random', globals.Object, [], 'Kernel-Objects');
+globals.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return Math.random();
+return self}, function($ctx1) {$ctx1.fill(self,"next",{},globals.Random)})},
+args: [],
+source: "next\x0a\x09<return Math.random()>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Random);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "next:",
+protocol: 'accessing',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st((1)._to_(anInteger))._collect_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return self._next();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},globals.Random)})},
+args: ["anInteger"],
+source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
+messageSends: ["collect:", "to:", "next"],
+referencedClasses: []
+}),
+globals.Random);
+
+
+
+smalltalk.addClass('UndefinedObject', globals.Object, [], 'Kernel-Objects');
+globals.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asJSON",
+protocol: 'converting',
+fn: function (){
+var self=this;
+var $1;
+$1=null;
+return $1;
+},
+args: [],
+source: "asJSON\x0a\x09^ null",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "deepCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "deepCopy\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNil:",
+protocol: 'testing',
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._ifNil_ifNotNil_(aBlock,(function(){
+}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},globals.UndefinedObject)})},
+args: ["aBlock"],
+source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
+messageSends: ["ifNil:ifNotNil:"],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNil:ifNotNil:",
+protocol: 'testing',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(aBlock)._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)})},
+args: ["aBlock", "anotherBlock"],
+source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
+messageSends: ["value"],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNotNil:",
+protocol: 'testing',
+fn: function (aBlock){
+var self=this;
+return self;
+},
+args: ["aBlock"],
+source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "ifNotNil:ifNil:",
+protocol: 'testing',
+fn: function (aBlock,anotherBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(anotherBlock)._value();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)})},
+args: ["aBlock", "anotherBlock"],
+source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
+messageSends: ["value"],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isImmutable",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isImmutable\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isNil",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return true;
+},
+args: [],
+source: "isNil\x0a\x09^ true",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "notNil",
+protocol: 'testing',
+fn: function (){
+var self=this;
+return false;
+},
+args: [],
+source: "notNil\x0a\x09^ false",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "printOn:",
+protocol: 'printing',
+fn: function (aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(aStream)._nextPutAll_("nil");
+return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.UndefinedObject)})},
+args: ["aStream"],
+source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
+messageSends: ["nextPutAll:"],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "shallowCopy",
+protocol: 'copying',
+fn: function (){
+var self=this;
+return self;
+},
+args: [],
+source: "shallowCopy\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclass:instanceVariableNames:",
+protocol: 'class creation',
+fn: function (aString,anotherString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.UndefinedObject)})},
+args: ["aString", "anotherString"],
+source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
+messageSends: ["subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclass:instanceVariableNames:category:",
+protocol: 'class creation',
+fn: function (aString,aString2,aString3){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._deprecatedAPI();
+$1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)})},
+args: ["aString", "aString2", "aString3"],
+source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
+messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+globals.UndefinedObject);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "subclass:instanceVariableNames:package:",
+protocol: 'class creation',
+fn: function (aString,aString2,aString3){
+var self=this;
+function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)})},
+args: ["aString", "aString2", "aString3"],
+source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
+messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
+referencedClasses: ["ClassBuilder"]
+}),
+globals.UndefinedObject);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "new",
+protocol: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._error_("You cannot create new instances of UndefinedObject. Use nil");
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.UndefinedObject.klass)})},
+args: [],
+source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
+messageSends: ["error:"],
+referencedClasses: []
+}),
+globals.UndefinedObject.klass);
+
+});

+ 1403 - 0
src/Kernel-Objects.st

@@ -0,0 +1,1403 @@
+Smalltalk createPackage: 'Kernel-Objects'!
+nil subclass: #ProtoObject
+	instanceVariableNames: ''
+	package: 'Kernel-Objects'!
+!ProtoObject commentStamp!
+I implement the basic behavior required for any object in Amber.
+
+In most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.!
+
+!ProtoObject methodsFor: 'accessing'!
+
+class
+	<return self.klass>
+!
+
+identityHash
+	<
+		var hash=self.identityHash;
+		if (hash) return hash;
+		hash=smalltalk.nextId();
+		Object.defineProperty(self, 'identityHash', {value:hash});
+		return hash;
+	>
+!
+
+instVarAt: aString
+	< return self['@'+aString] >
+!
+
+instVarAt: aString put: anObject
+	< self['@' + aString] = anObject >
+!
+
+yourself
+	^ self
+! !
+
+!ProtoObject methodsFor: 'comparing'!
+
+= anObject
+	^ self == anObject
+!
+
+== anObject
+	^ self identityHash = anObject identityHash
+!
+
+~= anObject
+	^ (self = anObject) = false
+!
+
+~~ anObject
+	^ (self == anObject) = false
+! !
+
+!ProtoObject methodsFor: 'converting'!
+
+asString
+	^ self printString
+! !
+
+!ProtoObject methodsFor: 'error handling'!
+
+doesNotUnderstand: aMessage
+	MessageNotUnderstood new
+		receiver: self;
+		message: aMessage;
+		signal
+! !
+
+!ProtoObject methodsFor: 'evaluating'!
+
+evaluate: aString on: anEvaluator
+	^ anEvaluator evaluate: aString receiver: self
+! !
+
+!ProtoObject methodsFor: 'initialization'!
+
+initialize
+! !
+
+!ProtoObject methodsFor: 'inspecting'!
+
+inspect
+	Inspector inspect: self
+!
+
+inspectOn: anInspector
+! !
+
+!ProtoObject methodsFor: 'message handling'!
+
+perform: aString
+	^ self perform: aString withArguments: #()
+!
+
+perform: aString withArguments: aCollection
+	<return smalltalk.send(self, aString._asSelector(), aCollection)>
+! !
+
+!ProtoObject methodsFor: 'printing'!
+
+printOn: aStream
+	aStream nextPutAll: (self class name first isVowel
+		ifTrue: [ 'an ' ]
+		ifFalse: [ 'a ' ]).
+	aStream nextPutAll: self class name
+!
+
+printString
+	^ String streamContents: [ :str | 
+		self printOn: str ]
+! !
+
+!ProtoObject class methodsFor: 'accessing'!
+
+heliosClass
+	"Should be an Helios extension. Unfortunately, since helios can browse remote
+	environments, we can't extend base classes"
+	
+	^ 'class'
+! !
+
+!ProtoObject class methodsFor: 'initialization'!
+
+initialize
+! !
+
+ProtoObject subclass: #Object
+	instanceVariableNames: ''
+	package: 'Kernel-Objects'!
+!Object commentStamp!
+**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.
+
+I provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:
+
+- accessing
+- copying
+- comparison
+- error handling
+- message sending
+- reflection
+
+Also utility messages that all objects should respond to are defined here.
+
+I have no instance variable.
+
+##Access
+
+Instance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.
+Accessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.
+
+##Copying
+
+Copying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.
+The hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.
+
+##Comparison
+
+I understand equality `#=` and identity `#==` comparison.
+
+##Error handling
+
+- `#halt` is the typical message to use for inserting breakpoints during debugging.
+- `#error:` throws a generic error exception
+- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.
+	Overriding this message can be useful to implement proxies for example.!
+
+!Object methodsFor: 'accessing'!
+
+basicAt: aString
+	<return self[aString]>
+!
+
+basicAt: aString put: anObject
+	<return self[aString] = anObject>
+!
+
+basicDelete: aString
+	<delete self[aString]; return aString>
+!
+
+size
+	self error: 'Object not indexable'
+!
+
+value
+	<return self.valueOf()>
+! !
+
+!Object methodsFor: 'browsing'!
+
+browse
+	Finder findClass: self class
+! !
+
+!Object methodsFor: 'converting'!
+
+-> anObject
+	^ Association key: self value: anObject
+!
+
+asJSON
+	| variables |
+	variables := HashedCollection new.
+	self class allInstanceVariableNames do: [ :each |
+		variables at: each put: (self instVarAt: each) asJSON ].
+	^ variables
+!
+
+asJSONString
+	^ JSON stringify: self asJSON
+!
+
+asJavascript
+	^ self asString
+! !
+
+!Object methodsFor: 'copying'!
+
+copy
+	^ self shallowCopy postCopy
+!
+
+deepCopy
+	<
+		var copy = self.klass._new();
+		Object.keys(self).forEach(function (i) {
+		if(/^@.+/.test(i)) {
+			copy[i] = self[i]._deepCopy();
+		}
+		});
+		return copy;
+	>
+!
+
+postCopy
+!
+
+shallowCopy
+	<
+		var copy = self.klass._new();
+		Object.keys(self).forEach(function(i) {
+		if(/^@.+/.test(i)) {
+			copy[i] = self[i];
+		}
+		});
+		return copy;
+	>
+! !
+
+!Object methodsFor: 'error handling'!
+
+deprecatedAPI
+	"Just a simple way to deprecate methods.
+	#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,
+	but it could in the future."
+	console warn: thisContext home asString, ' is deprecated!! (in ', thisContext home home asString, ')'.
+!
+
+deprecatedAPI: aString
+	"Just a simple way to deprecate methods.
+	#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,
+	but it could in the future."
+	console warn: thisContext home asString, ' is deprecated!! (in ', thisContext home home asString, ')'.
+	console warn: aString
+!
+
+error: aString
+	Error signal: aString
+!
+
+halt
+	Halt signal
+!
+
+shouldNotImplement
+	self error: 'This method should not be implemented in ', self class name
+!
+
+subclassResponsibility
+	self error: 'This method is a responsibility of a subclass'
+!
+
+throw: anObject
+	< throw anObject >
+!
+
+try: aBlock catch: anotherBlock
+	self deprecatedAPI.
+	
+	^ aBlock tryCatch: anotherBlock
+! !
+
+!Object methodsFor: 'inspecting'!
+
+inspectOn: anInspector
+	| variables |
+	variables := Dictionary new.
+	variables at: '#self' put: self.
+	self class allInstanceVariableNames do: [ :each |
+		variables at: each put: (self instVarAt: each) ].
+	anInspector
+		setLabel: self printString;
+		setVariables: variables
+! !
+
+!Object methodsFor: 'message handling'!
+
+basicPerform: aString
+	^ self basicPerform: aString withArguments: #()
+!
+
+basicPerform: aString withArguments: aCollection
+	<return self[aString].apply(self, aCollection);>
+! !
+
+!Object methodsFor: 'streaming'!
+
+putOn: aStream
+	aStream nextPut: self
+! !
+
+!Object methodsFor: 'testing'!
+
+ifNil: aBlock
+	"inlined in the Compiler"
+	^ self
+!
+
+ifNil: aBlock ifNotNil: anotherBlock
+	"inlined in the Compiler"
+	^ anotherBlock value: self
+!
+
+ifNotNil: aBlock
+	"inlined in the Compiler"
+	^ aBlock value: self
+!
+
+ifNotNil: aBlock ifNil: anotherBlock
+	"inlined in the Compiler"
+	^ aBlock value: self
+!
+
+isBehavior
+	^ false
+!
+
+isBoolean
+	^ false
+!
+
+isClass
+	^ false
+!
+
+isCompiledMethod
+	^ false
+!
+
+isImmutable
+	^ false
+!
+
+isKindOf: aClass
+	^ (self isMemberOf: aClass)
+		ifTrue: [ true ]
+		ifFalse: [ self class inheritsFrom: aClass ]
+!
+
+isMemberOf: aClass
+	^ self class = aClass
+!
+
+isMetaclass
+	^ false
+!
+
+isNil
+	^ false
+!
+
+isNumber
+	^ false
+!
+
+isPackage
+	^ false
+!
+
+isParseFailure
+	^ false
+!
+
+isString
+	^ false
+!
+
+isSymbol
+	^ false
+!
+
+notNil
+	^ self isNil not
+!
+
+respondsTo: aSelector
+	^ self class canUnderstand: aSelector
+! !
+
+!Object class methodsFor: 'helios'!
+
+accessorProtocolWith: aGenerator
+	aGenerator accessorProtocolForObject
+!
+
+accessorsSourceCodesWith: aGenerator
+	aGenerator accessorsForObject
+!
+
+heliosClass
+	"Should be an Helios extension. Unfortunately, since helios can browse remote
+	environments, we can't extend base classes"
+	
+	^ 'class'
+!
+
+initializeProtocolWith: aGenerator
+	aGenerator initializeProtocolForObject
+!
+
+initializeSourceCodesWith: aGenerator
+	aGenerator initializeForObject
+! !
+
+!Object class methodsFor: 'initialization'!
+
+initialize
+	"no op"
+! !
+
+Object subclass: #Boolean
+	instanceVariableNames: ''
+	package: 'Kernel-Objects'!
+!Boolean commentStamp!
+I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).
+
+I have two instances, `true` and `false`.
+
+I am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.
+
+## Usage Example:
+
+    aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]!
+
+!Boolean methodsFor: 'comparing'!
+
+= aBoolean
+	<
+		return aBoolean !!= null &&
+			typeof aBoolean._isBoolean === "function" &&
+			aBoolean._isBoolean() &&
+			Boolean(self == true) == aBoolean
+	>
+!
+
+== aBoolean
+	^ self = aBoolean
+! !
+
+!Boolean methodsFor: 'controlling'!
+
+& aBoolean
+	<
+		if(self == true) {
+		return aBoolean;
+		} else {
+		return false;
+		}
+	>
+!
+
+and: aBlock
+	^ self = true
+		ifTrue: aBlock
+		ifFalse: [ false ]
+!
+
+ifFalse: aBlock
+	"inlined in the Compiler"
+	^ self ifTrue: [] ifFalse: aBlock
+!
+
+ifFalse: aBlock ifTrue: anotherBlock
+	"inlined in the Compiler"
+	^ self ifTrue: anotherBlock ifFalse: aBlock
+!
+
+ifTrue: aBlock
+	"inlined in the Compiler"
+	^ self ifTrue: aBlock ifFalse: []
+!
+
+ifTrue: aBlock ifFalse: anotherBlock
+	"inlined in the Compiler"
+	<
+		if(self == true) {
+		return aBlock._value();
+		} else {
+		return anotherBlock._value();
+		}
+	>
+!
+
+not
+	^ self = false
+!
+
+or: aBlock
+	^ self = true
+		ifTrue: [ true ]
+		ifFalse: aBlock
+!
+
+| aBoolean
+	<
+		if(self == true) {
+		return true;
+		} else {
+		return aBoolean;
+		}
+	>
+! !
+
+!Boolean methodsFor: 'converting'!
+
+asBit
+	^ self ifTrue: [ 1 ] ifFalse: [ 0 ]
+!
+
+asJSON
+	^ self
+!
+
+asString
+	< return self.toString() >
+! !
+
+!Boolean methodsFor: 'copying'!
+
+deepCopy
+	^ self
+!
+
+shallowCopy
+	^ self
+! !
+
+!Boolean methodsFor: 'printing'!
+
+printOn: aStream
+	aStream nextPutAll: self asString
+! !
+
+!Boolean methodsFor: 'testing'!
+
+isBoolean
+	^ true
+!
+
+isImmutable
+	^ true
+! !
+
+Object subclass: #Date
+	instanceVariableNames: ''
+	package: 'Kernel-Objects'!
+!Date commentStamp!
+I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in
+Amber and answer the same date object.
+
+Date directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.
+
+## API
+
+The class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.
+
+Arithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).
+
+The `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).!
+
+!Date methodsFor: 'accessing'!
+
+day
+	^ self dayOfWeek
+!
+
+day: aNumber
+	self dayOfWeek: aNumber
+!
+
+dayOfMonth
+	<return self.getDate()>
+!
+
+dayOfMonth: aNumber
+	<self.setDate(aNumber)>
+!
+
+dayOfWeek
+	<return self.getDay() + 1>
+!
+
+dayOfWeek: aNumber
+	<return self.setDay(aNumber - 1)>
+!
+
+hours
+	<return self.getHours()>
+!
+
+hours: aNumber
+	<self.setHours(aNumber)>
+!
+
+milliseconds
+	<return self.getMilliseconds()>
+!
+
+milliseconds: aNumber
+	<self.setMilliseconds(aNumber)>
+!
+
+minutes
+	<return self.getMinutes()>
+!
+
+minutes: aNumber
+	<self.setMinutes(aNumber)>
+!
+
+month
+	<return self.getMonth() + 1>
+!
+
+month: aNumber
+	<self.setMonth(aNumber - 1)>
+!
+
+seconds
+	<return self.getSeconds()>
+!
+
+seconds: aNumber
+	<self.setSeconds(aNumber)>
+!
+
+time
+	<return self.getTime()>
+!
+
+time: aNumber
+	<self.setTime(aNumber)>
+!
+
+year
+	<return self.getFullYear()>
+!
+
+year: aNumber
+	<self.setFullYear(aNumber)>
+! !
+
+!Date methodsFor: 'arithmetic'!
+
++ aDate
+	<return self + aDate>
+!
+
+- aDate
+	<return self - aDate>
+! !
+
+!Date methodsFor: 'comparing'!
+
+< aDate
+	<return self < aDate>
+!
+
+<= aDate
+	<return self <= aDate>
+!
+
+> aDate
+	<return self >> aDate>
+!
+
+>= aDate
+	<return self >>= aDate>
+! !
+
+!Date methodsFor: 'converting'!
+
+asDateString
+	<return self.toDateString()>
+!
+
+asLocaleString
+	<return self.toLocaleString()>
+!
+
+asMilliseconds
+	^ self time
+!
+
+asNumber
+	^ self asMilliseconds
+!
+
+asString
+	<return self.toString()>
+!
+
+asTimeString
+	<return self.toTimeString()>
+! !
+
+!Date methodsFor: 'printing'!
+
+printOn: aStream
+	aStream nextPutAll: self asString
+! !
+
+!Date class methodsFor: 'helios'!
+
+heliosClass
+	^ 'magnitude'
+! !
+
+!Date class methodsFor: 'instance creation'!
+
+fromMilliseconds: aNumber
+	^ self new: aNumber
+!
+
+fromSeconds: aNumber
+	^ self fromMilliseconds: aNumber * 1000
+!
+
+fromString: aString
+	"Example: Date fromString('2011/04/15 00:00:00')"
+	^ self new: aString
+!
+
+millisecondsToRun: aBlock
+	| t |
+	t := Date now.
+	aBlock value.
+	^ Date now - t
+!
+
+new: anObject
+	<return new Date(anObject)>
+!
+
+now
+	^ self today
+!
+
+today
+	^ self new
+! !
+
+Object subclass: #Number
+	instanceVariableNames: ''
+	package: 'Kernel-Objects'!
+!Number commentStamp!
+I am the Amber representation for all numbers.
+I am directly mapped to JavaScript Number.
+
+## API
+
+I provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.
+
+My instances can also be used to evaluate a block a fixed number of times:
+
+	5 timesRepeat: [ Transcript show: 'This will be printed 5 times'; cr ].
+	
+	1 to: 5 do: [ :aNumber| Transcript show: aNumber asString; cr ].
+	
+	1 to: 10 by: 2 do: [ :aNumber| Transcript show: aNumber asString; cr ].!
+
+!Number methodsFor: 'accessing'!
+
+identityHash
+	^ self asString, 'n'
+! !
+
+!Number methodsFor: 'arithmetic'!
+
+* aNumber
+	"Inlined in the Compiler"
+	<return self * aNumber>
+!
+
++ aNumber
+	"Inlined in the Compiler"
+	<return self + aNumber>
+!
+
+- aNumber
+	"Inlined in the Compiler"
+	<return self - aNumber>
+!
+
+/ aNumber
+	"Inlined in the Compiler"
+	<return self / aNumber>
+!
+
+// aNumber
+	^ (self / aNumber) floor
+!
+
+\\ aNumber
+	<return self % aNumber>
+!
+
+abs
+	<return Math.abs(self);>
+!
+
+max: aNumber
+	<return Math.max(self, aNumber);>
+!
+
+min: aNumber
+	<return Math.min(self, aNumber);>
+!
+
+negated
+	^ 0 - self
+! !
+
+!Number methodsFor: 'comparing'!
+
+< aNumber
+	"Inlined in the Compiler"
+	<return self < aNumber>
+!
+
+<= aNumber
+	"Inlined in the Compiler"
+	<return self <= aNumber>
+!
+
+= aNumber
+	<
+		return aNumber !!= null &&
+			typeof aNumber._isNumber === "function" &&
+			aNumber._isNumber() &&
+			Number(self) == aNumber
+	>
+!
+
+> aNumber
+	"Inlined in the Compiler"
+	<return self >> aNumber>
+!
+
+>= aNumber
+	"Inlined in the Compiler"
+	<return self >>= aNumber>
+! !
+
+!Number methodsFor: 'converting'!
+
+& aNumber
+	<return self & aNumber>
+!
+
+@ aNumber
+	^ Point x: self y: aNumber
+!
+
+asJSON
+	^ self
+!
+
+asJavascript
+	^ '(', self printString, ')'
+!
+
+asNumber
+	^ self
+!
+
+asPoint
+	^ Point x: self y: self
+!
+
+asString
+	< return String(self) >
+!
+
+atRandom
+	^ (Random new next * self) truncated + 1
+!
+
+ceiling
+	<return Math.ceil(self);>
+!
+
+floor
+	<return Math.floor(self);>
+!
+
+rounded
+	<return Math.round(self);>
+!
+
+to: aNumber
+	| array first last count |
+	first := self truncated.
+	last := aNumber truncated + 1.
+	count := 1.
+	array := Array new.
+	(last - first) timesRepeat: [
+		array at: count put: first.
+		count := count + 1.
+		first := first + 1 ].
+	^ array
+!
+
+to: stop by: step
+	| array value pos |
+	value := self.
+	array := Array new.
+	pos := 1.
+	step = 0 ifTrue: [ self error: 'step must be non-zero' ].
+	step < 0
+		ifTrue: [ [ value >= stop ] whileTrue: [
+					array at: pos put: value.
+					pos := pos + 1.
+					value := value + step ]]
+		ifFalse: [ [ value <= stop ] whileTrue: [
+					array at: pos put: value.
+				pos := pos + 1.
+					value := value + step ]].
+	^ array
+!
+
+truncated
+	<
+		if(self >>= 0) {
+			return Math.floor(self);
+		} else {
+			return Math.floor(self * (-1)) * (-1);
+		};
+	>
+!
+
+| aNumber
+	<return self | aNumber>
+! !
+
+!Number methodsFor: 'copying'!
+
+copy
+	^ self
+!
+
+deepCopy
+	^ self copy
+! !
+
+!Number methodsFor: 'enumerating'!
+
+timesRepeat: aBlock
+	| count |
+	count := 1.
+	[ count > self ] whileFalse: [
+		aBlock value.
+		count := count + 1 ]
+!
+
+to: stop by: step do: aBlock
+	| value |
+	value := self.
+	step = 0 ifTrue: [ self error: 'step must be non-zero' ].
+	step < 0
+		ifTrue: [ [ value >= stop ] whileTrue: [
+					aBlock value: value.
+					value := value + step ]]
+		ifFalse: [ [ value <= stop ] whileTrue: [
+					aBlock value: value.
+					value := value + step ]]
+!
+
+to: stop do: aBlock
+	"Evaluate aBlock for each number from self to aNumber."
+	| nextValue |
+	nextValue := self.
+	[ nextValue <= stop ]
+		whileTrue:
+			[ aBlock value: nextValue.
+			nextValue := nextValue + 1 ]
+! !
+
+!Number methodsFor: 'mathematical functions'!
+
+** exponent
+	^ self raisedTo: exponent
+!
+
+arcCos
+	<return Math.acos(self);>
+!
+
+arcSin
+	<return Math.asin(self);>
+!
+
+arcTan
+	<return Math.atan(self);>
+!
+
+cos
+	<return Math.cos(self);>
+!
+
+ln
+	<return Math.log(self);>
+!
+
+log
+	<return Math.log(self) / Math.LN10;>
+!
+
+log: aNumber
+	<return Math.log(self) / Math.log(aNumber);>
+!
+
+raisedTo: exponent
+	<return Math.pow(self, exponent);>
+!
+
+sign
+	self isZero 
+		ifTrue: [ ^ 0 ].
+	self positive
+		ifTrue: [ ^ 1 ]
+		ifFalse: [ ^ -1 ].
+!
+
+sin
+	<return Math.sin(self);>
+!
+
+sqrt
+	<return Math.sqrt(self)>
+!
+
+squared
+	^ self * self
+!
+
+tan
+	<return Math.tan(self);>
+! !
+
+!Number methodsFor: 'printing'!
+
+printOn: aStream
+	aStream nextPutAll: self asString
+!
+
+printShowingDecimalPlaces: placesDesired
+	<return self.toFixed(placesDesired)>
+! !
+
+!Number methodsFor: 'testing'!
+
+even
+	^ 0 = (self \\ 2)
+!
+
+isImmutable
+	^ true
+!
+
+isNumber
+	^ true
+!
+
+isZero
+	^ self = 0
+!
+
+negative
+	"Answer whether the receiver is mathematically negative."
+
+	^ self < 0
+!
+
+odd
+	^ self even not
+!
+
+positive
+	"Answer whether the receiver is positive or equal to 0. (ST-80 protocol)."
+
+	^ self >= 0
+! !
+
+!Number class methodsFor: 'helios'!
+
+heliosClass
+	^ 'magnitude'
+! !
+
+!Number class methodsFor: 'instance creation'!
+
+e
+	<return Math.E;>
+!
+
+pi
+	<return Math.PI>
+! !
+
+Object subclass: #Point
+	instanceVariableNames: 'x y'
+	package: 'Kernel-Objects'!
+!Point commentStamp!
+I represent an x-y pair of numbers usually designating a geometric coordinate.
+
+## API
+
+Instances are traditionally created using the binary `#@` message to a number:
+
+	100@120
+
+Points can then be arithmetically manipulated:
+
+	100@100 + (10@10)
+
+...or for example:
+
+	(100@100) * 2
+
+**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:
+
+	100@ -100 "but 100@-100 would not parse"!
+
+!Point methodsFor: 'accessing'!
+
+x
+	^ x
+!
+
+x: aNumber
+	x := aNumber
+!
+
+y
+	^ y
+!
+
+y: aNumber
+	y := aNumber
+! !
+
+!Point methodsFor: 'arithmetic'!
+
+* aPoint
+	^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y
+!
+
++ aPoint
+	^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y
+!
+
+- aPoint
+	^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y
+!
+
+/ aPoint
+	^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y
+! !
+
+!Point methodsFor: 'comparing'!
+
+< aPoint
+	^ self x < aPoint x and: [
+		self y < aPoint y ]
+!
+
+<= aPoint
+	^ self x <= aPoint x and: [
+		self y <= aPoint y ]
+!
+
+= aPoint
+	^ aPoint class = self class and: [
+		(aPoint x = self x) & (aPoint y = self y) ]
+!
+
+> aPoint
+	^ self x > aPoint x and: [
+		self y > aPoint y ]
+!
+
+>= aPoint
+	^ self x >= aPoint x and: [
+		self y >= aPoint y ]
+! !
+
+!Point methodsFor: 'converting'!
+
+asPoint
+	^ self
+! !
+
+!Point methodsFor: 'printing'!
+
+printOn: aStream
+	"Print receiver in classic x@y notation."
+
+	x printOn: aStream.
+	
+	aStream nextPutAll: '@'.
+	(y notNil and: [ y negative ]) ifTrue: [
+			"Avoid ambiguous @- construct"
+			aStream space ].
+	
+	y printOn: aStream
+! !
+
+!Point methodsFor: 'transforming'!
+
+dist: aPoint 
+	"Answer the distance between aPoint and the receiver."
+	| dx dy |
+	dx := aPoint x - x.
+	dy := aPoint y - y.
+	^ (dx * dx + (dy * dy)) sqrt
+!
+
+translateBy: delta
+	"Answer a Point translated by delta (an instance of Point)."
+	^ (delta x + x) @ (delta y + y)
+! !
+
+!Point class methodsFor: 'helios'!
+
+heliosClass
+	^ 'magnitude'
+! !
+
+!Point class methodsFor: 'instance creation'!
+
+x: aNumber y: anotherNumber
+	^ self new
+		x: aNumber;
+		y: anotherNumber;
+		yourself
+! !
+
+Object subclass: #Random
+	instanceVariableNames: ''
+	package: 'Kernel-Objects'!
+!Random commentStamp!
+I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.
+
+## API
+
+The typical use case it to use the `#next` method like the following:
+
+	Random new next
+
+This will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`
+
+	10 atRandom
+
+A random number in a specific interval can be obtained with the following:
+
+	(3 to: 7) atRandom
+
+Be aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:
+
+	5 atRandom + 2
+
+Since `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:
+
+	#('a' 'b' 'c') atRandom
+
+As well as letter from a `String`:
+
+	'abc' atRandom
+
+Since Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.!
+
+!Random methodsFor: 'accessing'!
+
+next
+	<return Math.random()>
+!
+
+next: anInteger
+	^ (1 to: anInteger) collect: [ :each | self next ]
+! !
+
+Object subclass: #UndefinedObject
+	instanceVariableNames: ''
+	package: 'Kernel-Objects'!
+!UndefinedObject commentStamp!
+I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.
+
+`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.
+
+__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.!
+
+!UndefinedObject methodsFor: 'class creation'!
+
+subclass: aString instanceVariableNames: anotherString
+	^ self subclass: aString instanceVariableNames: anotherString package: nil
+!
+
+subclass: aString instanceVariableNames: aString2 category: aString3
+	"Kept for compatibility."
+	self deprecatedAPI.
+	^ self subclass: aString instanceVariableNames: aString2 package: aString3
+!
+
+subclass: aString instanceVariableNames: aString2 package: aString3
+	^ ClassBuilder new
+		superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3
+! !
+
+!UndefinedObject methodsFor: 'converting'!
+
+asJSON
+	^ null
+! !
+
+!UndefinedObject methodsFor: 'copying'!
+
+deepCopy
+	^ self
+!
+
+shallowCopy
+	^ self
+! !
+
+!UndefinedObject methodsFor: 'printing'!
+
+printOn: aStream
+	aStream nextPutAll: 'nil'
+! !
+
+!UndefinedObject methodsFor: 'testing'!
+
+ifNil: aBlock
+	"inlined in the Compiler"
+	^ self ifNil: aBlock ifNotNil: []
+!
+
+ifNil: aBlock ifNotNil: anotherBlock
+	"inlined in the Compiler"
+	^ aBlock value
+!
+
+ifNotNil: aBlock
+	"inlined in the Compiler"
+	^ self
+!
+
+ifNotNil: aBlock ifNil: anotherBlock
+	"inlined in the Compiler"
+	^ anotherBlock value
+!
+
+isImmutable
+	^ true
+!
+
+isNil
+	^ true
+!
+
+notNil
+	^ false
+! !
+
+!UndefinedObject class methodsFor: 'instance creation'!
+
+new
+		self error: 'You cannot create new instances of UndefinedObject. Use nil'
+! !
+

Деякі файли не було показано, через те що забагато файлів було змінено