mdbe 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/app.rb +182 -0
- data/bin/mdbe +5 -0
- data/config.ru +2 -0
- data/environment.rb +8 -0
- data/lib/mdbe.rb +39 -0
- data/lib/mdbe/action_controller_debug_patch.rb +12 -0
- data/lib/mdbe/code_evaluation.rb +46 -0
- data/lib/mdbe/database_views.rb +24 -0
- data/lib/mdbe/database_views/abstract_dictionary.rb +69 -0
- data/lib/mdbe/database_views/abstract_exception.rb +25 -0
- data/lib/mdbe/database_views/array.rb +28 -0
- data/lib/mdbe/database_views/boolean.rb +12 -0
- data/lib/mdbe/database_views/class.rb +46 -0
- data/lib/mdbe/database_views/exception.rb +3 -0
- data/lib/mdbe/database_views/execblock.rb +5 -0
- data/lib/mdbe/database_views/fixnum.rb +5 -0
- data/lib/mdbe/database_views/float.rb +5 -0
- data/lib/mdbe/database_views/globals.rb +2 -0
- data/lib/mdbe/database_views/gsnmethod.rb +29 -0
- data/lib/mdbe/database_views/hash.rb +5 -0
- data/lib/mdbe/database_views/maglev_record.rb +42 -0
- data/lib/mdbe/database_views/module.rb +103 -0
- data/lib/mdbe/database_views/nilclass.rb +5 -0
- data/lib/mdbe/database_views/object.rb +80 -0
- data/lib/mdbe/database_views/proc.rb +3 -0
- data/lib/mdbe/database_views/repository.rb +3 -0
- data/lib/mdbe/database_views/ruby_workspace.rb +5 -0
- data/lib/mdbe/database_views/smalltalk_classes.rb +34 -0
- data/lib/mdbe/database_views/smalltalk_classes.st +60 -0
- data/lib/mdbe/database_views/string.rb +31 -0
- data/lib/mdbe/database_views/symbol.rb +32 -0
- data/lib/mdbe/database_views/system.rb +61 -0
- data/lib/mdbe/database_views/thread.rb +101 -0
- data/lib/mdbe/debug_server.rb +22 -0
- data/lib/mdbe/halt.rb +42 -0
- data/lib/mdbe/ruby_workspace.rb +29 -0
- data/lib/mdbe/version.rb +3 -0
- data/lib/tasks/maglev-database-explorer_tasks.rake +4 -0
- data/public/LICENSE +35 -0
- data/public/amber/CHANGELOG +65 -0
- data/public/amber/LICENSE +22 -0
- data/public/amber/Makefile +53 -0
- data/public/amber/README.md +30 -0
- data/public/amber/bin/amber +3 -0
- data/public/amber/bin/amberc +352 -0
- data/public/amber/bin/nodecompile.js +33 -0
- data/public/amber/bin/server +3 -0
- data/public/amber/bin/server.bat +3 -0
- data/public/amber/css/amber-normalize.css +468 -0
- data/public/amber/css/amber-normalize.less +501 -0
- data/public/amber/css/amber.css +539 -0
- data/public/amber/css/documentation.css +84 -0
- data/public/amber/css/profstef.css +75 -0
- data/public/amber/css/style.css +313 -0
- data/public/amber/documentation.html +37 -0
- data/public/amber/examples/Makefile +23 -0
- data/public/amber/examples/README +4 -0
- data/public/amber/examples/android/helloamber/AndroidManifest.xml +19 -0
- data/public/amber/examples/android/helloamber/HelloAmber.st +13 -0
- data/public/amber/examples/android/helloamber/Makefile +56 -0
- data/public/amber/examples/android/helloamber/README.md +80 -0
- data/public/amber/examples/android/helloamber/ant.properties +17 -0
- data/public/amber/examples/android/helloamber/assets/index.html +15 -0
- data/public/amber/examples/android/helloamber/assets/jquery-1.7.2.min.js +4 -0
- data/public/amber/examples/android/helloamber/build.xml +83 -0
- data/public/amber/examples/android/helloamber/local.properties +10 -0
- data/public/amber/examples/android/helloamber/proguard-project.txt +20 -0
- data/public/amber/examples/android/helloamber/project.properties +14 -0
- data/public/amber/examples/android/helloamber/res/layout/main.xml +6 -0
- data/public/amber/examples/android/helloamber/res/values/strings.xml +4 -0
- data/public/amber/examples/android/helloamber/src/org/amberlang/android/helloamber/HelloAmber.java +59 -0
- data/public/amber/examples/myproject/index.html +16 -0
- data/public/amber/examples/nodejs/README +9 -0
- data/public/amber/examples/nodejs/benchfib/Benchfib.st +124 -0
- data/public/amber/examples/nodejs/benchfib/Makefile +8 -0
- data/public/amber/examples/nodejs/benchfib/benchfib +1 -0
- data/public/amber/examples/nodejs/hello/Hello.st +9 -0
- data/public/amber/examples/nodejs/hello/Makefile +8 -0
- data/public/amber/examples/nodejs/hello/README +13 -0
- data/public/amber/examples/nodejs/hello/hello +1 -0
- data/public/amber/examples/nodejs/meta/Makefile +8 -0
- data/public/amber/examples/nodejs/meta/MyScript.st +27 -0
- data/public/amber/examples/nodejs/meta/meta +1 -0
- data/public/amber/examples/nodejs/pystone/Makefile +8 -0
- data/public/amber/examples/nodejs/pystone/Pystone.st +306 -0
- data/public/amber/examples/nodejs/pystone/pystone +1 -0
- data/public/amber/examples/nodejs/trivialserver/Makefile +8 -0
- data/public/amber/examples/nodejs/trivialserver/TrivialServer.st +51 -0
- data/public/amber/examples/nodejs/trivialserver/trivial +1 -0
- data/public/amber/examples/presentation/esug2011/images/asterix.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/background_box.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/background_header.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/balloon.jpg +0 -0
- data/public/amber/examples/presentation/esug2011/images/balloon_header.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/devices.jpg +0 -0
- data/public/amber/examples/presentation/esug2011/images/enyo.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/ide_star_wars.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/nodejs.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/terminal.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/webos.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/amber.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/ambrhino.jpg +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/nodejs.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/pharo.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/php.gif +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/rails.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-next.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-prev.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/closedhand.cur +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/openhand.cur +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-back.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-forward.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.css +100 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.js +1232 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.min.js +13 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.easing.1.3.js +38 -0
- data/public/amber/examples/presentation/index.html +17 -0
- data/public/amber/examples/presentation/js/Presentation.deploy.js +1922 -0
- data/public/amber/examples/presentation/js/Presentation.js +2712 -0
- data/public/amber/examples/presentation/st/Presentation.st +1996 -0
- data/public/amber/examples/trysmalltalk/index.html +18 -0
- data/public/amber/examples/trysmalltalk/js/TrySmalltalk.deploy.js +837 -0
- data/public/amber/examples/trysmalltalk/js/TrySmalltalk.js +1206 -0
- data/public/amber/examples/trysmalltalk/st/TrySmalltalk.st +964 -0
- data/public/amber/examples/twitterwall/css/twitterwall.css +19 -0
- data/public/amber/examples/twitterwall/index.html +35 -0
- data/public/amber/examples/twitterwall/js/TwitterWall.deploy.js +116 -0
- data/public/amber/examples/twitterwall/js/TwitterWall.js +146 -0
- data/public/amber/examples/twitterwall/st/TwitterWall.st +91 -0
- data/public/amber/examples/webos/README +11 -0
- data/public/amber/examples/webos/eris/DuckQwaq.wav +0 -0
- data/public/amber/examples/webos/eris/EnyoAmber.st +36 -0
- data/public/amber/examples/webos/eris/Eris.css +0 -0
- data/public/amber/examples/webos/eris/Eris.st +86 -0
- data/public/amber/examples/webos/eris/Makefile +37 -0
- data/public/amber/examples/webos/eris/README +3 -0
- data/public/amber/examples/webos/eris/appinfo.json +10 -0
- data/public/amber/examples/webos/eris/index.html +12 -0
- data/public/amber/examples/webos/helloamber/EnyoAmber.st +36 -0
- data/public/amber/examples/webos/helloamber/HelloAmber.st +86 -0
- data/public/amber/examples/webos/helloamber/Makefile +38 -0
- data/public/amber/examples/webos/helloamber/README +5 -0
- data/public/amber/examples/webos/helloamber/appinfo.json +10 -0
- data/public/amber/examples/webos/helloamber/index.html +12 -0
- data/public/amber/favicon.ico +0 -0
- data/public/amber/images/amber.png +0 -0
- data/public/amber/images/amber.svg +706 -0
- data/public/amber/images/amber_small.png +0 -0
- data/public/amber/images/off.amber.png +0 -0
- data/public/amber/images/off.png +0 -0
- data/public/amber/images/offHover.amber.png +0 -0
- data/public/amber/images/offHover.png +0 -0
- data/public/amber/images/presentation.png +0 -0
- data/public/amber/images/profstef.png +0 -0
- data/public/amber/images/sprite.amber.png +0 -0
- data/public/amber/images/sprite.png +0 -0
- data/public/amber/images/tinylogo.amber.png +0 -0
- data/public/amber/images/tinylogo.png +0 -0
- data/public/amber/images/twitterwall.png +0 -0
- data/public/amber/index.html +55 -0
- data/public/amber/js/Additional-Examples.deploy.js +15 -0
- data/public/amber/js/Additional-Examples.js +21 -0
- data/public/amber/js/Benchfib.deploy.js +132 -0
- data/public/amber/js/Benchfib.js +167 -0
- data/public/amber/js/Canvas.deploy.js +2446 -0
- data/public/amber/js/Canvas.js +3547 -0
- data/public/amber/js/Compiler-Tests.deploy.js +97 -0
- data/public/amber/js/Compiler-Tests.js +137 -0
- data/public/amber/js/Compiler.deploy.js +1877 -0
- data/public/amber/js/Compiler.js +2622 -0
- data/public/amber/js/Documentation.deploy.js +961 -0
- data/public/amber/js/Documentation.js +1376 -0
- data/public/amber/js/Examples.deploy.js +53 -0
- data/public/amber/js/Examples.js +73 -0
- data/public/amber/js/IDE.deploy.js +3557 -0
- data/public/amber/js/IDE.js +5002 -0
- data/public/amber/js/Kernel-Announcements.deploy.js +107 -0
- data/public/amber/js/Kernel-Announcements.js +152 -0
- data/public/amber/js/Kernel-Classes.deploy.js +774 -0
- data/public/amber/js/Kernel-Classes.js +1095 -0
- data/public/amber/js/Kernel-Collections.deploy.js +3121 -0
- data/public/amber/js/Kernel-Collections.js +4427 -0
- data/public/amber/js/Kernel-Exceptions.deploy.js +244 -0
- data/public/amber/js/Kernel-Exceptions.js +349 -0
- data/public/amber/js/Kernel-Methods.deploy.js +573 -0
- data/public/amber/js/Kernel-Methods.js +807 -0
- data/public/amber/js/Kernel-Objects.deploy.js +2877 -0
- data/public/amber/js/Kernel-Objects.js +4107 -0
- data/public/amber/js/Kernel-Tests.deploy.js +1513 -0
- data/public/amber/js/Kernel-Tests.js +2053 -0
- data/public/amber/js/Kernel-Transcript.deploy.js +142 -0
- data/public/amber/js/Kernel-Transcript.js +202 -0
- data/public/amber/js/Maglev-Core.deploy.js +2996 -0
- data/public/amber/js/Maglev-Core.js +4246 -0
- data/public/amber/js/Maglev-Database-Explorer.deploy.js +4476 -0
- data/public/amber/js/Maglev-Database-Explorer.js +6232 -0
- data/public/amber/js/Maglev-Vendor.deploy.js +350 -0
- data/public/amber/js/Maglev-Vendor.js +465 -0
- data/public/amber/js/README.md +5 -0
- data/public/amber/js/SUnit.deploy.js +351 -0
- data/public/amber/js/SUnit.js +501 -0
- data/public/amber/js/amber.js +273 -0
- data/public/amber/js/boot.js +602 -0
- data/public/amber/js/compat.js +22 -0
- data/public/amber/js/init.js +9 -0
- data/public/amber/js/lib/CodeMirror/LICENSE +19 -0
- data/public/amber/js/lib/CodeMirror/active-line.js +39 -0
- data/public/amber/js/lib/CodeMirror/amber.css +21 -0
- data/public/amber/js/lib/CodeMirror/codemirror.css +67 -0
- data/public/amber/js/lib/CodeMirror/codemirror.js +2144 -0
- data/public/amber/js/lib/CodeMirror/smalltalk.js +134 -0
- data/public/amber/js/lib/jQuery/jquery-1.4.4.min.js +167 -0
- data/public/amber/js/lib/jQuery/jquery-1.6.4.min.js +4 -0
- data/public/amber/js/lib/jQuery/jquery-ui-1.8.16.custom.min.js +791 -0
- data/public/amber/js/lib/jQuery/jquery.textarea.js +267 -0
- data/public/amber/js/lib/peg-0.6.2.min.js +2 -0
- data/public/amber/js/lib/showdown.js +419 -0
- data/public/amber/js/parser.js +4222 -0
- data/public/amber/js/parser.pegjs +223 -0
- data/public/amber/learn.html +40 -0
- data/public/amber/repl/Makefile +8 -0
- data/public/amber/repl/REPL.js +124 -0
- data/public/amber/repl/REPL.st +56 -0
- data/public/amber/repl/amber.js +18085 -0
- data/public/amber/server/FileServer.st +576 -0
- data/public/amber/server/Makefile +8 -0
- data/public/amber/server/server.js +13049 -0
- data/public/amber/st/Benchfib.js +297 -0
- data/public/amber/st/Benchfib.st +124 -0
- data/public/amber/st/Canvas.st +968 -0
- data/public/amber/st/Compiler-Tests.st +471 -0
- data/public/amber/st/Compiler.st +1445 -0
- data/public/amber/st/Documentation.st +758 -0
- data/public/amber/st/Examples.js +100 -0
- data/public/amber/st/Examples.st +38 -0
- data/public/amber/st/IDE.st +2404 -0
- data/public/amber/st/Kernel-Announcements.st +61 -0
- data/public/amber/st/Kernel-Classes.st +462 -0
- data/public/amber/st/Kernel-Collections.st +1611 -0
- data/public/amber/st/Kernel-Exceptions.st +124 -0
- data/public/amber/st/Kernel-Methods.st +291 -0
- data/public/amber/st/Kernel-Objects.st +1587 -0
- data/public/amber/st/Kernel-Tests.st +953 -0
- data/public/amber/st/Kernel-Transcript.st +70 -0
- data/public/amber/st/Maglev-Core.st +1694 -0
- data/public/amber/st/Maglev-Database-Explorer.st +3148 -0
- data/public/amber/st/Maglev-Vendor.st +151 -0
- data/public/amber/st/Makefile +104 -0
- data/public/amber/st/README.md +4 -0
- data/public/amber/st/SUnit.st +172 -0
- data/public/css/bootstrap-combined.no-icons.min.css +731 -0
- data/public/css/bootstrap.css +6811 -0
- data/public/css/images/animated-overlay.gif +0 -0
- data/public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/css/images/ui-icons_222222_256x240.png +0 -0
- data/public/css/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/css/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/css/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/css/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/css/jquery-ui.min.css +5 -0
- data/public/css/smalltalk_code.css +42 -0
- data/public/css/style.css +210 -0
- data/public/images/bg_tile.png +0 -0
- data/public/images/maglev-logo.gif +0 -0
- data/public/images/mchammer.gif +0 -0
- data/public/images/rails_tiny.png +0 -0
- data/public/images/ruby.png +0 -0
- data/public/images/ruby_smalltalk_bridge.png +0 -0
- data/public/images/smalltalk.png +0 -0
- data/public/img/glyphicons-halflings.png +0 -0
- data/public/index.html +118 -0
- data/public/libs/bootstrap.min.js +7 -0
- data/public/libs/codemirror/CONTRIBUTING.md +72 -0
- data/public/libs/codemirror/LICENSE +23 -0
- data/public/libs/codemirror/README.md +11 -0
- data/public/libs/codemirror/addon/dialog/dialog.css +32 -0
- data/public/libs/codemirror/addon/dialog/dialog.js +80 -0
- data/public/libs/codemirror/addon/display/placeholder.js +54 -0
- data/public/libs/codemirror/addon/edit/closebrackets.js +54 -0
- data/public/libs/codemirror/addon/edit/closetag.js +86 -0
- data/public/libs/codemirror/addon/edit/continuecomment.js +44 -0
- data/public/libs/codemirror/addon/edit/continuelist.js +25 -0
- data/public/libs/codemirror/addon/edit/matchbrackets.js +82 -0
- data/public/libs/codemirror/addon/fold/brace-fold.js +31 -0
- data/public/libs/codemirror/addon/fold/foldcode.js +32 -0
- data/public/libs/codemirror/addon/fold/indent-fold.js +11 -0
- data/public/libs/codemirror/addon/fold/xml-fold.js +64 -0
- data/public/libs/codemirror/addon/hint/html-hint.js +582 -0
- data/public/libs/codemirror/addon/hint/javascript-hint.js +142 -0
- data/public/libs/codemirror/addon/hint/pig-hint.js +117 -0
- data/public/libs/codemirror/addon/hint/python-hint.js +93 -0
- data/public/libs/codemirror/addon/hint/show-hint.css +38 -0
- data/public/libs/codemirror/addon/hint/show-hint.js +180 -0
- data/public/libs/codemirror/addon/hint/xml-hint.js +118 -0
- data/public/libs/codemirror/addon/lint/javascript-lint.js +127 -0
- data/public/libs/codemirror/addon/lint/json-lint.js +14 -0
- data/public/libs/codemirror/addon/lint/lint.css +96 -0
- data/public/libs/codemirror/addon/lint/lint.js +197 -0
- data/public/libs/codemirror/addon/mode/loadmode.js +51 -0
- data/public/libs/codemirror/addon/mode/multiplex.js +95 -0
- data/public/libs/codemirror/addon/mode/overlay.js +59 -0
- data/public/libs/codemirror/addon/runmode/colorize.js +29 -0
- data/public/libs/codemirror/addon/runmode/runmode-standalone.js +130 -0
- data/public/libs/codemirror/addon/runmode/runmode.js +52 -0
- data/public/libs/codemirror/addon/runmode/runmode.node.js +89 -0
- data/public/libs/codemirror/addon/search/match-highlighter.js +60 -0
- data/public/libs/codemirror/addon/search/search.js +131 -0
- data/public/libs/codemirror/addon/search/searchcursor.js +133 -0
- data/public/libs/codemirror/addon/selection/active-line.js +39 -0
- data/public/libs/codemirror/addon/selection/mark-selection.js +34 -0
- data/public/libs/codemirror/bin/compress +91 -0
- data/public/libs/codemirror/bin/lint +11 -0
- data/public/libs/codemirror/demo/activeline.html +70 -0
- data/public/libs/codemirror/demo/bidi.html +61 -0
- data/public/libs/codemirror/demo/btree.html +87 -0
- data/public/libs/codemirror/demo/buffers.html +98 -0
- data/public/libs/codemirror/demo/changemode.html +50 -0
- data/public/libs/codemirror/demo/closebrackets.html +63 -0
- data/public/libs/codemirror/demo/closetag.html +37 -0
- data/public/libs/codemirror/demo/complete.html +70 -0
- data/public/libs/codemirror/demo/emacs.html +60 -0
- data/public/libs/codemirror/demo/folding.html +69 -0
- data/public/libs/codemirror/demo/fullscreen.html +147 -0
- data/public/libs/codemirror/demo/html5complete.html +92 -0
- data/public/libs/codemirror/demo/indentwrap.html +49 -0
- data/public/libs/codemirror/demo/lint.html +90 -0
- data/public/libs/codemirror/demo/loadmode.html +40 -0
- data/public/libs/codemirror/demo/marker.html +59 -0
- data/public/libs/codemirror/demo/markselection.html +36 -0
- data/public/libs/codemirror/demo/matchhighlighter.html +38 -0
- data/public/libs/codemirror/demo/multiplex.html +60 -0
- data/public/libs/codemirror/demo/mustache.html +59 -0
- data/public/libs/codemirror/demo/placeholder.html +36 -0
- data/public/libs/codemirror/demo/preview.html +76 -0
- data/public/libs/codemirror/demo/resize.html +49 -0
- data/public/libs/codemirror/demo/runmode.html +50 -0
- data/public/libs/codemirror/demo/search.html +85 -0
- data/public/libs/codemirror/demo/spanaffectswrapping_shim.html +73 -0
- data/public/libs/codemirror/demo/theme.html +89 -0
- data/public/libs/codemirror/demo/variableheight.html +52 -0
- data/public/libs/codemirror/demo/vim.html +65 -0
- data/public/libs/codemirror/demo/visibletabs.html +53 -0
- data/public/libs/codemirror/demo/widget.html +74 -0
- data/public/libs/codemirror/demo/xmlcomplete.html +81 -0
- data/public/libs/codemirror/index.html +487 -0
- data/public/libs/codemirror/keymap/emacs.js +30 -0
- data/public/libs/codemirror/keymap/vim.js +3044 -0
- data/public/libs/codemirror/lib/codemirror.css +253 -0
- data/public/libs/codemirror/lib/codemirror.js +5585 -0
- data/public/libs/codemirror/mode/apl/apl.js +160 -0
- data/public/libs/codemirror/mode/apl/index.html +61 -0
- data/public/libs/codemirror/mode/asterisk/asterisk.js +183 -0
- data/public/libs/codemirror/mode/asterisk/index.html +142 -0
- data/public/libs/codemirror/mode/clike/clike.js +302 -0
- data/public/libs/codemirror/mode/clike/index.html +103 -0
- data/public/libs/codemirror/mode/clike/scala.html +767 -0
- data/public/libs/codemirror/mode/clojure/clojure.js +222 -0
- data/public/libs/codemirror/mode/clojure/index.html +76 -0
- data/public/libs/codemirror/mode/coffeescript/LICENSE +22 -0
- data/public/libs/codemirror/mode/coffeescript/coffeescript.js +346 -0
- data/public/libs/codemirror/mode/coffeescript/index.html +728 -0
- data/public/libs/codemirror/mode/commonlisp/commonlisp.js +101 -0
- data/public/libs/codemirror/mode/commonlisp/index.html +165 -0
- data/public/libs/codemirror/mode/css/css.js +567 -0
- data/public/libs/codemirror/mode/css/index.html +58 -0
- data/public/libs/codemirror/mode/css/scss.html +145 -0
- data/public/libs/codemirror/mode/css/scss_test.js +80 -0
- data/public/libs/codemirror/mode/css/test.js +113 -0
- data/public/libs/codemirror/mode/d/d.js +205 -0
- data/public/libs/codemirror/mode/d/index.html +262 -0
- data/public/libs/codemirror/mode/diff/diff.js +32 -0
- data/public/libs/codemirror/mode/diff/index.html +105 -0
- data/public/libs/codemirror/mode/ecl/ecl.js +192 -0
- data/public/libs/codemirror/mode/ecl/index.html +39 -0
- data/public/libs/codemirror/mode/erlang/erlang.js +463 -0
- data/public/libs/codemirror/mode/erlang/index.html +64 -0
- data/public/libs/codemirror/mode/gas/gas.js +326 -0
- data/public/libs/codemirror/mode/gas/index.html +57 -0
- data/public/libs/codemirror/mode/gfm/gfm.js +96 -0
- data/public/libs/codemirror/mode/gfm/index.html +74 -0
- data/public/libs/codemirror/mode/gfm/test.js +112 -0
- data/public/libs/codemirror/mode/go/go.js +165 -0
- data/public/libs/codemirror/mode/go/index.html +74 -0
- data/public/libs/codemirror/mode/groovy/groovy.js +210 -0
- data/public/libs/codemirror/mode/groovy/index.html +73 -0
- data/public/libs/codemirror/mode/haskell/haskell.js +242 -0
- data/public/libs/codemirror/mode/haskell/index.html +62 -0
- data/public/libs/codemirror/mode/haxe/haxe.js +429 -0
- data/public/libs/codemirror/mode/haxe/index.html +90 -0
- data/public/libs/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
- data/public/libs/codemirror/mode/htmlembedded/index.html +49 -0
- data/public/libs/codemirror/mode/htmlmixed/htmlmixed.js +104 -0
- data/public/libs/codemirror/mode/htmlmixed/index.html +73 -0
- data/public/libs/codemirror/mode/http/http.js +98 -0
- data/public/libs/codemirror/mode/http/index.html +32 -0
- data/public/libs/codemirror/mode/javascript/index.html +92 -0
- data/public/libs/codemirror/mode/javascript/javascript.js +467 -0
- data/public/libs/codemirror/mode/javascript/typescript.html +48 -0
- data/public/libs/codemirror/mode/jinja2/index.html +38 -0
- data/public/libs/codemirror/mode/jinja2/jinja2.js +42 -0
- data/public/libs/codemirror/mode/less/index.html +741 -0
- data/public/libs/codemirror/mode/less/less.js +266 -0
- data/public/libs/codemirror/mode/livescript/LICENSE +23 -0
- data/public/libs/codemirror/mode/livescript/index.html +446 -0
- data/public/libs/codemirror/mode/livescript/livescript.js +267 -0
- data/public/libs/codemirror/mode/livescript/livescript.ls +266 -0
- data/public/libs/codemirror/mode/lua/index.html +74 -0
- data/public/libs/codemirror/mode/lua/lua.js +140 -0
- data/public/libs/codemirror/mode/markdown/index.html +344 -0
- data/public/libs/codemirror/mode/markdown/markdown.js +526 -0
- data/public/libs/codemirror/mode/markdown/test.js +636 -0
- data/public/libs/codemirror/mode/meta.js +75 -0
- data/public/libs/codemirror/mode/mirc/index.html +149 -0
- data/public/libs/codemirror/mode/mirc/mirc.js +177 -0
- data/public/libs/codemirror/mode/ntriples/index.html +33 -0
- data/public/libs/codemirror/mode/ntriples/ntriples.js +170 -0
- data/public/libs/codemirror/mode/ocaml/index.html +131 -0
- data/public/libs/codemirror/mode/ocaml/ocaml.js +113 -0
- data/public/libs/codemirror/mode/pascal/LICENSE +7 -0
- data/public/libs/codemirror/mode/pascal/index.html +48 -0
- data/public/libs/codemirror/mode/pascal/pascal.js +94 -0
- data/public/libs/codemirror/mode/perl/LICENSE +19 -0
- data/public/libs/codemirror/mode/perl/index.html +62 -0
- data/public/libs/codemirror/mode/perl/perl.js +816 -0
- data/public/libs/codemirror/mode/php/index.html +51 -0
- data/public/libs/codemirror/mode/php/php.js +129 -0
- data/public/libs/codemirror/mode/pig/index.html +42 -0
- data/public/libs/codemirror/mode/pig/pig.js +171 -0
- data/public/libs/codemirror/mode/properties/index.html +41 -0
- data/public/libs/codemirror/mode/properties/properties.js +63 -0
- data/public/libs/codemirror/mode/python/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/python/index.html +135 -0
- data/public/libs/codemirror/mode/python/python.js +340 -0
- data/public/libs/codemirror/mode/q/index.html +131 -0
- data/public/libs/codemirror/mode/q/q.js +124 -0
- data/public/libs/codemirror/mode/r/LICENSE +24 -0
- data/public/libs/codemirror/mode/r/index.html +74 -0
- data/public/libs/codemirror/mode/r/r.js +141 -0
- data/public/libs/codemirror/mode/rpm/changes/changes.js +19 -0
- data/public/libs/codemirror/mode/rpm/changes/index.html +53 -0
- data/public/libs/codemirror/mode/rpm/spec/index.html +99 -0
- data/public/libs/codemirror/mode/rpm/spec/spec.css +5 -0
- data/public/libs/codemirror/mode/rpm/spec/spec.js +66 -0
- data/public/libs/codemirror/mode/rst/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/rst/index.html +524 -0
- data/public/libs/codemirror/mode/rst/rst.js +550 -0
- data/public/libs/codemirror/mode/ruby/LICENSE +24 -0
- data/public/libs/codemirror/mode/ruby/index.html +173 -0
- data/public/libs/codemirror/mode/ruby/ruby.js +197 -0
- data/public/libs/codemirror/mode/rust/index.html +48 -0
- data/public/libs/codemirror/mode/rust/rust.js +432 -0
- data/public/libs/codemirror/mode/sass/index.html +54 -0
- data/public/libs/codemirror/mode/sass/sass.js +349 -0
- data/public/libs/codemirror/mode/scheme/index.html +65 -0
- data/public/libs/codemirror/mode/scheme/scheme.js +230 -0
- data/public/libs/codemirror/mode/shell/index.html +51 -0
- data/public/libs/codemirror/mode/shell/shell.js +118 -0
- data/public/libs/codemirror/mode/sieve/LICENSE +19 -0
- data/public/libs/codemirror/mode/sieve/index.html +81 -0
- data/public/libs/codemirror/mode/sieve/sieve.js +183 -0
- data/public/libs/codemirror/mode/smalltalk/index.html +57 -0
- data/public/libs/codemirror/mode/smalltalk/smalltalk.js +141 -0
- data/public/libs/codemirror/mode/smarty/index.html +83 -0
- data/public/libs/codemirror/mode/smarty/smarty.js +148 -0
- data/public/libs/codemirror/mode/sparql/index.html +42 -0
- data/public/libs/codemirror/mode/sparql/sparql.js +143 -0
- data/public/libs/codemirror/mode/sql/index.html +68 -0
- data/public/libs/codemirror/mode/sql/sql.js +268 -0
- data/public/libs/codemirror/mode/stex/index.html +98 -0
- data/public/libs/codemirror/mode/stex/stex.js +246 -0
- data/public/libs/codemirror/mode/stex/test.js +117 -0
- data/public/libs/codemirror/mode/tcl/index.html +129 -0
- data/public/libs/codemirror/mode/tcl/tcl.js +131 -0
- data/public/libs/codemirror/mode/tiddlywiki/index.html +142 -0
- data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
- data/public/libs/codemirror/mode/tiki/index.html +81 -0
- data/public/libs/codemirror/mode/tiki/tiki.css +26 -0
- data/public/libs/codemirror/mode/tiki/tiki.js +308 -0
- data/public/libs/codemirror/mode/turtle/index.html +39 -0
- data/public/libs/codemirror/mode/turtle/turtle.js +145 -0
- data/public/libs/codemirror/mode/vb/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/vb/index.html +88 -0
- data/public/libs/codemirror/mode/vb/vb.js +259 -0
- data/public/libs/codemirror/mode/vbscript/index.html +42 -0
- data/public/libs/codemirror/mode/vbscript/vbscript.js +26 -0
- data/public/libs/codemirror/mode/velocity/index.html +103 -0
- data/public/libs/codemirror/mode/velocity/velocity.js +144 -0
- data/public/libs/codemirror/mode/verilog/index.html +121 -0
- data/public/libs/codemirror/mode/verilog/verilog.js +182 -0
- data/public/libs/codemirror/mode/xml/index.html +45 -0
- data/public/libs/codemirror/mode/xml/xml.js +328 -0
- data/public/libs/codemirror/mode/xquery/LICENSE +20 -0
- data/public/libs/codemirror/mode/xquery/index.html +221 -0
- data/public/libs/codemirror/mode/xquery/test.js +64 -0
- data/public/libs/codemirror/mode/xquery/xquery.js +450 -0
- data/public/libs/codemirror/mode/yaml/index.html +68 -0
- data/public/libs/codemirror/mode/yaml/yaml.js +95 -0
- data/public/libs/codemirror/mode/z80/index.html +39 -0
- data/public/libs/codemirror/mode/z80/z80.js +85 -0
- data/public/libs/codemirror/package.json +21 -0
- data/public/libs/codemirror/test/doc_test.js +329 -0
- data/public/libs/codemirror/test/driver.js +138 -0
- data/public/libs/codemirror/test/index.html +182 -0
- data/public/libs/codemirror/test/lint/acorn.js +1593 -0
- data/public/libs/codemirror/test/lint/lint.js +112 -0
- data/public/libs/codemirror/test/lint/parse-js.js +1372 -0
- data/public/libs/codemirror/test/lint/walk.js +216 -0
- data/public/libs/codemirror/test/mode_test.css +10 -0
- data/public/libs/codemirror/test/mode_test.js +192 -0
- data/public/libs/codemirror/test/phantom_driver.js +31 -0
- data/public/libs/codemirror/test/run.js +33 -0
- data/public/libs/codemirror/test/test.js +1400 -0
- data/public/libs/codemirror/test/vim_test.js +1688 -0
- data/public/libs/codemirror/theme/ambiance-mobile.css +5 -0
- data/public/libs/codemirror/theme/ambiance.css +75 -0
- data/public/libs/codemirror/theme/blackboard.css +25 -0
- data/public/libs/codemirror/theme/cobalt.css +18 -0
- data/public/libs/codemirror/theme/eclipse.css +25 -0
- data/public/libs/codemirror/theme/elegant.css +10 -0
- data/public/libs/codemirror/theme/erlang-dark.css +21 -0
- data/public/libs/codemirror/theme/lesser-dark.css +44 -0
- data/public/libs/codemirror/theme/midnight.css +52 -0
- data/public/libs/codemirror/theme/monokai.css +28 -0
- data/public/libs/codemirror/theme/neat.css +9 -0
- data/public/libs/codemirror/theme/night.css +21 -0
- data/public/libs/codemirror/theme/rubyblue.css +21 -0
- data/public/libs/codemirror/theme/solarized.css +207 -0
- data/public/libs/codemirror/theme/twilight.css +26 -0
- data/public/libs/codemirror/theme/vibrant-ink.css +27 -0
- data/public/libs/codemirror/theme/xq-dark.css +46 -0
- data/public/libs/codemirror/theme/xq-light.css +43 -0
- data/public/libs/font-awesome/css/font-awesome-ie7.css +983 -0
- data/public/libs/font-awesome/css/font-awesome-ie7.min.css +24 -0
- data/public/libs/font-awesome/css/font-awesome.css +1268 -0
- data/public/libs/font-awesome/css/font-awesome.min.css +24 -0
- data/public/libs/font-awesome/font/FontAwesome.otf +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.eot +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.svg +339 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.ttf +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.woff +0 -0
- data/public/libs/font-awesome/less/bootstrap.less +78 -0
- data/public/libs/font-awesome/less/core.less +132 -0
- data/public/libs/font-awesome/less/extras.less +79 -0
- data/public/libs/font-awesome/less/font-awesome-ie7.less +413 -0
- data/public/libs/font-awesome/less/font-awesome.less +32 -0
- data/public/libs/font-awesome/less/icons.less +330 -0
- data/public/libs/font-awesome/less/mixins.less +34 -0
- data/public/libs/font-awesome/less/path.less +15 -0
- data/public/libs/font-awesome/less/variables.less +9 -0
- data/public/libs/jquery-1.10.0.min.js +6 -0
- data/public/libs/jquery-ui.min.js +12 -0
- data/public/libs/jquery.jsPlumb-1.4.0-all.js +9571 -0
- data/public/libs/jquery.livequery.js +226 -0
- data/public/libs/jsPlumbInitializer.js +72 -0
- data/public/libs/jstree/README.txt +10 -0
- data/public/libs/jstree/_demo/_dump.sql +20 -0
- data/public/libs/jstree/_demo/_inc/__mysql_errors.log +0 -0
- data/public/libs/jstree/_demo/_inc/class._database.php +146 -0
- data/public/libs/jstree/_demo/_inc/class._database_i.php +152 -0
- data/public/libs/jstree/_demo/_inc/class.tree.php +602 -0
- data/public/libs/jstree/_demo/_install.txt +6 -0
- data/public/libs/jstree/_demo/config.php +14 -0
- data/public/libs/jstree/_demo/file.png +0 -0
- data/public/libs/jstree/_demo/folder.png +0 -0
- data/public/libs/jstree/_demo/index.html +461 -0
- data/public/libs/jstree/_demo/root.png +0 -0
- data/public/libs/jstree/_demo/server.php +69 -0
- data/public/libs/jstree/_docs/!style.css +48 -0
- data/public/libs/jstree/_docs/_drive.png +0 -0
- data/public/libs/jstree/_docs/_html_data.html +2 -0
- data/public/libs/jstree/_docs/_json_data.json +4 -0
- data/public/libs/jstree/_docs/_search_data.json +6 -0
- data/public/libs/jstree/_docs/_search_result.json +1 -0
- data/public/libs/jstree/_docs/_xml_flat.xml +12 -0
- data/public/libs/jstree/_docs/_xml_nest.xml +18 -0
- data/public/libs/jstree/_docs/checkbox.html +171 -0
- data/public/libs/jstree/_docs/contextmenu.html +121 -0
- data/public/libs/jstree/_docs/cookies.html +97 -0
- data/public/libs/jstree/_docs/core.html +689 -0
- data/public/libs/jstree/_docs/crrm.html +316 -0
- data/public/libs/jstree/_docs/dnd.html +199 -0
- data/public/libs/jstree/_docs/hotkeys.html +82 -0
- data/public/libs/jstree/_docs/html_data.html +175 -0
- data/public/libs/jstree/_docs/index.html +86 -0
- data/public/libs/jstree/_docs/json_data.html +249 -0
- data/public/libs/jstree/_docs/languages.html +152 -0
- data/public/libs/jstree/_docs/logo.png +0 -0
- data/public/libs/jstree/_docs/search.html +153 -0
- data/public/libs/jstree/_docs/sort.html +85 -0
- data/public/libs/jstree/_docs/syntax/!script.js +2232 -0
- data/public/libs/jstree/_docs/syntax/!style.css +511 -0
- data/public/libs/jstree/_docs/syntax/clipboard.swf +0 -0
- data/public/libs/jstree/_docs/syntax/help.png +0 -0
- data/public/libs/jstree/_docs/syntax/magnifier.png +0 -0
- data/public/libs/jstree/_docs/syntax/page_white_code.png +0 -0
- data/public/libs/jstree/_docs/syntax/page_white_copy.png +0 -0
- data/public/libs/jstree/_docs/syntax/printer.png +0 -0
- data/public/libs/jstree/_docs/syntax/wrapping.png +0 -0
- data/public/libs/jstree/_docs/themeroller.html +107 -0
- data/public/libs/jstree/_docs/themes.html +127 -0
- data/public/libs/jstree/_docs/types.html +178 -0
- data/public/libs/jstree/_docs/ui.html +197 -0
- data/public/libs/jstree/_docs/unique.html +85 -0
- data/public/libs/jstree/_docs/xml_data.html +218 -0
- data/public/libs/jstree/_lib/jquery.cookie.js +96 -0
- data/public/libs/jstree/_lib/jquery.hotkeys.js +99 -0
- data/public/libs/jstree/_lib/jquery.js +5 -0
- data/public/libs/jstree/jquery.jstree.js +4564 -0
- data/public/libs/jstree/themes/apple/bg.jpg +0 -0
- data/public/libs/jstree/themes/apple/d.png +0 -0
- data/public/libs/jstree/themes/apple/dot_for_ie.gif +0 -0
- data/public/libs/jstree/themes/apple/style.css +61 -0
- data/public/libs/jstree/themes/apple/throbber.gif +0 -0
- data/public/libs/jstree/themes/classic/d.gif +0 -0
- data/public/libs/jstree/themes/classic/d.png +0 -0
- data/public/libs/jstree/themes/classic/dot_for_ie.gif +0 -0
- data/public/libs/jstree/themes/classic/style.css +77 -0
- data/public/libs/jstree/themes/classic/throbber.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/d.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/d.png +0 -0
- data/public/libs/jstree/themes/default-rtl/dots.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/style.css +84 -0
- data/public/libs/jstree/themes/default-rtl/throbber.gif +0 -0
- data/public/libs/jstree/themes/default/d.gif +0 -0
- data/public/libs/jstree/themes/default/d.png +0 -0
- data/public/libs/jstree/themes/default/style.css +74 -0
- data/public/libs/jstree/themes/default/throbber.gif +0 -0
- data/public/themes/geo-bootstrap/README.md +25 -0
- data/public/themes/geo-bootstrap/img/flames.gif +0 -0
- data/public/themes/geo-bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/public/themes/geo-bootstrap/img/glyphicons-halflings.png +0 -0
- data/public/themes/geo-bootstrap/img/microfab.gif +0 -0
- data/public/themes/geo-bootstrap/img/progress.gif +0 -0
- data/public/themes/geo-bootstrap/img/rainbow.gif +0 -0
- data/public/themes/geo-bootstrap/img/stars.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/7upspot.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/americanflag.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/community.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/computer-01.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/computer.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/construction.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/counter.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/counter2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider1.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider3.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider4.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/drudgesiren.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/emailme.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/funky.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/geocities.jpg +0 -0
- data/public/themes/geo-bootstrap/img/test/hacker.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/heart.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/hot.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/ie_logo.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/mailkitten.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/mchammer.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/new.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/new2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/noframes.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/notepad.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/ns_logo.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/sign-in.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/spinningearth.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/underconstruction.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/wabwalk.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/webtrips.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/yahooweek.gif +0 -0
- data/public/themes/geo-bootstrap/package.json +21 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.css +1109 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.min.css +9 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap.css +6462 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap.min.css +9 -0
- metadata +791 -0
@@ -0,0 +1,124 @@
|
|
1
|
+
Smalltalk current createPackage: 'Kernel-Exceptions' properties: #{}!
|
2
|
+
Object subclass: #Error
|
3
|
+
instanceVariableNames: 'messageText'
|
4
|
+
package: 'Kernel-Exceptions'!
|
5
|
+
|
6
|
+
!Error methodsFor: 'accessing'!
|
7
|
+
|
8
|
+
context
|
9
|
+
<return self.context>
|
10
|
+
!
|
11
|
+
|
12
|
+
jsStack
|
13
|
+
<return self.stack>
|
14
|
+
!
|
15
|
+
|
16
|
+
messageText
|
17
|
+
^messageText
|
18
|
+
!
|
19
|
+
|
20
|
+
messageText: aString
|
21
|
+
messageText := aString
|
22
|
+
! !
|
23
|
+
|
24
|
+
!Error methodsFor: 'signaling'!
|
25
|
+
|
26
|
+
signal
|
27
|
+
<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>
|
28
|
+
! !
|
29
|
+
|
30
|
+
!Error methodsFor: 'testing'!
|
31
|
+
|
32
|
+
isSmalltalkError
|
33
|
+
<return self.smalltalkError === true>
|
34
|
+
! !
|
35
|
+
|
36
|
+
!Error class methodsFor: 'instance creation'!
|
37
|
+
|
38
|
+
signal: aString
|
39
|
+
^self new
|
40
|
+
messageText: aString;
|
41
|
+
signal
|
42
|
+
! !
|
43
|
+
|
44
|
+
Error subclass: #MessageNotUnderstood
|
45
|
+
instanceVariableNames: 'message receiver'
|
46
|
+
package: 'Kernel-Exceptions'!
|
47
|
+
|
48
|
+
!MessageNotUnderstood methodsFor: 'accessing'!
|
49
|
+
|
50
|
+
message
|
51
|
+
^message
|
52
|
+
!
|
53
|
+
|
54
|
+
message: aMessage
|
55
|
+
message := aMessage
|
56
|
+
!
|
57
|
+
|
58
|
+
messageText
|
59
|
+
^self receiver asString, ' does not understand #', self message selector
|
60
|
+
!
|
61
|
+
|
62
|
+
receiver
|
63
|
+
^receiver
|
64
|
+
!
|
65
|
+
|
66
|
+
receiver: anObject
|
67
|
+
receiver := anObject
|
68
|
+
! !
|
69
|
+
|
70
|
+
Object subclass: #ErrorHandler
|
71
|
+
instanceVariableNames: ''
|
72
|
+
package: 'Kernel-Exceptions'!
|
73
|
+
|
74
|
+
!ErrorHandler methodsFor: 'error handling'!
|
75
|
+
|
76
|
+
handleError: anError
|
77
|
+
anError context ifNotNil: [self logErrorContext: anError context].
|
78
|
+
self logError: anError
|
79
|
+
! !
|
80
|
+
|
81
|
+
!ErrorHandler methodsFor: 'private'!
|
82
|
+
|
83
|
+
log: aString
|
84
|
+
console log: aString
|
85
|
+
!
|
86
|
+
|
87
|
+
logContext: aContext
|
88
|
+
aContext home ifNotNil: [
|
89
|
+
self logContext: aContext home].
|
90
|
+
self log: aContext receiver asString, '>>', aContext selector
|
91
|
+
!
|
92
|
+
|
93
|
+
logError: anError
|
94
|
+
self log: anError messageText
|
95
|
+
!
|
96
|
+
|
97
|
+
logErrorContext: aContext
|
98
|
+
aContext ifNotNil: [
|
99
|
+
aContext home ifNotNil: [
|
100
|
+
self logContext: aContext home]]
|
101
|
+
! !
|
102
|
+
|
103
|
+
ErrorHandler class instanceVariableNames: 'current'!
|
104
|
+
|
105
|
+
!ErrorHandler class methodsFor: 'accessing'!
|
106
|
+
|
107
|
+
current
|
108
|
+
^current ifNil: [current := self new]
|
109
|
+
!
|
110
|
+
|
111
|
+
setCurrent: anHandler
|
112
|
+
current := anHandler
|
113
|
+
! !
|
114
|
+
|
115
|
+
!ErrorHandler class methodsFor: 'initialization'!
|
116
|
+
|
117
|
+
initialize
|
118
|
+
self register
|
119
|
+
!
|
120
|
+
|
121
|
+
register
|
122
|
+
ErrorHandler setCurrent: self new
|
123
|
+
! !
|
124
|
+
|
@@ -0,0 +1,291 @@
|
|
1
|
+
Smalltalk current createPackage: 'Kernel-Methods' properties: #{}!
|
2
|
+
Object subclass: #BlockClosure
|
3
|
+
instanceVariableNames: ''
|
4
|
+
package: 'Kernel-Methods'!
|
5
|
+
!BlockClosure commentStamp!
|
6
|
+
A BlockClosure is a lexical closure.
|
7
|
+
The JavaScript representation is a function.
|
8
|
+
|
9
|
+
A BlockClosure is evaluated with the `#value*` methods in the 'evaluating' protocol.!
|
10
|
+
|
11
|
+
!BlockClosure methodsFor: 'accessing'!
|
12
|
+
|
13
|
+
compiledSource
|
14
|
+
<return self.toString()>
|
15
|
+
!
|
16
|
+
|
17
|
+
numArgs
|
18
|
+
<return self.length>
|
19
|
+
! !
|
20
|
+
|
21
|
+
!BlockClosure methodsFor: 'controlling'!
|
22
|
+
|
23
|
+
whileFalse
|
24
|
+
"inlined in the Compiler"
|
25
|
+
self whileFalse: []
|
26
|
+
!
|
27
|
+
|
28
|
+
whileFalse: aBlock
|
29
|
+
"inlined in the Compiler"
|
30
|
+
<while(!!self()) {aBlock()}>
|
31
|
+
!
|
32
|
+
|
33
|
+
whileTrue
|
34
|
+
"inlined in the Compiler"
|
35
|
+
self whileTrue: []
|
36
|
+
!
|
37
|
+
|
38
|
+
whileTrue: aBlock
|
39
|
+
"inlined in the Compiler"
|
40
|
+
<while(self()) {aBlock()}>
|
41
|
+
! !
|
42
|
+
|
43
|
+
!BlockClosure methodsFor: 'error handling'!
|
44
|
+
|
45
|
+
on: anErrorClass do: aBlock
|
46
|
+
^self try: self catch: [:error |
|
47
|
+
(error isKindOf: anErrorClass)
|
48
|
+
ifTrue: [aBlock value: error]
|
49
|
+
ifFalse: [error signal]]
|
50
|
+
! !
|
51
|
+
|
52
|
+
!BlockClosure methodsFor: 'evaluating'!
|
53
|
+
|
54
|
+
applyTo: anObject arguments: aCollection
|
55
|
+
<return self.apply(anObject, aCollection)>
|
56
|
+
!
|
57
|
+
|
58
|
+
ensure: aBlock
|
59
|
+
| success |
|
60
|
+
success := false.
|
61
|
+
^[self value. success := true. aBlock value]
|
62
|
+
on: Error
|
63
|
+
do: [:ex |
|
64
|
+
success ifFalse: [aBlock value].
|
65
|
+
ex signal]
|
66
|
+
!
|
67
|
+
|
68
|
+
new
|
69
|
+
"Use the receiver as a JS constructor.
|
70
|
+
*Do not* use this method to instanciate Smalltalk objects!!"
|
71
|
+
<return new self()>
|
72
|
+
!
|
73
|
+
|
74
|
+
newValue: anObject
|
75
|
+
"Use the receiver as a JS constructor.
|
76
|
+
*Do not* use this method to instanciate Smalltalk objects!!"
|
77
|
+
<return new self(anObject)>
|
78
|
+
!
|
79
|
+
|
80
|
+
newValue: anObject value: anObject2
|
81
|
+
"Use the receiver as a JS constructor.
|
82
|
+
*Do not* use this method to instanciate Smalltalk objects!!"
|
83
|
+
<return new self(anObject, anObject2)>
|
84
|
+
!
|
85
|
+
|
86
|
+
newValue: anObject value: anObject2 value: anObject3
|
87
|
+
"Use the receiver as a JS constructor.
|
88
|
+
*Do not* use this method to instanciate Smalltalk objects!!"
|
89
|
+
<return new self(anObject, anObject2)>
|
90
|
+
!
|
91
|
+
|
92
|
+
timeToRun
|
93
|
+
"Answer the number of milliseconds taken to execute this block."
|
94
|
+
|
95
|
+
^ Date millisecondsToRun: self
|
96
|
+
!
|
97
|
+
|
98
|
+
value
|
99
|
+
"inlined in the Compiler"
|
100
|
+
<return self();>
|
101
|
+
!
|
102
|
+
|
103
|
+
value: anArg
|
104
|
+
"inlined in the Compiler"
|
105
|
+
<return self(anArg);>
|
106
|
+
!
|
107
|
+
|
108
|
+
value: firstArg value: secondArg
|
109
|
+
"inlined in the Compiler"
|
110
|
+
<return self(firstArg, secondArg);>
|
111
|
+
!
|
112
|
+
|
113
|
+
value: firstArg value: secondArg value: thirdArg
|
114
|
+
"inlined in the Compiler"
|
115
|
+
<return self(firstArg, secondArg, thirdArg);>
|
116
|
+
!
|
117
|
+
|
118
|
+
valueWithPossibleArguments: aCollection
|
119
|
+
<return self.apply(null, aCollection);>
|
120
|
+
! !
|
121
|
+
|
122
|
+
!BlockClosure methodsFor: 'timeout/interval'!
|
123
|
+
|
124
|
+
valueWithInterval: aNumber
|
125
|
+
<return setInterval(self, aNumber)>
|
126
|
+
!
|
127
|
+
|
128
|
+
valueWithTimeout: aNumber
|
129
|
+
<return setTimeout(self, aNumber)>
|
130
|
+
! !
|
131
|
+
|
132
|
+
Object subclass: #CompiledMethod
|
133
|
+
instanceVariableNames: ''
|
134
|
+
package: 'Kernel-Methods'!
|
135
|
+
!CompiledMethod commentStamp!
|
136
|
+
CompiledMethod hold the source and compiled code of a class method.
|
137
|
+
|
138
|
+
You can get a CompiledMethod using `Behavior>>methodAt:`
|
139
|
+
|
140
|
+
String methodAt: 'lines'
|
141
|
+
|
142
|
+
and read the source code
|
143
|
+
|
144
|
+
(String methodAt: 'lines') source
|
145
|
+
|
146
|
+
See referenced classes:
|
147
|
+
|
148
|
+
(String methodAt: 'lines') referencedClasses
|
149
|
+
|
150
|
+
or messages sent from this method:
|
151
|
+
|
152
|
+
(String methodAt: 'lines') messageSends!
|
153
|
+
|
154
|
+
!CompiledMethod methodsFor: 'accessing'!
|
155
|
+
|
156
|
+
arguments
|
157
|
+
<return self.args || []>
|
158
|
+
!
|
159
|
+
|
160
|
+
category
|
161
|
+
^(self basicAt: 'category') ifNil: ['']
|
162
|
+
!
|
163
|
+
|
164
|
+
category: aString
|
165
|
+
self basicAt: 'category' put: aString
|
166
|
+
!
|
167
|
+
|
168
|
+
fn
|
169
|
+
^self basicAt: 'fn'
|
170
|
+
!
|
171
|
+
|
172
|
+
fn: aBlock
|
173
|
+
self basicAt: 'fn' put: aBlock
|
174
|
+
!
|
175
|
+
|
176
|
+
messageSends
|
177
|
+
^self basicAt: 'messageSends'
|
178
|
+
!
|
179
|
+
|
180
|
+
methodClass
|
181
|
+
^self basicAt: 'methodClass'
|
182
|
+
!
|
183
|
+
|
184
|
+
referencedClasses
|
185
|
+
^self basicAt: 'referencedClasses'
|
186
|
+
!
|
187
|
+
|
188
|
+
selector
|
189
|
+
^self basicAt: 'selector'
|
190
|
+
!
|
191
|
+
|
192
|
+
selector: aString
|
193
|
+
self basicAt: 'selector' put: aString
|
194
|
+
!
|
195
|
+
|
196
|
+
source
|
197
|
+
^(self basicAt: 'source') ifNil: ['']
|
198
|
+
!
|
199
|
+
|
200
|
+
source: aString
|
201
|
+
self basicAt: 'source' put: aString
|
202
|
+
! !
|
203
|
+
|
204
|
+
Object subclass: #Message
|
205
|
+
instanceVariableNames: 'selector arguments'
|
206
|
+
package: 'Kernel-Methods'!
|
207
|
+
!Message commentStamp!
|
208
|
+
Generally, the system does not use instances of Message for efficiency reasons.
|
209
|
+
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.
|
210
|
+
This instance is sent it as an argument with the message `doesNotUnderstand:` to the receiver.
|
211
|
+
|
212
|
+
See boot.js, `messageNotUnderstood` and its counterpart `Object>>doesNotUnderstand:`!
|
213
|
+
|
214
|
+
!Message methodsFor: 'accessing'!
|
215
|
+
|
216
|
+
arguments
|
217
|
+
^arguments
|
218
|
+
!
|
219
|
+
|
220
|
+
arguments: anArray
|
221
|
+
arguments := anArray
|
222
|
+
!
|
223
|
+
|
224
|
+
selector
|
225
|
+
^selector
|
226
|
+
!
|
227
|
+
|
228
|
+
selector: aString
|
229
|
+
selector := aString
|
230
|
+
! !
|
231
|
+
|
232
|
+
!Message methodsFor: 'printing'!
|
233
|
+
|
234
|
+
printString
|
235
|
+
^ String streamContents: [:aStream|
|
236
|
+
aStream
|
237
|
+
nextPutAll: super printString;
|
238
|
+
nextPutAll: '(';
|
239
|
+
nextPutAll: selector;
|
240
|
+
nextPutAll: ')' ]
|
241
|
+
!
|
242
|
+
|
243
|
+
sendTo: anObject
|
244
|
+
Smalltalk current send: self selector to: anObject arguments: self arguments
|
245
|
+
! !
|
246
|
+
|
247
|
+
!Message class methodsFor: 'instance creation'!
|
248
|
+
|
249
|
+
selector: aString arguments: anArray
|
250
|
+
^self new
|
251
|
+
selector: aString;
|
252
|
+
arguments: anArray;
|
253
|
+
yourself
|
254
|
+
! !
|
255
|
+
|
256
|
+
Object subclass: #MethodContext
|
257
|
+
instanceVariableNames: ''
|
258
|
+
package: 'Kernel-Methods'!
|
259
|
+
!MethodContext commentStamp!
|
260
|
+
MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.
|
261
|
+
|
262
|
+
MethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js
|
263
|
+
|
264
|
+
Current limitation: MethodContext instances are not created on Block evaluation. That means it's actually impossible to debug inside a Block.!
|
265
|
+
|
266
|
+
!MethodContext methodsFor: 'accessing'!
|
267
|
+
|
268
|
+
asString
|
269
|
+
^self receiver class printString, ' >> ', self selector
|
270
|
+
!
|
271
|
+
|
272
|
+
home
|
273
|
+
<return self.homeContext>
|
274
|
+
!
|
275
|
+
|
276
|
+
printString
|
277
|
+
^super printString, '(', self asString, ')'
|
278
|
+
!
|
279
|
+
|
280
|
+
receiver
|
281
|
+
<return self.receiver>
|
282
|
+
!
|
283
|
+
|
284
|
+
selector
|
285
|
+
<return smalltalk.convertSelector(self.selector)>
|
286
|
+
!
|
287
|
+
|
288
|
+
temps
|
289
|
+
<return self.temps>
|
290
|
+
! !
|
291
|
+
|
@@ -0,0 +1,1587 @@
|
|
1
|
+
Smalltalk current createPackage: 'Kernel-Objects' properties: #{}!
|
2
|
+
nil subclass: #Object
|
3
|
+
instanceVariableNames: ''
|
4
|
+
package: 'Kernel-Objects'!
|
5
|
+
!Object commentStamp!
|
6
|
+
*Object is the root of the Smalltalk class system*. All classes in the system are subclasses of Object.
|
7
|
+
|
8
|
+
Object provides default behavior common to all normal objects, such as:
|
9
|
+
|
10
|
+
- access
|
11
|
+
- copying
|
12
|
+
- comparison
|
13
|
+
- error handling
|
14
|
+
- message sending
|
15
|
+
- reflection
|
16
|
+
|
17
|
+
Also utility messages that all objects should respond to are defined here.
|
18
|
+
|
19
|
+
Object has no instance variable.
|
20
|
+
|
21
|
+
##Access
|
22
|
+
|
23
|
+
Instance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `Object >> instanceVariableNames` answers a collection of all instance variable names.
|
24
|
+
Accessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.
|
25
|
+
|
26
|
+
##Copying
|
27
|
+
|
28
|
+
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.
|
29
|
+
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.
|
30
|
+
|
31
|
+
##Comparison
|
32
|
+
|
33
|
+
Objects understand equality `#=` and identity `#==` comparison.
|
34
|
+
|
35
|
+
##Error handling
|
36
|
+
|
37
|
+
- `#halt` is the typical message to use for inserting breakpoints during debugging.
|
38
|
+
- `#error:` throws a generic error exception
|
39
|
+
- `#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.
|
40
|
+
Overriding this message can be useful to implement proxies for example.!
|
41
|
+
|
42
|
+
!Object methodsFor: 'accessing'!
|
43
|
+
|
44
|
+
basicAt: aString
|
45
|
+
<return self[aString]>
|
46
|
+
!
|
47
|
+
|
48
|
+
basicAt: aString put: anObject
|
49
|
+
<return self[aString] = anObject>
|
50
|
+
!
|
51
|
+
|
52
|
+
basicDelete: aString
|
53
|
+
<delete self[aString]; return aString>
|
54
|
+
!
|
55
|
+
|
56
|
+
class
|
57
|
+
<return self.klass>
|
58
|
+
!
|
59
|
+
|
60
|
+
identityHash
|
61
|
+
<return self.identityHash || (self.identityHash = smalltalk.nextId());>
|
62
|
+
!
|
63
|
+
|
64
|
+
instVarAt: aSymbol
|
65
|
+
| varname |
|
66
|
+
varname := aSymbol asString.
|
67
|
+
<return self['@'+varname]>
|
68
|
+
!
|
69
|
+
|
70
|
+
instVarAt: aSymbol put: anObject
|
71
|
+
| varname |
|
72
|
+
varname := aSymbol asString.
|
73
|
+
<self['@' + varname] = anObject>
|
74
|
+
!
|
75
|
+
|
76
|
+
size
|
77
|
+
self error: 'Object not indexable'
|
78
|
+
!
|
79
|
+
|
80
|
+
yourself
|
81
|
+
^self
|
82
|
+
! !
|
83
|
+
|
84
|
+
!Object methodsFor: 'comparing'!
|
85
|
+
|
86
|
+
= anObject
|
87
|
+
^self == anObject
|
88
|
+
!
|
89
|
+
|
90
|
+
== anObject
|
91
|
+
^self identityHash = anObject identityHash
|
92
|
+
!
|
93
|
+
|
94
|
+
~= anObject
|
95
|
+
^(self = anObject) = false
|
96
|
+
!
|
97
|
+
|
98
|
+
~~ anObject
|
99
|
+
^(self == anObject) = false
|
100
|
+
! !
|
101
|
+
|
102
|
+
!Object methodsFor: 'converting'!
|
103
|
+
|
104
|
+
-> anObject
|
105
|
+
^Association key: self value: anObject
|
106
|
+
!
|
107
|
+
|
108
|
+
asJSON
|
109
|
+
| variables |
|
110
|
+
variables := HashedCollection new.
|
111
|
+
self class allInstanceVariableNames do: [:each |
|
112
|
+
variables at: each put: (self instVarAt: each) asJSON].
|
113
|
+
^variables
|
114
|
+
!
|
115
|
+
|
116
|
+
asJSONString
|
117
|
+
^JSON stringify: self asJSON
|
118
|
+
!
|
119
|
+
|
120
|
+
asJavascript
|
121
|
+
^self asString
|
122
|
+
!
|
123
|
+
|
124
|
+
asString
|
125
|
+
^self printString
|
126
|
+
! !
|
127
|
+
|
128
|
+
!Object methodsFor: 'copying'!
|
129
|
+
|
130
|
+
copy
|
131
|
+
^self shallowCopy postCopy
|
132
|
+
!
|
133
|
+
|
134
|
+
deepCopy
|
135
|
+
<
|
136
|
+
var copy = self.klass._new();
|
137
|
+
for(var i in self) {
|
138
|
+
if(/^@.+/.test(i)) {
|
139
|
+
copy[i] = self[i]._deepCopy();
|
140
|
+
}
|
141
|
+
}
|
142
|
+
return copy;
|
143
|
+
>
|
144
|
+
!
|
145
|
+
|
146
|
+
postCopy
|
147
|
+
!
|
148
|
+
|
149
|
+
shallowCopy
|
150
|
+
<
|
151
|
+
var copy = self.klass._new();
|
152
|
+
for(var i in self) {
|
153
|
+
if(/^@.+/.test(i)) {
|
154
|
+
copy[i] = self[i];
|
155
|
+
}
|
156
|
+
}
|
157
|
+
return copy;
|
158
|
+
>
|
159
|
+
! !
|
160
|
+
|
161
|
+
!Object methodsFor: 'error handling'!
|
162
|
+
|
163
|
+
deprecatedAPI
|
164
|
+
"Just a simple way to deprecate methods.
|
165
|
+
#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,
|
166
|
+
but it could in the future."
|
167
|
+
console warn: thisContext home asString, ' is deprecated!! (in ', thisContext home home asString, ')'
|
168
|
+
!
|
169
|
+
|
170
|
+
doesNotUnderstand: aMessage
|
171
|
+
MessageNotUnderstood new
|
172
|
+
receiver: self;
|
173
|
+
message: aMessage;
|
174
|
+
signal
|
175
|
+
!
|
176
|
+
|
177
|
+
error: aString
|
178
|
+
Error signal: aString
|
179
|
+
!
|
180
|
+
|
181
|
+
halt
|
182
|
+
self error: 'Halt encountered'
|
183
|
+
!
|
184
|
+
|
185
|
+
shouldNotImplement
|
186
|
+
self error: 'This method should not be implemented in ', self class name
|
187
|
+
!
|
188
|
+
|
189
|
+
subclassResponsibility
|
190
|
+
self error: 'This method is a responsibility of a subclass'
|
191
|
+
!
|
192
|
+
|
193
|
+
try: aBlock catch: anotherBlock
|
194
|
+
<try{result = aBlock()} catch(e) {result = anotherBlock(e)};
|
195
|
+
return result;>
|
196
|
+
! !
|
197
|
+
|
198
|
+
!Object methodsFor: 'initialization'!
|
199
|
+
|
200
|
+
initialize
|
201
|
+
! !
|
202
|
+
|
203
|
+
!Object methodsFor: 'message handling'!
|
204
|
+
|
205
|
+
basicPerform: aSymbol
|
206
|
+
^self basicPerform: aSymbol withArguments: #()
|
207
|
+
!
|
208
|
+
|
209
|
+
basicPerform: aSymbol withArguments: aCollection
|
210
|
+
<return self[aSymbol].apply(self, aCollection);>
|
211
|
+
!
|
212
|
+
|
213
|
+
perform: aSymbol
|
214
|
+
^self perform: aSymbol withArguments: #()
|
215
|
+
!
|
216
|
+
|
217
|
+
perform: aSymbol withArguments: aCollection
|
218
|
+
^self basicPerform: aSymbol asSelector withArguments: aCollection
|
219
|
+
! !
|
220
|
+
|
221
|
+
!Object methodsFor: 'printing'!
|
222
|
+
|
223
|
+
log: aString block: aBlock
|
224
|
+
|
225
|
+
| result |
|
226
|
+
console log: aString, ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.
|
227
|
+
^result
|
228
|
+
!
|
229
|
+
|
230
|
+
printNl
|
231
|
+
<console.log(self)>
|
232
|
+
!
|
233
|
+
|
234
|
+
printString
|
235
|
+
^'a ', self class name
|
236
|
+
!
|
237
|
+
|
238
|
+
storeOn: aStream
|
239
|
+
aStream nextPutAll: self printString
|
240
|
+
!
|
241
|
+
|
242
|
+
storeString
|
243
|
+
"Answer a String representation of the receiver from which the receiver
|
244
|
+
can be reconstructed."
|
245
|
+
|
246
|
+
^ String streamContents: [:s | self storeOn: s]
|
247
|
+
! !
|
248
|
+
|
249
|
+
!Object methodsFor: 'rendering'!
|
250
|
+
|
251
|
+
inlineViewComponent
|
252
|
+
^ self asString
|
253
|
+
! !
|
254
|
+
|
255
|
+
!Object methodsFor: 'testing'!
|
256
|
+
|
257
|
+
ifNil: aBlock
|
258
|
+
"inlined in the Compiler"
|
259
|
+
^self
|
260
|
+
!
|
261
|
+
|
262
|
+
ifNil: aBlock ifNotNil: anotherBlock
|
263
|
+
"inlined in the Compiler"
|
264
|
+
^anotherBlock value
|
265
|
+
!
|
266
|
+
|
267
|
+
ifNotNil: aBlock
|
268
|
+
"inlined in the Compiler"
|
269
|
+
^aBlock value
|
270
|
+
!
|
271
|
+
|
272
|
+
ifNotNil: aBlock ifNil: anotherBlock
|
273
|
+
"inlined in the Compiler"
|
274
|
+
^aBlock value
|
275
|
+
!
|
276
|
+
|
277
|
+
isAssociation
|
278
|
+
^ false
|
279
|
+
!
|
280
|
+
|
281
|
+
isClass
|
282
|
+
^false
|
283
|
+
!
|
284
|
+
|
285
|
+
isKindOf: aClass
|
286
|
+
^(self isMemberOf: aClass)
|
287
|
+
ifTrue: [true]
|
288
|
+
ifFalse: [self class inheritsFrom: aClass]
|
289
|
+
!
|
290
|
+
|
291
|
+
isMemberOf: aClass
|
292
|
+
^self class = aClass
|
293
|
+
!
|
294
|
+
|
295
|
+
isMetaclass
|
296
|
+
^false
|
297
|
+
!
|
298
|
+
|
299
|
+
isNil
|
300
|
+
^false
|
301
|
+
!
|
302
|
+
|
303
|
+
isNumber
|
304
|
+
^false
|
305
|
+
!
|
306
|
+
|
307
|
+
isParseFailure
|
308
|
+
^false
|
309
|
+
!
|
310
|
+
|
311
|
+
isString
|
312
|
+
^false
|
313
|
+
!
|
314
|
+
|
315
|
+
isSymbol
|
316
|
+
^false
|
317
|
+
!
|
318
|
+
|
319
|
+
notNil
|
320
|
+
^self isNil not
|
321
|
+
! !
|
322
|
+
|
323
|
+
!Object class methodsFor: 'initialization'!
|
324
|
+
|
325
|
+
initialize
|
326
|
+
"no op"
|
327
|
+
! !
|
328
|
+
|
329
|
+
Object subclass: #Boolean
|
330
|
+
instanceVariableNames: ''
|
331
|
+
package: 'Kernel-Objects'!
|
332
|
+
!Boolean commentStamp!
|
333
|
+
Boolean wraps the JavaScript `Boolean()` constructor. The `true` and `false` objects are the JavaScript boolean objects.
|
334
|
+
|
335
|
+
Boolean defines the protocol for logic testing operations and conditional control structures for the logical values.
|
336
|
+
Boolean instances are weither `true` or `false`.!
|
337
|
+
|
338
|
+
!Boolean methodsFor: 'comparing'!
|
339
|
+
|
340
|
+
= aBoolean
|
341
|
+
aBoolean class = self class ifFalse: [^false].
|
342
|
+
<return Boolean(self == true) == aBoolean>
|
343
|
+
! !
|
344
|
+
|
345
|
+
!Boolean methodsFor: 'controlling'!
|
346
|
+
|
347
|
+
& aBoolean
|
348
|
+
<
|
349
|
+
if(self == true) {
|
350
|
+
return aBoolean;
|
351
|
+
} else {
|
352
|
+
return false;
|
353
|
+
}
|
354
|
+
>
|
355
|
+
!
|
356
|
+
|
357
|
+
and: aBlock
|
358
|
+
^self = true
|
359
|
+
ifTrue: aBlock
|
360
|
+
ifFalse: [false]
|
361
|
+
!
|
362
|
+
|
363
|
+
ifFalse: aBlock
|
364
|
+
"inlined in the Compiler"
|
365
|
+
^self ifTrue: [] ifFalse: aBlock
|
366
|
+
!
|
367
|
+
|
368
|
+
ifFalse: aBlock ifTrue: anotherBlock
|
369
|
+
"inlined in the Compiler"
|
370
|
+
^self ifTrue: anotherBlock ifFalse: aBlock
|
371
|
+
!
|
372
|
+
|
373
|
+
ifTrue: aBlock
|
374
|
+
"inlined in the Compiler"
|
375
|
+
^self ifTrue: aBlock ifFalse: []
|
376
|
+
!
|
377
|
+
|
378
|
+
ifTrue: aBlock ifFalse: anotherBlock
|
379
|
+
"inlined in the Compiler"
|
380
|
+
<
|
381
|
+
if(self == true) {
|
382
|
+
return aBlock();
|
383
|
+
} else {
|
384
|
+
return anotherBlock();
|
385
|
+
}
|
386
|
+
>
|
387
|
+
!
|
388
|
+
|
389
|
+
not
|
390
|
+
^self = false
|
391
|
+
!
|
392
|
+
|
393
|
+
or: aBlock
|
394
|
+
^self = true
|
395
|
+
ifTrue: [true]
|
396
|
+
ifFalse: aBlock
|
397
|
+
!
|
398
|
+
|
399
|
+
| aBoolean
|
400
|
+
<
|
401
|
+
if(self == true) {
|
402
|
+
return true;
|
403
|
+
} else {
|
404
|
+
return aBoolean;
|
405
|
+
}
|
406
|
+
>
|
407
|
+
! !
|
408
|
+
|
409
|
+
!Boolean methodsFor: 'converting'!
|
410
|
+
|
411
|
+
asJSON
|
412
|
+
^self
|
413
|
+
! !
|
414
|
+
|
415
|
+
!Boolean methodsFor: 'copying'!
|
416
|
+
|
417
|
+
deepCopy
|
418
|
+
^self
|
419
|
+
!
|
420
|
+
|
421
|
+
shallowCopy
|
422
|
+
^self
|
423
|
+
! !
|
424
|
+
|
425
|
+
!Boolean methodsFor: 'printing'!
|
426
|
+
|
427
|
+
printString
|
428
|
+
<return self.toString()>
|
429
|
+
! !
|
430
|
+
|
431
|
+
Object subclass: #Date
|
432
|
+
instanceVariableNames: ''
|
433
|
+
package: 'Kernel-Objects'!
|
434
|
+
!Date commentStamp!
|
435
|
+
The Date class is used to work with dates and times. Therefore `Date today` and `Date now` are both valid in
|
436
|
+
Amber and answer the same date object.
|
437
|
+
|
438
|
+
Date wraps the `Date()` JavaScript constructor, and Smalltalk date objects are JavaScript date objects.!
|
439
|
+
|
440
|
+
!Date methodsFor: 'accessing'!
|
441
|
+
|
442
|
+
day
|
443
|
+
^self dayOfWeek
|
444
|
+
!
|
445
|
+
|
446
|
+
day: aNumber
|
447
|
+
self day: aNumber
|
448
|
+
!
|
449
|
+
|
450
|
+
dayOfMonth
|
451
|
+
<return self.getDate()>
|
452
|
+
!
|
453
|
+
|
454
|
+
dayOfMonth: aNumber
|
455
|
+
<self.setDate(aNumber)>
|
456
|
+
!
|
457
|
+
|
458
|
+
dayOfWeek
|
459
|
+
<return self.getDay() + 1>
|
460
|
+
!
|
461
|
+
|
462
|
+
dayOfWeek: aNumber
|
463
|
+
<return self.setDay(aNumber - 1)>
|
464
|
+
!
|
465
|
+
|
466
|
+
hours
|
467
|
+
<return self.getHours()>
|
468
|
+
!
|
469
|
+
|
470
|
+
hours: aNumber
|
471
|
+
<self.setHours(aNumber)>
|
472
|
+
!
|
473
|
+
|
474
|
+
milliseconds
|
475
|
+
<return self.getMilliseconds()>
|
476
|
+
!
|
477
|
+
|
478
|
+
milliseconds: aNumber
|
479
|
+
<self.setMilliseconds(aNumber)>
|
480
|
+
!
|
481
|
+
|
482
|
+
minutes
|
483
|
+
<return self.getMinutes()>
|
484
|
+
!
|
485
|
+
|
486
|
+
minutes: aNumber
|
487
|
+
<self.setMinutes(aNumber)>
|
488
|
+
!
|
489
|
+
|
490
|
+
month
|
491
|
+
<return self.getMonth() + 1>
|
492
|
+
!
|
493
|
+
|
494
|
+
month: aNumber
|
495
|
+
<self.setMonth(aNumber - 1)>
|
496
|
+
!
|
497
|
+
|
498
|
+
seconds
|
499
|
+
<return self.getSeconds()>
|
500
|
+
!
|
501
|
+
|
502
|
+
seconds: aNumber
|
503
|
+
<self.setSeconds(aNumber)>
|
504
|
+
!
|
505
|
+
|
506
|
+
time
|
507
|
+
<return self.getTime()>
|
508
|
+
!
|
509
|
+
|
510
|
+
time: aNumber
|
511
|
+
<self.setTime(aNumber)>
|
512
|
+
!
|
513
|
+
|
514
|
+
year
|
515
|
+
<return self.getFullYear()>
|
516
|
+
!
|
517
|
+
|
518
|
+
year: aNumber
|
519
|
+
<self.setFullYear(aNumber)>
|
520
|
+
! !
|
521
|
+
|
522
|
+
!Date methodsFor: 'arithmetic'!
|
523
|
+
|
524
|
+
+ aDate
|
525
|
+
<return self + aDate>
|
526
|
+
!
|
527
|
+
|
528
|
+
- aDate
|
529
|
+
<return self - aDate>
|
530
|
+
! !
|
531
|
+
|
532
|
+
!Date methodsFor: 'comparing'!
|
533
|
+
|
534
|
+
< aDate
|
535
|
+
<return self < aDate>
|
536
|
+
!
|
537
|
+
|
538
|
+
<= aDate
|
539
|
+
<return self <= aDate>
|
540
|
+
!
|
541
|
+
|
542
|
+
> aDate
|
543
|
+
<return self >> aDate>
|
544
|
+
!
|
545
|
+
|
546
|
+
>= aDate
|
547
|
+
<return self >>= aDate>
|
548
|
+
! !
|
549
|
+
|
550
|
+
!Date methodsFor: 'converting'!
|
551
|
+
|
552
|
+
asDateString
|
553
|
+
<return self.toDateString()>
|
554
|
+
!
|
555
|
+
|
556
|
+
asLocaleString
|
557
|
+
<return self.toLocaleString()>
|
558
|
+
!
|
559
|
+
|
560
|
+
asMilliseconds
|
561
|
+
^self time
|
562
|
+
!
|
563
|
+
|
564
|
+
asNumber
|
565
|
+
^self asMilliseconds
|
566
|
+
!
|
567
|
+
|
568
|
+
asString
|
569
|
+
<return self.toString()>
|
570
|
+
!
|
571
|
+
|
572
|
+
asTimeString
|
573
|
+
<return self.toTimeString()>
|
574
|
+
! !
|
575
|
+
|
576
|
+
!Date methodsFor: 'printing'!
|
577
|
+
|
578
|
+
printString
|
579
|
+
^self asString
|
580
|
+
! !
|
581
|
+
|
582
|
+
!Date class methodsFor: 'instance creation'!
|
583
|
+
|
584
|
+
fromMilliseconds: aNumber
|
585
|
+
^self new: aNumber
|
586
|
+
!
|
587
|
+
|
588
|
+
fromSeconds: aNumber
|
589
|
+
^self fromMilliseconds: aNumber * 1000
|
590
|
+
!
|
591
|
+
|
592
|
+
fromString: aString
|
593
|
+
"Example: Date fromString('2011/04/15 00:00:00')"
|
594
|
+
^self new: aString
|
595
|
+
!
|
596
|
+
|
597
|
+
millisecondsToRun: aBlock
|
598
|
+
| t |
|
599
|
+
t := Date now.
|
600
|
+
aBlock value.
|
601
|
+
^Date now - t
|
602
|
+
!
|
603
|
+
|
604
|
+
new: anObject
|
605
|
+
<return new Date(anObject)>
|
606
|
+
!
|
607
|
+
|
608
|
+
now
|
609
|
+
^self today
|
610
|
+
!
|
611
|
+
|
612
|
+
today
|
613
|
+
^self new
|
614
|
+
! !
|
615
|
+
|
616
|
+
Object subclass: #JSObjectProxy
|
617
|
+
instanceVariableNames: 'jsObject'
|
618
|
+
package: 'Kernel-Objects'!
|
619
|
+
!JSObjectProxy commentStamp!
|
620
|
+
JSObjectProxy handles sending messages to JavaScript object, therefore accessing JavaScript objects from Amber is transparent.
|
621
|
+
JSOjbectProxy makes intensive use of `#doesNotUnderstand:`.
|
622
|
+
|
623
|
+
## Examples
|
624
|
+
|
625
|
+
JSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.
|
626
|
+
|
627
|
+
window alert: 'hello world'.
|
628
|
+
window inspect.
|
629
|
+
(window jQuery: 'body') append: 'hello world'
|
630
|
+
|
631
|
+
Smalltalk 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.
|
632
|
+
|
633
|
+
## Message conversion rules
|
634
|
+
|
635
|
+
- `someUser name` becomes `someUser.name`
|
636
|
+
- `someUser name: 'John'` becomes `someUser name = "John"`
|
637
|
+
- `console log: 'hello world'` becomes `console.log('hello world')`
|
638
|
+
- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`
|
639
|
+
|
640
|
+
__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.!
|
641
|
+
|
642
|
+
!JSObjectProxy methodsFor: 'accessing'!
|
643
|
+
|
644
|
+
at: aSymbol
|
645
|
+
| attr |
|
646
|
+
attr := aSymbol asString.
|
647
|
+
<return self['@jsObject'][attr]>
|
648
|
+
!
|
649
|
+
|
650
|
+
at: aSymbol put: anObject
|
651
|
+
| attr |
|
652
|
+
attr := aSymbol asString.
|
653
|
+
<self['@jsObject'][attr] = anObject>
|
654
|
+
!
|
655
|
+
|
656
|
+
jsObject
|
657
|
+
^jsObject
|
658
|
+
!
|
659
|
+
|
660
|
+
jsObject: aJSObject
|
661
|
+
jsObject := aJSObject
|
662
|
+
!
|
663
|
+
|
664
|
+
keysAndValuesDo: aBlock
|
665
|
+
< for (var key in self['@jsObject']) {
|
666
|
+
aBlock._value_value_(key, self['@jsObject'][key]);
|
667
|
+
} >
|
668
|
+
!
|
669
|
+
|
670
|
+
size
|
671
|
+
< var obj = self['@jsObject'];
|
672
|
+
return Object.keys(obj).size; >
|
673
|
+
! !
|
674
|
+
|
675
|
+
!JSObjectProxy methodsFor: 'proxy'!
|
676
|
+
|
677
|
+
doesNotUnderstand: aMessage
|
678
|
+
| obj selector jsSelector arguments |
|
679
|
+
obj := self jsObject.
|
680
|
+
selector := aMessage selector.
|
681
|
+
jsSelector := selector asJavaScriptSelector.
|
682
|
+
arguments := aMessage arguments.
|
683
|
+
<if(obj[jsSelector] !!= undefined) {return smalltalk.send(obj, jsSelector, arguments)}>.
|
684
|
+
super doesNotUnderstand: aMessage
|
685
|
+
!
|
686
|
+
|
687
|
+
inspectOn: anInspector
|
688
|
+
| variables |
|
689
|
+
variables := Dictionary new.
|
690
|
+
variables at: '#self' put: self jsObject.
|
691
|
+
anInspector setLabel: self printString.
|
692
|
+
<for(var i in self['@jsObject']) {
|
693
|
+
variables._at_put_(i, self['@jsObject'][i]);
|
694
|
+
}>.
|
695
|
+
anInspector setVariables: variables
|
696
|
+
!
|
697
|
+
|
698
|
+
printString
|
699
|
+
^self jsObject toString
|
700
|
+
! !
|
701
|
+
|
702
|
+
!JSObjectProxy class methodsFor: 'instance creation'!
|
703
|
+
|
704
|
+
on: aJSObject
|
705
|
+
^self new
|
706
|
+
jsObject: aJSObject;
|
707
|
+
yourself
|
708
|
+
! !
|
709
|
+
|
710
|
+
Object subclass: #Number
|
711
|
+
instanceVariableNames: ''
|
712
|
+
package: 'Kernel-Objects'!
|
713
|
+
!Number commentStamp!
|
714
|
+
Number holds the most general methods for dealing with numbers.
|
715
|
+
Number is directly mapped to JavaScript Number.
|
716
|
+
|
717
|
+
Most arithmetic methods like `#+` `#/` `#-` `#max:` are directly inlined into javascript.
|
718
|
+
|
719
|
+
##Enumerating
|
720
|
+
A Number can be used to evaluate a Block a fixed number of times:
|
721
|
+
|
722
|
+
5 timesRepeat: [Transcript show: 'This will be printed 5 times'; cr].
|
723
|
+
|
724
|
+
1 to: 5 do: [:aNumber| Transcript show: aNumber asString; cr].
|
725
|
+
|
726
|
+
1 to: 10 by: 2 do: [:aNumber| Transcript show: aNumber asString; cr].!
|
727
|
+
|
728
|
+
!Number methodsFor: 'accessing'!
|
729
|
+
|
730
|
+
identityHash
|
731
|
+
^self asString, 'n'
|
732
|
+
! !
|
733
|
+
|
734
|
+
!Number methodsFor: 'arithmetic'!
|
735
|
+
|
736
|
+
* aNumber
|
737
|
+
"Inlined in the Compiler"
|
738
|
+
<return self * aNumber>
|
739
|
+
!
|
740
|
+
|
741
|
+
+ aNumber
|
742
|
+
"Inlined in the Compiler"
|
743
|
+
<return self + aNumber>
|
744
|
+
!
|
745
|
+
|
746
|
+
- aNumber
|
747
|
+
"Inlined in the Compiler"
|
748
|
+
<return self - aNumber>
|
749
|
+
!
|
750
|
+
|
751
|
+
/ aNumber
|
752
|
+
"Inlined in the Compiler"
|
753
|
+
<return self / aNumber>
|
754
|
+
!
|
755
|
+
|
756
|
+
\\ aNumber
|
757
|
+
<return self % aNumber>
|
758
|
+
!
|
759
|
+
|
760
|
+
bitAnd: anInteger
|
761
|
+
< return self & anInteger; >
|
762
|
+
!
|
763
|
+
|
764
|
+
bitShift: anInteger
|
765
|
+
< if (anInteger >> 0) {
|
766
|
+
return self << anInteger;
|
767
|
+
}
|
768
|
+
else {
|
769
|
+
// bitshift might fail with big numbers
|
770
|
+
return bitShiftRight(self, -1 * anInteger);
|
771
|
+
} >
|
772
|
+
!
|
773
|
+
|
774
|
+
max: aNumber
|
775
|
+
<return Math.max(self, aNumber);>
|
776
|
+
!
|
777
|
+
|
778
|
+
min: aNumber
|
779
|
+
<return Math.min(self, aNumber);>
|
780
|
+
!
|
781
|
+
|
782
|
+
negated
|
783
|
+
^0 - self
|
784
|
+
!
|
785
|
+
|
786
|
+
sqrt
|
787
|
+
<return Math.sqrt(self)>
|
788
|
+
!
|
789
|
+
|
790
|
+
squared
|
791
|
+
^self * self
|
792
|
+
! !
|
793
|
+
|
794
|
+
!Number methodsFor: 'comparing'!
|
795
|
+
|
796
|
+
< aNumber
|
797
|
+
"Inlined in the Compiler"
|
798
|
+
<return self < aNumber>
|
799
|
+
!
|
800
|
+
|
801
|
+
<= aNumber
|
802
|
+
"Inlined in the Compiler"
|
803
|
+
<return self <= aNumber>
|
804
|
+
!
|
805
|
+
|
806
|
+
= aNumber
|
807
|
+
aNumber isNumber ifFalse: [^false].
|
808
|
+
<return Number(self) == aNumber>
|
809
|
+
!
|
810
|
+
|
811
|
+
> aNumber
|
812
|
+
"Inlined in the Compiler"
|
813
|
+
<return self >> aNumber>
|
814
|
+
!
|
815
|
+
|
816
|
+
>= aNumber
|
817
|
+
"Inlined in the Compiler"
|
818
|
+
<return self >>= aNumber>
|
819
|
+
! !
|
820
|
+
|
821
|
+
!Number methodsFor: 'converting'!
|
822
|
+
|
823
|
+
@ aNumber
|
824
|
+
^Point x: self y: aNumber
|
825
|
+
!
|
826
|
+
|
827
|
+
asHexString
|
828
|
+
< return self.toString(16); >
|
829
|
+
!
|
830
|
+
|
831
|
+
asJSON
|
832
|
+
^self
|
833
|
+
!
|
834
|
+
|
835
|
+
asJavascript
|
836
|
+
^'(', self printString, ')'
|
837
|
+
!
|
838
|
+
|
839
|
+
asPoint
|
840
|
+
^Point x: self y: self
|
841
|
+
!
|
842
|
+
|
843
|
+
asString
|
844
|
+
^self printString
|
845
|
+
!
|
846
|
+
|
847
|
+
atRandom
|
848
|
+
^(Random new next * self) truncated + 1
|
849
|
+
!
|
850
|
+
|
851
|
+
ceiled
|
852
|
+
< return Math.ceil(self); >
|
853
|
+
!
|
854
|
+
|
855
|
+
rounded
|
856
|
+
<return Math.round(self);>
|
857
|
+
!
|
858
|
+
|
859
|
+
to: aNumber
|
860
|
+
| array first last count |
|
861
|
+
first := self truncated.
|
862
|
+
last := aNumber truncated + 1.
|
863
|
+
count := 1.
|
864
|
+
array := Array new.
|
865
|
+
(last - first) timesRepeat: [
|
866
|
+
array at: count put: first.
|
867
|
+
count := count + 1.
|
868
|
+
first := first + 1].
|
869
|
+
^array
|
870
|
+
!
|
871
|
+
|
872
|
+
to: stop by: step
|
873
|
+
| array value pos |
|
874
|
+
value := self.
|
875
|
+
array := Array new.
|
876
|
+
pos := 1.
|
877
|
+
step = 0 ifTrue: [self error: 'step must be non-zero'].
|
878
|
+
step < 0
|
879
|
+
ifTrue: [[ value >= stop ] whileTrue: [
|
880
|
+
array at: pos put: value.
|
881
|
+
pos := pos + 1.
|
882
|
+
value := value + step]]
|
883
|
+
ifFalse: [[ value <= stop ] whileTrue: [
|
884
|
+
array at: pos put: value.
|
885
|
+
pos := pos + 1.
|
886
|
+
value := value + step]].
|
887
|
+
^array
|
888
|
+
!
|
889
|
+
|
890
|
+
truncated
|
891
|
+
|result|
|
892
|
+
|
893
|
+
self >= 0
|
894
|
+
ifTrue: [<result = Math.floor(self);>]
|
895
|
+
ifFalse: [<result = (Math.floor(self * (-1)) * (-1));>].
|
896
|
+
|
897
|
+
^ result
|
898
|
+
! !
|
899
|
+
|
900
|
+
!Number methodsFor: 'copying'!
|
901
|
+
|
902
|
+
copy
|
903
|
+
^self
|
904
|
+
!
|
905
|
+
|
906
|
+
deepCopy
|
907
|
+
^self copy
|
908
|
+
! !
|
909
|
+
|
910
|
+
!Number methodsFor: 'enumerating'!
|
911
|
+
|
912
|
+
timesRepeat: aBlock
|
913
|
+
| integer count |
|
914
|
+
integer := self truncated.
|
915
|
+
count := 1.
|
916
|
+
[count > self] whileFalse: [
|
917
|
+
aBlock value.
|
918
|
+
count := count + 1]
|
919
|
+
!
|
920
|
+
|
921
|
+
to: stop by: step do: aBlock
|
922
|
+
| value |
|
923
|
+
value := self.
|
924
|
+
step = 0 ifTrue: [self error: 'step must be non-zero'].
|
925
|
+
step < 0
|
926
|
+
ifTrue: [[ value >= stop ] whileTrue: [
|
927
|
+
aBlock value: value.
|
928
|
+
value := value + step]]
|
929
|
+
ifFalse: [[ value <= stop ] whileTrue: [
|
930
|
+
aBlock value: value.
|
931
|
+
value := value + step]]
|
932
|
+
!
|
933
|
+
|
934
|
+
to: stop do: aBlock
|
935
|
+
"Evaluate aBlock for each number from self to aNumber."
|
936
|
+
| nextValue |
|
937
|
+
nextValue := self.
|
938
|
+
[nextValue <= stop]
|
939
|
+
whileTrue:
|
940
|
+
[aBlock value: nextValue.
|
941
|
+
nextValue := nextValue + 1]
|
942
|
+
! !
|
943
|
+
|
944
|
+
!Number methodsFor: 'printing'!
|
945
|
+
|
946
|
+
printShowingDecimalPlaces: placesDesired
|
947
|
+
<return self.toFixed(placesDesired)>
|
948
|
+
!
|
949
|
+
|
950
|
+
printString
|
951
|
+
<return String(self)>
|
952
|
+
! !
|
953
|
+
|
954
|
+
!Number methodsFor: 'testing'!
|
955
|
+
|
956
|
+
even
|
957
|
+
^ 0 = (self \\ 2)
|
958
|
+
!
|
959
|
+
|
960
|
+
isNumber
|
961
|
+
^true
|
962
|
+
!
|
963
|
+
|
964
|
+
isZero
|
965
|
+
^self = 0
|
966
|
+
!
|
967
|
+
|
968
|
+
negative
|
969
|
+
"Answer whether the receiver is mathematically negative."
|
970
|
+
|
971
|
+
^ self < 0
|
972
|
+
!
|
973
|
+
|
974
|
+
odd
|
975
|
+
^ self even not
|
976
|
+
!
|
977
|
+
|
978
|
+
positive
|
979
|
+
"Answer whether the receiver is positive or equal to 0. (ST-80 protocol)."
|
980
|
+
|
981
|
+
^ self >= 0
|
982
|
+
! !
|
983
|
+
|
984
|
+
!Number methodsFor: 'timeouts/intervals'!
|
985
|
+
|
986
|
+
clearInterval
|
987
|
+
<clearInterval(Number(self))>
|
988
|
+
!
|
989
|
+
|
990
|
+
clearTimeout
|
991
|
+
<clearTimeout(Number(self))>
|
992
|
+
! !
|
993
|
+
|
994
|
+
!Number class methodsFor: 'instance creation'!
|
995
|
+
|
996
|
+
pi
|
997
|
+
<return Math.PI>
|
998
|
+
! !
|
999
|
+
|
1000
|
+
Object subclass: #Package
|
1001
|
+
instanceVariableNames: 'commitPathJs commitPathSt'
|
1002
|
+
package: 'Kernel-Objects'!
|
1003
|
+
!Package commentStamp!
|
1004
|
+
A Package is 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.
|
1005
|
+
|
1006
|
+
A Package has a name, an Array of "requires", a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.
|
1007
|
+
Packages are manipulated through "Smalltalk current", like for example finding one based on a name:
|
1008
|
+
|
1009
|
+
Smalltalk current packageAt: 'Kernel'
|
1010
|
+
|
1011
|
+
...but you can also use:
|
1012
|
+
|
1013
|
+
Package named: 'Kernel'
|
1014
|
+
|
1015
|
+
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
|
1016
|
+
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. This can easily be seen in for example class
|
1017
|
+
String where the method category "*IDE" defines #inspectOn: which thus is a method belonging to the IDE package.
|
1018
|
+
|
1019
|
+
You can fetch a package from the server:
|
1020
|
+
|
1021
|
+
Package fetch: 'Additional-Examples'!
|
1022
|
+
|
1023
|
+
!Package methodsFor: 'accessing'!
|
1024
|
+
|
1025
|
+
commitPathJs
|
1026
|
+
^ commitPathJs ifNil: [self class defaultCommitPathJs]
|
1027
|
+
!
|
1028
|
+
|
1029
|
+
commitPathJs: aString
|
1030
|
+
commitPathJs := aString
|
1031
|
+
!
|
1032
|
+
|
1033
|
+
commitPathSt
|
1034
|
+
^ commitPathSt ifNil: [self class defaultCommitPathSt]
|
1035
|
+
!
|
1036
|
+
|
1037
|
+
commitPathSt: aString
|
1038
|
+
commitPathSt := aString
|
1039
|
+
!
|
1040
|
+
|
1041
|
+
dependencies
|
1042
|
+
^self propertyAt: 'dependencies' ifAbsent: [#()]
|
1043
|
+
!
|
1044
|
+
|
1045
|
+
dependencies: anArray
|
1046
|
+
^self propertyAt: 'dependencies' put: anArray
|
1047
|
+
!
|
1048
|
+
|
1049
|
+
name
|
1050
|
+
<return self.pkgName>
|
1051
|
+
!
|
1052
|
+
|
1053
|
+
name: aString
|
1054
|
+
<self.pkgName = aString>
|
1055
|
+
!
|
1056
|
+
|
1057
|
+
properties
|
1058
|
+
^Smalltalk current readJSObject: (self basicAt: 'properties')
|
1059
|
+
!
|
1060
|
+
|
1061
|
+
properties: aDict
|
1062
|
+
"We store it as a javascript object."
|
1063
|
+
|
1064
|
+
| object |
|
1065
|
+
<object = {};>.
|
1066
|
+
aDict keysAndValuesDo: [:key :value |
|
1067
|
+
<object[key] = value>.
|
1068
|
+
].
|
1069
|
+
<return self.properties = object>
|
1070
|
+
! !
|
1071
|
+
|
1072
|
+
!Package methodsFor: 'classes'!
|
1073
|
+
|
1074
|
+
classes
|
1075
|
+
"We need to do a reverse scan."
|
1076
|
+
^Smalltalk current classes select: [:c | c package == self]
|
1077
|
+
!
|
1078
|
+
|
1079
|
+
sortedClasses
|
1080
|
+
"Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)."
|
1081
|
+
|
1082
|
+
^self class sortedClasses: self classes
|
1083
|
+
! !
|
1084
|
+
|
1085
|
+
!Package methodsFor: 'printing'!
|
1086
|
+
|
1087
|
+
printString
|
1088
|
+
^self name
|
1089
|
+
! !
|
1090
|
+
|
1091
|
+
!Package methodsFor: 'private'!
|
1092
|
+
|
1093
|
+
jsProperties
|
1094
|
+
<return self.properties>
|
1095
|
+
!
|
1096
|
+
|
1097
|
+
jsProperties: aJSObject
|
1098
|
+
<return self.properties = aJSObject>
|
1099
|
+
!
|
1100
|
+
|
1101
|
+
propertiesAsJSON
|
1102
|
+
<return JSON.stringify(self.properties)>
|
1103
|
+
! !
|
1104
|
+
|
1105
|
+
!Package methodsFor: 'properties'!
|
1106
|
+
|
1107
|
+
propertyAt: key
|
1108
|
+
|
1109
|
+
<return self.properties[key]>
|
1110
|
+
!
|
1111
|
+
|
1112
|
+
propertyAt: key ifAbsent: block
|
1113
|
+
|
1114
|
+
^(self propertyAt: key) ifNil: [block value]
|
1115
|
+
!
|
1116
|
+
|
1117
|
+
propertyAt: key put: value
|
1118
|
+
|
1119
|
+
<return self.properties[key] = value>
|
1120
|
+
! !
|
1121
|
+
|
1122
|
+
Package class instanceVariableNames: 'defaultCommitPathJs defaultCommitPathSt'!
|
1123
|
+
|
1124
|
+
!Package class methodsFor: 'commit paths'!
|
1125
|
+
|
1126
|
+
defaultCommitPathJs
|
1127
|
+
^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']
|
1128
|
+
!
|
1129
|
+
|
1130
|
+
defaultCommitPathJs: aString
|
1131
|
+
defaultCommitPathJs := aString
|
1132
|
+
!
|
1133
|
+
|
1134
|
+
defaultCommitPathSt
|
1135
|
+
^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']
|
1136
|
+
!
|
1137
|
+
|
1138
|
+
defaultCommitPathSt: aString
|
1139
|
+
defaultCommitPathSt := aString
|
1140
|
+
!
|
1141
|
+
|
1142
|
+
resetCommitPaths
|
1143
|
+
defaultCommitPathJs := nil.
|
1144
|
+
defaultCommitPathSt := nil.
|
1145
|
+
! !
|
1146
|
+
|
1147
|
+
!Package class methodsFor: 'loading-storing'!
|
1148
|
+
|
1149
|
+
commitToLocalStorage: aPackageName
|
1150
|
+
| key sourceCode |
|
1151
|
+
key := 'smalltalk.packages.' , aPackageName.
|
1152
|
+
sourceCode := Exporter new exportPackage: aPackageName.
|
1153
|
+
<localStorage[key] = escape(sourceCode)>
|
1154
|
+
!
|
1155
|
+
|
1156
|
+
fetch: aPackageName
|
1157
|
+
self fetch: aPackageName prefix: self defaultCommitPathJs, '/'
|
1158
|
+
!
|
1159
|
+
|
1160
|
+
fetch: aPackageName prefix: aPrefix
|
1161
|
+
jQuery getScript: (aPrefix , aPackageName , '.js') onSuccess: [ Package init: aPackageName ]
|
1162
|
+
!
|
1163
|
+
|
1164
|
+
init: aPackageName
|
1165
|
+
(smalltalk classes select: [ :each | <each.pkg.pkgName == aPackageName> ])
|
1166
|
+
do: [ :each | <smalltalk.init(each)> ];
|
1167
|
+
do: [ :each | each initialize ]
|
1168
|
+
! !
|
1169
|
+
|
1170
|
+
!Package class methodsFor: 'not yet classified'!
|
1171
|
+
|
1172
|
+
named: aPackageName
|
1173
|
+
|
1174
|
+
^Smalltalk current packageAt: aPackageName
|
1175
|
+
!
|
1176
|
+
|
1177
|
+
named: aPackageName ifAbsent: aBlock
|
1178
|
+
|
1179
|
+
^Smalltalk current packageAt: aPackageName ifAbsent: aBlock
|
1180
|
+
! !
|
1181
|
+
|
1182
|
+
!Package class methodsFor: 'sorting'!
|
1183
|
+
|
1184
|
+
sortedClasses: classes
|
1185
|
+
"Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)"
|
1186
|
+
|
1187
|
+
| children others nodes expandedClasses |
|
1188
|
+
children := #().
|
1189
|
+
others := #().
|
1190
|
+
classes do: [:each |
|
1191
|
+
(classes includes: each superclass)
|
1192
|
+
ifFalse: [children add: each]
|
1193
|
+
ifTrue: [others add: each]].
|
1194
|
+
nodes := children collect: [:each |
|
1195
|
+
ClassSorterNode on: each classes: others level: 0].
|
1196
|
+
nodes := nodes sorted: [:a :b | a theClass name <= b theClass name ].
|
1197
|
+
expandedClasses := Array new.
|
1198
|
+
nodes do: [:aNode |
|
1199
|
+
aNode traverseClassesWith: expandedClasses].
|
1200
|
+
^expandedClasses
|
1201
|
+
! !
|
1202
|
+
|
1203
|
+
Object subclass: #Point
|
1204
|
+
instanceVariableNames: 'x y'
|
1205
|
+
package: 'Kernel-Objects'!
|
1206
|
+
!Point commentStamp!
|
1207
|
+
A `Point` represents an x-y pair of numbers usually designating a geometric coordinate.
|
1208
|
+
Points are traditionally created using the binary `#@` message to a number:
|
1209
|
+
|
1210
|
+
100@120
|
1211
|
+
|
1212
|
+
Points can then be arithmetically manipulated:
|
1213
|
+
|
1214
|
+
100@100 + (10@10)
|
1215
|
+
|
1216
|
+
...or for example:
|
1217
|
+
|
1218
|
+
(100@100) * 2
|
1219
|
+
|
1220
|
+
**NOTE:** Creating a Point with a negative y-value will need a space after `@` in order to avoid a parsing error:
|
1221
|
+
|
1222
|
+
100@ -100 "but 100@-100 would not parse"
|
1223
|
+
|
1224
|
+
Amber does not have much behavior in this class out-of-the-box.!
|
1225
|
+
|
1226
|
+
!Point methodsFor: 'accessing'!
|
1227
|
+
|
1228
|
+
x
|
1229
|
+
^x
|
1230
|
+
!
|
1231
|
+
|
1232
|
+
x: aNumber
|
1233
|
+
x := aNumber
|
1234
|
+
!
|
1235
|
+
|
1236
|
+
y
|
1237
|
+
^y
|
1238
|
+
!
|
1239
|
+
|
1240
|
+
y: aNumber
|
1241
|
+
y := aNumber
|
1242
|
+
! !
|
1243
|
+
|
1244
|
+
!Point methodsFor: 'arithmetic'!
|
1245
|
+
|
1246
|
+
* aPoint
|
1247
|
+
^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y
|
1248
|
+
!
|
1249
|
+
|
1250
|
+
+ aPoint
|
1251
|
+
^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y
|
1252
|
+
!
|
1253
|
+
|
1254
|
+
- aPoint
|
1255
|
+
^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y
|
1256
|
+
!
|
1257
|
+
|
1258
|
+
/ aPoint
|
1259
|
+
^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y
|
1260
|
+
!
|
1261
|
+
|
1262
|
+
= aPoint
|
1263
|
+
^aPoint class = self class and: [
|
1264
|
+
(aPoint x = self x) & (aPoint y = self y)]
|
1265
|
+
! !
|
1266
|
+
|
1267
|
+
!Point methodsFor: 'converting'!
|
1268
|
+
|
1269
|
+
asPoint
|
1270
|
+
^self
|
1271
|
+
! !
|
1272
|
+
|
1273
|
+
!Point methodsFor: 'printing'!
|
1274
|
+
|
1275
|
+
printString
|
1276
|
+
"Print receiver in classic x@y notation."
|
1277
|
+
|
1278
|
+
^String streamContents: [:stream |
|
1279
|
+
stream nextPutAll: x printString, '@'.
|
1280
|
+
(y notNil and: [y negative])
|
1281
|
+
ifTrue: [
|
1282
|
+
"Avoid ambiguous @- construct"
|
1283
|
+
stream space].
|
1284
|
+
stream nextPutAll: y printString]
|
1285
|
+
! !
|
1286
|
+
|
1287
|
+
!Point methodsFor: 'transforming'!
|
1288
|
+
|
1289
|
+
translateBy: delta
|
1290
|
+
"Answer a Point translated by delta (an instance of Point)."
|
1291
|
+
^(delta x + x) @ (delta y + y)
|
1292
|
+
! !
|
1293
|
+
|
1294
|
+
!Point class methodsFor: 'instance creation'!
|
1295
|
+
|
1296
|
+
x: aNumber y: anotherNumber
|
1297
|
+
^self new
|
1298
|
+
x: aNumber;
|
1299
|
+
y: anotherNumber;
|
1300
|
+
yourself
|
1301
|
+
! !
|
1302
|
+
|
1303
|
+
Object subclass: #Random
|
1304
|
+
instanceVariableNames: ''
|
1305
|
+
package: 'Kernel-Objects'!
|
1306
|
+
!Random commentStamp!
|
1307
|
+
`Random` is a random number generator and is implemented as a trivial wrapper around javascript `Math.random()` and is used like this:
|
1308
|
+
|
1309
|
+
Random new next
|
1310
|
+
|
1311
|
+
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`
|
1312
|
+
|
1313
|
+
10 atRandom
|
1314
|
+
|
1315
|
+
...and if you want a random number in a specific interval this also works:
|
1316
|
+
|
1317
|
+
(3 to: 7) atRandom
|
1318
|
+
|
1319
|
+
...but 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:
|
1320
|
+
|
1321
|
+
5 atRandom + 2
|
1322
|
+
|
1323
|
+
Since `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:
|
1324
|
+
|
1325
|
+
#('a' 'b' 'c') atRandom
|
1326
|
+
|
1327
|
+
...or perhaps a letter from a `String`:
|
1328
|
+
|
1329
|
+
'abc' atRandom
|
1330
|
+
|
1331
|
+
Since Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.!
|
1332
|
+
|
1333
|
+
!Random methodsFor: 'accessing'!
|
1334
|
+
|
1335
|
+
next
|
1336
|
+
<return Math.random()>
|
1337
|
+
!
|
1338
|
+
|
1339
|
+
next: anInteger
|
1340
|
+
^(1 to: anInteger) collect: [:each | self next]
|
1341
|
+
! !
|
1342
|
+
|
1343
|
+
Object subclass: #Smalltalk
|
1344
|
+
instanceVariableNames: ''
|
1345
|
+
package: 'Kernel-Objects'!
|
1346
|
+
!Smalltalk commentStamp!
|
1347
|
+
Smalltalk has only one instance, accessed with `Smalltalk current`.
|
1348
|
+
It represents the global JavaScript variable `smalltalk` declared in `js/boot.js`.
|
1349
|
+
|
1350
|
+
The `smalltalk` object holds all class and packages defined in the system.
|
1351
|
+
|
1352
|
+
## Classes
|
1353
|
+
|
1354
|
+
Classes can be accessed using the following methods:
|
1355
|
+
|
1356
|
+
- `#classes` answers the full list of Smalltalk classes in the system
|
1357
|
+
- `#at:` answers a specific class of `nil`
|
1358
|
+
|
1359
|
+
## Packages
|
1360
|
+
|
1361
|
+
Packages can be accessed using the following methods:
|
1362
|
+
|
1363
|
+
- `#packages` answers the full list of packages
|
1364
|
+
- `#packageAt:` answers a specific class of `nil`
|
1365
|
+
|
1366
|
+
__note:__ classes and packages are accessed using strings, not symbols
|
1367
|
+
|
1368
|
+
## Parsing
|
1369
|
+
|
1370
|
+
The `#parse:` method is used to parse Smalltalk source code.
|
1371
|
+
It requires the `Compiler` package and the `js/parser.js` parser file in order to work!
|
1372
|
+
|
1373
|
+
!Smalltalk methodsFor: 'accessing'!
|
1374
|
+
|
1375
|
+
at: aString
|
1376
|
+
<return self[aString]>
|
1377
|
+
!
|
1378
|
+
|
1379
|
+
basicParse: aString
|
1380
|
+
<return smalltalk.parser.parse(aString)>
|
1381
|
+
!
|
1382
|
+
|
1383
|
+
classes
|
1384
|
+
<return self.classes()>
|
1385
|
+
!
|
1386
|
+
|
1387
|
+
parse: aString
|
1388
|
+
| result |
|
1389
|
+
self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].
|
1390
|
+
^result
|
1391
|
+
!
|
1392
|
+
|
1393
|
+
parseError: anException parsing: aString
|
1394
|
+
| row col message lines badLine code |
|
1395
|
+
<row = anException.line;
|
1396
|
+
col = anException.column;
|
1397
|
+
message = anException.message;>.
|
1398
|
+
lines := aString lines.
|
1399
|
+
badLine := lines at: row.
|
1400
|
+
badLine := (badLine copyFrom: 1 to: col - 1), ' ===>', (badLine copyFrom: col to: badLine size).
|
1401
|
+
lines at: row put: badLine.
|
1402
|
+
code := String streamContents: [:s |
|
1403
|
+
lines withIndexDo: [:l :i |
|
1404
|
+
s nextPutAll: i asString, ': ', l, String lf]].
|
1405
|
+
^ Error new messageText: ('Parse error on line ' , row , ' column ' , col , ' : ' , message , ' Below is code with line numbers and ===> marker inserted:' , String lf, code)
|
1406
|
+
!
|
1407
|
+
|
1408
|
+
readJSObject: anObject
|
1409
|
+
<return self.readJSObject(anObject)>
|
1410
|
+
!
|
1411
|
+
|
1412
|
+
reservedWords
|
1413
|
+
"JavaScript reserved words"
|
1414
|
+
<return self.reservedWords>
|
1415
|
+
!
|
1416
|
+
|
1417
|
+
send: aSelector to: anObject arguments: aCollection
|
1418
|
+
| selector |
|
1419
|
+
selector := aSelector asString asSelector.
|
1420
|
+
<self.send(anObject, selector, aCollection)>
|
1421
|
+
! !
|
1422
|
+
|
1423
|
+
!Smalltalk methodsFor: 'classes'!
|
1424
|
+
|
1425
|
+
removeClass: aClass
|
1426
|
+
aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!!'].
|
1427
|
+
aClass methodDictionary values do: [:each |
|
1428
|
+
aClass removeCompiledMethod: each].
|
1429
|
+
aClass class methodDictionary values do: [:each |
|
1430
|
+
aClass class removeCompiledMethod: each].
|
1431
|
+
self basicDelete: aClass name
|
1432
|
+
! !
|
1433
|
+
|
1434
|
+
!Smalltalk methodsFor: 'packages'!
|
1435
|
+
|
1436
|
+
packageAt: packageName
|
1437
|
+
<return self.packages[packageName]>
|
1438
|
+
!
|
1439
|
+
|
1440
|
+
packageAt: packageName ifAbsent: aBlock
|
1441
|
+
^(self packageAt: packageName) ifNil: aBlock
|
1442
|
+
!
|
1443
|
+
|
1444
|
+
packages
|
1445
|
+
"Return all Package instances in the system."
|
1446
|
+
|
1447
|
+
<return self.packages.all()>
|
1448
|
+
!
|
1449
|
+
|
1450
|
+
removePackage: packageName
|
1451
|
+
"Removes a package and all its classes."
|
1452
|
+
|
1453
|
+
| pkg |
|
1454
|
+
pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].
|
1455
|
+
pkg classes do: [:each |
|
1456
|
+
self removeClass: each].
|
1457
|
+
self deletePackage: packageName
|
1458
|
+
!
|
1459
|
+
|
1460
|
+
renamePackage: packageName to: newName
|
1461
|
+
"Rename a package."
|
1462
|
+
|
1463
|
+
| pkg |
|
1464
|
+
pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].
|
1465
|
+
(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].
|
1466
|
+
<smalltalk.packages[newName] = smalltalk.packages[packageName]>.
|
1467
|
+
pkg name: newName.
|
1468
|
+
self deletePackage: packageName.
|
1469
|
+
! !
|
1470
|
+
|
1471
|
+
!Smalltalk methodsFor: 'private'!
|
1472
|
+
|
1473
|
+
createPackage: packageName
|
1474
|
+
"Create and bind a new package with given name and return it."
|
1475
|
+
|
1476
|
+
<return smalltalk.addPackage(packageName, nil)>
|
1477
|
+
!
|
1478
|
+
|
1479
|
+
createPackage: packageName properties: aDict
|
1480
|
+
"Create and bind a new package with given name and return it."
|
1481
|
+
|
1482
|
+
| object |
|
1483
|
+
<object = {};>.
|
1484
|
+
aDict keysAndValuesDo: [:key :value |
|
1485
|
+
<object[key] = value>.
|
1486
|
+
].
|
1487
|
+
<return smalltalk.addPackage(packageName, object)>
|
1488
|
+
!
|
1489
|
+
|
1490
|
+
deletePackage: packageName
|
1491
|
+
"Deletes a package by deleting its binding, but does not check if it contains classes etc.
|
1492
|
+
To remove a package, use #removePackage instead."
|
1493
|
+
|
1494
|
+
<delete smalltalk.packages[packageName]>
|
1495
|
+
! !
|
1496
|
+
|
1497
|
+
Smalltalk class instanceVariableNames: 'current'!
|
1498
|
+
|
1499
|
+
!Smalltalk class methodsFor: 'accessing'!
|
1500
|
+
|
1501
|
+
current
|
1502
|
+
<return smalltalk>
|
1503
|
+
! !
|
1504
|
+
|
1505
|
+
Object subclass: #UndefinedObject
|
1506
|
+
instanceVariableNames: ''
|
1507
|
+
package: 'Kernel-Objects'!
|
1508
|
+
!UndefinedObject commentStamp!
|
1509
|
+
UndefinedObject describes the behavior of its sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.
|
1510
|
+
|
1511
|
+
`nil` is the Smalltalk representation of the `undefined` JavaScript object.!
|
1512
|
+
|
1513
|
+
!UndefinedObject methodsFor: 'class creation'!
|
1514
|
+
|
1515
|
+
subclass: aString instanceVariableNames: anotherString
|
1516
|
+
^self subclass: aString instanceVariableNames: anotherString package: nil
|
1517
|
+
!
|
1518
|
+
|
1519
|
+
subclass: aString instanceVariableNames: aString2 category: aString3
|
1520
|
+
"Kept for compatibility."
|
1521
|
+
self deprecatedAPI.
|
1522
|
+
^self subclass: aString instanceVariableNames: aString2 package: aString3
|
1523
|
+
!
|
1524
|
+
|
1525
|
+
subclass: aString instanceVariableNames: aString2 package: aString3
|
1526
|
+
^ClassBuilder new
|
1527
|
+
superclass: self subclass: aString instanceVariableNames: aString2 package: aString3
|
1528
|
+
! !
|
1529
|
+
|
1530
|
+
!UndefinedObject methodsFor: 'converting'!
|
1531
|
+
|
1532
|
+
asJSON
|
1533
|
+
^null
|
1534
|
+
! !
|
1535
|
+
|
1536
|
+
!UndefinedObject methodsFor: 'copying'!
|
1537
|
+
|
1538
|
+
deepCopy
|
1539
|
+
^self
|
1540
|
+
!
|
1541
|
+
|
1542
|
+
shallowCopy
|
1543
|
+
^self
|
1544
|
+
! !
|
1545
|
+
|
1546
|
+
!UndefinedObject methodsFor: 'printing'!
|
1547
|
+
|
1548
|
+
printString
|
1549
|
+
^'nil'
|
1550
|
+
! !
|
1551
|
+
|
1552
|
+
!UndefinedObject methodsFor: 'testing'!
|
1553
|
+
|
1554
|
+
ifNil: aBlock
|
1555
|
+
"inlined in the Compiler"
|
1556
|
+
^self ifNil: aBlock ifNotNil: []
|
1557
|
+
!
|
1558
|
+
|
1559
|
+
ifNil: aBlock ifNotNil: anotherBlock
|
1560
|
+
"inlined in the Compiler"
|
1561
|
+
^aBlock value
|
1562
|
+
!
|
1563
|
+
|
1564
|
+
ifNotNil: aBlock
|
1565
|
+
"inlined in the Compiler"
|
1566
|
+
^self
|
1567
|
+
!
|
1568
|
+
|
1569
|
+
ifNotNil: aBlock ifNil: anotherBlock
|
1570
|
+
"inlined in the Compiler"
|
1571
|
+
^anotherBlock value
|
1572
|
+
!
|
1573
|
+
|
1574
|
+
isNil
|
1575
|
+
^true
|
1576
|
+
!
|
1577
|
+
|
1578
|
+
notNil
|
1579
|
+
^false
|
1580
|
+
! !
|
1581
|
+
|
1582
|
+
!UndefinedObject class methodsFor: 'instance creation'!
|
1583
|
+
|
1584
|
+
new
|
1585
|
+
self error: 'You cannot create new instances of UndefinedObject. Use nil'
|
1586
|
+
! !
|
1587
|
+
|